Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/apps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2013-04-17 06:54:27 +0400
committerFrank Karlitschek <frank@owncloud.org>2013-04-17 06:54:27 +0400
commit0bfb0acb78c37a411ebfb96b13a87024db309ee3 (patch)
tree588a471f641a3772a41c9d903fa0b23e7c544129 /files_odfviewer
parent1569acabdaee2a8e85d42baf97b31820047c9416 (diff)
parentc1e185cbc3d263ddcf681fa22cc1e500c54f0cb1 (diff)
Merge pull request #898 from p5n/master
files_odfviewer: update webodf from current url
Diffstat (limited to 'files_odfviewer')
-rw-r--r--files_odfviewer/css/webodf.css160
-rw-r--r--files_odfviewer/js/webodf-debug.js4074
-rw-r--r--files_odfviewer/js/webodf.js881
-rwxr-xr-xfiles_odfviewer/src/update.sh2
4 files changed, 4275 insertions, 842 deletions
diff --git a/files_odfviewer/css/webodf.css b/files_odfviewer/css/webodf.css
index 0ceca2f85..387f99d7b 100644
--- a/files_odfviewer/css/webodf.css
+++ b/files_odfviewer/css/webodf.css
@@ -7,6 +7,8 @@
@namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0);
@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);
@namespace runtimens url(urn:webodf); /* namespace for runtime only */
+@namespace cursor url(urn:webodf:names:cursor);
+@namespace editinfo url(urn:webodf:names:editinfo);
office|document > *, office|document-content > * {
display: none;
@@ -18,11 +20,10 @@ office|body, office|document {
text|p, text|h {
display: block;
- padding: 3px 3px 3px 3px;
- margin: 5px 5px 5px 5px;
-}
-text|h {
- font-weight: bold;
+ padding: 0;
+ margin: 0;
+ line-height: normal;
+ position: relative;
}
*[runtimens|containsparagraphanchor] {
position: relative;
@@ -112,6 +113,7 @@ office|spreadsheet table|table-row:before {
border: 1px solid black;
text-align: center;
content: counter(row);
+ display: table-cell;
}
office|spreadsheet table|table-cell {
border: 1px solid #cccccc;
@@ -124,6 +126,9 @@ draw|frame table|table {
height: 100%;
background: white;
}
+table|table-header-rows {
+ display: table-header-group;
+}
table|table-row {
display: table-row;
}
@@ -131,6 +136,7 @@ table|table-column {
display: table-column;
}
table|table-cell {
+ width: 0.889in;
display: table-cell;
}
draw|frame {
@@ -150,29 +156,24 @@ draw|image {
draw|frame > draw|image:nth-of-type(n+2) {
display: none;
}
+text|list:before {
+ display: none;
+ content:"";
+}
text|list {
- display: block;
- padding-left: 1.5em;
counter-reset: list;
}
text|list-item {
display: block;
}
-text|list-item:before {
- display: inline-block;
- content: '•';
- counter-increment: list;
- width: 0.5em;
- margin-left: -0.5em;
- padding: 0px;
- border: 0px;
-}
-text|list-item > *:first-child {
- display: inline-block;
+text|number {
+ display:none;
}
+
text|a {
color: blue;
text-decoration: underline;
+ cursor: pointer;
}
text|note-citation {
vertical-align: super;
@@ -194,3 +195,126 @@ text|note:hover text|note-body {
svg|title, svg|desc {
display: none;
}
+video {
+ width: 100%;
+ height: 100%
+}
+
+/* below set up the cursor */
+cursor|cursor {
+ display: inline;
+ width: 0px;
+ height: 1em;
+ /* making the position relative enables the avatar to use
+ the cursor as reference for its absolute position */
+ position: relative;
+}
+cursor|cursor > span {
+ display: inline;
+ position: absolute;
+ height: 1em;
+ border-left: 2px solid black;
+ outline: none;
+}
+
+cursor|cursor > div {
+ padding: 3px;
+ box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);
+ border: none !important;
+ border-radius: 5px;
+ opacity: 0.3;
+}
+
+cursor|cursor > div > img {
+ border-radius: 5px;
+}
+
+cursor|cursor > div.active {
+ opacity: 0.8;
+}
+
+cursor|cursor > div:after {
+ content: ' ';
+ position: absolute;
+ width: 0px;
+ height: 0px;
+ border-style: solid;
+ border-width: 8.7px 5px 0 5px;
+ border-color: black transparent transparent transparent;
+
+ top: 100%;
+ left: 43%;
+}
+
+
+.editInfoMarker {
+ position: absolute;
+ width: 10px;
+ height: 100%;
+ left: -20px;
+ opacity: 0.8;
+ top: 0;
+ border-radius: 5px;
+ background-color: transparent;
+ box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);
+}
+.editInfoMarker:hover {
+ box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);
+}
+
+.editInfoHandle {
+ position: absolute;
+ background-color: black;
+ padding: 5px;
+ border-radius: 5px;
+ opacity: 0.8;
+ box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);
+ bottom: 100%;
+ margin-bottom: 10px;
+ z-index: 3;
+ left: -25px;
+}
+.editInfoHandle:after {
+ content: ' ';
+ position: absolute;
+ width: 0px;
+ height: 0px;
+ border-style: solid;
+ border-width: 8.7px 5px 0 5px;
+ border-color: black transparent transparent transparent;
+
+ top: 100%;
+ left: 5px;
+}
+.editInfo {
+ font-family: sans-serif;
+ font-weight: normal;
+ font-style: normal;
+ text-decoration: none;
+ color: white;
+ width: 100%;
+ height: 12pt;
+}
+.editInfoColor {
+ float: left;
+ width: 10pt;
+ height: 10pt;
+ border: 1px solid white;
+}
+.editInfoAuthor {
+ float: left;
+ margin-left: 5pt;
+ font-size: 10pt;
+ text-align: left;
+ height: 12pt;
+ line-height: 12pt;
+}
+.editInfoTime {
+ float: right;
+ margin-left: 30pt;
+ font-size: 8pt;
+ font-style: italic;
+ color: yellow;
+ height: 12pt;
+ line-height: 12pt;
+}
diff --git a/files_odfviewer/js/webodf-debug.js b/files_odfviewer/js/webodf-debug.js
index a161f4e6b..e1c8ce3b0 100644
--- a/files_odfviewer/js/webodf-debug.js
+++ b/files_odfviewer/js/webodf-debug.js
@@ -1,5 +1,8 @@
/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
@licstart
The JavaScript code in this page is free software: you can redistribute it
and/or modify it under the terms of the GNU Affero General Public License
@@ -28,18 +31,26 @@
This license applies to this entire compilation.
@licend
@source: http://www.webodf.org/
- @source: http://gitorious.org/odfkit/webodf/
+ @source: http://gitorious.org/webodf/webodf/
*/
var core = {};
var gui = {};
var xmldom = {};
var odf = {};
+var ops = {};
function Runtime() {
}
Runtime.ByteArray = function(size) {
};
+Runtime.prototype.getVariable = function(name) {
+};
+Runtime.prototype.toJson = function(anything) {
+};
+Runtime.prototype.fromJson = function(jsonstr) {
+};
Runtime.ByteArray.prototype.slice = function(start, end) {
};
+Runtime.ByteArray.prototype.length = 0;
Runtime.prototype.byteArrayFromArray = function(array) {
};
Runtime.prototype.byteArrayFromString = function(string, encoding) {
@@ -74,8 +85,12 @@ Runtime.prototype.type = function() {
};
Runtime.prototype.getDOMImplementation = function() {
};
+Runtime.prototype.parseXML = function(xml) {
+};
Runtime.prototype.getWindow = function() {
};
+Runtime.prototype.assert = function(condition, message, callback) {
+};
var IS_COMPILED_CODE = false;
Runtime.byteArrayToString = function(bytearray, encoding) {
function byteArrayToString(bytearray) {
@@ -116,6 +131,19 @@ Runtime.byteArrayToString = function(bytearray, encoding) {
}
return result
};
+Runtime.getVariable = function(name) {
+ try {
+ return eval(name)
+ }catch(e) {
+ return undefined
+ }
+};
+Runtime.toJson = function(anything) {
+ return JSON.stringify(anything)
+};
+Runtime.fromJson = function(jsonstr) {
+ return JSON.parse(jsonstr)
+};
Runtime.getFunctionName = function getFunctionName(f) {
var m;
if(f.name === undefined) {
@@ -211,9 +239,12 @@ function BrowserRuntime(logoutput) {
return result
};
this.byteArrayToString = Runtime.byteArrayToString;
+ this.getVariable = Runtime.getVariable;
+ this.fromJson = Runtime.fromJson;
+ this.toJson = Runtime.toJson;
function log(msgOrCategory, msg) {
var node, doc, category;
- if(msg) {
+ if(msg !== undefined) {
category = msgOrCategory
}else {
msg = msgOrCategory
@@ -236,6 +267,18 @@ function BrowserRuntime(logoutput) {
console.log(msg)
}
}
+ if(category === "alert") {
+ alert(msg)
+ }
+ }
+ function assert(condition, message, callback) {
+ if(!condition) {
+ log("alert", "ASSERTION FAILED:\n" + message);
+ if(callback) {
+ callback()
+ }
+ throw message;
+ }
}
function readFile(path, encoding, callback) {
if(cache.hasOwnProperty(path)) {
@@ -251,7 +294,7 @@ function BrowserRuntime(logoutput) {
}else {
if(xhr.status === 200 || xhr.status === 0) {
if(encoding === "binary") {
- if(typeof VBArray !== "undefined") {
+ if(String(typeof VBArray) !== "undefined") {
data = (new VBArray(xhr.responseBody)).toArray()
}else {
data = self.byteArrayFromString(xhr.responseText, "binary")
@@ -295,7 +338,7 @@ function BrowserRuntime(logoutput) {
callback("File " + path + " is empty.")
}else {
if(xhr.status === 200 || xhr.status === 0) {
- if(typeof VBArray !== "undefined") {
+ if(String(typeof VBArray) !== "undefined") {
data = (new VBArray(xhr.responseBody)).toArray()
}else {
data = self.byteArrayFromString(xhr.responseText, "binary")
@@ -373,6 +416,7 @@ function BrowserRuntime(logoutput) {
}
}
function deleteFile(path, callback) {
+ delete cache[path];
var xhr = new XMLHttpRequest;
xhr.open("DELETE", path, true);
xhr.onreadystatechange = function() {
@@ -457,6 +501,7 @@ function BrowserRuntime(logoutput) {
this.isFile = isFile;
this.getFileSize = getFileSize;
this.log = log;
+ this.assert = assert;
this.setTimeout = function(f, msec) {
setTimeout(function() {
f()
@@ -473,15 +518,26 @@ function BrowserRuntime(logoutput) {
this.getDOMImplementation = function() {
return window.document.implementation
};
+ this.parseXML = function(xml) {
+ var parser = new DOMParser;
+ return parser.parseFromString(xml, "text/xml")
+ };
this.exit = function(exitCode) {
log("Calling exit with code " + String(exitCode) + ", but exit() is not implemented.")
};
this.getWindow = function() {
return window
+ };
+ this.getNetwork = function() {
+ var now = this.getVariable("now");
+ if(now === undefined) {
+ return{networkStatus:"unavailable"}
+ }
+ return now
}
}
function NodeJSRuntime() {
- var self = this, fs = require("fs"), currentDirectory = "";
+ var self = this, fs = require("fs"), pathmod = require("path"), currentDirectory = "", parser, domImplementation;
this.ByteArray = function(size) {
return new Buffer(size)
};
@@ -504,34 +560,45 @@ function NodeJSRuntime() {
this.byteArrayToString = function(bytearray, encoding) {
return bytearray.toString(encoding)
};
+ this.getVariable = Runtime.getVariable;
+ this.fromJson = Runtime.fromJson;
+ this.toJson = Runtime.toJson;
function isFile(path, callback) {
- if(currentDirectory) {
- path = currentDirectory + "/" + path
- }
+ path = pathmod.resolve(currentDirectory, path);
fs.stat(path, function(err, stats) {
callback(!err && stats.isFile())
})
}
- function loadXML(path, callback) {
- throw"Not implemented.";
- }
- this.readFile = function(path, encoding, callback) {
+ function readFile(path, encoding, callback) {
+ path = pathmod.resolve(currentDirectory, path);
if(encoding !== "binary") {
fs.readFile(path, encoding, callback)
}else {
fs.readFile(path, null, callback)
}
- };
+ }
+ this.readFile = readFile;
+ function loadXML(path, callback) {
+ readFile(path, "utf-8", function(err, data) {
+ if(err) {
+ return callback(err)
+ }
+ callback(null, self.parseXML(data))
+ })
+ }
+ this.loadXML = loadXML;
this.writeFile = function(path, data, callback) {
+ path = pathmod.resolve(currentDirectory, path);
fs.writeFile(path, data, "binary", function(err) {
callback(err || null)
})
};
- this.deleteFile = fs.unlink;
+ this.deleteFile = function(path, callback) {
+ path = pathmod.resolve(currentDirectory, path);
+ fs.unlink(path, callback)
+ };
this.read = function(path, offset, length, callback) {
- if(currentDirectory) {
- path = currentDirectory + "/" + path
- }
+ path = pathmod.resolve(currentDirectory, path);
fs.open(path, "r+", 666, function(err, fd) {
if(err) {
callback(err);
@@ -548,14 +615,14 @@ function NodeJSRuntime() {
if(!encoding) {
return""
}
+ if(encoding === "binary") {
+ return fs.readFileSync(path, null)
+ }
return fs.readFileSync(path, encoding)
};
- this.loadXML = loadXML;
this.isFile = isFile;
this.getFileSize = function(path, callback) {
- if(currentDirectory) {
- path = currentDirectory + "/" + path
- }
+ path = pathmod.resolve(currentDirectory, path);
fs.stat(path, function(err, stats) {
if(err) {
callback(-1)
@@ -564,9 +631,31 @@ function NodeJSRuntime() {
}
})
};
- this.log = function(msg) {
- process.stderr.write(msg + "\n")
- };
+ function log(msgOrCategory, msg) {
+ var category;
+ if(msg !== undefined) {
+ category = msgOrCategory
+ }else {
+ msg = msgOrCategory
+ }
+ if(category === "alert") {
+ process.stderr.write("\n!!!!! ALERT !!!!!" + "\n")
+ }
+ process.stderr.write(msg + "\n");
+ if(category === "alert") {
+ process.stderr.write("!!!!! ALERT !!!!!" + "\n")
+ }
+ }
+ this.log = log;
+ function assert(condition, message, callback) {
+ if(!condition) {
+ process.stderr.write("ASSERTION FAILED: " + message);
+ if(callback) {
+ callback()
+ }
+ }
+ }
+ this.assert = assert;
this.setTimeout = function(f, msec) {
setTimeout(function() {
f()
@@ -585,12 +674,24 @@ function NodeJSRuntime() {
return"NodeJSRuntime"
};
this.getDOMImplementation = function() {
- return null
+ return domImplementation
+ };
+ this.parseXML = function(xml) {
+ return parser.parseFromString(xml, "text/xml")
};
this.exit = process.exit;
this.getWindow = function() {
return null
+ };
+ this.getNetwork = function() {
+ return{networkStatus:"unavailable"}
+ };
+ function init() {
+ var DOMParser = require("xmldom").DOMParser;
+ parser = new DOMParser;
+ domImplementation = self.parseXML("<a/>").implementation
}
+ init()
}
function RhinoRuntime() {
var self = this, dom = Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(), builder, entityresolver, currentDirectory = "";
@@ -622,6 +723,9 @@ function RhinoRuntime() {
return a
};
this.byteArrayToString = Runtime.byteArrayToString;
+ this.getVariable = Runtime.getVariable;
+ this.fromJson = Runtime.fromJson;
+ this.toJson = Runtime.toJson;
this.concatByteArrays = function(bytearray1, bytearray2) {
return bytearray1.concat(bytearray2)
};
@@ -637,6 +741,9 @@ function RhinoRuntime() {
callback(null, document)
}
function runtimeReadFile(path, encoding, callback) {
+ if(currentDirectory) {
+ path = currentDirectory + "/" + path
+ }
var file = new Packages.java.io.File(path), data, rhinoencoding = encoding === "binary" ? "latin1" : encoding;
if(!file.isFile()) {
callback(path + " is not a file.")
@@ -668,6 +775,9 @@ function RhinoRuntime() {
this.loadXML = loadXML;
this.readFile = runtimeReadFile;
this.writeFile = function(path, data, callback) {
+ if(currentDirectory) {
+ path = currentDirectory + "/" + path
+ }
var out = new Packages.java.io.FileOutputStream(path), i, l = data.length;
for(i = 0;i < l;i += 1) {
out.write(data[i])
@@ -676,6 +786,9 @@ function RhinoRuntime() {
callback(null)
};
this.deleteFile = function(path, callback) {
+ if(currentDirectory) {
+ path = currentDirectory + "/" + path
+ }
var file = new Packages.java.io.File(path);
if(file["delete"]()) {
callback(null)
@@ -708,7 +821,31 @@ function RhinoRuntime() {
var file = new Packages.java.io.File(path);
callback(file.length())
};
- this.log = print;
+ function log(msgOrCategory, msg) {
+ var category;
+ if(msg !== undefined) {
+ category = msgOrCategory
+ }else {
+ msg = msgOrCategory
+ }
+ if(category === "alert") {
+ print("\n!!!!! ALERT !!!!!")
+ }
+ print(msg);
+ if(category === "alert") {
+ print("!!!!! ALERT !!!!!")
+ }
+ }
+ this.log = log;
+ function assert(condition, message, callback) {
+ if(!condition) {
+ log("alert", "ASSERTION FAILED: " + message);
+ if(callback) {
+ callback()
+ }
+ }
+ }
+ this.assert = assert;
this.setTimeout = function(f, msec) {
f()
};
@@ -727,17 +864,23 @@ function RhinoRuntime() {
this.getDOMImplementation = function() {
return builder.getDOMImplementation()
};
+ this.parseXML = function(xml) {
+ return builder.parse(xml)
+ };
this.exit = quit;
this.getWindow = function() {
return null
+ };
+ this.getNetwork = function() {
+ return{networkStatus:"unavailable"}
}
}
var runtime = function() {
var result;
- if(typeof window !== "undefined") {
+ if(String(typeof window) !== "undefined") {
result = new BrowserRuntime(window.document.getElementById("logoutput"))
}else {
- if(typeof require !== "undefined") {
+ if(String(typeof require) !== "undefined") {
result = new NodeJSRuntime
}else {
result = new RhinoRuntime
@@ -830,27 +973,31 @@ var runtime = function() {
}
})();
(function(args) {
- args = Array.prototype.slice.call(args);
+ if(args) {
+ args = Array.prototype.slice.call(args)
+ }else {
+ args = []
+ }
function run(argv) {
if(!argv.length) {
return
}
var script = argv[0];
runtime.readFile(script, "utf8", function(err, code) {
- var path = "", paths = runtime.libraryPaths();
+ var path = "", paths = runtime.libraryPaths(), codestring = code;
if(script.indexOf("/") !== -1) {
path = script.substring(0, script.indexOf("/"))
}
runtime.setCurrentDirectory(path);
function run() {
var script, path, paths, args, argv, result;
- result = eval(code);
+ result = eval(codestring);
if(result) {
runtime.exit(result)
}
return
}
- if(err) {
+ if(err || codestring === null) {
runtime.log(err);
runtime.exit(1)
}else {
@@ -867,7 +1014,7 @@ var runtime = function() {
run(args.slice(1))
}
}
-})(typeof arguments !== "undefined" && arguments);
+})(String(typeof arguments) !== "undefined" && arguments);
core.Base64 = function() {
var b64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", b64charcodes = function() {
var a = [], i, codeA = "A".charCodeAt(0), codea = "a".charCodeAt(0), code0 = "0".charCodeAt(0);
@@ -889,7 +1036,7 @@ core.Base64 = function() {
t[bin.charAt(i)] = i
}
return t
- }(b64chars), convertUTF16StringToBase64, convertBase64ToUTF16String, btoa, atob;
+ }(b64chars), convertUTF16StringToBase64, convertBase64ToUTF16String, window = runtime.getWindow(), btoa, atob;
function stringToArray(s) {
var a = [], i, l = s.length;
for(i = 0;i < l;i += 1) {
@@ -1037,8 +1184,10 @@ core.Base64 = function() {
function convertUTF16StringToUTF8String(uni) {
return String.fromCharCode.apply(String, convertUTF16ArrayToUTF8Array(stringToArray(uni)))
}
- btoa = runtime.getWindow() && runtime.getWindow().btoa;
- if(btoa) {
+ if(window && window.btoa) {
+ btoa = function(b) {
+ return window.btoa(b)
+ };
convertUTF16StringToBase64 = function(uni) {
return btoa(convertUTF16StringToUTF8String(uni))
}
@@ -1048,8 +1197,10 @@ core.Base64 = function() {
return convertUTF8ArrayToBase64(convertUTF16StringToUTF8Array(uni))
}
}
- atob = runtime.getWindow() && runtime.getWindow().atob;
- if(atob) {
+ if(window && window.atob) {
+ atob = function(a) {
+ return window.atob(a)
+ };
convertBase64ToUTF16String = function(b64) {
var b = atob(b64);
return convertUTF8StringToUTF16String_internal(b, 0, b.length)
@@ -2132,7 +2283,7 @@ core.RawDeflate = function() {
var i, j;
zip_deflate_data = str;
zip_deflate_pos = 0;
- if(typeof level === "undefined") {
+ if(String(typeof level) === "undefined") {
level = zip_DEFAULT_LEVEL
}
zip_deflate_start(level);
@@ -2795,133 +2946,184 @@ core.RawInflate = function RawInflate() {
};
this.inflate = zip_inflate
};
+core.Selection = function Selection(domDocument) {
+ var self = this, ranges = [];
+ this.getRangeAt = function(i) {
+ return ranges[i]
+ };
+ this.addRange = function(range) {
+ if(ranges.length === 0) {
+ self.focusNode = range.startContainer;
+ self.focusOffset = range.startOffset
+ }
+ ranges.push(range);
+ self.rangeCount += 1
+ };
+ this.removeAllRanges = function() {
+ ranges = [];
+ self.rangeCount = 0;
+ self.focusNode = null;
+ self.focusOffset = 0
+ };
+ this.collapse = function(node, offset) {
+ runtime.assert(offset >= 0, "invalid offset " + offset + " in Selection.collapse");
+ ranges.length = self.rangeCount = 1;
+ var range = ranges[0];
+ if(!range) {
+ ranges[0] = range = domDocument.createRange()
+ }
+ range.setStart(node, offset);
+ range.collapse(true);
+ self.focusNode = node;
+ self.focusOffset = offset
+ };
+ this.extend = function(node, offset) {
+ };
+ this.rangeCount = 0;
+ this.focusNode = null;
+ this.focusOffset = 0
+};
+core.LoopWatchDog = function LoopWatchDog(timeout, maxChecks) {
+ var startTime = Date.now(), checks = 0;
+ function check() {
+ var t;
+ if(timeout) {
+ t = Date.now();
+ if(t - startTime > timeout) {
+ runtime.log("alert", "watchdog timeout");
+ throw"timeout!";
+ }
+ }
+ if(maxChecks > 0) {
+ checks += 1;
+ if(checks > maxChecks) {
+ runtime.log("alert", "watchdog loop overflow");
+ throw"loop overflow";
+ }
+ }
+ }
+ this.check = check
+};
+runtime.loadClass("core.Selection");
core.Cursor = function Cursor(selection, document) {
- var cursorns, cursorNode;
- cursorns = "urn:webodf:names:cursor";
- cursorNode = document.createElementNS(cursorns, "cursor");
+ var self = this, cursorNode, cursorTextNode;
function putCursorIntoTextNode(container, offset) {
- var len, ref, textnode, parent;
- parent = container.parentNode;
- if(offset === 0) {
- parent.insertBefore(cursorNode, container)
- }else {
- if(offset === container.length) {
- parent.appendChild(cursorNode)
- }else {
- len = container.length;
- ref = container.nextSibling;
- textnode = document.createTextNode(container.substringData(offset, len));
- container.deleteData(offset, len);
- if(ref) {
- parent.insertBefore(textnode, ref)
- }else {
- parent.appendChild(textnode)
- }
- parent.insertBefore(cursorNode, textnode)
- }
+ var parent = container.parentNode;
+ if(offset > 0) {
+ cursorTextNode.data = container.substringData(0, offset);
+ container.deleteData(0, offset);
+ parent.insertBefore(cursorTextNode, container)
}
+ parent.insertBefore(cursorNode, container)
}
function putCursorIntoContainer(container, offset) {
- var node;
- node = container.firstChild;
- while(node && offset) {
+ var node = container.firstChild;
+ while(node !== null && offset > 0) {
node = node.nextSibling;
offset -= 1
}
container.insertBefore(cursorNode, node)
}
- function getPotentialParentOrNode(parent, node) {
- var n = node;
- while(n && n !== parent) {
- n = n.parentNode
- }
- return n || node
- }
- function removeCursorFromSelectionRange(range, cursorpos) {
- var cursorParent, start, end;
- cursorParent = cursorNode.parentNode;
- start = getPotentialParentOrNode(cursorNode, range.startContainer);
- end = getPotentialParentOrNode(cursorNode, range.endContainer);
- if(start === cursorNode) {
- range.setStart(cursorParent, cursorpos)
- }else {
- if(start === cursorParent && range.startOffset > cursorpos) {
- range.setStart(cursorParent, range.startOffset - 1)
+ function removeCursor(onCursorRemove) {
+ var t = cursorNode.nextSibling, textNodeIncrease = 0;
+ if(cursorTextNode.parentNode) {
+ cursorTextNode.parentNode.removeChild(cursorTextNode);
+ if(t && t.nodeType === 3) {
+ t.insertData(0, cursorTextNode.nodeValue);
+ textNodeIncrease = cursorTextNode.length
}
}
- if(range.endContainer === cursorNode) {
- range.setEnd(cursorParent, cursorpos)
- }else {
- if(range.endContainer === cursorParent && range.endOffset > cursorpos) {
- range.setEnd(cursorParent, range.endOffset - 1)
- }
+ onCursorRemove(t, textNodeIncrease);
+ if(cursorNode.parentNode) {
+ cursorNode.parentNode.removeChild(cursorNode)
}
}
- function adaptRangeToMergedText(range, prev, textnodetomerge, cursorpos) {
- var diff = prev.length - textnodetomerge.length;
- if(range.startContainer === textnodetomerge) {
- range.setStart(prev, diff + range.startOffset)
- }else {
- if(range.startContainer === prev.parentNode && range.startOffset === cursorpos) {
- range.setStart(prev, diff)
- }
- }
- if(range.endContainer === textnodetomerge) {
- range.setEnd(prev, diff + range.endOffset)
+ function putCursor(container, offset, onCursorAdd) {
+ var text, element;
+ if(container.nodeType === 3) {
+ text = container;
+ putCursorIntoTextNode(text, offset);
+ onCursorAdd(cursorNode.nextSibling, offset)
}else {
- if(range.endContainer === prev.parentNode && range.endOffset === cursorpos) {
- range.setEnd(prev, diff)
+ if(container.nodeType === 1) {
+ element = container;
+ putCursorIntoContainer(element, offset);
+ onCursorAdd(cursorNode.nextSibling, 0)
}
}
}
- function removeCursor() {
- var i, cursorpos, node, textnodetoremove, range;
- if(!cursorNode.parentNode) {
- return
- }
- cursorpos = 0;
- node = cursorNode.parentNode.firstChild;
- while(node && node !== cursorNode) {
- cursorpos += 1;
- node = node.nextSibling
- }
- if(cursorNode.previousSibling && cursorNode.previousSibling.nodeType === 3 && cursorNode.nextSibling && cursorNode.nextSibling.nodeType === 3) {
- textnodetoremove = cursorNode.nextSibling;
- cursorNode.previousSibling.appendData(textnodetoremove.nodeValue)
- }
- for(i = 0;i < selection.rangeCount;i += 1) {
- removeCursorFromSelectionRange(selection.getRangeAt(i), cursorpos)
- }
- if(textnodetoremove) {
- for(i = 0;i < selection.rangeCount;i += 1) {
- adaptRangeToMergedText(selection.getRangeAt(i), cursorNode.previousSibling, textnodetoremove, cursorpos)
- }
- textnodetoremove.parentNode.removeChild(textnodetoremove)
+ this.getNode = function() {
+ return cursorNode
+ };
+ this.getSelection = function() {
+ return selection
+ };
+ this.updateToSelection = function(onCursorRemove, onCursorAdd) {
+ var range;
+ removeCursor(onCursorRemove);
+ if(selection.focusNode) {
+ putCursor(selection.focusNode, selection.focusOffset, onCursorAdd)
}
- cursorNode.parentNode.removeChild(cursorNode)
+ };
+ this.remove = function(onCursorRemove) {
+ removeCursor(onCursorRemove)
+ };
+ function init() {
+ var cursorns = "urn:webodf:names:cursor";
+ cursorNode = document.createElementNS(cursorns, "cursor");
+ cursorTextNode = document.createTextNode("")
}
- function putCursor(container, offset) {
- if(container.nodeType === 3) {
- putCursorIntoTextNode(container, offset)
- }else {
- if(container.nodeType !== 9) {
- putCursorIntoContainer(container, offset)
+ init()
+};
+core.EditInfo = function EditInfo(container, odtDocument) {
+ var self = this, editInfoNode, editHistory = {};
+ function sortEdits() {
+ var arr = [], memberid;
+ for(memberid in editHistory) {
+ if(editHistory.hasOwnProperty(memberid)) {
+ arr.push({"memberid":memberid, "time":editHistory[memberid].time})
}
}
+ arr.sort(function(a, b) {
+ return a.time - b.time
+ });
+ return arr
}
this.getNode = function() {
- return cursorNode
+ return editInfoNode
};
- this.updateToSelection = function() {
- var range;
- removeCursor();
- if(selection.focusNode) {
- putCursor(selection.focusNode, selection.focusOffset)
+ this.getOdtDocument = function() {
+ return odtDocument
+ };
+ this.getEdits = function() {
+ return editHistory
+ };
+ this.getSortedEdits = function() {
+ return sortEdits()
+ };
+ this.addEdit = function(memberid, timestamp) {
+ var id, userid = memberid.split("___")[0];
+ if(!editHistory[memberid]) {
+ for(id in editHistory) {
+ if(editHistory.hasOwnProperty(id)) {
+ if(id.split("___")[0] === userid) {
+ delete editHistory[id];
+ break
+ }
+ }
+ }
}
+ editHistory[memberid] = {time:timestamp}
+ };
+ this.clearEdits = function() {
+ editHistory = {}
};
- this.remove = function() {
- removeCursor()
+ function init() {
+ var editInfons = "urn:webodf:names:editinfo", dom = odtDocument.getDOM();
+ editInfoNode = dom.createElementNS(editInfons, "editinfo");
+ container.insertBefore(editInfoNode, container.firstChild)
}
+ init()
};
core.UnitTest = function UnitTest() {
};
@@ -2935,6 +3137,19 @@ core.UnitTest.prototype.tests = function() {
};
core.UnitTest.prototype.asyncTests = function() {
};
+core.UnitTest.provideTestAreaDiv = function() {
+ var maindoc = runtime.getWindow().document, testarea = maindoc.getElementById("testarea");
+ runtime.assert(!testarea, 'Unclean test environment, found a div with id "testarea".');
+ testarea = maindoc.createElement("div");
+ testarea.setAttribute("id", "testarea");
+ maindoc.body.appendChild(testarea);
+ return testarea
+};
+core.UnitTest.cleanupTestAreaDiv = function() {
+ var maindoc = runtime.getWindow().document, testarea = maindoc.getElementById("testarea");
+ runtime.assert(!!testarea && testarea.parentNode === maindoc.body, 'Test environment broken, found no div with id "testarea" below body.');
+ maindoc.body.removeChild(testarea)
+};
core.UnitTestRunner = function UnitTestRunner() {
var failedTests = 0;
function debug(msg) {
@@ -3001,7 +3216,7 @@ core.UnitTestRunner = function UnitTestRunner() {
if(isResultCorrect(av, bv)) {
testPassed(a + " is " + b)
}else {
- if(typeof av === typeof bv) {
+ if(String(typeof av) === String(typeof bv)) {
testFailed(a + " should be " + bv + ". Was " + stringify(av) + ".")
}else {
testFailed(a + " should be " + bv + " (of type " + typeof bv + "). Was " + av + " (of type " + typeof av + ").")
@@ -3040,7 +3255,7 @@ core.UnitTester = function UnitTester() {
var failedTests = 0, results = {};
this.runTests = function(TestClass, callback) {
var testName = Runtime.getFunctionName(TestClass), tname, runner = new core.UnitTestRunner, test = new TestClass(runner), testResults = {}, i, t, tests, lastFailCount;
- if(testName.hasOwnProperty(results)) {
+ if(results.hasOwnProperty(testName)) {
runtime.log("Test " + testName + " has already run.");
return
}
@@ -3083,130 +3298,249 @@ core.UnitTester = function UnitTester() {
return results
}
};
-core.PointWalker = function PointWalker(node) {
- var currentNode = node, before = null, after = node && node.firstChild, root = node, pos = 0;
- function getPosition(node) {
- var p = -1, n = node;
- while(n) {
- n = n.previousSibling;
- p += 1
+core.PositionIterator = function PositionIterator(root, whatToShow, filter, expandEntityReferences) {
+ function EmptyTextNodeFilter() {
+ this.acceptNode = function(node) {
+ if(node.nodeType === 3 && node.length === 0) {
+ return 2
+ }
+ return 1
}
- return p
}
- this.setPoint = function(node, position) {
- currentNode = node;
- pos = position;
- if(currentNode.nodeType === 3) {
- after = null;
- before = null
- }else {
- after = currentNode.firstChild;
- while(position) {
- position -= 1;
- after = after.nextSibling
+ function FilteredEmptyTextNodeFilter(filter) {
+ this.acceptNode = function(node) {
+ if(node.nodeType === 3 && node.length === 0) {
+ return 2
+ }
+ return filter.acceptNode(node)
+ }
+ }
+ var self = this, walker, currentPos;
+ this.nextPosition = function() {
+ if(walker.currentNode === root) {
+ return false
+ }
+ if(currentPos === 0 && walker.currentNode.nodeType === 1) {
+ if(walker.firstChild() === null) {
+ currentPos = 1
}
- if(after) {
- before = after.previousSibling
+ }else {
+ if(walker.currentNode.nodeType === 3 && currentPos + 1 < walker.currentNode.length) {
+ currentPos += 1
}else {
- before = currentNode.lastChild
+ if(walker.nextSibling() !== null) {
+ currentPos = 0
+ }else {
+ walker.parentNode();
+ currentPos = 1
+ }
}
}
+ return true
};
- this.stepForward = function() {
- var len;
- if(currentNode.nodeType === 3) {
- if(typeof currentNode.nodeValue.length === "number") {
- len = currentNode.nodeValue.length
+ function setAtEnd() {
+ var type = walker.currentNode.nodeType;
+ if(type === 3) {
+ currentPos = walker.currentNode.length - 1
+ }else {
+ currentPos = type === 1 ? 1 : 0
+ }
+ }
+ this.previousPosition = function() {
+ var moved = true;
+ if(currentPos === 0) {
+ if(walker.previousSibling() === null) {
+ walker.parentNode();
+ if(walker.currentNode === root) {
+ walker.firstChild();
+ return false
+ }
+ currentPos = 0
}else {
- len = currentNode.nodeValue.length()
- }
- if(pos < len) {
- pos += 1;
- return true
+ setAtEnd()
}
- }
- if(after) {
- if(after.nodeType === 1) {
- currentNode = after;
- before = null;
- after = currentNode.firstChild;
- pos = 0
+ }else {
+ if(walker.currentNode.nodeType === 3) {
+ currentPos -= 1
}else {
- if(after.nodeType === 3) {
- currentNode = after;
- before = null;
- after = null;
- pos = 0
+ if(walker.lastChild() !== null) {
+ setAtEnd()
}else {
- before = after;
- after = after.nextSibling;
- pos += 1
+ if(walker.currentNode === root) {
+ moved = false
+ }else {
+ currentPos = 0
+ }
}
}
- return true
}
- if(currentNode !== root) {
- before = currentNode;
- after = before.nextSibling;
- currentNode = currentNode.parentNode;
- pos = getPosition(before) + 1;
- return true
+ return moved
+ };
+ this.container = function() {
+ var n = walker.currentNode, t = n.nodeType;
+ if(currentPos === 0 && t !== 3) {
+ return n.parentNode
}
- return false
+ return n
};
- this.stepBackward = function() {
- if(currentNode.nodeType === 3) {
- if(pos > 0) {
- pos -= 1;
- return true
+ this.offset = function() {
+ if(walker.currentNode.nodeType === 3) {
+ return currentPos
+ }
+ var c = 0, startNode = walker.currentNode, n, nextNode;
+ if(currentPos === 1) {
+ n = walker.lastChild()
+ }else {
+ n = walker.previousSibling()
+ }
+ while(n) {
+ if(n.nodeType !== 3 || n.nextSibling !== nextNode || nextNode.nodeType !== 3) {
+ c += 1
}
+ nextNode = n;
+ n = walker.previousSibling()
}
- if(before) {
- if(before.nodeType === 1) {
- currentNode = before;
- before = currentNode.lastChild;
- after = null;
- pos = getPosition(before) + 1
+ walker.currentNode = startNode;
+ return c
+ };
+ this.domOffset = function() {
+ if(walker.currentNode.nodeType === 3) {
+ return currentPos
+ }
+ var c = 0, startNode = walker.currentNode, n;
+ if(currentPos === 1) {
+ n = walker.lastChild()
+ }else {
+ n = walker.previousSibling()
+ }
+ while(n) {
+ c += 1;
+ n = walker.previousSibling()
+ }
+ walker.currentNode = startNode;
+ return c
+ };
+ this.unfilteredDomOffset = function() {
+ if(walker.currentNode.nodeType === 3) {
+ return currentPos
+ }
+ var c = 0, n = walker.currentNode;
+ if(currentPos === 1) {
+ n = n.lastChild
+ }else {
+ n = n.previousSibling
+ }
+ while(n) {
+ c += 1;
+ n = n.previousSibling
+ }
+ return c
+ };
+ this.textOffset = function() {
+ if(walker.currentNode.nodeType !== 3) {
+ return 0
+ }
+ var offset = currentPos, n = walker.currentNode;
+ while(walker.previousSibling() && walker.currentNode.nodeType === 3) {
+ offset += walker.currentNode.length
+ }
+ walker.currentNode = n;
+ return offset
+ };
+ this.substr = function(start, length) {
+ var n = walker.currentNode, t, data = "";
+ if(n.nodeType !== 3) {
+ return data
+ }
+ while(walker.previousSibling()) {
+ if(walker.currentNode.nodeType !== 3) {
+ walker.nextSibling();
+ break
+ }
+ }
+ do {
+ data += walker.currentNode.data
+ }while(walker.nextSibling() && walker.currentNode.nodeType === 3);
+ walker.currentNode = n;
+ return data.substr(start, length)
+ };
+ this.setPosition = function(container, offset) {
+ runtime.assert(container !== null, "PositionIterator.setPosition called with container===null");
+ walker.currentNode = container;
+ if(container.nodeType === 3) {
+ currentPos = offset;
+ if(offset > container.length) {
+ throw"Error in setPosition: " + offset + " > " + container.length;
}else {
- if(before.nodeType === 3) {
- currentNode = before;
- before = null;
- after = null;
- if(typeof currentNode.nodeValue.length === "number") {
- pos = currentNode.nodeValue.length
+ if(offset < 0) {
+ throw"Error in setPosition: " + offset + " < 0";
+ }
+ }
+ if(offset === container.length) {
+ if(walker.nextSibling()) {
+ currentPos = 0
+ }else {
+ if(walker.parentNode()) {
+ currentPos = 1
}else {
- pos = currentNode.nodeValue.length()
+ throw"Error in setPosition: position not valid.";
}
- }else {
- after = before;
- before = before.previousSibling;
- pos -= 1
}
}
return true
}
- if(currentNode !== root) {
- after = currentNode;
- before = after.previousSibling;
- currentNode = currentNode.parentNode;
- pos = getPosition(after);
- return true
+ var o = offset, n = walker.firstChild(), prevNode;
+ while(offset > 0 && n) {
+ offset -= 1;
+ prevNode = n;
+ n = walker.nextSibling();
+ while(n && n.nodeType === 3 && prevNode.nodeType === 3 && n.previousSibling === prevNode) {
+ prevNode = n;
+ n = walker.nextSibling()
+ }
}
- return false
- };
- this.node = function() {
- return currentNode
- };
- this.position = function() {
- return pos
+ if(offset !== 0) {
+ throw"Error in setPosition: offset " + o + " is out of range.";
+ }
+ if(n === null) {
+ walker.currentNode = container;
+ currentPos = 1
+ }else {
+ currentPos = 0
+ }
+ return true
};
- this.precedingSibling = function() {
- return before
+ this.moveToEnd = function() {
+ walker.currentNode = root;
+ currentPos = 1
};
- this.followingSibling = function() {
- return after
+ function init() {
+ var f, acceptNode;
+ if(filter) {
+ f = new FilteredEmptyTextNodeFilter(filter)
+ }else {
+ f = new EmptyTextNodeFilter
+ }
+ acceptNode = f.acceptNode;
+ acceptNode.acceptNode = acceptNode;
+ whatToShow = whatToShow || 4294967295;
+ walker = root.ownerDocument.createTreeWalker(root, whatToShow, acceptNode, expandEntityReferences);
+ currentPos = 0;
+ if(walker.firstChild() === null) {
+ currentPos = 1
+ }
}
+ init()
+};
+runtime.loadClass("core.PositionIterator");
+core.PositionFilter = function PositionFilter() {
+};
+core.PositionFilter.FilterResult = {FILTER_ACCEPT:1, FILTER_REJECT:2, FILTER_SKIP:3};
+core.PositionFilter.prototype.acceptPosition = function(point) {
};
+(function() {
+ return core.PositionFilter
+})();
core.Async = function Async() {
this.forEach = function(items, f, callback) {
var i, l = items.length, itemsDone = 0;
@@ -3297,7 +3631,7 @@ core.Zip = function Zip(url, entriesReadCallback) {
size = filesize - offset
}
runtime.read(url, offset, size, function(err, data) {
- if(err) {
+ if(err || data === null) {
callback(err, data)
}else {
handleEntryData(data, callback)
@@ -3379,7 +3713,11 @@ core.Zip = function Zip(url, entriesReadCallback) {
cdsOffset = stream.readUInt16LE();
cdsOffset = filesize - 22 - cdsSize;
runtime.read(url, cdsOffset, filesize - cdsOffset, function(err, data) {
- handleCentralDirectory(data, callback)
+ if(err || data === null) {
+ callback(err, zip)
+ }else {
+ handleCentralDirectory(data, callback)
+ }
})
}
function load(filename, callback) {
@@ -3403,15 +3741,15 @@ core.Zip = function Zip(url, entriesReadCallback) {
}
function loadAsString(filename, callback) {
load(filename, function(err, data) {
- if(err) {
+ if(err || data === null) {
return callback(err, null)
}
- data = runtime.byteArrayToString(data, "utf8");
- callback(null, data)
+ var d = runtime.byteArrayToString(data, "utf8");
+ callback(null, d)
})
}
function loadContentXmlAsFragments(filename, handler) {
- loadAsString(filename, function(err, data) {
+ zip.loadAsString(filename, function(err, data) {
if(err) {
return handler.rootElementReady(err)
}
@@ -3448,14 +3786,13 @@ core.Zip = function Zip(url, entriesReadCallback) {
})
}
function loadAsDOM(filename, callback) {
- loadAsString(filename, function(err, xmldata) {
- if(err) {
+ zip.loadAsString(filename, function(err, xmldata) {
+ if(err || xmldata === null) {
callback(err, null);
return
}
- var parser = new DOMParser;
- xmldata = parser.parseFromString(xmldata, "text/xml");
- callback(null, xmldata)
+ var parser = new DOMParser, dom = parser.parseFromString(xmldata, "text/xml");
+ callback(null, dom)
})
}
function save(filename, data, compressed, date) {
@@ -3523,10 +3860,10 @@ core.Zip = function Zip(url, entriesReadCallback) {
loadAllEntries(position + 1, callback)
})
}
- function write(callback) {
+ function createByteArray(successCallback, errorCallback) {
loadAllEntries(0, function(err) {
if(err) {
- callback(err);
+ errorCallback(err);
return
}
var data = new core.ByteArrayWriter("utf8"), i, e, codoffset, codsize, offsets = [0];
@@ -3546,12 +3883,22 @@ core.Zip = function Zip(url, entriesReadCallback) {
data.appendUInt32LE(codsize);
data.appendUInt32LE(codoffset);
data.appendArray([0, 0]);
- runtime.writeFile(url, data.getByteArray(), callback)
+ successCallback(data.getByteArray())
})
}
+ function writeAs(newurl, callback) {
+ createByteArray(function(data) {
+ runtime.writeFile(newurl, data, callback)
+ }, callback)
+ }
+ function write(callback) {
+ writeAs(url, callback)
+ }
this.load = load;
this.save = save;
this.write = write;
+ this.writeAs = writeAs;
+ this.createByteArray = createByteArray;
this.loadContentXmlAsFragments = loadContentXmlAsFragments;
this.loadAsString = loadAsString;
this.loadAsDOM = loadAsDOM;
@@ -3570,7 +3917,7 @@ core.Zip = function Zip(url, entriesReadCallback) {
entriesReadCallback("File '" + url + "' cannot be read.", zip)
}else {
runtime.read(url, filesize - 22, 22, function(err, data) {
- if(err || entriesReadCallback === null) {
+ if(err || entriesReadCallback === null || data === null) {
entriesReadCallback(err, zip)
}else {
handleCentralDirectoryEnd(data, entriesReadCallback)
@@ -3579,6 +3926,23 @@ core.Zip = function Zip(url, entriesReadCallback) {
}
})
};
+core.CSSUnits = function CSSUnits() {
+ var sizemap = {"in":1, "cm":2.54, "mm":25.4, "pt":72, "pc":12};
+ this.convert = function(value, oldUnit, newUnit) {
+ return value * sizemap[newUnit] / sizemap[oldUnit]
+ };
+ this.convertMeasure = function(measure, newUnit) {
+ var value, oldUnit, newMeasure;
+ if(measure && newUnit) {
+ value = parseFloat(measure);
+ oldUnit = measure.replace(value.toString(), "");
+ newMeasure = this.convert(value, oldUnit, newUnit)
+ }else {
+ newMeasure = ""
+ }
+ return newMeasure.toString()
+ }
+};
xmldom.LSSerializerFilter = function LSSerializerFilter() {
};
if(typeof Object.create !== "function") {
@@ -3607,7 +3971,7 @@ xmldom.LSSerializer = function LSSerializer() {
function startNode(nsmap, node) {
var s = "", atts = node.attributes, length, i, attr, attstr = "", accept, prefix;
if(atts) {
- if(nsmap[node.namespaceURI] !== node.prefix) {
+ if(node.namespaceURI && nsmap[node.namespaceURI] !== node.prefix) {
nsmap[node.namespaceURI] = node.prefix
}
s += "<" + node.nodeName;
@@ -4927,7 +5291,7 @@ xmldom.XPath = function() {
};
XPathIterator.prototype.reset = function() {
};
- function NodeIterator() {
+ function XPathNodeIterator() {
var node, done = false;
this.setNode = function setNode(n) {
node = n
@@ -5013,7 +5377,7 @@ xmldom.XPath = function() {
})
}
function createPredicateFilteredIterator(it, p, namespaceResolver) {
- var nit = new NodeIterator, pit = createXPathPathIterator(nit, p, namespaceResolver), value = p.value;
+ var nit = new XPathNodeIterator, pit = createXPathPathIterator(nit, p, namespaceResolver), value = p.value;
if(value === undefined) {
return new ConditionIterator(it, function(node) {
nit.setNode(node);
@@ -5056,7 +5420,7 @@ xmldom.XPath = function() {
return it
};
function fallback(node, xpath, namespaceResolver) {
- var it = new NodeIterator, i, nodelist, parsedXPath, pos;
+ var it = new XPathNodeIterator, i, nodelist, parsedXPath, pos;
it.setNode(node);
parsedXPath = parseXPath(xpath);
it = createXPathPathIterator(it, parsedXPath, namespaceResolver);
@@ -5070,7 +5434,7 @@ xmldom.XPath = function() {
}
function getODFElementsWithXPath(node, xpath, namespaceResolver) {
var doc = node.ownerDocument, nodes, elements = [], n = null;
- if(!doc || !doc.evaluate || !n) {
+ if(!doc || !doc.evaluate) {
elements = fallback(node, xpath, namespaceResolver)
}else {
nodes = doc.evaluate(xpath, node, namespaceResolver, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
@@ -5089,40 +5453,50 @@ xmldom.XPath = function() {
};
return xmldom.XPath
}();
+runtime.loadClass("xmldom.XPath");
odf.StyleInfo = function StyleInfo() {
var chartns = "urn:oasis:names:tc:opendocument:xmlns:chart:1.0", dbns = "urn:oasis:names:tc:opendocument:xmlns:database:1.0", dr3dns = "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0", drawns = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", fons = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", formns = "urn:oasis:names:tc:opendocument:xmlns:form:1.0", numberns = "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", officens = "urn:oasis:names:tc:opendocument:xmlns:office:1.0",
- presentationns = "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", stylens = "urn:oasis:names:tc:opendocument:xmlns:style:1.0", svgns = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", tablens = "urn:oasis:names:tc:opendocument:xmlns:table:1.0", textns = "urn:oasis:names:tc:opendocument:xmlns:text:1.0", elementstyles = {"text":[{ens:stylens, en:"tab-stop", ans:stylens, a:"leader-text-style"}, {ens:stylens, en:"drop-cap", ans:stylens, a:"style-name"}, {ens:textns, en:"notes-configuration",
- ans:textns, a:"citation-body-style-name"}, {ens:textns, en:"notes-configuration", ans:textns, a:"citation-style-name"}, {ens:textns, en:"a", ans:textns, a:"style-name"}, {ens:textns, en:"alphabetical-index", ans:textns, a:"style-name"}, {ens:textns, en:"linenumbering-configuration", ans:textns, a:"style-name"}, {ens:textns, en:"list-level-style-number", ans:textns, a:"style-name"}, {ens:textns, en:"ruby-text", ans:textns, a:"style-name"}, {ens:textns, en:"span", ans:textns, a:"style-name"}, {ens:textns,
- en:"a", ans:textns, a:"visited-style-name"}, {ens:stylens, en:"text-properties", ans:stylens, a:"text-line-through-text-style"}, {ens:textns, en:"alphabetical-index-source", ans:textns, a:"main-entry-style-name"}, {ens:textns, en:"index-entry-bibliography", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-chapter", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-link-end", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-link-start", ans:textns, a:"style-name"}, {ens:textns,
- en:"index-entry-page-number", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-span", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-tab-stop", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-text", ans:textns, a:"style-name"}, {ens:textns, en:"index-title-template", ans:textns, a:"style-name"}, {ens:textns, en:"list-level-style-bullet", ans:textns, a:"style-name"}, {ens:textns, en:"outline-level-style", ans:textns, a:"style-name"}], "paragraph":[{ens:drawns, en:"caption",
- ans:drawns, a:"text-style-name"}, {ens:drawns, en:"circle", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"connector", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"control", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"custom-shape", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"ellipse", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"frame", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"line", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"measure", ans:drawns,
- a:"text-style-name"}, {ens:drawns, en:"path", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"polygon", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"polyline", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"rect", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"regular-polygon", ans:drawns, a:"text-style-name"}, {ens:officens, en:"annotation", ans:drawns, a:"text-style-name"}, {ens:formns, en:"column", ans:formns, a:"text-style-name"}, {ens:stylens, en:"style", ans:stylens, a:"next-style-name"},
- {ens:tablens, en:"body", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"even-columns", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"even-rows", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"first-column", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"first-row", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"last-column", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"last-row", ans:tablens, a:"paragraph-style-name"}, {ens:tablens,
- en:"odd-columns", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"odd-rows", ans:tablens, a:"paragraph-style-name"}, {ens:textns, en:"notes-configuration", ans:textns, a:"default-style-name"}, {ens:textns, en:"alphabetical-index-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"bibliography-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"h", ans:textns, a:"style-name"}, {ens:textns, en:"illustration-index-entry-template", ans:textns, a:"style-name"}, {ens:textns,
- en:"index-source-style", ans:textns, a:"style-name"}, {ens:textns, en:"object-index-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"p", ans:textns, a:"style-name"}, {ens:textns, en:"table-index-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"table-of-content-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"table-index-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"user-index-entry-template", ans:textns, a:"style-name"}, {ens:stylens, en:"page-layout-properties",
- ans:stylens, a:"register-truth-ref-style-name"}], "chart":[{ens:chartns, en:"axis", ans:chartns, a:"style-name"}, {ens:chartns, en:"chart", ans:chartns, a:"style-name"}, {ens:chartns, en:"data-label", ans:chartns, a:"style-name"}, {ens:chartns, en:"data-point", ans:chartns, a:"style-name"}, {ens:chartns, en:"equation", ans:chartns, a:"style-name"}, {ens:chartns, en:"error-indicator", ans:chartns, a:"style-name"}, {ens:chartns, en:"floor", ans:chartns, a:"style-name"}, {ens:chartns, en:"footer",
- ans:chartns, a:"style-name"}, {ens:chartns, en:"grid", ans:chartns, a:"style-name"}, {ens:chartns, en:"legend", ans:chartns, a:"style-name"}, {ens:chartns, en:"mean-value", ans:chartns, a:"style-name"}, {ens:chartns, en:"plot-area", ans:chartns, a:"style-name"}, {ens:chartns, en:"regression-curve", ans:chartns, a:"style-name"}, {ens:chartns, en:"series", ans:chartns, a:"style-name"}, {ens:chartns, en:"stock-gain-marker", ans:chartns, a:"style-name"}, {ens:chartns, en:"stock-loss-marker", ans:chartns,
- a:"style-name"}, {ens:chartns, en:"stock-range-line", ans:chartns, a:"style-name"}, {ens:chartns, en:"subtitle", ans:chartns, a:"style-name"}, {ens:chartns, en:"title", ans:chartns, a:"style-name"}, {ens:chartns, en:"wall", ans:chartns, a:"style-name"}], "section":[{ens:textns, en:"alphabetical-index", ans:textns, a:"style-name"}, {ens:textns, en:"bibliography", ans:textns, a:"style-name"}, {ens:textns, en:"illustration-index", ans:textns, a:"style-name"}, {ens:textns, en:"index-title", ans:textns,
- a:"style-name"}, {ens:textns, en:"object-index", ans:textns, a:"style-name"}, {ens:textns, en:"section", ans:textns, a:"style-name"}, {ens:textns, en:"table-of-content", ans:textns, a:"style-name"}, {ens:textns, en:"table-index", ans:textns, a:"style-name"}, {ens:textns, en:"user-index", ans:textns, a:"style-name"}], "ruby":[{ens:textns, en:"ruby", ans:textns, a:"style-name"}], "table":[{ens:dbns, en:"query", ans:dbns, a:"style-name"}, {ens:dbns, en:"table-representation", ans:dbns, a:"style-name"},
- {ens:tablens, en:"background", ans:tablens, a:"style-name"}, {ens:tablens, en:"table", ans:tablens, a:"style-name"}], "table-column":[{ens:dbns, en:"column", ans:dbns, a:"style-name"}, {ens:tablens, en:"table-column", ans:tablens, a:"style-name"}], "table-row":[{ens:dbns, en:"query", ans:dbns, a:"default-row-style-name"}, {ens:dbns, en:"table-representation", ans:dbns, a:"default-row-style-name"}, {ens:tablens, en:"table-row", ans:tablens, a:"style-name"}], "table-cell":[{ens:dbns, en:"column",
- ans:dbns, a:"default-cell-style-name"}, {ens:tablens, en:"table-column", ans:tablens, a:"default-cell-style-name"}, {ens:tablens, en:"table-row", ans:tablens, a:"default-cell-style-name"}, {ens:tablens, en:"body", ans:tablens, a:"style-name"}, {ens:tablens, en:"covered-table-cell", ans:tablens, a:"style-name"}, {ens:tablens, en:"even-columns", ans:tablens, a:"style-name"}, {ens:tablens, en:"covered-table-cell", ans:tablens, a:"style-name"}, {ens:tablens, en:"even-columns", ans:tablens, a:"style-name"},
- {ens:tablens, en:"even-rows", ans:tablens, a:"style-name"}, {ens:tablens, en:"first-column", ans:tablens, a:"style-name"}, {ens:tablens, en:"first-row", ans:tablens, a:"style-name"}, {ens:tablens, en:"last-column", ans:tablens, a:"style-name"}, {ens:tablens, en:"last-row", ans:tablens, a:"style-name"}, {ens:tablens, en:"odd-columns", ans:tablens, a:"style-name"}, {ens:tablens, en:"odd-rows", ans:tablens, a:"style-name"}, {ens:tablens, en:"table-cell", ans:tablens, a:"style-name"}], "graphic":[{ens:dr3dns,
- en:"cube", ans:drawns, a:"style-name"}, {ens:dr3dns, en:"extrude", ans:drawns, a:"style-name"}, {ens:dr3dns, en:"rotate", ans:drawns, a:"style-name"}, {ens:dr3dns, en:"scene", ans:drawns, a:"style-name"}, {ens:dr3dns, en:"sphere", ans:drawns, a:"style-name"}, {ens:drawns, en:"caption", ans:drawns, a:"style-name"}, {ens:drawns, en:"circle", ans:drawns, a:"style-name"}, {ens:drawns, en:"connector", ans:drawns, a:"style-name"}, {ens:drawns, en:"control", ans:drawns, a:"style-name"}, {ens:drawns, en:"custom-shape",
- ans:drawns, a:"style-name"}, {ens:drawns, en:"ellipse", ans:drawns, a:"style-name"}, {ens:drawns, en:"frame", ans:drawns, a:"style-name"}, {ens:drawns, en:"g", ans:drawns, a:"style-name"}, {ens:drawns, en:"line", ans:drawns, a:"style-name"}, {ens:drawns, en:"measure", ans:drawns, a:"style-name"}, {ens:drawns, en:"page-thumbnail", ans:drawns, a:"style-name"}, {ens:drawns, en:"path", ans:drawns, a:"style-name"}, {ens:drawns, en:"polygon", ans:drawns, a:"style-name"}, {ens:drawns, en:"polyline", ans:drawns,
- a:"style-name"}, {ens:drawns, en:"rect", ans:drawns, a:"style-name"}, {ens:drawns, en:"regular-polygon", ans:drawns, a:"style-name"}, {ens:officens, en:"annotation", ans:drawns, a:"style-name"}], "presentation":[{ens:dr3dns, en:"cube", ans:presentationns, a:"style-name"}, {ens:dr3dns, en:"extrude", ans:presentationns, a:"style-name"}, {ens:dr3dns, en:"rotate", ans:presentationns, a:"style-name"}, {ens:dr3dns, en:"scene", ans:presentationns, a:"style-name"}, {ens:dr3dns, en:"sphere", ans:presentationns,
- a:"style-name"}, {ens:drawns, en:"caption", ans:presentationns, a:"style-name"}, {ens:drawns, en:"circle", ans:presentationns, a:"style-name"}, {ens:drawns, en:"connector", ans:presentationns, a:"style-name"}, {ens:drawns, en:"control", ans:presentationns, a:"style-name"}, {ens:drawns, en:"custom-shape", ans:presentationns, a:"style-name"}, {ens:drawns, en:"ellipse", ans:presentationns, a:"style-name"}, {ens:drawns, en:"frame", ans:presentationns, a:"style-name"}, {ens:drawns, en:"g", ans:presentationns,
- a:"style-name"}, {ens:drawns, en:"line", ans:presentationns, a:"style-name"}, {ens:drawns, en:"measure", ans:presentationns, a:"style-name"}, {ens:drawns, en:"page-thumbnail", ans:presentationns, a:"style-name"}, {ens:drawns, en:"path", ans:presentationns, a:"style-name"}, {ens:drawns, en:"polygon", ans:presentationns, a:"style-name"}, {ens:drawns, en:"polyline", ans:presentationns, a:"style-name"}, {ens:drawns, en:"rect", ans:presentationns, a:"style-name"}, {ens:drawns, en:"regular-polygon",
- ans:presentationns, a:"style-name"}, {ens:officens, en:"annotation", ans:presentationns, a:"style-name"}], "drawing-page":[{ens:drawns, en:"page", ans:drawns, a:"style-name"}, {ens:presentationns, en:"notes", ans:drawns, a:"style-name"}, {ens:stylens, en:"handout-master", ans:drawns, a:"style-name"}, {ens:stylens, en:"master-page", ans:drawns, a:"style-name"}], "list-style":[{ens:textns, en:"list", ans:textns, a:"style-name"}, {ens:textns, en:"numbered-paragraph", ans:textns, a:"style-name"}, {ens:textns,
- en:"list-item", ans:textns, a:"style-override"}, {ens:stylens, en:"style", ans:stylens, a:"list-style-name"}, {ens:stylens, en:"style", ans:stylens, a:"data-style-name"}, {ens:stylens, en:"style", ans:stylens, a:"percentage-data-style-name"}, {ens:presentationns, en:"date-time-decl", ans:stylens, a:"data-style-name"}, {ens:textns, en:"creation-date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"creation-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"database-display", ans:stylens,
- a:"data-style-name"}, {ens:textns, en:"date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"editing-duration", ans:stylens, a:"data-style-name"}, {ens:textns, en:"expression", ans:stylens, a:"data-style-name"}, {ens:textns, en:"meta-field", ans:stylens, a:"data-style-name"}, {ens:textns, en:"modification-date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"modification-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"print-date", ans:stylens, a:"data-style-name"}, {ens:textns,
- en:"print-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"table-formula", ans:stylens, a:"data-style-name"}, {ens:textns, en:"time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-defined", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-field-get", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-field-input", ans:stylens, a:"data-style-name"}, {ens:textns, en:"variable-get", ans:stylens, a:"data-style-name"}, {ens:textns, en:"variable-input", ans:stylens,
- a:"data-style-name"}, {ens:textns, en:"variable-set", ans:stylens, a:"data-style-name"}], "data":[{ens:stylens, en:"style", ans:stylens, a:"data-style-name"}, {ens:stylens, en:"style", ans:stylens, a:"percentage-data-style-name"}, {ens:presentationns, en:"date-time-decl", ans:stylens, a:"data-style-name"}, {ens:textns, en:"creation-date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"creation-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"database-display", ans:stylens, a:"data-style-name"},
- {ens:textns, en:"date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"editing-duration", ans:stylens, a:"data-style-name"}, {ens:textns, en:"expression", ans:stylens, a:"data-style-name"}, {ens:textns, en:"meta-field", ans:stylens, a:"data-style-name"}, {ens:textns, en:"modification-date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"modification-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"print-date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"print-time",
- ans:stylens, a:"data-style-name"}, {ens:textns, en:"table-formula", ans:stylens, a:"data-style-name"}, {ens:textns, en:"time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-defined", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-field-get", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-field-input", ans:stylens, a:"data-style-name"}, {ens:textns, en:"variable-get", ans:stylens, a:"data-style-name"}, {ens:textns, en:"variable-input", ans:stylens, a:"data-style-name"},
- {ens:textns, en:"variable-set", ans:stylens, a:"data-style-name"}], "page-layout":[{ens:presentationns, en:"notes", ans:stylens, a:"page-layout-name"}, {ens:stylens, en:"handout-master", ans:stylens, a:"page-layout-name"}, {ens:stylens, en:"master-page", ans:stylens, a:"page-layout-name"}]}, elements;
+ presentationns = "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", stylens = "urn:oasis:names:tc:opendocument:xmlns:style:1.0", svgns = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", tablens = "urn:oasis:names:tc:opendocument:xmlns:table:1.0", textns = "urn:oasis:names:tc:opendocument:xmlns:text:1.0", xmlns = "http://www.w3.org/XML/1998/namespace", elementstyles = {"text":[{ens:stylens, en:"tab-stop", ans:stylens, a:"leader-text-style"}, {ens:stylens, en:"drop-cap", ans:stylens,
+ a:"style-name"}, {ens:textns, en:"notes-configuration", ans:textns, a:"citation-body-style-name"}, {ens:textns, en:"notes-configuration", ans:textns, a:"citation-style-name"}, {ens:textns, en:"a", ans:textns, a:"style-name"}, {ens:textns, en:"alphabetical-index", ans:textns, a:"style-name"}, {ens:textns, en:"linenumbering-configuration", ans:textns, a:"style-name"}, {ens:textns, en:"list-level-style-number", ans:textns, a:"style-name"}, {ens:textns, en:"ruby-text", ans:textns, a:"style-name"},
+ {ens:textns, en:"span", ans:textns, a:"style-name"}, {ens:textns, en:"a", ans:textns, a:"visited-style-name"}, {ens:stylens, en:"text-properties", ans:stylens, a:"text-line-through-text-style"}, {ens:textns, en:"alphabetical-index-source", ans:textns, a:"main-entry-style-name"}, {ens:textns, en:"index-entry-bibliography", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-chapter", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-link-end", ans:textns, a:"style-name"}, {ens:textns,
+ en:"index-entry-link-start", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-page-number", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-span", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-tab-stop", ans:textns, a:"style-name"}, {ens:textns, en:"index-entry-text", ans:textns, a:"style-name"}, {ens:textns, en:"index-title-template", ans:textns, a:"style-name"}, {ens:textns, en:"list-level-style-bullet", ans:textns, a:"style-name"}, {ens:textns, en:"outline-level-style",
+ ans:textns, a:"style-name"}], "paragraph":[{ens:drawns, en:"caption", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"circle", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"connector", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"control", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"custom-shape", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"ellipse", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"frame", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"line", ans:drawns,
+ a:"text-style-name"}, {ens:drawns, en:"measure", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"path", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"polygon", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"polyline", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"rect", ans:drawns, a:"text-style-name"}, {ens:drawns, en:"regular-polygon", ans:drawns, a:"text-style-name"}, {ens:officens, en:"annotation", ans:drawns, a:"text-style-name"}, {ens:formns, en:"column", ans:formns, a:"text-style-name"},
+ {ens:stylens, en:"style", ans:stylens, a:"next-style-name"}, {ens:tablens, en:"body", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"even-columns", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"even-rows", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"first-column", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"first-row", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"last-column", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"last-row",
+ ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"odd-columns", ans:tablens, a:"paragraph-style-name"}, {ens:tablens, en:"odd-rows", ans:tablens, a:"paragraph-style-name"}, {ens:textns, en:"notes-configuration", ans:textns, a:"default-style-name"}, {ens:textns, en:"alphabetical-index-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"bibliography-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"h", ans:textns, a:"style-name"}, {ens:textns, en:"illustration-index-entry-template",
+ ans:textns, a:"style-name"}, {ens:textns, en:"index-source-style", ans:textns, a:"style-name"}, {ens:textns, en:"object-index-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"p", ans:textns, a:"style-name"}, {ens:textns, en:"table-index-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"table-of-content-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"table-index-entry-template", ans:textns, a:"style-name"}, {ens:textns, en:"user-index-entry-template", ans:textns,
+ a:"style-name"}, {ens:stylens, en:"page-layout-properties", ans:stylens, a:"register-truth-ref-style-name"}], "chart":[{ens:chartns, en:"axis", ans:chartns, a:"style-name"}, {ens:chartns, en:"chart", ans:chartns, a:"style-name"}, {ens:chartns, en:"data-label", ans:chartns, a:"style-name"}, {ens:chartns, en:"data-point", ans:chartns, a:"style-name"}, {ens:chartns, en:"equation", ans:chartns, a:"style-name"}, {ens:chartns, en:"error-indicator", ans:chartns, a:"style-name"}, {ens:chartns, en:"floor",
+ ans:chartns, a:"style-name"}, {ens:chartns, en:"footer", ans:chartns, a:"style-name"}, {ens:chartns, en:"grid", ans:chartns, a:"style-name"}, {ens:chartns, en:"legend", ans:chartns, a:"style-name"}, {ens:chartns, en:"mean-value", ans:chartns, a:"style-name"}, {ens:chartns, en:"plot-area", ans:chartns, a:"style-name"}, {ens:chartns, en:"regression-curve", ans:chartns, a:"style-name"}, {ens:chartns, en:"series", ans:chartns, a:"style-name"}, {ens:chartns, en:"stock-gain-marker", ans:chartns, a:"style-name"},
+ {ens:chartns, en:"stock-loss-marker", ans:chartns, a:"style-name"}, {ens:chartns, en:"stock-range-line", ans:chartns, a:"style-name"}, {ens:chartns, en:"subtitle", ans:chartns, a:"style-name"}, {ens:chartns, en:"title", ans:chartns, a:"style-name"}, {ens:chartns, en:"wall", ans:chartns, a:"style-name"}], "section":[{ens:textns, en:"alphabetical-index", ans:textns, a:"style-name"}, {ens:textns, en:"bibliography", ans:textns, a:"style-name"}, {ens:textns, en:"illustration-index", ans:textns, a:"style-name"},
+ {ens:textns, en:"index-title", ans:textns, a:"style-name"}, {ens:textns, en:"object-index", ans:textns, a:"style-name"}, {ens:textns, en:"section", ans:textns, a:"style-name"}, {ens:textns, en:"table-of-content", ans:textns, a:"style-name"}, {ens:textns, en:"table-index", ans:textns, a:"style-name"}, {ens:textns, en:"user-index", ans:textns, a:"style-name"}], "ruby":[{ens:textns, en:"ruby", ans:textns, a:"style-name"}], "table":[{ens:dbns, en:"query", ans:dbns, a:"style-name"}, {ens:dbns, en:"table-representation",
+ ans:dbns, a:"style-name"}, {ens:tablens, en:"background", ans:tablens, a:"style-name"}, {ens:tablens, en:"table", ans:tablens, a:"style-name"}], "table-column":[{ens:dbns, en:"column", ans:dbns, a:"style-name"}, {ens:tablens, en:"table-column", ans:tablens, a:"style-name"}], "table-row":[{ens:dbns, en:"query", ans:dbns, a:"default-row-style-name"}, {ens:dbns, en:"table-representation", ans:dbns, a:"default-row-style-name"}, {ens:tablens, en:"table-row", ans:tablens, a:"style-name"}], "table-cell":[{ens:dbns,
+ en:"column", ans:dbns, a:"default-cell-style-name"}, {ens:tablens, en:"table-column", ans:tablens, a:"default-cell-style-name"}, {ens:tablens, en:"table-row", ans:tablens, a:"default-cell-style-name"}, {ens:tablens, en:"body", ans:tablens, a:"style-name"}, {ens:tablens, en:"covered-table-cell", ans:tablens, a:"style-name"}, {ens:tablens, en:"even-columns", ans:tablens, a:"style-name"}, {ens:tablens, en:"covered-table-cell", ans:tablens, a:"style-name"}, {ens:tablens, en:"even-columns", ans:tablens,
+ a:"style-name"}, {ens:tablens, en:"even-rows", ans:tablens, a:"style-name"}, {ens:tablens, en:"first-column", ans:tablens, a:"style-name"}, {ens:tablens, en:"first-row", ans:tablens, a:"style-name"}, {ens:tablens, en:"last-column", ans:tablens, a:"style-name"}, {ens:tablens, en:"last-row", ans:tablens, a:"style-name"}, {ens:tablens, en:"odd-columns", ans:tablens, a:"style-name"}, {ens:tablens, en:"odd-rows", ans:tablens, a:"style-name"}, {ens:tablens, en:"table-cell", ans:tablens, a:"style-name"}],
+ "graphic":[{ens:dr3dns, en:"cube", ans:drawns, a:"style-name"}, {ens:dr3dns, en:"extrude", ans:drawns, a:"style-name"}, {ens:dr3dns, en:"rotate", ans:drawns, a:"style-name"}, {ens:dr3dns, en:"scene", ans:drawns, a:"style-name"}, {ens:dr3dns, en:"sphere", ans:drawns, a:"style-name"}, {ens:drawns, en:"caption", ans:drawns, a:"style-name"}, {ens:drawns, en:"circle", ans:drawns, a:"style-name"}, {ens:drawns, en:"connector", ans:drawns, a:"style-name"}, {ens:drawns, en:"control", ans:drawns, a:"style-name"},
+ {ens:drawns, en:"custom-shape", ans:drawns, a:"style-name"}, {ens:drawns, en:"ellipse", ans:drawns, a:"style-name"}, {ens:drawns, en:"frame", ans:drawns, a:"style-name"}, {ens:drawns, en:"g", ans:drawns, a:"style-name"}, {ens:drawns, en:"line", ans:drawns, a:"style-name"}, {ens:drawns, en:"measure", ans:drawns, a:"style-name"}, {ens:drawns, en:"page-thumbnail", ans:drawns, a:"style-name"}, {ens:drawns, en:"path", ans:drawns, a:"style-name"}, {ens:drawns, en:"polygon", ans:drawns, a:"style-name"},
+ {ens:drawns, en:"polyline", ans:drawns, a:"style-name"}, {ens:drawns, en:"rect", ans:drawns, a:"style-name"}, {ens:drawns, en:"regular-polygon", ans:drawns, a:"style-name"}, {ens:officens, en:"annotation", ans:drawns, a:"style-name"}], "presentation":[{ens:dr3dns, en:"cube", ans:presentationns, a:"style-name"}, {ens:dr3dns, en:"extrude", ans:presentationns, a:"style-name"}, {ens:dr3dns, en:"rotate", ans:presentationns, a:"style-name"}, {ens:dr3dns, en:"scene", ans:presentationns, a:"style-name"},
+ {ens:dr3dns, en:"sphere", ans:presentationns, a:"style-name"}, {ens:drawns, en:"caption", ans:presentationns, a:"style-name"}, {ens:drawns, en:"circle", ans:presentationns, a:"style-name"}, {ens:drawns, en:"connector", ans:presentationns, a:"style-name"}, {ens:drawns, en:"control", ans:presentationns, a:"style-name"}, {ens:drawns, en:"custom-shape", ans:presentationns, a:"style-name"}, {ens:drawns, en:"ellipse", ans:presentationns, a:"style-name"}, {ens:drawns, en:"frame", ans:presentationns, a:"style-name"},
+ {ens:drawns, en:"g", ans:presentationns, a:"style-name"}, {ens:drawns, en:"line", ans:presentationns, a:"style-name"}, {ens:drawns, en:"measure", ans:presentationns, a:"style-name"}, {ens:drawns, en:"page-thumbnail", ans:presentationns, a:"style-name"}, {ens:drawns, en:"path", ans:presentationns, a:"style-name"}, {ens:drawns, en:"polygon", ans:presentationns, a:"style-name"}, {ens:drawns, en:"polyline", ans:presentationns, a:"style-name"}, {ens:drawns, en:"rect", ans:presentationns, a:"style-name"},
+ {ens:drawns, en:"regular-polygon", ans:presentationns, a:"style-name"}, {ens:officens, en:"annotation", ans:presentationns, a:"style-name"}], "drawing-page":[{ens:drawns, en:"page", ans:drawns, a:"style-name"}, {ens:presentationns, en:"notes", ans:drawns, a:"style-name"}, {ens:stylens, en:"handout-master", ans:drawns, a:"style-name"}, {ens:stylens, en:"master-page", ans:drawns, a:"style-name"}], "list-style":[{ens:textns, en:"list", ans:textns, a:"style-name"}, {ens:textns, en:"numbered-paragraph",
+ ans:textns, a:"style-name"}, {ens:textns, en:"list-item", ans:textns, a:"style-override"}, {ens:stylens, en:"style", ans:stylens, a:"list-style-name"}, {ens:stylens, en:"style", ans:stylens, a:"data-style-name"}, {ens:stylens, en:"style", ans:stylens, a:"percentage-data-style-name"}, {ens:presentationns, en:"date-time-decl", ans:stylens, a:"data-style-name"}, {ens:textns, en:"creation-date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"creation-time", ans:stylens, a:"data-style-name"}, {ens:textns,
+ en:"database-display", ans:stylens, a:"data-style-name"}, {ens:textns, en:"date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"editing-duration", ans:stylens, a:"data-style-name"}, {ens:textns, en:"expression", ans:stylens, a:"data-style-name"}, {ens:textns, en:"meta-field", ans:stylens, a:"data-style-name"}, {ens:textns, en:"modification-date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"modification-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"print-date", ans:stylens,
+ a:"data-style-name"}, {ens:textns, en:"print-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"table-formula", ans:stylens, a:"data-style-name"}, {ens:textns, en:"time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-defined", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-field-get", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-field-input", ans:stylens, a:"data-style-name"}, {ens:textns, en:"variable-get", ans:stylens, a:"data-style-name"}, {ens:textns,
+ en:"variable-input", ans:stylens, a:"data-style-name"}, {ens:textns, en:"variable-set", ans:stylens, a:"data-style-name"}], "data":[{ens:stylens, en:"style", ans:stylens, a:"data-style-name"}, {ens:stylens, en:"style", ans:stylens, a:"percentage-data-style-name"}, {ens:presentationns, en:"date-time-decl", ans:stylens, a:"data-style-name"}, {ens:textns, en:"creation-date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"creation-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"database-display",
+ ans:stylens, a:"data-style-name"}, {ens:textns, en:"date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"editing-duration", ans:stylens, a:"data-style-name"}, {ens:textns, en:"expression", ans:stylens, a:"data-style-name"}, {ens:textns, en:"meta-field", ans:stylens, a:"data-style-name"}, {ens:textns, en:"modification-date", ans:stylens, a:"data-style-name"}, {ens:textns, en:"modification-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"print-date", ans:stylens, a:"data-style-name"},
+ {ens:textns, en:"print-time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"table-formula", ans:stylens, a:"data-style-name"}, {ens:textns, en:"time", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-defined", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-field-get", ans:stylens, a:"data-style-name"}, {ens:textns, en:"user-field-input", ans:stylens, a:"data-style-name"}, {ens:textns, en:"variable-get", ans:stylens, a:"data-style-name"}, {ens:textns, en:"variable-input",
+ ans:stylens, a:"data-style-name"}, {ens:textns, en:"variable-set", ans:stylens, a:"data-style-name"}], "page-layout":[{ens:presentationns, en:"notes", ans:stylens, a:"page-layout-name"}, {ens:stylens, en:"handout-master", ans:stylens, a:"page-layout-name"}, {ens:stylens, en:"master-page", ans:stylens, a:"page-layout-name"}]}, elements, xpath = new xmldom.XPath;
+ function hasDerivedStyles(odfbody, nsResolver, styleElement) {
+ var nodes, xp, stylens = nsResolver("style"), styleName = styleElement.getAttributeNS(stylens, "name"), styleFamily = styleElement.getAttributeNS(stylens, "family");
+ xp = "//style:*[@style:parent-style-name='" + styleName + "'][@style:family='" + styleFamily + "']";
+ nodes = xpath.getODFElementsWithXPath(odfbody, xp, nsResolver);
+ if(nodes.length) {
+ return true
+ }
+ return false
+ }
function canElementHaveStyle(family, element) {
var elname = elements[element.localName], elns = elname && elname[element.namespaceURI], length = elns ? elns.length : 0, i;
- return elns && elns.length > 0
+ return length > 0
}
function getStyleRef(family, element) {
var elname = elements[element.localName], elns = elname && elname[element.namespaceURI], length = elns ? elns.length : 0, i, attr;
@@ -5131,30 +5505,27 @@ odf.StyleInfo = function StyleInfo() {
}
return null
}
- function getUsedStylesForAutomatic(element, keys) {
- var elname = elements[element.localName], elns = elname && elname[element.namespaceURI], length = elns ? elns.length : 0, i, attr, group, map, e;
+ function determineUsedStyles(styleUsingElementsRoot, usedStyles) {
+ var elname = elements[styleUsingElementsRoot.localName], elns = elname && elname[styleUsingElementsRoot.namespaceURI], length = elns ? elns.length : 0, i, stylename, keyname, map, e;
for(i = 0;i < length;i += 1) {
- attr = element.getAttributeNS(elns[i].ns, elns[i].localname);
- if(attr) {
- group = elns[i].keygroup;
- map = keys[group];
- if(!map) {
- map = keys[group] = {}
- }
- map[attr] = 1
+ stylename = styleUsingElementsRoot.getAttributeNS(elns[i].ns, elns[i].localname);
+ if(stylename) {
+ keyname = elns[i].keyname;
+ map = usedStyles[keyname] = usedStyles[keyname] || {};
+ map[stylename] = 1
}
}
- i = element.firstChild;
+ i = styleUsingElementsRoot.firstChild;
while(i) {
if(i.nodeType === 1) {
e = i;
- getUsedStylesForAutomatic(e, keys)
+ determineUsedStyles(e, usedStyles)
}
i = i.nextSibling
}
}
function inverse(elementstyles) {
- var keyname, i, list, item, l, elements = {}, map, array;
+ var keyname, i, l, list, item, elements = {}, map, array;
for(keyname in elementstyles) {
if(elementstyles.hasOwnProperty(keyname)) {
list = elementstyles[keyname];
@@ -5163,14 +5534,14 @@ odf.StyleInfo = function StyleInfo() {
item = list[i];
map = elements[item.en] = elements[item.en] || {};
array = map[item.ens] = map[item.ens] || [];
- array.push({ns:item.ans, localname:item.a, keygroup:keyname})
+ array.push({ns:item.ans, localname:item.a, keyname:keyname})
}
}
}
return elements
}
- this.UsedKeysList = function(element) {
- var usedKeys = {};
+ this.UsedStyleList = function(styleUsingElementsRoot) {
+ var usedStyles = {};
this.uses = function(element) {
var localName = element.localName, name = element.getAttributeNS(drawns, "name") || element.getAttributeNS(stylens, "name"), keyName, map;
if(localName === "style") {
@@ -5182,46 +5553,51 @@ odf.StyleInfo = function StyleInfo() {
keyName = localName
}
}
- map = usedKeys[keyName];
+ map = usedStyles[keyName];
return map ? map[name] > 0 : false
};
- getUsedStylesForAutomatic(element, usedKeys)
+ determineUsedStyles(styleUsingElementsRoot, usedStyles)
};
this.canElementHaveStyle = canElementHaveStyle;
+ this.hasDerivedStyles = hasDerivedStyles;
elements = inverse(elementstyles)
};
odf.Style2CSS = function Style2CSS() {
var xlinkns = "http://www.w3.org/1999/xlink", drawns = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", fons = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", officens = "urn:oasis:names:tc:opendocument:xmlns:office:1.0", presentationns = "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", stylens = "urn:oasis:names:tc:opendocument:xmlns:style:1.0", svgns = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", tablens = "urn:oasis:names:tc:opendocument:xmlns:table:1.0",
- textns = "urn:oasis:names:tc:opendocument:xmlns:text:1.0", namespaces = {"draw":drawns, "fo":fons, "office":officens, "presentation":presentationns, "style":stylens, "svg":svgns, "table":tablens, "text":textns, "xlink":xlinkns}, familynamespaceprefixes = {"graphic":"draw", "paragraph":"text", "presentation":"presentation", "ruby":"text", "section":"text", "table":"table", "table-cell":"table", "table-column":"table", "table-row":"table", "text":"text", "list":"text"}, familytagnames = {"graphic":["circle",
- "connected", "control", "custom-shape", "ellipse", "frame", "g", "line", "measure", "page", "page-thumbnail", "path", "polygon", "polyline", "rect", "regular-polygon"], "paragraph":["alphabetical-index-entry-template", "h", "illustration-index-entry-template", "index-source-style", "object-index-entry-template", "p", "table-index-entry-template", "table-of-content-entry-template", "user-index-entry-template"], "presentation":["caption", "circle", "connector", "control", "custom-shape", "ellipse",
- "frame", "g", "line", "measure", "page-thumbnail", "path", "polygon", "polyline", "rect", "regular-polygon"], "ruby":["ruby", "ruby-text"], "section":["alphabetical-index", "bibliography", "illustration-index", "index-title", "object-index", "section", "table-of-content", "table-index", "user-index"], "table":["background", "table"], "table-cell":["body", "covered-table-cell", "even-columns", "even-rows", "first-column", "first-row", "last-column", "last-row", "odd-columns", "odd-rows", "table-cell"],
- "table-column":["table-column"], "table-row":["table-row"], "text":["a", "index-entry-chapter", "index-entry-link-end", "index-entry-link-start", "index-entry-page-number", "index-entry-span", "index-entry-tab-stop", "index-entry-text", "index-title-template", "linenumbering-configuration", "list-level-style-number", "list-level-style-bullet", "outline-level-style", "span"], "list":["list-item"]}, textPropertySimpleMapping = [[fons, "color", "color"], [fons, "background-color", "background-color"],
- [fons, "font-weight", "font-weight"], [fons, "font-style", "font-style"], [fons, "font-size", "font-size"]], bgImageSimpleMapping = [[stylens, "repeat", "background-repeat"]], paragraphPropertySimpleMapping = [[fons, "background-color", "background-color"], [fons, "text-align", "text-align"], [fons, "padding-left", "padding-left"], [fons, "padding-right", "padding-right"], [fons, "padding-top", "padding-top"], [fons, "padding-bottom", "padding-bottom"], [fons, "border-left", "border-left"], [fons,
- "border-right", "border-right"], [fons, "border-top", "border-top"], [fons, "border-bottom", "border-bottom"], [fons, "margin-left", "margin-left"], [fons, "margin-right", "margin-right"], [fons, "margin-top", "margin-top"], [fons, "margin-bottom", "margin-bottom"], [fons, "border", "border"]], graphicPropertySimpleMapping = [[drawns, "fill-color", "background-color"], [drawns, "fill", "background"], [fons, "min-height", "min-height"], [drawns, "stroke", "border"], [svgns, "stroke-color", "border-color"]],
- tablecellPropertySimpleMapping = [[fons, "background-color", "background-color"], [fons, "border-left", "border-left"], [fons, "border-right", "border-right"], [fons, "border-top", "border-top"], [fons, "border-bottom", "border-bottom"]];
+ textns = "urn:oasis:names:tc:opendocument:xmlns:text:1.0", xmlns = "http://www.w3.org/XML/1998/namespace", namespaces = {"draw":drawns, "fo":fons, "office":officens, "presentation":presentationns, "style":stylens, "svg":svgns, "table":tablens, "text":textns, "xlink":xlinkns, "xml":xmlns}, familynamespaceprefixes = {"graphic":"draw", "paragraph":"text", "presentation":"presentation", "ruby":"text", "section":"text", "table":"table", "table-cell":"table", "table-column":"table", "table-row":"table",
+ "text":"text", "list":"text"}, familytagnames = {"graphic":["circle", "connected", "control", "custom-shape", "ellipse", "frame", "g", "line", "measure", "page", "page-thumbnail", "path", "polygon", "polyline", "rect", "regular-polygon"], "paragraph":["alphabetical-index-entry-template", "h", "illustration-index-entry-template", "index-source-style", "object-index-entry-template", "p", "table-index-entry-template", "table-of-content-entry-template", "user-index-entry-template"], "presentation":["caption",
+ "circle", "connector", "control", "custom-shape", "ellipse", "frame", "g", "line", "measure", "page-thumbnail", "path", "polygon", "polyline", "rect", "regular-polygon"], "ruby":["ruby", "ruby-text"], "section":["alphabetical-index", "bibliography", "illustration-index", "index-title", "object-index", "section", "table-of-content", "table-index", "user-index"], "table":["background", "table"], "table-cell":["body", "covered-table-cell", "even-columns", "even-rows", "first-column", "first-row",
+ "last-column", "last-row", "odd-columns", "odd-rows", "table-cell"], "table-column":["table-column"], "table-row":["table-row"], "text":["a", "index-entry-chapter", "index-entry-link-end", "index-entry-link-start", "index-entry-page-number", "index-entry-span", "index-entry-tab-stop", "index-entry-text", "index-title-template", "linenumbering-configuration", "list-level-style-number", "list-level-style-bullet", "outline-level-style", "span"], "list":["list-item"]}, textPropertySimpleMapping = [[fons,
+ "color", "color"], [fons, "background-color", "background-color"], [fons, "font-weight", "font-weight"], [fons, "font-style", "font-style"], [fons, "font-size", "font-size"]], bgImageSimpleMapping = [[stylens, "repeat", "background-repeat"]], paragraphPropertySimpleMapping = [[fons, "background-color", "background-color"], [fons, "text-align", "text-align"], [fons, "padding-left", "padding-left"], [fons, "padding-right", "padding-right"], [fons, "padding-top", "padding-top"], [fons, "padding-bottom",
+ "padding-bottom"], [fons, "border-left", "border-left"], [fons, "border-right", "border-right"], [fons, "border-top", "border-top"], [fons, "border-bottom", "border-bottom"], [fons, "margin-left", "margin-left"], [fons, "margin-right", "margin-right"], [fons, "margin-top", "margin-top"], [fons, "margin-bottom", "margin-bottom"], [fons, "border", "border"]], graphicPropertySimpleMapping = [[drawns, "fill-color", "background-color"], [drawns, "fill", "background"], [fons, "min-height", "min-height"],
+ [drawns, "stroke", "border"], [svgns, "stroke-color", "border-color"]], tablecellPropertySimpleMapping = [[fons, "background-color", "background-color"], [fons, "border-left", "border-left"], [fons, "border-right", "border-right"], [fons, "border-top", "border-top"], [fons, "border-bottom", "border-bottom"], [fons, "border", "border"]], tablecolumnPropertySimpleMapping = [[stylens, "column-width", "width"]], tablerowPropertySimpleMapping = [[stylens, "row-height", "height"], [fons, "keep-together",
+ null]], tablePropertySimpleMapping = [[stylens, "width", "width"], [fons, "margin-left", "margin-left"], [fons, "margin-right", "margin-right"], [fons, "margin-top", "margin-top"], [fons, "margin-bottom", "margin-bottom"]], fontFaceDeclsMap = {};
function namespaceResolver(prefix) {
return namespaces[prefix] || null
}
function getStyleMap(doc, stylesnode) {
- var stylemap = {}, node, name, family, map;
+ var stylemap = {}, node, name, family, style;
if(!stylesnode) {
return stylemap
}
node = stylesnode.firstChild;
while(node) {
- if(node.namespaceURI === stylens && node.localName === "style") {
+ if(node.namespaceURI === stylens && (node.localName === "style" || node.localName === "default-style")) {
family = node.getAttributeNS(stylens, "family")
}else {
if(node.namespaceURI === textns && node.localName === "list-style") {
family = "list"
+ }else {
+ family = undefined
}
}
- name = family && node.getAttributeNS && node.getAttributeNS(stylens, "name");
- if(name) {
- if(!stylemap[family]) {
- stylemap[family] = {}
+ if(family) {
+ name = node.getAttributeNS && node.getAttributeNS(stylens, "name");
+ if(!name) {
+ name = ""
}
- stylemap[family][name] = node
+ style = stylemap[family] = stylemap[family] || {};
+ style[name] = node
}
node = node.nextSibling
}
@@ -5283,12 +5659,21 @@ odf.Style2CSS = function Style2CSS() {
if(prefix === null) {
return null
}
- namepart = "[" + prefix + '|style-name="' + name + '"]';
+ if(name) {
+ namepart = "[" + prefix + '|style-name="' + name + '"]'
+ }else {
+ namepart = "[" + prefix + "|style-name]"
+ }
if(prefix === "presentation") {
prefix = "draw";
- namepart = '[presentation|style-name="' + name + '"]'
+ if(name) {
+ namepart = '[presentation|style-name="' + name + '"]'
+ }else {
+ namepart = "[presentation|style-name]"
+ }
}
- return prefix + "|" + familytagnames[family].join(namepart + "," + prefix + "|") + namepart
+ selector = prefix + "|" + familytagnames[family].join(namepart + "," + prefix + "|") + namepart;
+ return selector
}
function getSelectors(family, name, node) {
var selectors = [], n, ss, s;
@@ -5332,22 +5717,51 @@ odf.Style2CSS = function Style2CSS() {
}
return rule
}
+ function makeFontFaceDeclsMap(doc, fontFaceDeclsNode) {
+ var fontFaceDeclsMap = {}, node, name, family, map;
+ if(!fontFaceDeclsNode) {
+ return fontFaceDeclsNode
+ }
+ node = fontFaceDeclsNode.firstChild;
+ while(node) {
+ if(node.nodeType === 1) {
+ family = node.getAttributeNS(svgns, "font-family");
+ name = node.getAttributeNS(stylens, "name");
+ if(family || node.getElementsByTagNameNS(svgns, "font-face-uri")[0]) {
+ if(name) {
+ if(!fontFaceDeclsMap[name]) {
+ fontFaceDeclsMap[name] = {}
+ }
+ fontFaceDeclsMap[name] = family
+ }
+ }
+ }
+ node = node.nextSibling
+ }
+ return fontFaceDeclsMap
+ }
function getFontDeclaration(name) {
- return'"' + name + '"'
+ return fontFaceDeclsMap[name]
}
function getTextProperties(props) {
- var rule = "", value;
+ var rule = "", fontName, value, textDecoration = "";
rule += applySimpleMapping(props, textPropertySimpleMapping);
value = props.getAttributeNS(stylens, "text-underline-style");
if(value === "solid") {
- rule += "text-decoration: underline;"
+ textDecoration += " underline"
}
- value = props.getAttributeNS(stylens, "font-name");
- if(value) {
- value = getFontDeclaration(value);
- if(value) {
- rule += "font-family: " + value + ";"
- }
+ value = props.getAttributeNS(stylens, "text-line-through-style");
+ if(value === "solid") {
+ textDecoration += " line-through"
+ }
+ if(textDecoration.length) {
+ textDecoration = "text-decoration:" + textDecoration + ";";
+ rule += textDecoration
+ }
+ fontName = props.getAttributeNS(stylens, "font-name");
+ if(fontName) {
+ value = getFontDeclaration(fontName);
+ rule += "font-family: " + (value || fontName) + ";"
}
return rule
}
@@ -5375,6 +5789,21 @@ odf.Style2CSS = function Style2CSS() {
rule += applySimpleMapping(props, tablecellPropertySimpleMapping);
return rule
}
+ function getTableRowProperties(props) {
+ var rule = "";
+ rule += applySimpleMapping(props, tablerowPropertySimpleMapping);
+ return rule
+ }
+ function getTableColumnProperties(props) {
+ var rule = "";
+ rule += applySimpleMapping(props, tablecolumnPropertySimpleMapping);
+ return rule
+ }
+ function getTableProperties(props) {
+ var rule = "";
+ rule += applySimpleMapping(props, tablePropertySimpleMapping);
+ return rule
+ }
function addStyleRule(sheet, family, name, node) {
var selectors = getSelectors(family, name, node), selector = selectors.join(","), rule = "", properties = getDirectChild(node, stylens, "text-properties");
if(properties) {
@@ -5392,6 +5821,21 @@ odf.Style2CSS = function Style2CSS() {
if(properties) {
rule += getTableCellProperties(properties)
}
+ properties = getDirectChild(node, stylens, "table-row-properties");
+ if(properties) {
+ rule += getTableRowProperties(properties)
+ }
+ properties = getDirectChild(node, stylens, "table-column-properties");
+ if(properties) {
+ rule += getTableColumnProperties(properties)
+ }
+ properties = getDirectChild(node, stylens, "table-properties");
+ if(properties) {
+ rule += getTableProperties(properties)
+ }
+ if(family === "table") {
+ runtime.log(rule)
+ }
if(rule.length === 0) {
return
}
@@ -5429,15 +5873,38 @@ odf.Style2CSS = function Style2CSS() {
return"content: '" + bulletChar + "';"
}
function addListStyleRule(sheet, name, node, itemrule) {
- var selector = 'text|list[text|style-name="' + name + '"]', level = node.getAttributeNS(textns, "level"), rule = "";
+ var selector = 'text|list[text|style-name="' + name + '"]', level = node.getAttributeNS(textns, "level"), itemSelector, listItemRule, listLevelProps = node.firstChild, listLevelLabelAlign = listLevelProps.firstChild, labelAlignAttr, bulletIndent, listIndent, bulletWidth, rule = "";
+ if(listLevelLabelAlign) {
+ labelAlignAttr = listLevelLabelAlign.attributes;
+ bulletIndent = labelAlignAttr["fo:text-indent"].value;
+ listIndent = labelAlignAttr["fo:margin-left"].value
+ }
+ if(!bulletIndent) {
+ bulletIndent = "-0.6cm"
+ }
+ if(bulletIndent.charAt(0) === "-") {
+ bulletWidth = bulletIndent.substring(1)
+ }else {
+ bulletWidth = "-" + bulletIndent
+ }
level = level && parseInt(level, 10);
while(level > 1) {
selector += " > text|list-item > text|list";
level -= 1
}
- selector += " > list-item:before";
+ itemSelector = selector;
+ itemSelector += " > text|list-item > *:not(text|list):first-child";
+ if(listIndent !== undefined) {
+ listItemRule = itemSelector + "{margin-left:" + listIndent + ";}";
+ sheet.insertRule(listItemRule, sheet.cssRules.length)
+ }
+ selector += " > text|list-item > *:not(text|list):first-child:before";
rule = itemrule;
- rule = selector + "{" + rule + "}";
+ rule = selector + "{" + rule + ";";
+ rule += "counter-increment:list;";
+ rule += "margin-left:" + bulletIndent + ";";
+ rule += "width:" + bulletWidth + ";";
+ rule += "display:inline-block}";
try {
sheet.insertRule(rule, sheet.cssRules.length)
}catch(e) {
@@ -5486,7 +5953,8 @@ odf.Style2CSS = function Style2CSS() {
this.namespaces = namespaces;
this.namespaceResolver = namespaceResolver;
this.namespaceResolver.lookupNamespaceURI = this.namespaceResolver;
- this.style2css = function(stylesheet, styles, autostyles) {
+ this.makeFontFaceDeclsMap = makeFontFaceDeclsMap;
+ this.style2css = function(stylesheet, fontFaceDecls, styles, autostyles) {
var doc, prefix, styletree, tree, name, rule, family, stylenodes, styleautonodes;
while(stylesheet.cssRules.length) {
stylesheet.deleteRule(stylesheet.cssRules.length - 1)
@@ -5510,6 +5978,7 @@ odf.Style2CSS = function Style2CSS() {
}
}
}
+ fontFaceDeclsMap = makeFontFaceDeclsMap(doc, fontFaceDecls);
stylenodes = getStyleMap(doc, styles);
styleautonodes = getStyleMap(doc, autostyles);
styletree = {};
@@ -5533,25 +6002,28 @@ runtime.loadClass("odf.Style2CSS");
odf.FontLoader = function() {
var style2CSS = new odf.Style2CSS, xpath = new xmldom.XPath, base64 = new core.Base64;
function getEmbeddedFontDeclarations(fontFaceDecls) {
- var decls = {}, fonts, i, font, name, uris, href;
+ var decls = {}, fonts, i, font, name, uris, href, family;
if(!fontFaceDecls) {
return decls
}
fonts = xpath.getODFElementsWithXPath(fontFaceDecls, "style:font-face[svg:font-face-src]", style2CSS.namespaceResolver);
for(i = 0;i < fonts.length;i += 1) {
font = fonts[i];
- name = font.getAttributeNS(style2CSS.namespaces["style"], "name");
+ name = font.getAttributeNS(style2CSS.namespaces.style, "name");
+ family = font.getAttributeNS(style2CSS.namespaces.svg, "font-family");
uris = xpath.getODFElementsWithXPath(font, "svg:font-face-src/svg:font-face-uri", style2CSS.namespaceResolver);
if(uris.length > 0) {
href = uris[0].getAttributeNS(style2CSS.namespaces["xlink"], "href");
- decls[name] = {href:href}
+ decls[name] = {href:href, family:family}
}
}
return decls
}
function addFontToCSS(name, font, fontdata, stylesheet) {
- stylesheet = document.styleSheets[0];
- var rule = '@font-face { font-family: "' + name + '"; src: ' + "url(data:application/x-font-ttf;charset=binary;base64," + base64.convertUTF8ArrayToBase64(fontdata) + ') format("truetype"); }';
+ if(!stylesheet) {
+ stylesheet = document.styleSheets[0]
+ }
+ var cssFamily = font.family || name, rule = "@font-face { font-family: '" + cssFamily + "'; src: " + "url(data:application/x-font-ttf;charset=binary;base64," + base64.convertUTF8ArrayToBase64(fontdata) + ') format("truetype"); }';
try {
stylesheet.insertRule(rule, stylesheet.cssRules.length)
}catch(e) {
@@ -5600,7 +6072,7 @@ runtime.loadClass("odf.StyleInfo");
runtime.loadClass("odf.Style2CSS");
runtime.loadClass("odf.FontLoader");
odf.OdfContainer = function() {
- var styleInfo = new odf.StyleInfo, style2CSS = new odf.Style2CSS, namespaces = style2CSS.namespaces, officens = "urn:oasis:names:tc:opendocument:xmlns:office:1.0", manifestns = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", nodeorder = ["meta", "settings", "scripts", "font-face-decls", "styles", "automatic-styles", "master-styles", "body"], base64 = new core.Base64, fontLoader = new odf.FontLoader, partMimetypes = {};
+ var styleInfo = new odf.StyleInfo, style2CSS = new odf.Style2CSS, namespaces = style2CSS.namespaces, officens = "urn:oasis:names:tc:opendocument:xmlns:office:1.0", manifestns = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", webodfns = "urn:webodf:names:origin", nodeorder = ["meta", "settings", "scripts", "font-face-decls", "styles", "automatic-styles", "master-styles", "body"], base64 = new core.Base64, fontLoader = new odf.FontLoader, partMimetypes = {};
function getDirectChild(node, ns, name) {
node = node ? node.firstChild : null;
while(node) {
@@ -5620,24 +6092,28 @@ odf.OdfContainer = function() {
}
return-1
}
- function OdfNodeFilter(odfroot, usedStylesElement) {
- var automaticStyles = odfroot.automaticStyles, usedKeysList;
- if(usedStylesElement) {
- usedKeysList = new styleInfo.UsedKeysList(usedStylesElement)
+ function OdfNodeFilter(odfroot, styleUsingElementsRoot) {
+ var automaticStyles = odfroot.automaticStyles, usedStyleList;
+ if(styleUsingElementsRoot) {
+ usedStyleList = new styleInfo.UsedStyleList(styleUsingElementsRoot)
}
this.acceptNode = function(node) {
var styleName, styleFamily, result;
if(node.namespaceURI === "http://www.w3.org/1999/xhtml") {
result = 3
}else {
- if(usedKeysList && node.parentNode === automaticStyles && node.nodeType === 1) {
- if(usedKeysList.uses(node)) {
- result = 1
+ if(node.namespaceURI && node.namespaceURI.match(/^urn:webodf:/)) {
+ result = 2
+ }else {
+ if(usedStyleList && node.parentNode === automaticStyles && node.nodeType === 1) {
+ if(usedStyleList.uses(node)) {
+ result = 1
+ }else {
+ result = 2
+ }
}else {
- result = 2
+ result = 1
}
- }else {
- result = 1
}
}
return result
@@ -5685,6 +6161,9 @@ odf.OdfContainer = function() {
this.DONE = 2;
this.state = this.EMPTY;
this.load = function() {
+ if(zip === null) {
+ return
+ }
var mimetype = partMimetypes[name];
this.mimetype = mimetype;
zip.loadAsDataURL(name, mimetype, function(err, url) {
@@ -5715,7 +6194,7 @@ odf.OdfContainer = function() {
}
}
odf.OdfContainer = function OdfContainer(url, onstatereadychange) {
- var self = this, zip = null, contentXmlCompletelyLoaded = false;
+ var self = this, zip, contentXmlCompletelyLoaded = false;
this.onstatereadychange = onstatereadychange;
this.onchange = null;
this.state = null;
@@ -5736,6 +6215,32 @@ odf.OdfContainer = function() {
n = next
}
}
+ function tagAutomaticStylesOrigin(stylesRootElement, origin) {
+ var n = stylesRootElement && stylesRootElement.firstChild;
+ while(n) {
+ if(n.nodeType === 1) {
+ n.setAttributeNS(webodfns, "origin", origin)
+ }
+ n = n.nextSibling
+ }
+ }
+ function cloneStylesByOrigin(stylesRootElement, origin) {
+ var copy = null, n, s;
+ if(stylesRootElement) {
+ copy = stylesRootElement.cloneNode(true);
+ n = copy.firstChild;
+ while(n) {
+ s = n.nextSibling;
+ if(n.nodeType === 1) {
+ if(n.getAttributeNS(webodfns, "origin") !== origin) {
+ copy.removeChild(n)
+ }
+ }
+ n = s
+ }
+ }
+ return copy
+ }
function importRootNode(xmldoc) {
var doc = self.rootElement.ownerDocument, node;
if(xmldoc) {
@@ -5782,10 +6287,13 @@ odf.OdfContainer = function() {
root.styles = getDirectChild(node, officens, "styles");
setChild(root, root.styles);
root.automaticStyles = getDirectChild(node, officens, "automatic-styles");
+ tagAutomaticStylesOrigin(root.automaticStyles, "styles.xml");
setChild(root, root.automaticStyles);
root.masterStyles = getDirectChild(node, officens, "master-styles");
setChild(root, root.masterStyles);
- fontLoader.loadFonts(root.fontFaceDecls, zip, null)
+ if(root.fontFaceDecls) {
+ fontLoader.loadFonts(root.fontFaceDecls, zip, null)
+ }
}
function handleContentXml(xmldoc) {
var node = importRootNode(xmldoc), root, automaticStyles, fontFaceDecls, c;
@@ -5808,6 +6316,7 @@ odf.OdfContainer = function() {
}
}
automaticStyles = getDirectChild(node, officens, "automatic-styles");
+ tagAutomaticStylesOrigin(automaticStyles, "content.xml");
if(root.automaticStyles && automaticStyles) {
c = automaticStyles.firstChild;
while(c) {
@@ -5921,6 +6430,12 @@ odf.OdfContainer = function() {
s += "</office:document-meta>";
return s
}
+ function serializeManifestXml() {
+ var xml = "<manifest:manifest xmlns:manifest='urn:oasis:names:tc:opendocument:xmlns:manifest:1.0' manifest:version='1.2'><manifest:file-entry manifest:media-type='application/vnd.oasis.opendocument.text' manifest:full-path='/'/>" + "<manifest:file-entry manifest:media-type='text/xml' manifest:full-path='content.xml'/>" + "<manifest:file-entry manifest:media-type='text/xml' manifest:full-path='styles.xml'/>" + "<manifest:file-entry manifest:media-type='text/xml' manifest:full-path='meta.xml'/>" +
+ "<manifest:file-entry manifest:media-type='text/xml' manifest:full-path='settings.xml'/>" + "</manifest:manifest>", manifest = runtime.parseXML(xml), serializer = new xmldom.LSSerializer;
+ serializer.filter = new OdfNodeFilter(self.rootElement);
+ return serializer.writeToString(manifest, style2CSS.namespaces)
+ }
function serializeSettingsXml() {
var nsmap = style2CSS.namespaces, serializer = new xmldom.LSSerializer, s = documentElement("document-settings", nsmap);
serializer.filter = new OdfNodeFilter(self.rootElement);
@@ -5929,19 +6444,19 @@ odf.OdfContainer = function() {
return s
}
function serializeStylesXml() {
- var nsmap = style2CSS.namespaces, serializer = new xmldom.LSSerializer, s = documentElement("document-styles", nsmap);
- serializer.filter = new OdfNodeFilter(self.rootElement, self.rootElement.masterStyles);
+ var nsmap = style2CSS.namespaces, serializer = new xmldom.LSSerializer, automaticStyles = cloneStylesByOrigin(self.rootElement.automaticStyles, "styles.xml"), s = documentElement("document-styles", nsmap);
+ serializer.filter = new OdfNodeFilter(self.rootElement);
s += serializer.writeToString(self.rootElement.fontFaceDecls, nsmap);
s += serializer.writeToString(self.rootElement.styles, nsmap);
- s += serializer.writeToString(self.rootElement.automaticStyles, nsmap);
+ s += serializer.writeToString(automaticStyles, nsmap);
s += serializer.writeToString(self.rootElement.masterStyles, nsmap);
s += "</office:document-styles>";
return s
}
function serializeContentXml() {
- var nsmap = style2CSS.namespaces, serializer = new xmldom.LSSerializer, s = documentElement("document-content", nsmap);
- serializer.filter = new OdfNodeFilter(self.rootElement, self.rootElement.body);
- s += serializer.writeToString(self.rootElement.automaticStyles, nsmap);
+ var nsmap = style2CSS.namespaces, serializer = new xmldom.LSSerializer, automaticStyles = cloneStylesByOrigin(self.rootElement.automaticStyles, "content.xml"), s = documentElement("document-content", nsmap);
+ serializer.filter = new OdfNodeFilter(self.rootElement);
+ s += serializer.writeToString(automaticStyles, nsmap);
s += serializer.writeToString(self.rootElement.body, nsmap);
s += "</office:document-content>";
return s
@@ -5967,36 +6482,66 @@ odf.OdfContainer = function() {
this.getPart = function(partname) {
return new OdfPart(partname, self, zip)
};
- this.save = function(callback) {
- var data;
+ function createEmptyTextDocument() {
+ var zip = new core.Zip("", null), data = runtime.byteArrayFromString("application/vnd.oasis.opendocument.text", "utf8"), root = self.rootElement, text = document.createElementNS(officens, "text");
+ zip.save("mimetype", data, false, new Date);
+ root.body = document.createElementNS(officens, "body");
+ root.body.appendChild(text);
+ root.appendChild(root.body);
+ setState(OdfContainer.DONE);
+ return zip
+ }
+ function fillZip() {
+ var data, date = new Date;
data = runtime.byteArrayFromString(serializeSettingsXml(), "utf8");
- zip.save("settings.xml", data, true, new Date);
+ zip.save("settings.xml", data, true, date);
data = runtime.byteArrayFromString(serializeMetaXml(), "utf8");
- zip.save("meta.xml", data, true, new Date);
+ zip.save("meta.xml", data, true, date);
data = runtime.byteArrayFromString(serializeStylesXml(), "utf8");
- zip.save("styles.xml", data, true, new Date);
+ zip.save("styles.xml", data, true, date);
data = runtime.byteArrayFromString(serializeContentXml(), "utf8");
- zip.save("content.xml", data, true, new Date);
- zip.write(function(err) {
+ zip.save("content.xml", data, true, date);
+ data = runtime.byteArrayFromString(serializeManifestXml(), "utf8");
+ zip.save("META-INF/manifest.xml", data, true, date)
+ }
+ function createByteArray(successCallback, errorCallback) {
+ fillZip();
+ zip.createByteArray(successCallback, errorCallback)
+ }
+ this.createByteArray = createByteArray;
+ function saveAs(newurl, callback) {
+ fillZip();
+ zip.writeAs(newurl, function(err) {
callback(err)
})
+ }
+ this.saveAs = saveAs;
+ this.save = function(callback) {
+ saveAs(url, callback)
+ };
+ this.getUrl = function() {
+ return url
};
this.state = OdfContainer.LOADING;
this.rootElement = createElement(ODFDocumentElement);
this.parts = new OdfPartList(this);
- zip = new core.Zip(url, function(err, zipobject) {
- zip = zipobject;
- if(err) {
- loadFromXML(url, function(xmlerr) {
- if(err) {
- zip.error = err + "\n" + xmlerr;
- setState(OdfContainer.INVALID)
- }
- })
- }else {
- loadComponents()
- }
- })
+ if(url) {
+ zip = new core.Zip(url, function(err, zipobject) {
+ zip = zipobject;
+ if(err) {
+ loadFromXML(url, function(xmlerr) {
+ if(err) {
+ zip.error = err + "\n" + xmlerr;
+ setState(OdfContainer.INVALID)
+ }
+ })
+ }else {
+ loadComponents()
+ }
+ })
+ }else {
+ zip = createEmptyTextDocument()
+ }
};
odf.OdfContainer.EMPTY = 0;
odf.OdfContainer.LOADING = 1;
@@ -6010,7 +6555,7 @@ odf.OdfContainer = function() {
return odf.OdfContainer
}();
odf.Formatting = function Formatting() {
- var odfContainer, styleInfo = new odf.StyleInfo;
+ var odfContainer, styleInfo = new odf.StyleInfo, style2CSS = new odf.Style2CSS, namespaces = style2CSS.namespaces;
function RangeElementIterator(range) {
function getNthChild(parent, n) {
var c = parent && parent.firstChild;
@@ -6029,6 +6574,23 @@ odf.Formatting = function Formatting() {
return null
}
}
+ function mergeRecursive(obj1, obj2) {
+ var p;
+ for(p in obj2) {
+ if(obj2.hasOwnProperty(p)) {
+ try {
+ if(obj2[p].constructor === Object) {
+ obj1[p] = mergeRecursive(obj1[p], obj2[p])
+ }else {
+ obj1[p] = obj2[p]
+ }
+ }catch(e) {
+ obj1[p] = obj2[p]
+ }
+ }
+ }
+ return obj1
+ }
function getParentStyle(element) {
var n = element.firstChild, e;
if(n.nodeType === 1) {
@@ -6050,6 +6612,10 @@ odf.Formatting = function Formatting() {
this.setOdfContainer = function(odfcontainer) {
odfContainer = odfcontainer
};
+ this.getFontMap = function() {
+ var doc = odfContainer.rootElement.ownerDocument, fontFaceDecls = odfContainer.rootElement.fontFaceDecls;
+ return style2CSS.makeFontFaceDeclsMap(doc, fontFaceDecls)
+ };
this.isCompletelyBold = function(selection) {
return false
};
@@ -6059,7 +6625,7 @@ odf.Formatting = function Formatting() {
};
this.getParagraphStyles = function(selection) {
var i, j, s, styles = [];
- for(i = 0;i < selection.length;i += 0) {
+ for(i = 0;i < selection.length;i += 1) {
s = getParagraphStyles(selection[i]);
for(j = 0;j < s.length;j += 1) {
if(styles.indexOf(s[j]) === -1) {
@@ -6069,6 +6635,114 @@ odf.Formatting = function Formatting() {
}
return styles
};
+ this.getAvailableParagraphStyles = function() {
+ var node = odfContainer.rootElement.styles && odfContainer.rootElement.styles.firstChild, p_family, p_name, p_displayName, paragraphStyles = [], style;
+ while(node) {
+ if(node.nodeType === 1 && node.localName === "style" && node.namespaceURI === namespaces.style) {
+ style = node;
+ p_family = style.getAttributeNS(namespaces.style, "family");
+ if(p_family === "paragraph") {
+ p_name = style.getAttributeNS(namespaces.style, "name");
+ p_displayName = style.getAttributeNS(namespaces.style, "display-name") || p_name;
+ if(p_name && p_displayName) {
+ paragraphStyles.push({name:p_name, displayName:p_displayName})
+ }
+ }
+ }
+ node = node.nextSibling
+ }
+ return paragraphStyles
+ };
+ this.isStyleUsed = function(styleElement) {
+ var hasDerivedStyles, isUsed;
+ hasDerivedStyles = styleInfo.hasDerivedStyles(odfContainer.rootElement, style2CSS.namespaceResolver, styleElement);
+ isUsed = (new styleInfo.UsedStyleList(odfContainer.rootElement.styles)).uses(styleElement) || (new styleInfo.UsedStyleList(odfContainer.rootElement.automaticStyles)).uses(styleElement) || (new styleInfo.UsedStyleList(odfContainer.rootElement.body)).uses(styleElement);
+ return hasDerivedStyles || isUsed
+ };
+ function getDefaultStyleElement(styleListElement, family) {
+ var node = styleListElement.firstChild;
+ while(node) {
+ if(node.nodeType === 1 && node.namespaceURI === namespaces.style && node.localName === "default-style" && node.getAttributeNS(namespaces.style, "family") === family) {
+ return node
+ }
+ node = node.nextSibling
+ }
+ return null
+ }
+ function getStyleElement(styleListElement, styleName, family) {
+ var node = styleListElement.firstChild;
+ while(node) {
+ if(node.nodeType === 1 && node.namespaceURI === namespaces.style && node.localName === "style" && node.getAttributeNS(namespaces.style, "family") === family && node.getAttributeNS(namespaces.style, "name") === styleName) {
+ return node
+ }
+ node = node.nextSibling
+ }
+ return null
+ }
+ this.getStyleElement = getStyleElement;
+ function getStyleAttributes(styleNode) {
+ var i, propertiesMap = {}, propertiesNode = styleNode.firstChild;
+ while(propertiesNode) {
+ if(propertiesNode.nodeType === 1 && propertiesNode.namespaceURI === namespaces.style) {
+ propertiesMap[propertiesNode.nodeName] = {};
+ for(i = 0;i < propertiesNode.attributes.length;i += 1) {
+ propertiesMap[propertiesNode.nodeName][propertiesNode.attributes[i].name] = propertiesNode.attributes[i].value
+ }
+ }
+ propertiesNode = propertiesNode.nextSibling
+ }
+ return propertiesMap
+ }
+ this.getStyleAttributes = getStyleAttributes;
+ function getInheritedStyleAttributes(styleListElement, styleNode) {
+ var i, parentStyleName, propertiesMap = {}, inheritedPropertiesMap = {}, node = styleNode;
+ while(node) {
+ propertiesMap = getStyleAttributes(node);
+ inheritedPropertiesMap = mergeRecursive(propertiesMap, inheritedPropertiesMap);
+ parentStyleName = node.getAttributeNS(namespaces.style, "parent-style-name");
+ if(parentStyleName) {
+ node = getStyleElement(styleListElement, parentStyleName, styleNode.getAttributeNS(namespaces.style, "family"))
+ }else {
+ node = null
+ }
+ }
+ propertiesMap = getStyleAttributes(getDefaultStyleElement(styleListElement, styleNode.getAttributeNS(namespaces.style, "family")));
+ inheritedPropertiesMap = mergeRecursive(propertiesMap, inheritedPropertiesMap);
+ return inheritedPropertiesMap
+ }
+ this.getInheritedStyleAttributes = getInheritedStyleAttributes;
+ this.getFirstNamedParentStyleNameOrSelf = function(styleName) {
+ var automaticStyleElementList = odfContainer.rootElement.automaticStyles, styleElementList = odfContainer.rootElement.styles, styleElement;
+ while((styleElement = getStyleElement(automaticStyleElementList, styleName, "paragraph")) !== null) {
+ styleName = styleElement.getAttributeNS(namespaces.style, "parent-style-name")
+ }
+ styleElement = getStyleElement(styleElementList, styleName, "paragraph");
+ if(!styleElement) {
+ return null
+ }
+ return styleName
+ };
+ this.hasParagraphStyle = function(styleName) {
+ return getStyleElement(odfContainer.rootElement.automaticStyles, styleName, "paragraph") || getStyleElement(odfContainer.rootElement.styles, styleName, "paragraph")
+ };
+ this.getParagraphStyleAttribute = function(styleName, attributeNameNS, attributeName) {
+ var automaticStyleElementList = odfContainer.rootElement.automaticStyles, styleElementList = odfContainer.rootElement.styles, styleElement, attributeValue;
+ while((styleElement = getStyleElement(automaticStyleElementList, styleName, "paragraph")) !== null) {
+ attributeValue = styleElement.getAttributeNS(attributeNameNS, attributeName);
+ if(attributeValue) {
+ return attributeValue
+ }
+ styleName = styleElement.getAttributeNS(namespaces.style, "parent-style-name")
+ }
+ while((styleElement = getStyleElement(styleElementList, styleName, "paragraph")) !== null) {
+ attributeValue = styleElement.getAttributeNS(attributeNameNS, attributeName);
+ if(attributeValue) {
+ return attributeValue
+ }
+ styleName = styleElement.getAttributeNS(namespaces.style, "parent-style-name")
+ }
+ return null
+ };
this.getTextStyles = function(selection) {
return[]
}
@@ -6112,6 +6786,10 @@ odf.OdfCanvas = function() {
sheet.insertRule("office|presentation draw|page {display:none;}", 0);
sheet.insertRule("office|presentation draw|page:nth-child(" + position + ") {display:block;}", 1)
}
+ this.showFirstPage = function() {
+ position = 1;
+ updateCSS()
+ };
this.showNextPage = function() {
position += 1;
updateCSS()
@@ -6122,6 +6800,12 @@ odf.OdfCanvas = function() {
updateCSS()
}
};
+ this.showPage = function(n) {
+ if(n > 0) {
+ position = n;
+ updateCSS()
+ }
+ };
this.css = css
}
function listenEvent(eventTarget, eventType, eventHandler) {
@@ -6215,25 +6899,7 @@ odf.OdfCanvas = function() {
listenEvent(element, "keyup", checkSelection);
listenEvent(element, "keydown", checkSelection)
}
- var style2CSS = new odf.Style2CSS, namespaces = style2CSS.namespaces, drawns = namespaces.draw, fons = namespaces.fo, officens = namespaces.office, svgns = namespaces.svg, textns = namespaces.text, xlinkns = namespaces.xlink, window = runtime.getWindow(), xpath = new xmldom.XPath, eventHandlers = {}, editparagraph, loadingQueue = new LoadingQueue;
- function addEventListener(eventType, eventHandler) {
- var handlers = eventHandlers[eventType];
- if(handlers === undefined) {
- handlers = eventHandlers[eventType] = []
- }
- if(eventHandler && handlers.indexOf(eventHandler) === -1) {
- handlers.push(eventHandler)
- }
- }
- function fireEvent(eventType, args) {
- if(!eventHandlers.hasOwnProperty(eventType)) {
- return
- }
- var handlers = eventHandlers[eventType], i;
- for(i = 0;i < handlers.length;i += 1) {
- handlers[i](args)
- }
- }
+ var style2CSS = new odf.Style2CSS, namespaces = style2CSS.namespaces, drawns = namespaces.draw, fons = namespaces.fo, officens = namespaces.office, stylens = namespaces.style, svgns = namespaces.svg, tablens = namespaces.table, textns = namespaces.text, xlinkns = namespaces.xlink, xmlns = namespaces.xml, window = runtime.getWindow(), xpath = new xmldom.XPath;
function clear(element) {
while(element.firstChild) {
element.removeChild(element.firstChild)
@@ -6241,7 +6907,7 @@ odf.OdfCanvas = function() {
}
function handleStyles(odfelement, stylesxmlcss) {
var style2css = new odf.Style2CSS;
- style2css.style2css(stylesxmlcss.sheet, odfelement.styles, odfelement.automaticStyles)
+ style2css.style2css(stylesxmlcss.sheet, odfelement.fontFaceDecls, odfelement.styles, odfelement.automaticStyles)
}
function setFramePosition(id, frame, stylesheet) {
frame.setAttribute("styleid", id);
@@ -6327,6 +6993,37 @@ odf.OdfCanvas = function() {
}
}
}
+ function modifyTables(container, odffragment, stylesheet) {
+ var i, tableCells, node;
+ function modifyTableCell(container, node, stylesheet) {
+ if(node.hasAttributeNS(tablens, "number-columns-spanned")) {
+ node.setAttribute("colspan", node.getAttributeNS(tablens, "number-columns-spanned"))
+ }
+ if(node.hasAttributeNS(tablens, "number-rows-spanned")) {
+ node.setAttribute("rowspan", node.getAttributeNS(tablens, "number-rows-spanned"))
+ }
+ }
+ tableCells = odffragment.getElementsByTagNameNS(tablens, "table-cell");
+ for(i = 0;i < tableCells.length;i += 1) {
+ node = tableCells.item(i);
+ modifyTableCell(container, node, stylesheet)
+ }
+ }
+ function modifyLinks(container, odffragment, stylesheet) {
+ var i, links, node;
+ function modifyLink(container, node, stylesheet) {
+ if(node.hasAttributeNS(xlinkns, "href")) {
+ node.onclick = function() {
+ window.open(node.getAttributeNS(xlinkns, "href"))
+ }
+ }
+ }
+ links = odffragment.getElementsByTagNameNS(textns, "a");
+ for(i = 0;i < links.length;i += 1) {
+ node = links.item(i);
+ modifyLink(container, node, stylesheet)
+ }
+ }
function modifyImages(container, odfbody, stylesheet) {
var node, frames, i, images;
function namespaceResolver(prefix) {
@@ -6355,27 +7052,15 @@ odf.OdfCanvas = function() {
}
formatParagraphAnchors(odfbody)
}
- function loadImages(container, odffragment, stylesheet) {
- var i, images, node;
- function loadImage(name, container, node, stylesheet) {
- loadingQueue.addToQueue(function() {
- setImage(name, container, node, stylesheet)
- })
- }
- images = odffragment.getElementsByTagNameNS(drawns, "image");
- for(i = 0;i < images.length;i += 1) {
- node = images.item(i);
- loadImage("image" + String(i), container, node, stylesheet)
- }
- }
function setVideo(id, container, plugin, stylesheet) {
var video, source, url, videoType, doc = plugin.ownerDocument, part, node;
url = plugin.getAttributeNS(xlinkns, "href");
function callback(url, mimetype) {
+ var ns = doc.documentElement.namespaceURI;
if(mimetype.substr(0, 6) === "video/") {
- video = doc.createElementNS(doc.documentElement.namespaceURI, "video");
+ video = doc.createElementNS(ns, "video");
video.setAttribute("controls", "controls");
- source = doc.createElement("source");
+ source = doc.createElementNS(ns, "source");
source.setAttribute("src", url);
source.setAttribute("type", mimetype);
video.appendChild(source);
@@ -6405,97 +7090,270 @@ odf.OdfCanvas = function() {
callback(url, "video/mp4")
}
}
- function loadVideos(container, odffragment, stylesheet) {
- var i, plugins, node;
- function loadVideo(name, container, node, stylesheet) {
- loadingQueue.addToQueue(function() {
- setVideo(name, container, node, stylesheet)
- })
+ function getNumberRule(node) {
+ var style = node.getAttributeNS(stylens, "num-format"), suffix = node.getAttributeNS(stylens, "num-suffix"), prefix = node.getAttributeNS(stylens, "num-prefix"), rule = "", stylemap = {1:"decimal", "a":"lower-latin", "A":"upper-latin", "i":"lower-roman", "I":"upper-roman"}, content;
+ content = prefix || "";
+ if(stylemap.hasOwnProperty(style)) {
+ content += " counter(list, " + stylemap[style] + ")"
+ }else {
+ if(style) {
+ content += "'" + style + "';"
+ }else {
+ content += " ''"
+ }
}
- plugins = odffragment.getElementsByTagNameNS(drawns, "plugin");
- runtime.log("Loading Videos:");
- for(i = 0;i < plugins.length;i += 1) {
- runtime.log("...Found a video.");
- node = plugins.item(i);
- loadVideo("video" + String(i), container, node, stylesheet)
+ if(suffix) {
+ content += " '" + suffix + "'"
}
+ rule = "content: " + content + ";";
+ return rule
}
- function addStyleSheet(document) {
- var styles = document.getElementsByTagName("style"), head = document.getElementsByTagName("head")[0], text = "", prefix, a = "", b;
- if(styles && styles.length > 0) {
- styles = styles[0].cloneNode(false)
+ function getImageRule(node) {
+ var rule = "content: none;";
+ return rule
+ }
+ function getBulletRule(node) {
+ var rule = "", bulletChar = node.getAttributeNS(textns, "bullet-char");
+ return"content: '" + bulletChar + "';"
+ }
+ function getBulletsRule(node) {
+ var itemrule;
+ if(node.localName === "list-level-style-number") {
+ itemrule = getNumberRule(node)
}else {
- styles = document.createElement("style")
+ if(node.localName === "list-level-style-image") {
+ itemrule = getImageRule(node)
+ }else {
+ if(node.localName === "list-level-style-bullet") {
+ itemrule = getBulletRule(node)
+ }
+ }
+ }
+ return itemrule
+ }
+ function loadLists(container, odffragment, stylesheet) {
+ var i, lists, svgns = namespaces.svg, node, id, continueList, styleName, rule, listMap = {}, parentList, listStyles, listStyle, listStyleMap = {}, bulletRule;
+ listStyles = window.document.getElementsByTagNameNS(textns, "list-style");
+ for(i = 0;i < listStyles.length;i += 1) {
+ node = listStyles.item(i);
+ styleName = node.getAttributeNS(stylens, "name");
+ if(styleName) {
+ listStyleMap[styleName] = node
+ }
+ }
+ lists = odffragment.getElementsByTagNameNS(textns, "list");
+ for(i = 0;i < lists.length;i += 1) {
+ node = lists.item(i);
+ id = node.getAttributeNS(xmlns, "id");
+ if(id) {
+ continueList = node.getAttributeNS(textns, "continue-list");
+ node.setAttribute("id", id);
+ rule = "text|list#" + id + " > text|list-item > *:first-child:before {";
+ styleName = node.getAttributeNS(textns, "style-name");
+ if(styleName) {
+ node = listStyleMap[styleName];
+ bulletRule = getBulletsRule(node.firstChild)
+ }
+ if(continueList) {
+ parentList = listMap[continueList];
+ while(parentList) {
+ continueList = parentList;
+ parentList = listMap[continueList]
+ }
+ rule += "counter-increment:" + continueList + ";";
+ if(bulletRule) {
+ bulletRule = bulletRule.replace("list", continueList);
+ rule += bulletRule
+ }else {
+ rule += "content:counter(" + continueList + ");"
+ }
+ }else {
+ continueList = "";
+ if(bulletRule) {
+ bulletRule = bulletRule.replace("list", id);
+ rule += bulletRule
+ }else {
+ rule += "content: counter(" + id + ");"
+ }
+ rule += "counter-increment:" + id + ";";
+ stylesheet.insertRule("text|list#" + id + " {counter-reset:" + id + "}", stylesheet.cssRules.length)
+ }
+ rule += "}";
+ listMap[id] = continueList;
+ if(rule) {
+ stylesheet.insertRule(rule, stylesheet.cssRules.length)
+ }
+ }
}
+ }
+ function addWebODFStyleSheet(document) {
+ var head = document.getElementsByTagName("head")[0], style, href;
+ if(String(typeof webodf_css) !== "undefined") {
+ style = document.createElementNS(head.namespaceURI, "style");
+ style.setAttribute("media", "screen, print, handheld, projection");
+ style.appendChild(document.createTextNode(webodf_css))
+ }else {
+ style = document.createElementNS(head.namespaceURI, "link");
+ href = "webodf.css";
+ if(runtime.currentDirectory) {
+ href = runtime.currentDirectory() + "/../" + href
+ }
+ style.setAttribute("href", href);
+ style.setAttribute("rel", "stylesheet")
+ }
+ style.setAttribute("type", "text/css");
+ head.appendChild(style);
+ return style
+ }
+ function addStyleSheet(document) {
+ var head = document.getElementsByTagName("head")[0], style = document.createElementNS(head.namespaceURI, "style"), text = "", prefix;
+ style.setAttribute("type", "text/css");
+ style.setAttribute("media", "screen, print, handheld, projection");
for(prefix in namespaces) {
if(namespaces.hasOwnProperty(prefix) && prefix) {
text += "@namespace " + prefix + " url(" + namespaces[prefix] + ");\n"
}
}
- styles.appendChild(document.createTextNode(text));
- head.appendChild(styles);
- return styles
+ style.appendChild(document.createTextNode(text));
+ head.appendChild(style);
+ return style
}
odf.OdfCanvas = function OdfCanvas(element) {
- var self = this, document = element.ownerDocument, odfcontainer, formatting = new odf.Formatting, selectionWatcher = new SelectionWatcher(element), slidecssindex = 0, pageSwitcher = new PageSwitcher(addStyleSheet(document)), stylesxmlcss = addStyleSheet(document), positioncss = addStyleSheet(document), editable = false, zoomLevel = 1;
+ var self = this, doc = element.ownerDocument, odfcontainer, formatting = new odf.Formatting, selectionWatcher = new SelectionWatcher(element), slidecssindex = 0, pageSwitcher, stylesxmlcss, positioncss, editable = false, zoomLevel = 1, eventHandlers = {}, editparagraph, loadingQueue = new LoadingQueue;
+ addWebODFStyleSheet(doc);
+ pageSwitcher = new PageSwitcher(addStyleSheet(doc));
+ stylesxmlcss = addStyleSheet(doc);
+ positioncss = addStyleSheet(doc);
+ function loadImages(container, odffragment, stylesheet) {
+ var i, images, node;
+ function loadImage(name, container, node, stylesheet) {
+ loadingQueue.addToQueue(function() {
+ setImage(name, container, node, stylesheet)
+ })
+ }
+ images = odffragment.getElementsByTagNameNS(drawns, "image");
+ for(i = 0;i < images.length;i += 1) {
+ node = images.item(i);
+ loadImage("image" + String(i), container, node, stylesheet)
+ }
+ }
+ function loadVideos(container, odffragment, stylesheet) {
+ var i, plugins, node;
+ function loadVideo(name, container, node, stylesheet) {
+ loadingQueue.addToQueue(function() {
+ setVideo(name, container, node, stylesheet)
+ })
+ }
+ plugins = odffragment.getElementsByTagNameNS(drawns, "plugin");
+ for(i = 0;i < plugins.length;i += 1) {
+ node = plugins.item(i);
+ loadVideo("video" + String(i), container, node, stylesheet)
+ }
+ }
+ function addEventListener(eventType, eventHandler) {
+ var handlers = eventHandlers[eventType];
+ if(handlers === undefined) {
+ handlers = eventHandlers[eventType] = []
+ }
+ if(eventHandler && handlers.indexOf(eventHandler) === -1) {
+ handlers.push(eventHandler)
+ }
+ }
+ function fireEvent(eventType, args) {
+ if(!eventHandlers.hasOwnProperty(eventType)) {
+ return
+ }
+ var handlers = eventHandlers[eventType], i;
+ for(i = 0;i < handlers.length;i += 1) {
+ handlers[i].apply(null, args)
+ }
+ }
function fixContainerSize() {
var sizer = element.firstChild, odfdoc = sizer.firstChild;
if(!odfdoc) {
return
}
- element.style.WebkitTransform = "scale(" + zoomLevel + ")";
- element.style.WebkitTransformOrigin = "left top";
- element.style.width = Math.round(zoomLevel * odfdoc.offsetWidth) + "px";
- element.style.height = Math.round(zoomLevel * odfdoc.offsetHeight) + "px"
+ if(zoomLevel > 1) {
+ sizer.style.MozTransformOrigin = "center top";
+ sizer.style.WebkitTransformOrigin = "center top";
+ sizer.style.OTransformOrigin = "center top";
+ sizer.style.msTransformOrigin = "center top"
+ }else {
+ sizer.style.MozTransformOrigin = "left top";
+ sizer.style.WebkitTransformOrigin = "left top";
+ sizer.style.OTransformOrigin = "left top";
+ sizer.style.msTransformOrigin = "left top"
+ }
+ sizer.style.WebkitTransform = "scale(" + zoomLevel + ")";
+ sizer.style.MozTransform = "scale(" + zoomLevel + ")";
+ sizer.style.OTransform = "scale(" + zoomLevel + ")";
+ sizer.style.msTransform = "scale(" + zoomLevel + ")";
+ element.style.width = Math.round(zoomLevel * sizer.offsetWidth) + "px";
+ element.style.height = Math.round(zoomLevel * sizer.offsetHeight) + "px"
}
function handleContent(container, odfnode) {
var css = positioncss.sheet, sizer;
modifyImages(container, odfnode.body, css);
css.insertRule("draw|page { background-color:#fff; }", css.cssRules.length);
clear(element);
- sizer = document.createElement("div");
+ sizer = doc.createElementNS(element.namespaceURI, "div");
sizer.style.display = "inline-block";
sizer.style.background = "white";
sizer.appendChild(odfnode);
element.appendChild(sizer);
+ modifyTables(container, odfnode.body, css);
+ modifyLinks(container, odfnode.body, css);
loadImages(container, odfnode.body, css);
loadVideos(container, odfnode.body, css);
+ loadLists(container, odfnode.body, css);
fixContainerSize()
}
- function refreshOdf(container) {
- if(odfcontainer !== container) {
- return
- }
+ function refreshOdf() {
function callback() {
clear(element);
element.style.display = "inline-block";
- var odfnode = container.rootElement;
+ var odfnode = odfcontainer.rootElement;
element.ownerDocument.importNode(odfnode, true);
- formatting.setOdfContainer(container);
+ formatting.setOdfContainer(odfcontainer);
handleStyles(odfnode, stylesxmlcss);
- handleContent(container, odfnode);
- fireEvent("statereadychange")
+ handleContent(odfcontainer, odfnode);
+ fireEvent("statereadychange", [odfcontainer])
}
if(odfcontainer.state === odf.OdfContainer.DONE) {
callback()
}else {
- odfcontainer.onchange = callback
+ runtime.log("WARNING: refreshOdf called but ODF was not DONE.");
+ runtime.setTimeout(function later_cb() {
+ if(odfcontainer.state === odf.OdfContainer.DONE) {
+ callback()
+ }else {
+ runtime.log("will be back later...");
+ runtime.setTimeout(later_cb, 500)
+ }
+ }, 100)
}
}
+ this.refreshCSS = function() {
+ handleStyles(odfcontainer.rootElement, stylesxmlcss)
+ };
this.odfContainer = function() {
return odfcontainer
};
this.slidevisibilitycss = function() {
return pageSwitcher.css
};
+ this.setOdfContainer = function(container) {
+ odfcontainer = container;
+ refreshOdf()
+ };
this["load"] = this.load = function(url) {
loadingQueue.clearQueue();
element.innerHTML = "loading " + url;
+ element.removeAttribute("style");
odfcontainer = new odf.OdfContainer(url, function(container) {
odfcontainer = container;
- refreshOdf(container)
- });
- odfcontainer.onstatereadychange = refreshOdf
+ refreshOdf()
+ })
};
function stopEditing() {
if(!editparagraph) {
@@ -6535,7 +7393,7 @@ odf.OdfCanvas = function() {
};
function processClick(evt) {
evt = evt || window.event;
- var e = evt.target, selection = window.getSelection(), range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null, startContainer = range && range.startContainer, startOffset = range && range.startOffset, endContainer = range && range.endContainer, endOffset = range && range.endOffset;
+ var e = evt.target, selection = window.getSelection(), range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null, startContainer = range && range.startContainer, startOffset = range && range.startOffset, endContainer = range && range.endContainer, endOffset = range && range.endOffset, doc, ns;
while(e && !((e.localName === "p" || e.localName === "h") && e.namespaceURI === textns)) {
e = e.parentNode
}
@@ -6545,11 +7403,10 @@ odf.OdfCanvas = function() {
if(!e || e.parentNode === editparagraph) {
return
}
+ doc = e.ownerDocument;
+ ns = doc.documentElement.namespaceURI;
if(!editparagraph) {
- editparagraph = e.ownerDocument.createElement("p");
- if(!editparagraph.style) {
- editparagraph = e.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml", "p")
- }
+ editparagraph = doc.createElementNS(ns, "p");
editparagraph.style.margin = "0px";
editparagraph.style.padding = "0px";
editparagraph.style.border = "0px";
@@ -6572,10 +7429,16 @@ odf.OdfCanvas = function() {
cancelEvent(evt)
}
this.addListener = function(eventName, handler) {
- if(eventName === "selectionchange") {
- selectionWatcher.addListener(eventName, handler)
- }else {
- addEventListener(eventName, handler)
+ switch(eventName) {
+ case "selectionchange":
+ selectionWatcher.addListener(eventName, handler);
+ break;
+ case "click":
+ listenEvent(element, eventName, handler);
+ break;
+ default:
+ addEventListener(eventName, handler);
+ break
}
};
this.getFormatting = function() {
@@ -6601,23 +7464,1765 @@ odf.OdfCanvas = function() {
zoomLevel = width / realWidth;
fixContainerSize()
};
+ this.fitSmart = function(width, height) {
+ var realWidth, realHeight, newScale;
+ realWidth = element.offsetWidth / zoomLevel;
+ realHeight = element.offsetHeight / zoomLevel;
+ newScale = width / realWidth;
+ if(height !== undefined) {
+ if(height / realHeight < newScale) {
+ newScale = height / realHeight
+ }
+ }
+ zoomLevel = Math.min(1, newScale);
+ fixContainerSize()
+ };
this.fitToHeight = function(height) {
var realHeight = element.offsetHeight / zoomLevel;
zoomLevel = height / realHeight;
fixContainerSize()
};
+ this.showFirstPage = function() {
+ pageSwitcher.showFirstPage()
+ };
this.showNextPage = function() {
pageSwitcher.showNextPage()
};
this.showPreviousPage = function() {
pageSwitcher.showPreviousPage()
};
+ this.showPage = function(n) {
+ pageSwitcher.showPage(n)
+ };
this.showAllPages = function() {
};
- listenEvent(element, "click", processClick)
+ this.getElement = function() {
+ return element
+ }
};
return odf.OdfCanvas
}();
+runtime.loadClass("odf.OdfCanvas");
+odf.CommandLineTools = function CommandLineTools() {
+ this.roundTrip = function(inputfilepath, outputfilepath, callback) {
+ function onready(odfcontainer) {
+ if(odfcontainer.state === odf.OdfContainer.INVALID) {
+ return callback("Document " + inputfilepath + " is invalid.")
+ }
+ if(odfcontainer.state === odf.OdfContainer.DONE) {
+ odfcontainer.saveAs(outputfilepath, function(err) {
+ callback(err)
+ })
+ }else {
+ callback("Document was not completely loaded.")
+ }
+ }
+ var odfcontainer = new odf.OdfContainer(inputfilepath, onready)
+ };
+ this.render = function(inputfilepath, document, callback) {
+ var body = document.getElementsByTagName("body")[0], odfcanvas;
+ while(body.firstChild) {
+ body.removeChild(body.firstChild)
+ }
+ odfcanvas = new odf.OdfCanvas(body);
+ odfcanvas.addListener("statereadychange", function(err) {
+ callback(err)
+ });
+ odfcanvas.load(inputfilepath)
+ }
+};
+ops.Operation = function Operation(session) {
+};
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.OpAddCursor = function OpAddCursor(session) {
+ var memberid, timestamp;
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp
+ };
+ this.execute = function(rootNode) {
+ var odtDocument = session.getOdtDocument(), cursor = new ops.OdtCursor(memberid, odtDocument);
+ odtDocument.addCursor(cursor);
+ session.emit(ops.Session.signalCursorAdded, cursor)
+ };
+ this.spec = function() {
+ return{optype:"AddCursor", memberid:memberid, timestamp:timestamp}
+ }
+};
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.OpRemoveCursor = function OpRemoveCursor(session) {
+ var memberid, timestamp, cursorns = "urn:webodf:names:cursor";
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp
+ };
+ this.execute = function(domroot) {
+ session.getOdtDocument().removeCursor(memberid);
+ session.emit(ops.Session.signalCursorRemoved, memberid)
+ };
+ this.spec = function() {
+ return{optype:"RemoveCursor", memberid:memberid, timestamp:timestamp}
+ }
+};
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.OpMoveCursor = function OpMoveCursor(session) {
+ var memberid, timestamp, number;
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp;
+ number = data.number
+ };
+ this.execute = function(domroot) {
+ var odtDocument = session.getOdtDocument(), cursor = odtDocument.getCursor(memberid), positionFilter = odtDocument.getPositionFilter(), stepCounter, steps;
+ runtime.assert(cursor !== undefined, "cursor for [" + memberid + "] not found (MoveCursor).");
+ stepCounter = cursor.getStepCounter();
+ if(number > 0) {
+ steps = stepCounter.countForwardSteps(number, positionFilter)
+ }else {
+ if(number < 0) {
+ steps = -stepCounter.countBackwardSteps(-number, positionFilter)
+ }else {
+ return
+ }
+ }
+ cursor.move(steps);
+ session.emit(ops.Session.signalCursorMoved, cursor)
+ };
+ this.spec = function() {
+ return{optype:"MoveCursor", memberid:memberid, timestamp:timestamp, number:number}
+ }
+};
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.OpInsertText = function OpInsertText(session) {
+ var memberid, timestamp, position, text;
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp;
+ position = data.position;
+ text = data.text
+ };
+ this.execute = function(domroot) {
+ session.getOdtDocument().insertText(memberid, timestamp, position, text)
+ };
+ this.spec = function() {
+ return{optype:"InsertText", memberid:memberid, timestamp:timestamp, position:position, text:text}
+ }
+};
+ops.OpRemoveText = function OpRemoveText(session) {
+ var memberid, timestamp, position, length, text;
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp;
+ position = data.position;
+ length = data.length;
+ text = data.text
+ };
+ this.execute = function(domroot) {
+ session.getOdtDocument().removeText(memberid, timestamp, position, length)
+ };
+ this.spec = function() {
+ return{optype:"RemoveText", memberid:memberid, timestamp:timestamp, position:position, length:length, text:text}
+ }
+};
+ops.OpSplitParagraph = function OpSplitParagraph(session) {
+ var memberid, timestamp, position;
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp;
+ position = data.position
+ };
+ this.execute = function(rootNode) {
+ var odtDocument = session.getOdtDocument(), domPosition, paragraphNode, textNodeCopy, node, splitNode, splitChildNode, keptChildNode;
+ domPosition = odtDocument.getPositionInTextNode(position);
+ if(domPosition) {
+ paragraphNode = odtDocument.getParagraphElement(domPosition.textNode);
+ if(paragraphNode) {
+ if(domPosition.offset === 0) {
+ keptChildNode = domPosition.textNode.previousSibling;
+ splitChildNode = null
+ }else {
+ if(domPosition.textNode.nextSibling && domPosition.textNode.nextSibling.namespaceURI === "urn:webodf:names:cursor" && domPosition.textNode.nextSibling.localName === "cursor") {
+ textNodeCopy = domPosition.textNode.cloneNode(false);
+ domPosition.textNode.parentNode.insertBefore(textNodeCopy, domPosition.textNode);
+ domPosition.textNode.parentNode.removeChild(domPosition.textNode);
+ domPosition.textNode = "";
+ domPosition.textNode = textNodeCopy
+ }
+ keptChildNode = domPosition.textNode;
+ if(domPosition.offset >= domPosition.textNode.length) {
+ splitChildNode = null
+ }else {
+ splitChildNode = domPosition.textNode.splitText(domPosition.offset)
+ }
+ }
+ node = domPosition.textNode;
+ while(node !== paragraphNode) {
+ node = node.parentNode;
+ splitNode = node.cloneNode(false);
+ if(!keptChildNode) {
+ node.parentNode.insertBefore(splitNode, node);
+ keptChildNode = splitNode;
+ splitChildNode = node
+ }else {
+ if(splitChildNode) {
+ splitNode.appendChild(splitChildNode)
+ }
+ while(keptChildNode.nextSibling) {
+ splitNode.appendChild(keptChildNode.nextSibling)
+ }
+ node.parentNode.insertBefore(splitNode, node.nextSibling);
+ keptChildNode = node;
+ splitChildNode = splitNode
+ }
+ }
+ odtDocument.emit("paragraphEdited", {element:paragraphNode, memberId:memberid, timeStamp:timestamp});
+ odtDocument.emit("paragraphEdited", {element:splitChildNode, memberId:memberid, timeStamp:timestamp})
+ }
+ }
+ };
+ this.spec = function() {
+ return{optype:"SplitParagraph", memberid:memberid, timestamp:timestamp, position:position}
+ }
+};
+ops.OpSetParagraphStyle = function OpSetParagraphStyle(session) {
+ var memberid, timestamp, position, styleNameBefore, styleNameAfter;
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp;
+ position = data.position;
+ styleNameBefore = data.styleNameBefore;
+ styleNameAfter = data.styleNameAfter
+ };
+ this.execute = function(domroot) {
+ var domPosition, paragraphNode, odtDocument = session.getOdtDocument();
+ odtDocument.setParagraphStyle(memberid, timestamp, position, styleNameBefore, styleNameAfter);
+ domPosition = odtDocument.getPositionInTextNode(position);
+ if(domPosition) {
+ paragraphNode = odtDocument.getParagraphElement(domPosition.textNode);
+ session.emit(ops.Session.signalParagraphChanged, paragraphNode)
+ }
+ };
+ this.spec = function() {
+ return{optype:"SetParagraphStyle", memberid:memberid, timestamp:timestamp, position:position, styleNameBefore:styleNameBefore, styleNameAfter:styleNameAfter}
+ }
+};
+ops.OpUpdateParagraphStyle = function OpUpdateParagraphStyle(session) {
+ var memberid, timestamp, position, styleName, info;
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp;
+ position = data.position;
+ styleName = data.styleName;
+ info = data.info
+ };
+ this.execute = function(domroot) {
+ var odtDocument = session.getOdtDocument();
+ odtDocument.updateParagraphStyle(styleName, info);
+ session.emit(ops.Session.signalParagraphStyleModified, styleName)
+ };
+ this.spec = function() {
+ return{optype:"UpdateParagraphStyle", memberid:memberid, timestamp:timestamp, position:position, styleName:styleName, info:info}
+ }
+};
+ops.OpCloneStyle = function OpCloneStyle(session) {
+ var memberid, timestamp, styleName, newStyleName, newStyleDisplayName, stylens = "urn:oasis:names:tc:opendocument:xmlns:style:1.0";
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp;
+ styleName = data.styleName;
+ newStyleName = data.newStyleName;
+ newStyleDisplayName = data.newStyleDisplayName
+ };
+ this.execute = function(domroot) {
+ var odtDocument = session.getOdtDocument(), styleNode = odtDocument.getParagraphStyleElement(styleName), newStyleNode = styleNode.cloneNode(true);
+ newStyleNode.setAttributeNS(stylens, "style:name", newStyleName);
+ newStyleNode.setAttributeNS(stylens, "style:display-name", newStyleDisplayName);
+ styleNode.parentNode.appendChild(newStyleNode);
+ odtDocument.getOdfCanvas().refreshCSS();
+ session.emit(ops.Session.signalStyleCreated, newStyleName)
+ };
+ this.spec = function() {
+ return{optype:"CloneStyle", memberid:memberid, timestamp:timestamp, styleName:styleName, newStyleName:newStyleName, newStyleDisplayName:newStyleDisplayName}
+ }
+};
+ops.OpDeleteStyle = function OpDeleteStyle(session) {
+ var memberid, timestamp, styleName;
+ this.init = function(data) {
+ memberid = data.memberid;
+ timestamp = data.timestamp;
+ styleName = data.styleName
+ };
+ this.execute = function(domroot) {
+ var odtDocument = session.getOdtDocument();
+ odtDocument.deleteStyle(styleName);
+ session.emit(ops.Session.signalStyleDeleted, styleName)
+ };
+ this.spec = function() {
+ return{optype:"DeleteStyle", memberid:memberid, timestamp:timestamp, styleName:styleName}
+ }
+};
+runtime.loadClass("ops.OpAddCursor");
+runtime.loadClass("ops.OpRemoveCursor");
+runtime.loadClass("ops.OpMoveCursor");
+runtime.loadClass("ops.OpInsertText");
+runtime.loadClass("ops.OpRemoveText");
+runtime.loadClass("ops.OpSplitParagraph");
+runtime.loadClass("ops.OpSetParagraphStyle");
+runtime.loadClass("ops.OpUpdateParagraphStyle");
+runtime.loadClass("ops.OpCloneStyle");
+runtime.loadClass("ops.OpDeleteStyle");
+ops.OperationFactory = function OperationFactory(session) {
+ var self = this;
+ this.create = function(spec) {
+ var op = null;
+ if(spec.optype === "AddCursor") {
+ op = new ops.OpAddCursor(session)
+ }else {
+ if(spec.optype === "InsertText") {
+ op = new ops.OpInsertText(session)
+ }else {
+ if(spec.optype === "RemoveText") {
+ op = new ops.OpRemoveText(session)
+ }else {
+ if(spec.optype === "SplitParagraph") {
+ op = new ops.OpSplitParagraph(session)
+ }else {
+ if(spec.optype === "SetParagraphStyle") {
+ op = new ops.OpSetParagraphStyle(session)
+ }else {
+ if(spec.optype === "UpdateParagraphStyle") {
+ op = new ops.OpUpdateParagraphStyle(session)
+ }else {
+ if(spec.optype === "CloneStyle") {
+ op = new ops.OpCloneStyle(session)
+ }else {
+ if(spec.optype === "DeleteStyle") {
+ op = new ops.OpDeleteStyle(session)
+ }else {
+ if(spec.optype === "MoveCursor") {
+ op = new ops.OpMoveCursor(session)
+ }else {
+ if(spec.optype === "RemoveCursor") {
+ op = new ops.OpRemoveCursor(session)
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if(op) {
+ op.init(spec)
+ }
+ return op
+ }
+};
+runtime.loadClass("core.Cursor");
+ops.OdtCursor = function OdtCursor(memberId, odtDocument) {
+ var self = this, selectionMover, cursor;
+ this.removeFromOdtDocument = function() {
+ cursor.remove(function(nodeAfterCursor, textNodeIncrease) {
+ })
+ };
+ this.move = function(number) {
+ var moved = 0;
+ if(number > 0) {
+ moved = selectionMover.movePointForward(number)
+ }else {
+ if(number <= 0) {
+ moved = -selectionMover.movePointBackward(-number)
+ }
+ }
+ self.handleUpdate();
+ return moved
+ };
+ this.handleUpdate = function() {
+ };
+ this.getStepCounter = function() {
+ return selectionMover.getStepCounter()
+ };
+ this.getMemberId = function() {
+ return memberId
+ };
+ this.getNode = function() {
+ return cursor.getNode()
+ };
+ this.getSelection = function() {
+ return cursor.getSelection()
+ };
+ this.getOdtDocument = function() {
+ return odtDocument
+ };
+ function init() {
+ var distanceToFirstTextNode, selection;
+ selection = new core.Selection(odtDocument.getDOM());
+ cursor = new core.Cursor(selection, odtDocument.getDOM());
+ cursor.getNode().setAttributeNS("urn:webodf:names:cursor", "memberId", memberId);
+ selectionMover = odtDocument.getSelectionManager().createSelectionMover(cursor)
+ }
+ init()
+};
+runtime.loadClass("core.Cursor");
+runtime.loadClass("core.PositionIterator");
+runtime.loadClass("core.PositionFilter");
+runtime.loadClass("core.LoopWatchDog");
+gui.SelectionMover = function SelectionMover(cursor, rootNode, onCursorAdd, onCursorRemove) {
+ var self = this, selection = cursor.getSelection(), positionIterator;
+ function doMove(steps, extend, move) {
+ var left = steps;
+ onCursorRemove = onCursorRemove || self.adaptToCursorRemoval;
+ onCursorAdd = onCursorAdd || self.adaptToInsertedCursor;
+ cursor.remove(onCursorRemove);
+ while(left > 0 && move()) {
+ left -= 1
+ }
+ if(steps - left > 0) {
+ selection.collapse(positionIterator.container(), positionIterator.unfilteredDomOffset())
+ }
+ cursor.updateToSelection(onCursorRemove, onCursorAdd);
+ return steps - left
+ }
+ this.movePointForward = function(steps, extend) {
+ return doMove(steps, extend, positionIterator.nextPosition)
+ };
+ this.movePointBackward = function(steps, extend) {
+ return doMove(steps, extend, positionIterator.previousPosition)
+ };
+ function countForwardSteps(steps, filter) {
+ var c = positionIterator.container(), o = positionIterator.offset(), watch = new core.LoopWatchDog(1E3), stepCount = 0, count = 0;
+ while(steps > 0 && positionIterator.nextPosition()) {
+ stepCount += 1;
+ watch.check();
+ if(filter.acceptPosition(positionIterator) === 1) {
+ count += stepCount;
+ stepCount = 0;
+ steps -= 1
+ }
+ }
+ positionIterator.setPosition(c, o);
+ return count
+ }
+ function countBackwardSteps(steps, filter) {
+ var c = positionIterator.container(), o = positionIterator.offset(), watch = new core.LoopWatchDog(1E3), stepCount = 0, count = 0;
+ while(steps > 0 && positionIterator.previousPosition()) {
+ stepCount += 1;
+ watch.check();
+ if(filter.acceptPosition(positionIterator) === 1) {
+ count += stepCount;
+ stepCount = 0;
+ steps -= 1
+ }
+ }
+ positionIterator.setPosition(c, o);
+ return count
+ }
+ function getOffset(el) {
+ var x = 0, y = 0;
+ while(el && el.nodeType === 1) {
+ x += el.offsetLeft - el.scrollLeft;
+ y += el.offsetTop - el.scrollTop;
+ el = el.parentNode
+ }
+ return{top:y, left:x}
+ }
+ function countLineUpSteps(range, filter) {
+ var c = positionIterator.container(), o = positionIterator.offset(), stepCount = 0, count = 0, bestc = null, besto, bestXDiff, bestCount = 0, rect, top, left, newTop, xDiff;
+ range.setStart(c, o);
+ rect = range.getClientRects()[0];
+ newTop = top = rect.top;
+ left = rect.left;
+ while(positionIterator.previousPosition()) {
+ stepCount += 1;
+ if(filter.acceptPosition(positionIterator) === 1) {
+ count += stepCount;
+ stepCount = 0;
+ c = positionIterator.container();
+ o = positionIterator.offset();
+ range.setStart(c, o);
+ rect = range.getClientRects()[0];
+ if(rect.top !== top) {
+ if(rect.top !== newTop) {
+ break
+ }
+ newTop = top;
+ xDiff = Math.abs(left - rect.left);
+ if(bestc === null || xDiff < bestXDiff) {
+ bestc = c;
+ besto = o;
+ bestXDiff = xDiff;
+ bestCount = count
+ }
+ }
+ }
+ }
+ if(bestc !== null) {
+ positionIterator.setPosition(bestc, besto);
+ count = bestCount
+ }else {
+ count = 0
+ }
+ return count
+ }
+ function countLinesUpSteps(lines, filter) {
+ var c = positionIterator.container(), o = positionIterator.offset(), stepCount, count = 0, range = c.ownerDocument.createRange();
+ while(lines > 0) {
+ stepCount += countLineUpSteps(range, filter);
+ if(stepCount === 0) {
+ break
+ }
+ count += stepCount;
+ lines -= 1
+ }
+ range.detach();
+ positionIterator.setPosition(c, o);
+ return count
+ }
+ function countLineDownSteps(lines, filter) {
+ var c = positionIterator.container(), o = positionIterator.offset(), span = cursor.getNode().firstChild, watch = new core.LoopWatchDog(1E3), stepCount = 0, count = 0, offset = span.offsetTop, i;
+ onCursorRemove = onCursorRemove || self.adaptToCursorRemoval;
+ onCursorAdd = onCursorAdd || self.adaptToInsertedCursor;
+ while(lines > 0 && positionIterator.nextPosition()) {
+ watch.check();
+ stepCount += 1;
+ if(filter.acceptPosition(positionIterator) === 1) {
+ offset = span.offsetTop;
+ selection.collapse(positionIterator.container(), positionIterator.offset());
+ cursor.updateToSelection(onCursorRemove, onCursorAdd);
+ offset = span.offsetTop;
+ if(offset !== span.offsetTop) {
+ count += stepCount;
+ stepCount = 0;
+ lines -= 1
+ }
+ }
+ }
+ positionIterator.setPosition(c, o);
+ selection.collapse(positionIterator.container(), positionIterator.offset());
+ cursor.updateToSelection(onCursorRemove, onCursorAdd);
+ return count
+ }
+ function getPositionInContainingNode(node, container) {
+ var offset = 0, n;
+ while(node.parentNode !== container) {
+ runtime.assert(node.parentNode !== null, "parent is null");
+ node = node.parentNode
+ }
+ n = container.firstChild;
+ while(n !== node) {
+ offset += 1;
+ n = n.nextSibling
+ }
+ return offset
+ }
+ function comparePoints(c1, o1, c2, o2) {
+ if(c1 === c2) {
+ return o2 - o1
+ }
+ var comparison = c1.compareDocumentPosition(c2);
+ if(comparison === 2) {
+ comparison = -1
+ }else {
+ if(comparison === 4) {
+ comparison = 1
+ }else {
+ if(comparison === 10) {
+ o1 = getPositionInContainingNode(c1, c2);
+ comparison = o1 < o2 ? 1 : -1
+ }else {
+ o2 = getPositionInContainingNode(c2, c1);
+ comparison = o2 < o1 ? -1 : 1
+ }
+ }
+ }
+ return comparison
+ }
+ function countStepsToPosition(element, offset, filter) {
+ runtime.assert(element !== null, "SelectionMover.countStepsToPosition called with element===null");
+ var c = positionIterator.container(), o = positionIterator.offset(), steps = 0, watch = new core.LoopWatchDog(1E3), comparison;
+ positionIterator.setPosition(element, offset);
+ element = positionIterator.container();
+ runtime.assert(element !== null, "SelectionMover.countStepsToPosition: positionIterator.container() returned null");
+ offset = positionIterator.offset();
+ positionIterator.setPosition(c, o);
+ comparison = comparePoints(element, offset, c, o);
+ if(comparison < 0) {
+ while(positionIterator.nextPosition()) {
+ watch.check();
+ if(filter.acceptPosition(positionIterator) === 1) {
+ steps += 1
+ }
+ if(positionIterator.container() === element) {
+ if(positionIterator.offset() === offset) {
+ positionIterator.setPosition(c, o);
+ return steps
+ }
+ }
+ }
+ positionIterator.setPosition(c, o)
+ }else {
+ if(comparison > 0) {
+ while(positionIterator.previousPosition()) {
+ watch.check();
+ if(filter.acceptPosition(positionIterator) === 1) {
+ steps -= 1
+ }
+ if(positionIterator.container() === element) {
+ if(positionIterator.offset() === offset) {
+ positionIterator.setPosition(c, o);
+ return steps
+ }
+ }
+ }
+ positionIterator.setPosition(c, o)
+ }
+ }
+ return steps
+ }
+ this.getStepCounter = function() {
+ return{countForwardSteps:countForwardSteps, countBackwardSteps:countBackwardSteps, countLineDownSteps:countLineDownSteps, countLinesUpSteps:countLinesUpSteps, countStepsToPosition:countStepsToPosition}
+ };
+ this.adaptToCursorRemoval = function(nodeAfterCursor, textNodeIncrease) {
+ if(textNodeIncrease === 0 || nodeAfterCursor === null || nodeAfterCursor.nodeType !== 3) {
+ return
+ }
+ var c = positionIterator.container();
+ if(c === nodeAfterCursor) {
+ positionIterator.setPosition(c, positionIterator.offset() + textNodeIncrease)
+ }
+ };
+ this.adaptToInsertedCursor = function(nodeAfterCursor, textNodeDecrease) {
+ if(textNodeDecrease === 0 || nodeAfterCursor === null || nodeAfterCursor.nodeType !== 3) {
+ return
+ }
+ var c = positionIterator.container(), oldOffset = positionIterator.offset();
+ if(c === nodeAfterCursor) {
+ if(oldOffset < textNodeDecrease) {
+ do {
+ c = c.previousSibling
+ }while(c && c.nodeType !== 3);
+ if(c) {
+ positionIterator.setPosition(c, oldOffset)
+ }
+ }else {
+ positionIterator.setPosition(c, positionIterator.offset() - textNodeDecrease)
+ }
+ }
+ };
+ function init() {
+ positionIterator = gui.SelectionMover.createPositionIterator(rootNode);
+ selection.collapse(positionIterator.container(), positionIterator.offset());
+ onCursorRemove = onCursorRemove || self.adaptToCursorRemoval;
+ onCursorAdd = onCursorAdd || self.adaptToInsertedCursor;
+ cursor.updateToSelection(onCursorRemove, onCursorAdd)
+ }
+ init()
+};
+gui.SelectionMover.createPositionIterator = function(rootNode) {
+ function CursorFilter() {
+ this.acceptNode = function(node) {
+ if(node.namespaceURI === "urn:webodf:names:cursor" || node.namespaceURI === "urn:webodf:names:editinfo") {
+ return 2
+ }
+ return 1
+ }
+ }
+ var filter = new CursorFilter;
+ return new core.PositionIterator(rootNode, 5, filter, false)
+};
+(function() {
+ return gui.SelectionMover
+})();
+gui.Avatar = function Avatar(parentElement) {
+ var handle, image, displayShown = "block", displayHidden = "none";
+ this.setColor = function(color) {
+ image.style.borderColor = color
+ };
+ this.setImageUrl = function(url) {
+ image.src = url
+ };
+ this.isVisible = function() {
+ return handle.style.display === displayShown
+ };
+ this.show = function() {
+ handle.style.display = displayShown
+ };
+ this.hide = function() {
+ handle.style.display = displayHidden
+ };
+ this.markAsFocussed = function(isFocussed) {
+ handle.className = isFocussed ? "active" : ""
+ };
+ function init() {
+ var document = parentElement.ownerDocument, htmlns = document.documentElement.namespaceURI;
+ handle = document.createElementNS(htmlns, "div");
+ image = document.createElementNS(htmlns, "img");
+ image.width = 64;
+ image.height = 64;
+ handle.appendChild(image);
+ handle.style.width = "64px";
+ handle.style.height = "70px";
+ handle.style.position = "absolute";
+ handle.style.top = "-80px";
+ handle.style.left = "-34px";
+ handle.style.display = displayShown;
+ parentElement.appendChild(handle)
+ }
+ init()
+};
+runtime.loadClass("gui.Avatar");
+runtime.loadClass("ops.OdtCursor");
+gui.Caret = function Caret(cursor) {
+ function clearNode(node) {
+ while(node.firstChild !== null) {
+ node.removeNode(node.firstChild)
+ }
+ }
+ var self = this, span, avatar, cursorNode, focussed = false, blinking = false, color = "";
+ function blink() {
+ if(!focussed || !cursorNode.parentNode) {
+ return
+ }
+ if(!blinking) {
+ blinking = true;
+ span.style.borderColor = span.style.borderColor === "transparent" ? color : "transparent";
+ runtime.setTimeout(function() {
+ blinking = false;
+ blink()
+ }, 500)
+ }
+ }
+ function pixelCount(size) {
+ var match;
+ if(typeof size === "string") {
+ if(size === "") {
+ return 0
+ }
+ match = /^(\d+)(\.\d+)?px$/.exec(size);
+ runtime.assert(match !== null, "size [" + size + "] does not have unit px.");
+ return parseFloat(match[1])
+ }
+ return size
+ }
+ function getOffsetBaseElement(element) {
+ var anchorElement = element, nodeStyle, window = runtime.getWindow();
+ runtime.assert(window !== null, "Expected to be run in an environment which has a global window, like a browser.");
+ do {
+ anchorElement = anchorElement.parentElement;
+ if(!anchorElement) {
+ break
+ }
+ nodeStyle = window.getComputedStyle(anchorElement, null)
+ }while(nodeStyle.display !== "block");
+ return anchorElement
+ }
+ function getRelativeOffsetTopLeftBySpacing(element, containerElement) {
+ var x = 0, y = 0, elementStyle, window = runtime.getWindow();
+ runtime.assert(window !== null, "Expected to be run in an environment which has a global window, like a browser.");
+ while(element && element !== containerElement) {
+ elementStyle = window.getComputedStyle(element, null);
+ x += pixelCount(elementStyle.marginLeft) + pixelCount(elementStyle.borderLeftWidth) + pixelCount(elementStyle.paddingLeft);
+ y += pixelCount(elementStyle.marginTop) + pixelCount(elementStyle.borderTopWidth) + pixelCount(elementStyle.paddingTop);
+ element = element.parentElement
+ }
+ return{x:x, y:y}
+ }
+ function getRelativeOffsetTopLeft(element, containerElement) {
+ var reachedContainerElement, offsetParent, e, x = 0, y = 0, resultBySpacing;
+ if(!element || !containerElement) {
+ return{x:0, y:0}
+ }
+ reachedContainerElement = false;
+ do {
+ offsetParent = element.offsetParent;
+ e = element.parentNode;
+ while(e !== offsetParent) {
+ if(e === containerElement) {
+ resultBySpacing = getRelativeOffsetTopLeftBySpacing(element, containerElement);
+ x += resultBySpacing.x;
+ y += resultBySpacing.y;
+ reachedContainerElement = true;
+ break
+ }
+ e = e.parentNode
+ }
+ if(reachedContainerElement) {
+ break
+ }
+ x += pixelCount(element.offsetLeft);
+ y += pixelCount(element.offsetTop);
+ element = offsetParent
+ }while(element && element !== containerElement);
+ return{x:x, y:y}
+ }
+ function getRelativeCaretOffsetRect(caretElement, containerElement, margin) {
+ var caretOffsetTopLeft, offsetBaseNode;
+ offsetBaseNode = getOffsetBaseElement(caretElement);
+ caretOffsetTopLeft = getRelativeOffsetTopLeft(offsetBaseNode, containerElement);
+ caretOffsetTopLeft.x += caretElement.offsetLeft;
+ caretOffsetTopLeft.y += caretElement.offsetTop;
+ return{left:caretOffsetTopLeft.x - margin, top:caretOffsetTopLeft.y - margin, right:caretOffsetTopLeft.x + caretElement.scrollWidth - 1 + margin, bottom:caretOffsetTopLeft.y + caretElement.scrollHeight - 1 + margin}
+ }
+ this.setFocus = function() {
+ focussed = true;
+ avatar.markAsFocussed(true);
+ blink()
+ };
+ this.removeFocus = function() {
+ focussed = false;
+ avatar.markAsFocussed(false);
+ span.style.borderColor = color
+ };
+ this.setAvatarImageUrl = function(url) {
+ avatar.setImageUrl(url)
+ };
+ this.setColor = function(newColor) {
+ if(color === newColor) {
+ return
+ }
+ color = newColor;
+ if(span.style.borderColor !== "transparent") {
+ span.style.borderColor = color
+ }
+ avatar.setColor(color)
+ };
+ this.getCursor = function() {
+ return cursor
+ };
+ this.getFocusElement = function() {
+ return span
+ };
+ this.toggleHandleVisibility = function() {
+ if(avatar.isVisible()) {
+ avatar.hide()
+ }else {
+ avatar.show()
+ }
+ };
+ this.showHandle = function() {
+ avatar.show()
+ };
+ this.hideHandle = function() {
+ avatar.hide()
+ };
+ this.ensureVisible = function() {
+ var canvasElement = cursor.getOdtDocument().getOdfCanvas().getElement(), canvasContainerElement = canvasElement.parentNode, caretOffsetRect, caretMargin = 5;
+ caretOffsetRect = getRelativeCaretOffsetRect(span, canvasContainerElement, caretMargin);
+ if(caretOffsetRect.top < canvasContainerElement.scrollTop) {
+ canvasContainerElement.scrollTop = caretOffsetRect.top
+ }else {
+ if(caretOffsetRect.bottom > canvasContainerElement.scrollTop + canvasContainerElement.clientHeight - 1) {
+ canvasContainerElement.scrollTop = caretOffsetRect.bottom - canvasContainerElement.clientHeight + 1
+ }
+ }
+ if(caretOffsetRect.left < canvasContainerElement.scrollLeft) {
+ canvasContainerElement.scrollLeft = caretOffsetRect.left
+ }else {
+ if(caretOffsetRect.right > canvasContainerElement.scrollLeft + canvasContainerElement.clientWidth - 1) {
+ canvasContainerElement.scrollLeft = caretOffsetRect.right - canvasContainerElement.clientWidth + 1
+ }
+ }
+ };
+ function init() {
+ var dom = cursor.getOdtDocument().getDOM(), htmlns = dom.documentElement.namespaceURI;
+ span = dom.createElementNS(htmlns, "span");
+ cursorNode = cursor.getNode();
+ cursorNode.appendChild(span);
+ avatar = new gui.Avatar(cursorNode)
+ }
+ init()
+};
+runtime.loadClass("ops.OpAddCursor");
+runtime.loadClass("ops.OpRemoveCursor");
+runtime.loadClass("ops.OpMoveCursor");
+runtime.loadClass("ops.OpInsertText");
+runtime.loadClass("ops.OpRemoveText");
+runtime.loadClass("ops.OpSplitParagraph");
+runtime.loadClass("ops.OpSetParagraphStyle");
+gui.SessionController = function() {
+ gui.SessionController = function SessionController(session, inputMemberId) {
+ var self = this, namespaces = (new odf.Style2CSS).namespaces;
+ function listenEvent(eventTarget, eventType, eventHandler) {
+ if(eventTarget.addEventListener) {
+ eventTarget.addEventListener(eventType, eventHandler, false)
+ }else {
+ if(eventTarget.attachEvent) {
+ eventType = "on" + eventType;
+ eventTarget.attachEvent(eventType, eventHandler)
+ }else {
+ eventTarget["on" + eventType] = eventHandler
+ }
+ }
+ }
+ function cancelEvent(event) {
+ if(event.preventDefault) {
+ event.preventDefault()
+ }else {
+ event.returnValue = false
+ }
+ }
+ function dummyHandler(e) {
+ cancelEvent(e)
+ }
+ function handleMouseClick(e) {
+ var selection = runtime.getWindow().getSelection(), steps, op, node, odtDocument = session.getOdtDocument(), canvasElement = odtDocument.getOdfCanvas().getElement();
+ node = selection.focusNode;
+ while(node !== canvasElement) {
+ if(node.namespaceURI === "urn:webodf:names:cursor" && node.localName === "cursor") {
+ return
+ }
+ node = node.parentNode
+ }
+ steps = odtDocument.getDistanceFromCursor(inputMemberId, selection.focusNode, selection.focusOffset);
+ if(steps !== 0) {
+ op = new ops.OpMoveCursor(session);
+ op.init({memberid:inputMemberId, number:steps});
+ session.enqueue(op)
+ }
+ }
+ function createOpMoveCursor(number) {
+ var op = new ops.OpMoveCursor(session);
+ op.init({memberid:inputMemberId, number:number});
+ return op
+ }
+ function createOpMoveCursorByHomeKey() {
+ var odtDocument = session.getOdtDocument(), steps, paragraphNode, op = null;
+ paragraphNode = odtDocument.getParagraphElement(odtDocument.getCursor(inputMemberId).getNode());
+ steps = odtDocument.getDistanceFromCursor(inputMemberId, paragraphNode, 0);
+ if(steps !== 0) {
+ op = new ops.OpMoveCursor(session);
+ op.init({memberid:inputMemberId, number:steps})
+ }
+ return op
+ }
+ function createOpRemoveTextByBackspaceKey() {
+ var odtDocument = session.getOdtDocument(), position = odtDocument.getCursorPosition(inputMemberId), domPosition = odtDocument.getPositionInTextNode(position - 1), op = null;
+ if(domPosition) {
+ op = new ops.OpRemoveText(session);
+ op.init({memberid:inputMemberId, position:position, length:-1})
+ }
+ return op
+ }
+ function createOpRemoveTextByDeleteKey() {
+ var odtDocument = session.getOdtDocument(), position = odtDocument.getCursorPosition(inputMemberId), domPosition = odtDocument.getPositionInTextNode(position + 1), op = null;
+ if(domPosition) {
+ op = new ops.OpRemoveText(session);
+ op.init({memberid:inputMemberId, position:position, length:1})
+ }
+ return op
+ }
+ function enqueueParagraphSplittingOps() {
+ var odtDocument = session.getOdtDocument(), position = odtDocument.getCursorPosition(inputMemberId), isAtEndOfParagraph = false, paragraphNode, styleName, nextStyleName, op;
+ op = new ops.OpSplitParagraph(session);
+ op.init({memberid:inputMemberId, position:position});
+ session.enqueue(op)
+ }
+ function handleKeyDown(e) {
+ var keyCode = e.keyCode, op = null, handled = false;
+ if(keyCode === 37) {
+ op = createOpMoveCursor(-1);
+ handled = true
+ }else {
+ if(keyCode === 39) {
+ op = createOpMoveCursor(1);
+ handled = true
+ }else {
+ if(keyCode === 38) {
+ op = createOpMoveCursor(-10);
+ handled = true
+ }else {
+ if(keyCode === 40) {
+ op = createOpMoveCursor(10);
+ handled = true
+ }else {
+ if(keyCode === 36) {
+ op = createOpMoveCursorByHomeKey();
+ handled = true
+ }else {
+ if(keyCode === 35) {
+ handled = true
+ }else {
+ if(keyCode === 8) {
+ op = createOpRemoveTextByBackspaceKey();
+ handled = op !== null
+ }else {
+ if(keyCode === 46) {
+ op = createOpRemoveTextByDeleteKey();
+ handled = op !== null
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if(op) {
+ session.enqueue(op)
+ }
+ if(handled) {
+ cancelEvent(e)
+ }
+ }
+ function stringFromKeyPress(event) {
+ if(event.which === null) {
+ return String.fromCharCode(event.keyCode)
+ }
+ if(event.which !== 0 && event.charCode !== 0) {
+ return String.fromCharCode(event.which)
+ }
+ return null
+ }
+ function handleKeyPress(e) {
+ var op, text = stringFromKeyPress(e);
+ if(e.keyCode === 13) {
+ enqueueParagraphSplittingOps();
+ cancelEvent(e)
+ }else {
+ if(text && !(e.altKey || e.ctrlKey || e.metaKey)) {
+ op = new ops.OpInsertText(session);
+ op.init({memberid:inputMemberId, position:session.getOdtDocument().getCursorPosition(inputMemberId), text:text});
+ session.enqueue(op);
+ cancelEvent(e)
+ }
+ }
+ }
+ this.startListening = function() {
+ var canvasElement = session.getOdtDocument().getOdfCanvas().getElement();
+ listenEvent(canvasElement, "keydown", handleKeyDown);
+ listenEvent(canvasElement, "keypress", handleKeyPress);
+ listenEvent(canvasElement, "keyup", dummyHandler);
+ listenEvent(canvasElement, "copy", dummyHandler);
+ listenEvent(canvasElement, "cut", dummyHandler);
+ listenEvent(canvasElement, "paste", dummyHandler);
+ listenEvent(canvasElement, "click", handleMouseClick)
+ };
+ this.startEditing = function() {
+ var op = new ops.OpAddCursor(session);
+ op.init({memberid:inputMemberId});
+ session.enqueue(op)
+ };
+ this.endEditing = function() {
+ var op = new ops.OpRemoveCursor(session);
+ op.init({memberid:inputMemberId});
+ session.enqueue(op)
+ };
+ this.getInputMemberId = function() {
+ return inputMemberId
+ };
+ this.getSession = function() {
+ return session
+ }
+ };
+ return gui.SessionController
+}();
+runtime.loadClass("gui.SelectionMover");
+gui.SelectionManager = function SelectionManager(rootNode) {
+ var movers = [];
+ function onCursorRemove(nodeAfterCursor, textNodeIncrease) {
+ var i;
+ for(i = 0;i < movers.length;i += 1) {
+ movers[i].adaptToCursorRemoval(nodeAfterCursor, textNodeIncrease)
+ }
+ }
+ function onCursorAdd(nodeAfterCursor, textNodeIncrease) {
+ var i;
+ for(i = 0;i < movers.length;i += 1) {
+ movers[i].adaptToInsertedCursor(nodeAfterCursor, textNodeIncrease)
+ }
+ }
+ this.createSelectionMover = function(cursor) {
+ var selectionMover = new gui.SelectionMover(cursor, rootNode, onCursorAdd, onCursorRemove);
+ movers.push(selectionMover);
+ return selectionMover
+ }
+};
+ops.UserModel = function UserModel() {
+};
+ops.UserModel.prototype.getUserDetailsAndUpdates = function(memberId, subscriber) {
+};
+ops.UserModel.prototype.unsubscribeUserDetailsUpdates = function(memberId, subscriber) {
+};
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.TrivialUserModel = function TrivialUserModel() {
+ var users = {};
+ users.bob = {memberid:"bob", fullname:"Bob Pigeon", color:"red", imageurl:"avatar-pigeon.png"};
+ users.alice = {memberid:"alice", fullname:"Alice Bee", color:"green", imageurl:"avatar-flower.png"};
+ users.you = {memberid:"you", fullname:"I, Robot", color:"blue", imageurl:"avatar-joe.png"};
+ this.getUserDetailsAndUpdates = function(memberId, subscriber) {
+ var userid = memberId.split("___")[0];
+ subscriber(memberId, users[userid] || null)
+ };
+ this.unsubscribeUserDetailsUpdates = function(memberId, subscriber) {
+ }
+};
+ops.NowjsUserModel = function NowjsUserModel() {
+ var cachedUserData = {}, memberDataSubscribers = {}, net = runtime.getNetwork();
+ function userIdFromMemberId(memberId) {
+ return memberId.split("___")[0]
+ }
+ function cacheUserDatum(userId, userData) {
+ var subscribers, i;
+ cachedUserData[userId] = userData;
+ subscribers = memberDataSubscribers[userId];
+ if(subscribers) {
+ for(i = 0;i < subscribers.length;i += 1) {
+ subscribers[i].subscriber(subscribers[i].memberId, userData)
+ }
+ }
+ runtime.log("data for user [" + userId + "] cached.")
+ }
+ this.getUserDetailsAndUpdates = function(memberId, subscriber) {
+ var userId = userIdFromMemberId(memberId), userData = cachedUserData[userId], subscribers = memberDataSubscribers[userId] = memberDataSubscribers[userId] || [], i;
+ runtime.assert(subscriber !== undefined, "missing callback");
+ for(i = 0;i < subscribers.length;i += 1) {
+ if(subscribers[i].subscriber === subscriber && subscribers[i].memberId === memberId) {
+ break
+ }
+ }
+ if(i < subscribers.length) {
+ runtime.log("double subscription request for " + memberId + " in NowjsUserModel::getUserDetailsAndUpdates")
+ }else {
+ subscribers.push({memberId:memberId, subscriber:subscriber})
+ }
+ if(userData === undefined) {
+ net.getUserData(userId, function(udata) {
+ cacheUserDatum(userId, udata ? {userid:udata.uid, fullname:udata.fullname, imageurl:"/user/" + udata.uid + "/avatar.png", color:udata.color} : null)
+ })
+ }else {
+ subscriber(memberId, userData)
+ }
+ };
+ this.unsubscribeUserDetailsUpdates = function(memberId, subscriber) {
+ var i, userId = userIdFromMemberId(memberId), subscribers = memberDataSubscribers[userId];
+ runtime.assert(subscriber !== undefined, "missing subscriber parameter or null");
+ runtime.assert(subscribers, "tried to unsubscribe when no one is subscribed ('" + memberId + "')");
+ if(subscribers) {
+ for(i = 0;i < subscribers.length;i += 1) {
+ if(subscribers[i].subscriber === subscriber && subscribers[i].memberId === memberId) {
+ break
+ }
+ }
+ runtime.assert(i < subscribers.length, "tried to unsubscribe when not subscribed for memberId '" + memberId + "'");
+ subscribers.splice(i, 1)
+ }
+ };
+ runtime.assert(net.networkStatus === "ready", "network not ready")
+};
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.TrivialOperationRouter = function TrivialOperationRouter() {
+ var self = this;
+ this.setOperationFactory = function(f) {
+ self.op_factory = f
+ };
+ this.setPlaybackFunction = function(playback_func) {
+ self.playback_func = playback_func
+ };
+ this.push = function(op) {
+ var timedOp, opspec = op.spec();
+ opspec.timestamp = (new Date).getTime();
+ timedOp = self.op_factory.create(opspec);
+ self.playback_func(timedOp)
+ }
+};
+ops.NowjsOperationRouter = function NowjsOperationRouter(sessionId, memberid) {
+ var self = this, net = runtime.getNetwork(), last_server_seq = -1, reorder_queue = {}, sends_since_server_op = 0, router_sequence = 1E3;
+ function nextNonce() {
+ runtime.assert(memberid !== null, "Router sequence N/A without memberid");
+ router_sequence += 1;
+ return"C:" + memberid + ":" + router_sequence
+ }
+ this.setOperationFactory = function(f) {
+ self.op_factory = f
+ };
+ this.setPlaybackFunction = function(playback_func) {
+ self.playback_func = playback_func
+ };
+ function receiveOpFromNetwork(opspec) {
+ var idx, seq, op = self.op_factory.create(opspec);
+ runtime.log(" op in: " + runtime.toJson(opspec));
+ if(op !== null) {
+ seq = Number(opspec.server_seq);
+ runtime.assert(!isNaN(seq), "server seq is not a number");
+ if(seq === last_server_seq + 1) {
+ self.playback_func(op);
+ last_server_seq = seq;
+ sends_since_server_op = 0;
+ for(idx = last_server_seq + 1;reorder_queue.hasOwnProperty(idx);idx += 1) {
+ self.playback_func(reorder_queue[idx]);
+ delete reorder_queue[idx];
+ runtime.log("op with server seq " + seq + " taken from hold (reordered)")
+ }
+ }else {
+ runtime.assert(seq !== last_server_seq + 1, "received incorrect order from server");
+ runtime.assert(!reorder_queue.hasOwnProperty(seq), "reorder_queue has incoming op");
+ runtime.log("op with server seq " + seq + " put on hold");
+ reorder_queue[seq] = op
+ }
+ }else {
+ runtime.log("ignoring invalid incoming opspec: " + opspec)
+ }
+ }
+ net.ping = function(pong) {
+ if(memberid !== null) {
+ pong(memberid)
+ }
+ };
+ net.receiveOp = function(op_session_id, opspec) {
+ if(op_session_id === sessionId) {
+ receiveOpFromNetwork(opspec)
+ }
+ };
+ this.push = function(op) {
+ var opspec = op.spec();
+ opspec.client_nonce = nextNonce();
+ opspec.parent_op = last_server_seq + "+" + sends_since_server_op;
+ sends_since_server_op += 1;
+ runtime.log("op out: " + runtime.toJson(opspec));
+ net.deliverOp(sessionId, opspec)
+ };
+ this.requestReplay = function(done_cb) {
+ net.requestReplay(sessionId, function(opspec) {
+ runtime.log("replaying: " + runtime.toJson(opspec));
+ receiveOpFromNetwork(opspec)
+ }, function(count) {
+ runtime.log("replay done (" + count + " ops).");
+ if(done_cb) {
+ done_cb()
+ }
+ })
+ };
+ function init() {
+ var sessionJoinSuccess;
+ net.memberid = memberid;
+ sessionJoinSuccess = net.joinSession(sessionId, function(sessionJoinSuccess) {
+ runtime.assert(sessionJoinSuccess, "Trying to join a session which does not exists or where we are already in")
+ })
+ }
+ init()
+};
+gui.EditInfoHandle = function EditInfoHandle(parentElement) {
+ var edits = [], handle, document = parentElement.ownerDocument, htmlns = document.documentElement.namespaceURI, editinfons = "urn:webodf:names:editinfo";
+ function renderEdits() {
+ var i, infoDiv, colorSpan, authorSpan, timeSpan;
+ handle.innerHTML = "";
+ for(i = 0;i < edits.length;i += 1) {
+ infoDiv = document.createElementNS(htmlns, "div");
+ infoDiv.className = "editInfo";
+ colorSpan = document.createElementNS(htmlns, "span");
+ colorSpan.className = "editInfoColor";
+ colorSpan.setAttributeNS(editinfons, "editinfo:memberid", edits[i].memberid);
+ authorSpan = document.createElementNS(htmlns, "span");
+ authorSpan.className = "editInfoAuthor";
+ authorSpan.setAttributeNS(editinfons, "editinfo:memberid", edits[i].memberid);
+ timeSpan = document.createElementNS(htmlns, "span");
+ timeSpan.className = "editInfoTime";
+ timeSpan.setAttributeNS(editinfons, "editinfo:memberid", edits[i].memberid);
+ timeSpan.innerHTML = edits[i].time;
+ infoDiv.appendChild(colorSpan);
+ infoDiv.appendChild(authorSpan);
+ infoDiv.appendChild(timeSpan);
+ handle.appendChild(infoDiv)
+ }
+ }
+ this.setEdits = function(editArray) {
+ edits = editArray;
+ renderEdits()
+ };
+ this.show = function() {
+ handle.style.display = "block"
+ };
+ this.hide = function() {
+ handle.style.display = "none"
+ };
+ function init() {
+ handle = document.createElementNS(htmlns, "div");
+ handle.setAttribute("class", "editInfoHandle");
+ handle.style.display = "none";
+ parentElement.appendChild(handle)
+ }
+ init()
+};
+runtime.loadClass("core.EditInfo");
+runtime.loadClass("gui.EditInfoHandle");
+gui.EditInfoMarker = function EditInfoMarker(editInfo) {
+ var self = this, editInfoNode, handle, marker, editinfons = "urn:webodf:names:editinfo", decay1, decay2, decayTimeStep = 1E4;
+ function applyDecay(opacity, delay) {
+ return window.setTimeout(function() {
+ marker.style.opacity = opacity
+ }, delay)
+ }
+ function deleteDecay(timer) {
+ window.clearTimeout(timer)
+ }
+ function setLastAuthor(memberid) {
+ marker.setAttributeNS(editinfons, "editinfo:memberid", memberid)
+ }
+ this.addEdit = function(memberid, timestamp) {
+ var age = Date.now() - timestamp;
+ editInfo.addEdit(memberid, timestamp);
+ handle.setEdits(editInfo.getSortedEdits());
+ setLastAuthor(memberid);
+ if(decay1) {
+ deleteDecay(decay1)
+ }
+ if(decay2) {
+ deleteDecay(decay2)
+ }
+ if(age < decayTimeStep) {
+ applyDecay(1, 0);
+ decay1 = applyDecay(0.5, decayTimeStep - age);
+ decay2 = applyDecay(0.2, decayTimeStep * 2 - age)
+ }else {
+ if(age >= decayTimeStep && age < decayTimeStep * 2) {
+ applyDecay(0.5, 0);
+ decay2 = applyDecay(0.2, decayTimeStep * 2 - age)
+ }else {
+ applyDecay(0.2, 0)
+ }
+ }
+ };
+ this.getEdits = function() {
+ return editInfo.getEdits()
+ };
+ this.clearEdits = function() {
+ editInfo.clearEdits();
+ handle.setEdits([]);
+ if(marker.hasAttributeNS(editinfons, "editinfo:memberid")) {
+ marker.removeAttributeNS(editinfons, "editinfo:memberid")
+ }
+ };
+ this.getEditInfo = function() {
+ return editInfo
+ };
+ this.showHandle = function() {
+ handle.show()
+ };
+ this.hideHandle = function() {
+ handle.hide()
+ };
+ function init() {
+ var dom = editInfo.getOdtDocument().getDOM(), htmlns = dom.documentElement.namespaceURI;
+ marker = dom.createElementNS(htmlns, "div");
+ marker.setAttribute("class", "editInfoMarker");
+ marker.onmouseover = function() {
+ self.showHandle()
+ };
+ marker.onmouseout = function() {
+ self.hideHandle()
+ };
+ editInfoNode = editInfo.getNode();
+ editInfoNode.appendChild(marker);
+ handle = new gui.EditInfoHandle(editInfoNode)
+ }
+ init()
+};
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+runtime.loadClass("gui.Caret");
+runtime.loadClass("ops.TrivialUserModel");
+runtime.loadClass("core.EditInfo");
+runtime.loadClass("gui.EditInfoMarker");
+gui.SessionView = function() {
+ function SessionView(session, caretFactory) {
+ var carets = {}, avatarInfoStyles, headlineNodeName = "text|h", paragraphNodeName = "text|p", editHighlightingEnabled = true, editInfons = "urn:webodf:names:editinfo", editInfoMap = {};
+ function createAvatarInfoNodeMatch(nodeName, className, memberId) {
+ var userId = memberId.split("___")[0];
+ return nodeName + "." + className + '[editinfo|memberid^="' + userId + '"]'
+ }
+ function getAvatarInfoStyle(nodeName, className, memberId) {
+ var node = avatarInfoStyles.firstChild, nodeMatch = createAvatarInfoNodeMatch(nodeName, className, memberId);
+ while(node) {
+ if(node.nodeType === 3 && node.data.indexOf(nodeMatch) === 0) {
+ return node
+ }
+ node = node.nextSibling
+ }
+ return null
+ }
+ function setAvatarInfoStyle(memberId, name, color) {
+ function setStyle(nodeName, className, rule) {
+ var styleRule = createAvatarInfoNodeMatch(nodeName, className, memberId) + rule, styleNode = getAvatarInfoStyle(nodeName, className, memberId);
+ if(styleNode) {
+ styleNode.data = styleRule
+ }else {
+ avatarInfoStyles.appendChild(document.createTextNode(styleRule))
+ }
+ }
+ setStyle("div", "editInfoMarker", "{ background-color: " + color + "; }");
+ setStyle("span", "editInfoColor", "{ background-color: " + color + "; }");
+ setStyle("span", "editInfoAuthor", ':before { content: "' + name + '"; }')
+ }
+ function removeAvatarInfoStyle(nodeName, className, memberId) {
+ var styleNode = getAvatarInfoStyle(nodeName, className, memberId);
+ if(styleNode) {
+ avatarInfoStyles.removeChild(styleNode)
+ }
+ }
+ function highlightEdit(element, memberId, timestamp) {
+ var editInfo, editInfoMarker, id = "", userModel = session.getUserModel(), editInfoNode = element.getElementsByTagNameNS(editInfons, "editinfo")[0];
+ if(editInfoNode) {
+ id = editInfoNode.getAttributeNS(editInfons, "id");
+ editInfoMarker = editInfoMap[id]
+ }else {
+ id = Math.random().toString();
+ editInfo = new core.EditInfo(element, session.getOdtDocument());
+ editInfoMarker = new gui.EditInfoMarker(editInfo);
+ editInfoNode = element.getElementsByTagNameNS(editInfons, "editinfo")[0];
+ editInfoNode.setAttributeNS(editInfons, "id", id);
+ editInfoMap[id] = editInfoMarker
+ }
+ editInfoMarker.addEdit(memberId, new Date(timestamp))
+ }
+ session.getOdtDocument().subscribe("paragraphEdited", function(info) {
+ highlightEdit(info.element, info.memberId, info.timeStamp)
+ });
+ this.enableEditHighlighting = function() {
+ if(editHighlightingEnabled) {
+ return
+ }
+ editHighlightingEnabled = true
+ };
+ this.disableEditHighlighting = function() {
+ if(!editHighlightingEnabled) {
+ return
+ }
+ editHighlightingEnabled = false
+ };
+ this.getSession = function() {
+ return session
+ };
+ this.getCaret = function(memberid) {
+ return carets[memberid]
+ };
+ function renderMemberData(memberId, userData) {
+ var caret = carets[memberId];
+ if(userData === undefined) {
+ runtime.log('UserModel sent undefined data for member "' + memberId + '".');
+ return
+ }
+ if(userData === null) {
+ userData = {memberid:memberId, fullname:"Unknown Identity", color:"black", imageurl:"avatar-joe.png"}
+ }
+ if(caret) {
+ caret.setAvatarImageUrl(userData.imageurl);
+ caret.setColor(userData.color)
+ }
+ if(editHighlightingEnabled) {
+ setAvatarInfoStyle(memberId, userData.fullname, userData.color)
+ }
+ }
+ function onCursorAdded(cursor) {
+ var caret = caretFactory.createCaret(cursor), memberId = cursor.getMemberId(), userModel = session.getUserModel();
+ carets[memberId] = caret;
+ renderMemberData(memberId, null);
+ userModel.getUserDetailsAndUpdates(memberId, renderMemberData);
+ runtime.log("+++ View here +++ eagerly created an Caret for '" + memberId + "'! +++")
+ }
+ function onCursorRemoved(memberid) {
+ delete carets[memberid]
+ }
+ function init() {
+ var head = document.getElementsByTagName("head")[0];
+ session.subscribe(ops.Session.signalCursorAdded, onCursorAdded);
+ session.subscribe(ops.Session.signalCursorRemoved, onCursorRemoved);
+ avatarInfoStyles = document.createElementNS(head.namespaceURI, "style");
+ avatarInfoStyles.type = "text/css";
+ avatarInfoStyles.media = "screen, print, handheld, projection";
+ avatarInfoStyles.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));
+ head.appendChild(avatarInfoStyles)
+ }
+ init()
+ }
+ return SessionView
+}();
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+runtime.loadClass("gui.Caret");
+gui.CaretFactory = function CaretFactory(sessionController) {
+ this.createCaret = function(cursor) {
+ var memberid = cursor.getMemberId(), odtDocument = sessionController.getSession().getOdtDocument(), canvasElement = odtDocument.getOdfCanvas().getElement(), caret = new gui.Caret(cursor);
+ if(memberid === sessionController.getInputMemberId()) {
+ runtime.log("Starting to track input on new cursor of " + memberid);
+ odtDocument.subscribe("paragraphEdited", function(info) {
+ if(info.memberId === memberid) {
+ caret.ensureVisible()
+ }
+ });
+ cursor.handleUpdate = caret.ensureVisible;
+ canvasElement.setAttribute("tabindex", 0);
+ canvasElement.onfocus = caret.setFocus;
+ canvasElement.onblur = caret.removeFocus;
+ canvasElement.focus();
+ sessionController.startListening()
+ }
+ return caret
+ }
+};
runtime.loadClass("xmldom.XPath");
runtime.loadClass("odf.Style2CSS");
gui.PresenterUI = function() {
@@ -6792,138 +9397,7 @@ gui.PresenterUI = function() {
document.addEventListener("keydown", self.keyDownHandler, false)
}
}();
-gui.Caret = function Caret(selection, rootNode) {
- var document = rootNode.ownerDocument, cursorns, cursorNode;
- cursorns = "urn:webodf:names:cursor";
- cursorNode = document.createElementNS(cursorns, "cursor");
- this.updateToSelection = function() {
- var range;
- if(selection.rangeCount === 1) {
- range = selection.getRangeAt(0)
- }
- }
-};
-runtime.loadClass("core.Cursor");
-gui.SelectionMover = function SelectionMover(selection, pointWalker) {
- var doc = pointWalker.node().ownerDocument, cursor = new core.Cursor(selection, doc);
- function getActiveRange(node) {
- var range;
- if(selection.rangeCount === 0) {
- selection.addRange(node.ownerDocument.createRange())
- }
- return selection.getRangeAt(selection.rangeCount - 1)
- }
- function setStart(node, offset) {
- var ranges = [], i, range;
- for(i = 0;i < selection.rangeCount;i += 1) {
- ranges[i] = selection.getRangeAt(i)
- }
- selection.removeAllRanges();
- if(ranges.length === 0) {
- ranges[0] = node.ownerDocument.createRange()
- }
- ranges[ranges.length - 1].setStart(pointWalker.node(), pointWalker.position());
- for(i = 0;i < ranges.length;i += 1) {
- selection.addRange(ranges[i])
- }
- }
- function doMove(extend, move) {
- if(selection.rangeCount === 0) {
- return
- }
- var range = selection.getRangeAt(0), element;
- if(!range.startContainer || range.startContainer.nodeType !== 1) {
- return
- }
- element = range.startContainer;
- pointWalker.setPoint(element, range.startOffset);
- move();
- setStart(pointWalker.node(), pointWalker.position())
- }
- function doMoveForward(extend, move) {
- if(selection.rangeCount === 0) {
- return
- }
- move();
- var range = selection.getRangeAt(0), element;
- if(!range.startContainer || range.startContainer.nodeType !== 1) {
- return
- }
- element = range.startContainer;
- pointWalker.setPoint(element, range.startOffset)
- }
- function moveCursor(node, offset, selectMode) {
- if(selectMode) {
- selection.extend(node, offset)
- }else {
- selection.collapse(node, offset)
- }
- cursor.updateToSelection()
- }
- function moveCursorLeft() {
- var element;
- if(!selection.focusNode || selection.focusNode.nodeType !== 1) {
- return
- }
- element = selection.focusNode;
- pointWalker.setPoint(element, selection.focusOffset);
- pointWalker.stepBackward();
- moveCursor(pointWalker.node(), pointWalker.position(), false)
- }
- function moveCursorRight() {
- cursor.remove();
- var element;
- if(!selection.focusNode || selection.focusNode.nodeType !== 1) {
- return
- }
- element = selection.focusNode;
- pointWalker.setPoint(element, selection.focusOffset);
- pointWalker.stepForward();
- moveCursor(pointWalker.node(), pointWalker.position(), false)
- }
- function moveCursorUp() {
- var rect = cursor.getNode().getBoundingClientRect(), x = rect.left, y = rect.top, arrived = false, left = 200;
- while(!arrived && left) {
- left -= 1;
- moveCursorLeft();
- rect = cursor.getNode().getBoundingClientRect();
- arrived = rect.top !== y && rect.left < x
- }
- }
- function moveCursorDown() {
- cursor.updateToSelection();
- var rect = cursor.getNode().getBoundingClientRect(), x = rect.left, y = rect.top, arrived = false, left = 200;
- while(!arrived) {
- left -= 1;
- moveCursorRight();
- rect = cursor.getNode().getBoundingClientRect();
- arrived = rect.top !== y && rect.left > x
- }
- }
- this.movePointForward = function(extend) {
- doMove(extend, pointWalker.stepForward)
- };
- this.movePointBackward = function(extend) {
- doMove(extend, pointWalker.stepBackward)
- };
- this.moveLineForward = function(extend) {
- if(selection.modify) {
- selection.modify(extend ? "extend" : "move", "forward", "line")
- }else {
- doMove(extend, moveCursorDown)
- }
- };
- this.moveLineBackward = function(extend) {
- if(selection.modify) {
- selection.modify(extend ? "extend" : "move", "backward", "line")
- }else {
- doMove(extend, function() {
- })
- }
- };
- return this
-};
-runtime.loadClass("core.PointWalker");
+runtime.loadClass("core.PositionIterator");
runtime.loadClass("core.Cursor");
gui.XMLEdit = function XMLEdit(element, stylesheet) {
var simplecss, cssprefix, documentElement, customNS = "customns", walker = null;
@@ -7110,14 +9584,422 @@ gui.XMLEdit = function XMLEdit(element, stylesheet) {
}
element.appendChild(node);
updateCSS();
- walker = new core.PointWalker(node)
+ walker = new core.PositionIterator(node)
}
initElement(element);
this.updateCSS = updateCSS;
this.setXML = setXML;
this.getXML = getXML
};
+ops.SessionPointFilter = function SessionPointFilter() {
+ this.acceptNode = function(node) {
+ return 1
+ }
+};
+runtime.loadClass("ops.TrivialOperationRouter");
+runtime.loadClass("gui.SelectionManager");
+ops.OdtDocument = function OdtDocument(odfCanvas) {
+ var self = this, textns = "urn:oasis:names:tc:opendocument:xmlns:text:1.0", fons = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", stylens = "urn:oasis:names:tc:opendocument:xmlns:style:1.0", svgns = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", rootNode, selectionManager, filter, cursors = {}, eventListener = {};
+ eventListener.paragraphEdited = [];
+ function TextPositionFilter() {
+ var accept = core.PositionFilter.FilterResult.FILTER_ACCEPT, reject = core.PositionFilter.FilterResult.FILTER_REJECT;
+ this.acceptPosition = function(iterator) {
+ var n = iterator.container(), p, o, d;
+ if(n.nodeType !== 3) {
+ if(n.localName !== "p" && n.localName !== "h" && n.localName !== "span") {
+ return reject
+ }
+ return accept
+ }
+ if(n.length === 0) {
+ return reject
+ }
+ p = n.parentNode;
+ o = p && p.localName;
+ if(o !== "p" && o !== "span" && o !== "h") {
+ return reject
+ }
+ o = iterator.textOffset();
+ if(o > 0 && iterator.substr(o - 1, 2) === " ") {
+ return reject
+ }
+ return accept
+ }
+ }
+ function findTextRoot(odfcontainer) {
+ var root = odfcontainer.rootElement.firstChild;
+ while(root && root.localName !== "body") {
+ root = root.nextSibling
+ }
+ root = root && root.firstChild;
+ while(root && root.localName !== "text") {
+ root = root.nextSibling
+ }
+ return root
+ }
+ function getPositionInTextNode(position) {
+ var iterator = gui.SelectionMover.createPositionIterator(rootNode), lastTextNode = null, node, nodeOffset = 0;
+ position += 1;
+ if(filter.acceptPosition(iterator) === 1) {
+ node = iterator.container();
+ if(node.nodeType === 3) {
+ lastTextNode = node;
+ nodeOffset = 0
+ }else {
+ if(position === 0) {
+ lastTextNode = rootNode.ownerDocument.createTextNode("");
+ node.insertBefore(lastTextNode, null);
+ nodeOffset = 0
+ }
+ }
+ }
+ while(position > 0 || lastTextNode === null) {
+ if(!iterator.nextPosition()) {
+ return null
+ }
+ if(filter.acceptPosition(iterator) === 1) {
+ position -= 1;
+ node = iterator.container();
+ if(node.nodeType === 3) {
+ if(node !== lastTextNode) {
+ lastTextNode = node;
+ nodeOffset = 0
+ }else {
+ nodeOffset += 1
+ }
+ }else {
+ if(lastTextNode !== null) {
+ if(position === 0) {
+ nodeOffset = lastTextNode.length;
+ break
+ }
+ lastTextNode = null
+ }else {
+ if(position === 0) {
+ lastTextNode = node.ownerDocument.createTextNode("");
+ node.appendChild(lastTextNode);
+ nodeOffset = 0;
+ break
+ }
+ }
+ }
+ }
+ }
+ if(lastTextNode === null) {
+ return null
+ }
+ while(nodeOffset === 0 && lastTextNode.previousSibling && lastTextNode.previousSibling.localName === "cursor") {
+ node = lastTextNode.previousSibling.previousSibling;
+ while(node && node.nodeType !== 3) {
+ node = node.previousSibling
+ }
+ if(node === null) {
+ node = rootNode.ownerDocument.createTextNode("");
+ lastTextNode.parentNode.insertBefore(node, lastTextNode.parentNode.firstChild)
+ }
+ lastTextNode = node;
+ nodeOffset = lastTextNode.length
+ }
+ return{textNode:lastTextNode, offset:nodeOffset}
+ }
+ function getParagraphElement(node) {
+ while(node && !((node.localName === "p" || node.localName === "h") && node.namespaceURI === textns)) {
+ node = node.parentNode
+ }
+ return node
+ }
+ function getParagraphStyleElement(styleName) {
+ var node;
+ node = odfCanvas.getFormatting().getStyleElement(odfCanvas.odfContainer().rootElement.styles, styleName, "paragraph");
+ return node
+ }
+ function getParagraphStyleAttributes(styleName) {
+ var node = getParagraphStyleElement(styleName);
+ if(node) {
+ return odfCanvas.getFormatting().getInheritedStyleAttributes(odfCanvas.odfContainer().rootElement.styles, node)
+ }
+ return null
+ }
+ this.getParagraphStyleElement = getParagraphStyleElement;
+ this.getParagraphElement = getParagraphElement;
+ this.getParagraphStyleAttributes = getParagraphStyleAttributes;
+ this.getPositionInTextNode = getPositionInTextNode;
+ this.getDistanceFromCursor = function(memberid, node, offset) {
+ var counter, cursor = cursors[memberid], steps = 0;
+ runtime.assert(node !== null, "OdtDocument.getDistanceFromCursor called with node===null");
+ if(cursor) {
+ counter = cursor.getStepCounter().countStepsToPosition;
+ steps = counter(node, offset, filter)
+ }
+ return steps
+ };
+ this.getCursorPosition = function(memberid) {
+ return-self.getDistanceFromCursor(memberid, rootNode, 0)
+ };
+ this.getPositionFilter = function() {
+ return filter
+ };
+ this.getOdfCanvas = function() {
+ return odfCanvas
+ };
+ this.getRootNode = function() {
+ return rootNode
+ };
+ this.getDOM = function() {
+ return rootNode.ownerDocument
+ };
+ this.getSelectionManager = function() {
+ return selectionManager
+ };
+ function triggerLayoutInWebkit(textNode) {
+ var parent = textNode.parentNode, next = textNode.nextSibling;
+ parent.removeChild(textNode);
+ parent.insertBefore(textNode, next)
+ }
+ this.insertText = function(memberid, timestamp, position, text) {
+ var domPosition, textNode;
+ domPosition = getPositionInTextNode(position);
+ if(domPosition) {
+ textNode = domPosition.textNode;
+ textNode.insertData(domPosition.offset, text);
+ triggerLayoutInWebkit(textNode);
+ self.emit("paragraphEdited", {element:getParagraphElement(domPosition.textNode), memberId:memberid, timeStamp:timestamp});
+ return true
+ }
+ return false
+ };
+ this.removeText = function(memberid, timestamp, position, length) {
+ var domPosition;
+ if(length < 0) {
+ length = -length;
+ position -= length;
+ domPosition = getPositionInTextNode(position)
+ }else {
+ domPosition = getPositionInTextNode(position + 1);
+ if(domPosition.offset !== 1) {
+ runtime.log("unexpected!");
+ return false
+ }
+ domPosition.offset -= 1
+ }
+ if(domPosition) {
+ domPosition.textNode.deleteData(domPosition.offset, length);
+ self.emit("paragraphEdited", {element:getParagraphElement(domPosition.textNode), memberId:memberid, timeStamp:timestamp});
+ return true
+ }
+ return false
+ };
+ this.setParagraphStyle = function(memberid, timestamp, position, styleNameBefore, styleNameAfter) {
+ var domPosition, paragraphNode;
+ domPosition = getPositionInTextNode(position);
+ runtime.log("Setting paragraph style:" + domPosition + " -- " + position + " " + styleNameBefore + "->" + styleNameAfter);
+ if(domPosition) {
+ paragraphNode = getParagraphElement(domPosition.textNode);
+ if(paragraphNode) {
+ paragraphNode.setAttributeNS(textns, "text:style-name", styleNameAfter);
+ self.emit("paragraphEdited", {element:paragraphNode, timeStamp:timestamp, memberId:memberid});
+ return true
+ }
+ }
+ return false
+ };
+ function setRealAttributeNS(node, ns, prefixedAttribute, value, unit) {
+ if(value !== undefined) {
+ if(unit !== undefined) {
+ node.setAttributeNS(ns, prefixedAttribute, value + unit)
+ }else {
+ node.setAttributeNS(ns, prefixedAttribute, value)
+ }
+ }
+ }
+ function isFontDeclared(fontName) {
+ var fontMap = odfCanvas.getFormatting().getFontMap();
+ if(fontMap.hasOwnProperty(fontName)) {
+ return true
+ }
+ return false
+ }
+ function declareFont(name, family) {
+ var declaration;
+ if(!name || !family) {
+ return
+ }
+ declaration = rootNode.ownerDocument.createElementNS(stylens, "style:font-face");
+ declaration.setAttributeNS(stylens, "style:name", name);
+ declaration.setAttributeNS(svgns, "svg:font-family", family);
+ odfCanvas.odfContainer().rootElement.fontFaceDecls.appendChild(declaration)
+ }
+ this.updateParagraphStyle = function(styleName, info) {
+ var styleNode, paragraphPropertiesNode, textPropertiesNode;
+ styleNode = getParagraphStyleElement(styleName);
+ if(styleNode) {
+ paragraphPropertiesNode = styleNode.getElementsByTagNameNS(stylens, "paragraph-properties")[0];
+ textPropertiesNode = styleNode.getElementsByTagNameNS(stylens, "text-properties")[0];
+ if(paragraphPropertiesNode === undefined && info.paragraphProperties) {
+ paragraphPropertiesNode = rootNode.ownerDocument.createElementNS(stylens, "style:paragraph-properties");
+ styleNode.appendChild(paragraphPropertiesNode)
+ }
+ if(textPropertiesNode === undefined && info.textProperties) {
+ textPropertiesNode = rootNode.ownerDocument.createElementNS(stylens, "style:text-properties");
+ styleNode.appendChild(textPropertiesNode)
+ }
+ if(info.paragraphProperties) {
+ setRealAttributeNS(paragraphPropertiesNode, fons, "fo:margin-top", info.paragraphProperties.topMargin, "mm");
+ setRealAttributeNS(paragraphPropertiesNode, fons, "fo:margin-bottom", info.paragraphProperties.bottomMargin, "mm");
+ setRealAttributeNS(paragraphPropertiesNode, fons, "fo:margin-left", info.paragraphProperties.leftMargin, "mm");
+ setRealAttributeNS(paragraphPropertiesNode, fons, "fo:margin-right", info.paragraphProperties.rightMargin, "mm");
+ setRealAttributeNS(paragraphPropertiesNode, fons, "fo:text-align", info.paragraphProperties.textAlign)
+ }
+ if(info.textProperties) {
+ setRealAttributeNS(textPropertiesNode, fons, "fo:font-size", info.textProperties.fontSize, "pt");
+ if(!isFontDeclared(info.textProperties.fontName)) {
+ declareFont(info.textProperties.fontName, info.textProperties.fontName)
+ }
+ setRealAttributeNS(textPropertiesNode, stylens, "style:font-name", info.textProperties.fontName);
+ setRealAttributeNS(textPropertiesNode, fons, "fo:color", info.textProperties.color);
+ setRealAttributeNS(textPropertiesNode, fons, "fo:background-color", info.textProperties.backgroundColor);
+ setRealAttributeNS(textPropertiesNode, fons, "fo:font-weight", info.textProperties.fontWeight);
+ setRealAttributeNS(textPropertiesNode, fons, "fo:font-style", info.textProperties.fontStyle);
+ setRealAttributeNS(textPropertiesNode, stylens, "style:text-underline-style", info.textProperties.underline);
+ setRealAttributeNS(textPropertiesNode, stylens, "style:text-line-through-style", info.textProperties.strikethrough)
+ }
+ odfCanvas.refreshCSS();
+ return true
+ }
+ return false
+ };
+ this.deleteStyle = function(styleName) {
+ var styleNode = getParagraphStyleElement(styleName);
+ styleNode.parentNode.removeChild(styleNode);
+ odfCanvas.refreshCSS()
+ };
+ this.getCursor = function(memberid) {
+ return cursors[memberid]
+ };
+ this.getCursors = function() {
+ var list = [], i;
+ for(i in cursors) {
+ if(cursors.hasOwnProperty(i)) {
+ list.push(cursors[i])
+ }
+ }
+ return list
+ };
+ this.addCursor = function(cursor) {
+ var distanceToFirstTextNode = cursor.getStepCounter().countForwardSteps(1, filter);
+ cursor.move(distanceToFirstTextNode);
+ cursors[cursor.getMemberId()] = cursor
+ };
+ this.removeCursor = function(memberid) {
+ var cursor = cursors[memberid], cursorNode;
+ if(cursor) {
+ cursor.removeFromOdtDocument();
+ delete cursors[memberid]
+ }
+ };
+ this.getMetaData = function(metadataId) {
+ var node = odfCanvas.odfContainer().rootElement.firstChild;
+ while(node && node.localName !== "meta") {
+ node = node.nextSibling
+ }
+ node = node && node.firstChild;
+ while(node && node.localName !== metadataId) {
+ node = node.nextSibling
+ }
+ node = node && node.firstChild;
+ while(node && node.nodeType !== 3) {
+ node = node.nextSibling
+ }
+ return node ? node.data : null
+ };
+ this.getFormatting = function() {
+ return odfCanvas.getFormatting()
+ };
+ this.emit = function(eventid, args) {
+ var i, subscribers;
+ runtime.assert(eventListener.hasOwnProperty(eventid), 'unknown event fired "' + eventid + '"');
+ subscribers = eventListener[eventid];
+ for(i = 0;i < subscribers.length;i += 1) {
+ subscribers[i](args)
+ }
+ };
+ this.subscribe = function(eventid, cb) {
+ runtime.assert(eventListener.hasOwnProperty(eventid), 'tried to subscribe to unknown event "' + eventid + '"');
+ eventListener[eventid].push(cb);
+ runtime.log('event "' + eventid + '" subscribed.')
+ };
+ function init() {
+ filter = new TextPositionFilter;
+ rootNode = findTextRoot(odfCanvas.odfContainer());
+ selectionManager = new gui.SelectionManager(rootNode)
+ }
+ init()
+};
+runtime.loadClass("ops.TrivialUserModel");
+runtime.loadClass("ops.TrivialOperationRouter");
+runtime.loadClass("ops.OperationFactory");
+runtime.loadClass("gui.SelectionManager");
+runtime.loadClass("ops.OdtDocument");
+ops.Session = function Session(odfCanvas) {
+ var self = this, odtDocument = new ops.OdtDocument(odfCanvas), style2CSS = new odf.Style2CSS, namespaces = style2CSS.namespaces, m_user_model = null, m_operation_router = null, m_event_listener = {};
+ m_event_listener[ops.Session.signalCursorAdded] = [];
+ m_event_listener[ops.Session.signalCursorRemoved] = [];
+ m_event_listener[ops.Session.signalCursorMoved] = [];
+ m_event_listener[ops.Session.signalParagraphChanged] = [];
+ m_event_listener[ops.Session.signalStyleCreated] = [];
+ m_event_listener[ops.Session.signalStyleDeleted] = [];
+ m_event_listener[ops.Session.signalParagraphStyleModified] = [];
+ function setUserModel(userModel) {
+ m_user_model = userModel
+ }
+ this.setUserModel = setUserModel;
+ function setOperationRouter(opRouter) {
+ m_operation_router = opRouter;
+ opRouter.setPlaybackFunction(self.playOperation);
+ opRouter.setOperationFactory(new ops.OperationFactory(self))
+ }
+ this.setOperationRouter = setOperationRouter;
+ function getUserModel() {
+ return m_user_model
+ }
+ this.getUserModel = getUserModel;
+ this.getOdtDocument = function() {
+ return odtDocument
+ };
+ this.emit = function(eventid, args) {
+ var i, subscribers;
+ runtime.assert(m_event_listener.hasOwnProperty(eventid), 'unknown event fired "' + eventid + '"');
+ subscribers = m_event_listener[eventid];
+ for(i = 0;i < subscribers.length;i += 1) {
+ subscribers[i](args)
+ }
+ };
+ this.subscribe = function(eventid, cb) {
+ runtime.assert(m_event_listener.hasOwnProperty(eventid), 'tried to subscribe to unknown event "' + eventid + '"');
+ m_event_listener[eventid].push(cb);
+ runtime.log('event "' + eventid + '" subscribed.')
+ };
+ this.enqueue = function(operation) {
+ m_operation_router.push(operation)
+ };
+ this.playOperation = function(op) {
+ op.execute(odtDocument.getRootNode())
+ };
+ function init() {
+ setUserModel(new ops.TrivialUserModel);
+ setOperationRouter(new ops.TrivialOperationRouter)
+ }
+ init()
+};
+ops.Session.signalCursorAdded = "cursor/added";
+ops.Session.signalCursorRemoved = "cursor/removed";
+ops.Session.signalCursorMoved = "cursor/moved";
+ops.Session.signalParagraphChanged = "paragraph/changed";
+ops.Session.signalStyleCreated = "style/created";
+ops.Session.signalStyleDeleted = "style/deleted";
+ops.Session.signalParagraphStyleModified = "paragraphstyle/modified";
(function() {
- return["core/Async.js", "core/Base64.js", "core/ByteArray.js", "core/ByteArrayWriter.js", "core/Cursor.js", "core/JSLint.js", "core/PointWalker.js", "core/RawDeflate.js", "core/RawInflate.js", "core/UnitTester.js", "core/Zip.js", "gui/Caret.js", "gui/SelectionMover.js", "gui/XMLEdit.js", "gui/PresenterUI.js", "odf/FontLoader.js", "odf/Formatting.js", "odf/OdfCanvas.js", "odf/OdfContainer.js", "odf/Style2CSS.js", "odf/StyleInfo.js", "xmldom/LSSerializer.js", "xmldom/LSSerializerFilter.js", "xmldom/OperationalTransformDOM.js",
- "xmldom/OperationalTransformInterface.js", "xmldom/RelaxNG.js", "xmldom/RelaxNG2.js", "xmldom/RelaxNGParser.js", "xmldom/XPath.js"]
+ return ops.Session
})();
+var webodf_css = "@namespace draw url(urn:oasis:names:tc:opendocument:xmlns:drawing:1.0);\n@namespace fo url(urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0);\n@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);\n@namespace presentation url(urn:oasis:names:tc:opendocument:xmlns:presentation:1.0);\n@namespace style url(urn:oasis:names:tc:opendocument:xmlns:style:1.0);\n@namespace svg url(urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0);\n@namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0);\n@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);\n@namespace runtimens url(urn:webodf); /* namespace for runtime only */\n@namespace cursor url(urn:webodf:names:cursor);\n@namespace editinfo url(urn:webodf:names:editinfo);\n\noffice|document > *, office|document-content > * {\n display: none;\n}\noffice|body, office|document {\n display: inline-block;\n position: relative;\n}\n\ntext|p, text|h {\n display: block;\n padding: 0;\n margin: 0;\n line-height: normal;\n position: relative;\n}\n*[runtimens|containsparagraphanchor] {\n position: relative;\n}\ntext|s:before { /* this needs to be the number of spaces given by text:c */\n content: ' ';\n}\ntext|tab:before {\n display: inline;\n content: ' ';\n}\ntext|line-break {\n content: \" \";\n display: block;\n}\ntext|tracked-changes {\n /*Consumers that do not support change tracking, should ignore changes.*/\n display: none;\n}\noffice|binary-data {\n display: none;\n}\noffice|text {\n display: block;\n width: 216mm; /* default to A4 width */\n min-height: 279mm;\n padding-left: 32mm;\n padding-right: 32mm;\n padding-top: 25mm;\n padding-bottom: 13mm;\n margin: 2px;\n text-align: left;\n overflow: hidden;\n}\noffice|spreadsheet {\n display: block;\n border-collapse: collapse;\n empty-cells: show;\n font-family: sans-serif;\n font-size: 10pt;\n text-align: left;\n page-break-inside: avoid;\n overflow: hidden;\n}\noffice|presentation {\n display: inline-block;\n text-align: left;\n}\ndraw|page {\n display: block;\n height: 21cm;\n width: 28cm;\n margin: 3px;\n position: relative;\n overflow: hidden;\n}\npresentation|notes {\n display: none;\n}\n@media print {\n draw|page {\n border: 1pt solid black;\n page-break-inside: avoid;\n }\n presentation|notes {\n /*TODO*/\n }\n}\noffice|spreadsheet text|p {\n border: 0px;\n padding: 1px;\n margin: 0px;\n}\noffice|spreadsheet table|table {\n margin: 3px;\n}\noffice|spreadsheet table|table:after {\n /* show sheet name the end of the sheet */\n /*content: attr(table|name);*/ /* gives parsing error in opera */\n}\noffice|spreadsheet table|table-row {\n counter-increment: row;\n}\noffice|spreadsheet table|table-row:before {\n width: 3em;\n background: #cccccc;\n border: 1px solid black;\n text-align: center;\n content: counter(row);\n display: table-cell;\n}\noffice|spreadsheet table|table-cell {\n border: 1px solid #cccccc;\n}\ntable|table {\n display: table;\n}\ndraw|frame table|table {\n width: 100%;\n height: 100%;\n background: white;\n}\ntable|table-header-rows {\n display: table-header-group;\n}\ntable|table-row {\n display: table-row;\n}\ntable|table-column {\n display: table-column;\n}\ntable|table-cell {\n width: 0.889in;\n display: table-cell;\n}\ndraw|frame {\n display: block;\n}\ndraw|image {\n display: block;\n width: 100%;\n height: 100%;\n top: 0px;\n left: 0px;\n background-repeat: no-repeat;\n background-size: 100% 100%;\n -moz-background-size: 100% 100%;\n}\n/* only show the first image in frame */\ndraw|frame > draw|image:nth-of-type(n+2) {\n display: none;\n}\ntext|list:before {\n display: none;\n content:\"\";\n}\ntext|list {\n counter-reset: list;\n}\ntext|list-item {\n display: block;\n}\ntext|number {\n display:none;\n}\n\ntext|a {\n color: blue;\n text-decoration: underline;\n cursor: pointer;\n}\ntext|note-citation {\n vertical-align: super;\n font-size: smaller;\n}\ntext|note-body {\n display: none;\n}\ntext|note:hover text|note-citation {\n background: #dddddd;\n}\ntext|note:hover text|note-body {\n display: block;\n left:1em;\n max-width: 80%;\n position: absolute;\n background: #ffffaa;\n}\nsvg|title, svg|desc {\n display: none;\n}\nvideo {\n width: 100%;\n height: 100%\n}\n\n/* below set up the cursor */\ncursor|cursor {\n display: inline;\n width: 0px;\n height: 1em;\n /* making the position relative enables the avatar to use\n the cursor as reference for its absolute position */\n position: relative;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n height: 1em;\n border-left: 2px solid black;\n outline: none;\n}\n\ncursor|cursor > div {\n padding: 3px;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n border: none !important;\n border-radius: 5px;\n opacity: 0.3;\n}\n\ncursor|cursor > div > img {\n border-radius: 5px;\n}\n\ncursor|cursor > div.active {\n opacity: 0.8;\n}\n\ncursor|cursor > div:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 43%;\n}\n\n\n.editInfoMarker {\n position: absolute;\n width: 10px;\n height: 100%;\n left: -20px;\n opacity: 0.8;\n top: 0;\n border-radius: 5px;\n background-color: transparent;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n}\n.editInfoMarker:hover {\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);\n}\n\n.editInfoHandle {\n position: absolute;\n background-color: black;\n padding: 5px;\n border-radius: 5px;\n opacity: 0.8;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n bottom: 100%;\n margin-bottom: 10px;\n z-index: 3;\n left: -25px;\n}\n.editInfoHandle:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 5px;\n}\n.editInfo {\n font-family: sans-serif;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n color: white;\n width: 100%;\n height: 12pt;\n}\n.editInfoColor {\n float: left;\n width: 10pt;\n height: 10pt;\n border: 1px solid white;\n}\n.editInfoAuthor {\n float: left;\n margin-left: 5pt;\n font-size: 10pt;\n text-align: left;\n height: 12pt;\n line-height: 12pt;\n}\n.editInfoTime {\n float: right;\n margin-left: 30pt;\n font-size: 8pt;\n font-style: italic;\n color: yellow;\n height: 12pt;\n line-height: 12pt;\n}\n";
+
diff --git a/files_odfviewer/js/webodf.js b/files_odfviewer/js/webodf.js
index 1b8552726..2c381a836 100644
--- a/files_odfviewer/js/webodf.js
+++ b/files_odfviewer/js/webodf.js
@@ -1,6 +1,9 @@
// Input 0
/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
@licstart
The JavaScript code in this page is free software: you can redistribute it
and/or modify it under the terms of the GNU Affero General Public License
@@ -29,177 +32,201 @@
This license applies to this entire compilation.
@licend
@source: http://www.webodf.org/
- @source: http://gitorious.org/odfkit/webodf/
+ @source: http://gitorious.org/webodf/webodf/
*/
-var core={},gui={},xmldom={},odf={};
+var core={},gui={},xmldom={},odf={},ops={};
// Input 1
-function Runtime(){}Runtime.ByteArray=function(){};Runtime.ByteArray.prototype.slice=function(){};Runtime.prototype.byteArrayFromArray=function(){};Runtime.prototype.byteArrayFromString=function(){};Runtime.prototype.byteArrayToString=function(){};Runtime.prototype.concatByteArrays=function(){};Runtime.prototype.read=function(){};Runtime.prototype.readFile=function(){};Runtime.prototype.readFileSync=function(){};Runtime.prototype.loadXML=function(){};Runtime.prototype.writeFile=function(){};
-Runtime.prototype.isFile=function(){};Runtime.prototype.getFileSize=function(){};Runtime.prototype.deleteFile=function(){};Runtime.prototype.log=function(){};Runtime.prototype.setTimeout=function(){};Runtime.prototype.libraryPaths=function(){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.getWindow=function(){};var IS_COMPILED_CODE=!0;
-Runtime.byteArrayToString=function(j,l){function f(c){var b="",d,a=c.length;for(d=0;d<a;d+=1)b+=String.fromCharCode(c[d]&255);return b}function g(c){var b="",d,a=c.length,e,i,h;for(d=0;d<a;d+=1)e=c[d],128>e?b+=String.fromCharCode(e):(d+=1,i=c[d],224>e?b+=String.fromCharCode((e&31)<<6|i&63):(d+=1,h=c[d],b+=String.fromCharCode((e&15)<<12|(i&63)<<6|h&63)));return b}var a;"utf8"===l?a=g(j):("binary"!==l&&this.log("Unsupported encoding: "+l),a=f(j));return a};
-Runtime.getFunctionName=function(j){return void 0===j.name?(j=/function\s+(\w+)/.exec(j))&&j[1]:j.name};
-function BrowserRuntime(j){function l(c,b){var d,a,e;b?e=c:b=c;j?(a=j.ownerDocument,e&&(d=a.createElement("span"),d.className=e,d.appendChild(a.createTextNode(e)),j.appendChild(d),j.appendChild(a.createTextNode(" "))),d=a.createElement("span"),d.appendChild(a.createTextNode(b)),j.appendChild(d),j.appendChild(a.createElement("br"))):console&&console.log(b)}var f=this,g={},a=window.ArrayBuffer&&window.Uint8Array;this.ByteArray=a?function(c){Uint8Array.prototype.slice=function(b,c){void 0===c&&(void 0===
-b&&(b=0),c=this.length);var a=this.subarray(b,c),e,i,c=c-b;e=new Uint8Array(new ArrayBuffer(c));for(i=0;i<c;i+=1)e[i]=a[i];return e};return new Uint8Array(new ArrayBuffer(c))}:function(c){var b=[];b.length=c;return b};this.concatByteArrays=a?function(c,b){var d,a=c.length,e=b.length,i=new this.ByteArray(a+e);for(d=0;d<a;d+=1)i[d]=c[d];for(d=0;d<e;d+=1)i[d+a]=b[d];return i}:function(c,b){return c.concat(b)};this.byteArrayFromArray=function(c){return c.slice()};this.byteArrayFromString=function(c,b){var d;
-if("utf8"===b){d=c.length;var a,e,i,h=0;for(e=0;e<d;e+=1)i=c.charCodeAt(e),h+=1+(128<i)+(2048<i);a=new f.ByteArray(h);for(e=h=0;e<d;e+=1)i=c.charCodeAt(e),128>i?(a[h]=i,h+=1):2048>i?(a[h]=192|i>>>6,a[h+1]=128|i&63,h+=2):(a[h]=224|i>>>12&15,a[h+1]=128|i>>>6&63,a[h+2]=128|i&63,h+=3)}else{"binary"!==b&&f.log("unknown encoding: "+b);d=c.length;a=new f.ByteArray(d);for(e=0;e<d;e+=1)a[e]=c.charCodeAt(e)&255}return d=a};this.byteArrayToString=Runtime.byteArrayToString;this.readFile=function(c,b,d){if(g.hasOwnProperty(c))d(null,
-g[c]);else{var a=new XMLHttpRequest;a.open("GET",c,!0);a.onreadystatechange=function(){var e;4===a.readyState&&(0===a.status&&!a.responseText?d("File "+c+" is empty."):200===a.status||0===a.status?(e="binary"===b?"undefined"!==typeof VBArray?(new VBArray(a.responseBody)).toArray():f.byteArrayFromString(a.responseText,"binary"):a.responseText,g[c]=e,d(null,e)):d(a.responseText||a.statusText))};a.overrideMimeType&&("binary"!==b?a.overrideMimeType("text/plain; charset="+b):a.overrideMimeType("text/plain; charset=x-user-defined"));
-try{a.send(null)}catch(e){d(e.message)}}};this.read=function(c,b,a,k){if(g.hasOwnProperty(c))k(null,g[c].slice(b,b+a));else{var e=new XMLHttpRequest;e.open("GET",c,!0);e.onreadystatechange=function(){var i;4===e.readyState&&(0===e.status&&!e.responseText?k("File "+c+" is empty."):200===e.status||0===e.status?(i="undefined"!==typeof VBArray?(new VBArray(e.responseBody)).toArray():f.byteArrayFromString(e.responseText,"binary"),g[c]=i,k(null,i.slice(b,b+a))):k(e.responseText||e.statusText))};e.overrideMimeType&&
-e.overrideMimeType("text/plain; charset=x-user-defined");try{e.send(null)}catch(i){k(i.message)}}};this.readFileSync=function(c,b){var a=new XMLHttpRequest,k;a.open("GET",c,!1);a.overrideMimeType&&("binary"!==b?a.overrideMimeType("text/plain; charset="+b):a.overrideMimeType("text/plain; charset=x-user-defined"));try{if(a.send(null),200===a.status||0===a.status)k=a.responseText}catch(e){}return k};this.writeFile=function(c,b,a){g[c]=b;var k=new XMLHttpRequest;k.open("PUT",c,!0);k.onreadystatechange=
-function(){4===k.readyState&&(0===k.status&&!k.responseText?a("File "+c+" is empty."):200<=k.status&&300>k.status||0===k.status?a(null):a("Status "+k.status+": "+k.responseText||k.statusText))};b=b.buffer&&!k.sendAsBinary?b.buffer:f.byteArrayToString(b,"binary");try{k.sendAsBinary?k.sendAsBinary(b):k.send(b)}catch(e){f.log("HUH? "+e+" "+b),a(e.message)}};this.deleteFile=function(a,b){var d=new XMLHttpRequest;d.open("DELETE",a,!0);d.onreadystatechange=function(){4===d.readyState&&(200>d.status&&300<=
-d.status?b(d.responseText):b(null))};d.send(null)};this.loadXML=function(a,b){var d=new XMLHttpRequest;d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){4===d.readyState&&(0===d.status&&!d.responseText?b("File "+a+" is empty."):200===d.status||0===d.status?b(null,d.responseXML):b(d.responseText))};try{d.send(null)}catch(k){b(k.message)}};this.isFile=function(a,b){f.getFileSize(a,function(a){b(-1!==a)})};this.getFileSize=function(a,b){var d=new XMLHttpRequest;
-d.open("HEAD",a,!0);d.onreadystatechange=function(){if(4===d.readyState){var a=d.getResponseHeader("Content-Length");a?b(parseInt(a,10)):b(-1)}};d.send(null)};this.log=l;this.setTimeout=function(a,b){setTimeout(function(){a()},b)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.exit=function(a){l("Calling exit with code "+a+", but exit() is not implemented.")};
-this.getWindow=function(){return window}}
-function NodeJSRuntime(){var j=require("fs"),l="";this.ByteArray=function(f){return new Buffer(f)};this.byteArrayFromArray=function(f){var g=new Buffer(f.length),a,c=f.length;for(a=0;a<c;a+=1)g[a]=f[a];return g};this.concatByteArrays=function(f,g){var a=new Buffer(f.length+g.length);f.copy(a,0,0);g.copy(a,f.length,0);return a};this.byteArrayFromString=function(f,g){return new Buffer(f,g)};this.byteArrayToString=function(f,g){return f.toString(g)};this.readFile=function(f,g,a){"binary"!==g?j.readFile(f,
-g,a):j.readFile(f,null,a)};this.writeFile=function(f,g,a){j.writeFile(f,g,"binary",function(c){a(c||null)})};this.deleteFile=j.unlink;this.read=function(f,g,a,c){l&&(f=l+"/"+f);j.open(f,"r+",666,function(b,d){if(b)c(b);else{var k=new Buffer(a);j.read(d,k,0,a,g,function(a){j.close(d);c(a,k)})}})};this.readFileSync=function(f,g){return!g?"":j.readFileSync(f,g)};this.loadXML=function(){throw"Not implemented.";};this.isFile=function(f,g){l&&(f=l+"/"+f);j.stat(f,function(a,c){g(!a&&c.isFile())})};this.getFileSize=
-function(f,g){l&&(f=l+"/"+f);j.stat(f,function(a,c){a?g(-1):g(c.size)})};this.log=function(f){process.stderr.write(f+"\n")};this.setTimeout=function(f,g){setTimeout(function(){f()},g)};this.libraryPaths=function(){return[__dirname]};this.setCurrentDirectory=function(f){l=f};this.currentDirectory=function(){return l};this.type=function(){return"NodeJSRuntime"};this.getDOMImplementation=function(){return null};this.exit=process.exit;this.getWindow=function(){return null}}
-function RhinoRuntime(){var j=this,l=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),f,g,a="";l.setValidating(!1);l.setNamespaceAware(!0);l.setExpandEntityReferences(!1);l.setSchema(null);g=Packages.org.xml.sax.EntityResolver({resolveEntity:function(a,b){var d=new Packages.java.io.FileReader(b);return new Packages.org.xml.sax.InputSource(d)}});f=l.newDocumentBuilder();f.setEntityResolver(g);this.ByteArray=function(a){return[a]};this.byteArrayFromArray=function(a){return a};this.byteArrayFromString=
-function(a){var b=[],d,k=a.length;for(d=0;d<k;d+=1)b[d]=a.charCodeAt(d)&255;return b};this.byteArrayToString=Runtime.byteArrayToString;this.concatByteArrays=function(a,b){return a.concat(b)};this.loadXML=function(a,b){var d=new Packages.java.io.File(a),k;try{k=f.parse(d)}catch(e){print(e);b(e);return}b(null,k)};this.readFile=function(a,b,d){var k=new Packages.java.io.File(a),e="binary"===b?"latin1":b;k.isFile()?(a=readFile(a,e),"binary"===b&&(a=j.byteArrayFromString(a,"binary")),d(null,a)):d(a+" is not a file.")};
-this.writeFile=function(a,b,d){var a=new Packages.java.io.FileOutputStream(a),k,e=b.length;for(k=0;k<e;k+=1)a.write(b[k]);a.close();d(null)};this.deleteFile=function(a,b){(new Packages.java.io.File(a))["delete"]()?b(null):b("Could not delete "+a)};this.read=function(c,b,d,k){a&&(c=a+"/"+c);var e;e=c;var i="binary";(new Packages.java.io.File(e)).isFile()?("binary"===i&&(i="latin1"),e=readFile(e,i)):e=null;e?k(null,this.byteArrayFromString(e.substring(b,b+d),"binary")):k("Cannot read "+c)};this.readFileSync=
-function(a,b){return!b?"":readFile(a,b)};this.isFile=function(c,b){a&&(c=a+"/"+c);var d=new Packages.java.io.File(c);b(d.isFile())};this.getFileSize=function(c,b){a&&(c=a+"/"+c);var d=new Packages.java.io.File(c);b(d.length())};this.log=print;this.setTimeout=function(a){a()};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(c){a=c};this.currentDirectory=function(){return a};this.type=function(){return"RhinoRuntime"};this.getDOMImplementation=function(){return f.getDOMImplementation()};
-this.exit=quit;this.getWindow=function(){return null}}var runtime=function(){return"undefined"!==typeof window?new BrowserRuntime(window.document.getElementById("logoutput")):"undefined"!==typeof require?new NodeJSRuntime:new RhinoRuntime}();
-(function(){function j(f){var a=f[0],c;c=eval("if (typeof "+a+" === 'undefined') {eval('"+a+" = {};');}"+a);for(a=1;a<f.length-1;a+=1)c.hasOwnProperty(f[a])||(c=c[f[a]]={});return c[f[f.length-1]]}var l={},f={};runtime.loadClass=function(g){function a(a){var a=a.replace(".","/")+".js",b=runtime.libraryPaths(),e,c,h;runtime.currentDirectory&&b.push(runtime.currentDirectory());for(e=0;e<b.length;e+=1){c=b[e];if(!f.hasOwnProperty(c))if((h=runtime.readFileSync(b[e]+"/manifest.js","utf8"))&&h.length)try{f[c]=
-eval(h)}catch(n){f[c]=null,runtime.log("Cannot load manifest for "+c+".")}else f[c]=null;if((c=f[c])&&c.indexOf&&-1!==c.indexOf(a))return b[e]+"/"+a}return null}if(!IS_COMPILED_CODE&&!l.hasOwnProperty(g)){var c=g.split("."),b;b=j(c);if(!b&&(b=function(b){var c,e;e=a(b);if(!e)throw b+" is not listed in any manifest.js.";try{c=runtime.readFileSync(e,"utf8")}catch(i){throw runtime.log("Error loading "+b+" "+i),i;}if(void 0===c)throw"Cannot load class "+b;try{c=eval(b+" = eval(code);")}catch(h){throw runtime.log("Error loading "+
-b+" "+h),h;}return c}(g),!b||Runtime.getFunctionName(b)!==c[c.length-1]))throw runtime.log("Loaded code is not for "+c[c.length-1]),"Loaded code is not for "+c[c.length-1];l[g]=!0}}})();
-(function(j){function l(f){if(f.length){var g=f[0];runtime.readFile(g,"utf8",function(a,c){function b(){var a;(a=eval(c))&&runtime.exit(a)}var d="";runtime.libraryPaths();-1!==g.indexOf("/")&&(d=g.substring(0,g.indexOf("/")));runtime.setCurrentDirectory(d);a?(runtime.log(a),runtime.exit(1)):b.apply(null,f)})}}j=Array.prototype.slice.call(j);"NodeJSRuntime"===runtime.type()?l(process.argv.slice(2)):"RhinoRuntime"===runtime.type()?l(j):l(j.slice(1))})("undefined"!==typeof arguments&&arguments);
+function Runtime(){}Runtime.ByteArray=function(){};Runtime.prototype.getVariable=function(){};Runtime.prototype.toJson=function(){};Runtime.prototype.fromJson=function(){};Runtime.ByteArray.prototype.slice=function(){};Runtime.ByteArray.prototype.length=0;Runtime.prototype.byteArrayFromArray=function(){};Runtime.prototype.byteArrayFromString=function(){};Runtime.prototype.byteArrayToString=function(){};Runtime.prototype.concatByteArrays=function(){};Runtime.prototype.read=function(){};
+Runtime.prototype.readFile=function(){};Runtime.prototype.readFileSync=function(){};Runtime.prototype.loadXML=function(){};Runtime.prototype.writeFile=function(){};Runtime.prototype.isFile=function(){};Runtime.prototype.getFileSize=function(){};Runtime.prototype.deleteFile=function(){};Runtime.prototype.log=function(){};Runtime.prototype.setTimeout=function(){};Runtime.prototype.libraryPaths=function(){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};
+Runtime.prototype.parseXML=function(){};Runtime.prototype.getWindow=function(){};Runtime.prototype.assert=function(){};var IS_COMPILED_CODE=!0;
+Runtime.byteArrayToString=function(g,k){var m;if("utf8"===k){m="";var f,e=g.length,c,a,b;for(f=0;f<e;f+=1)c=g[f],128>c?m+=String.fromCharCode(c):(f+=1,a=g[f],224>c?m+=String.fromCharCode((c&31)<<6|a&63):(f+=1,b=g[f],m+=String.fromCharCode((c&15)<<12|(a&63)<<6|b&63)))}else{"binary"!==k&&this.log("Unsupported encoding: "+k);m="";e=g.length;for(f=0;f<e;f+=1)m+=String.fromCharCode(g[f]&255)}return m};Runtime.getVariable=function(g){try{return eval(g)}catch(k){}};Runtime.toJson=function(g){return JSON.stringify(g)};
+Runtime.fromJson=function(g){return JSON.parse(g)};Runtime.getFunctionName=function(g){return void 0===g.name?(g=/function\s+(\w+)/.exec(g))&&g[1]:g.name};
+function BrowserRuntime(g){function k(c,a){var b,h,d;void 0!==a?d=c:a=c;g?(h=g.ownerDocument,d&&(b=h.createElement("span"),b.className=d,b.appendChild(h.createTextNode(d)),g.appendChild(b),g.appendChild(h.createTextNode(" "))),b=h.createElement("span"),b.appendChild(h.createTextNode(a)),g.appendChild(b),g.appendChild(h.createElement("br"))):console&&console.log(a);"alert"===d&&alert(a)}var m=this,f={},e=window.ArrayBuffer&&window.Uint8Array;this.ByteArray=e?function(c){Uint8Array.prototype.slice=
+function(a,b){void 0===b&&(void 0===a&&(a=0),b=this.length);var h=this.subarray(a,b),d,l;b-=a;d=new Uint8Array(new ArrayBuffer(b));for(l=0;l<b;l+=1)d[l]=h[l];return d};return new Uint8Array(new ArrayBuffer(c))}:function(c){var a=[];a.length=c;return a};this.concatByteArrays=e?function(c,a){var b,h=c.length,d=a.length,l=new this.ByteArray(h+d);for(b=0;b<h;b+=1)l[b]=c[b];for(b=0;b<d;b+=1)l[b+h]=a[b];return l}:function(c,a){return c.concat(a)};this.byteArrayFromArray=function(c){return c.slice()};this.byteArrayFromString=
+function(c,a){var b;if("utf8"===a){b=c.length;var h,d,l,e=0;for(d=0;d<b;d+=1)l=c.charCodeAt(d),e+=1+(128<l)+(2048<l);h=new m.ByteArray(e);for(d=e=0;d<b;d+=1)l=c.charCodeAt(d),128>l?(h[e]=l,e+=1):2048>l?(h[e]=192|l>>>6,h[e+1]=128|l&63,e+=2):(h[e]=224|l>>>12&15,h[e+1]=128|l>>>6&63,h[e+2]=128|l&63,e+=3)}else{"binary"!==a&&m.log("unknown encoding: "+a);b=c.length;h=new m.ByteArray(b);for(d=0;d<b;d+=1)h[d]=c.charCodeAt(d)&255}return b=h};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=
+Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=function(c,a,b){function h(){var h;4===d.readyState&&(0===d.status&&!d.responseText?b("File "+c+" is empty."):200===d.status||0===d.status?(h="binary"===a?"undefined"!==String(typeof VBArray)?(new VBArray(d.responseBody)).toArray():m.byteArrayFromString(d.responseText,"binary"):d.responseText,f[c]=h,b(null,h)):b(d.responseText||d.statusText))}if(f.hasOwnProperty(c))b(null,f[c]);else{var d=new XMLHttpRequest;
+d.open("GET",c,!0);d.onreadystatechange=h;d.overrideMimeType&&("binary"!==a?d.overrideMimeType("text/plain; charset="+a):d.overrideMimeType("text/plain; charset=x-user-defined"));try{d.send(null)}catch(l){b(l.message)}}};this.read=function(c,a,b,h){function d(){var d;4===l.readyState&&(0===l.status&&!l.responseText?h("File "+c+" is empty."):200===l.status||0===l.status?(d="undefined"!==String(typeof VBArray)?(new VBArray(l.responseBody)).toArray():m.byteArrayFromString(l.responseText,"binary"),f[c]=
+d,h(null,d.slice(a,a+b))):h(l.responseText||l.statusText))}if(f.hasOwnProperty(c))h(null,f[c].slice(a,a+b));else{var l=new XMLHttpRequest;l.open("GET",c,!0);l.onreadystatechange=d;l.overrideMimeType&&l.overrideMimeType("text/plain; charset=x-user-defined");try{l.send(null)}catch(e){h(e.message)}}};this.readFileSync=function(c,a){var b=new XMLHttpRequest,h;b.open("GET",c,!1);b.overrideMimeType&&("binary"!==a?b.overrideMimeType("text/plain; charset="+a):b.overrideMimeType("text/plain; charset=x-user-defined"));
+try{if(b.send(null),200===b.status||0===b.status)h=b.responseText}catch(d){}return h};this.writeFile=function(c,a,b){f[c]=a;var h=new XMLHttpRequest;h.open("PUT",c,!0);h.onreadystatechange=function(){4===h.readyState&&(0===h.status&&!h.responseText?b("File "+c+" is empty."):200<=h.status&&300>h.status||0===h.status?b(null):b("Status "+String(h.status)+": "+h.responseText||h.statusText))};a=a.buffer&&!h.sendAsBinary?a.buffer:m.byteArrayToString(a,"binary");try{h.sendAsBinary?h.sendAsBinary(a):h.send(a)}catch(d){m.log("HUH? "+
+d+" "+a),b(d.message)}};this.deleteFile=function(c,a){delete f[c];var b=new XMLHttpRequest;b.open("DELETE",c,!0);b.onreadystatechange=function(){4===b.readyState&&(200>b.status&&300<=b.status?a(b.responseText):a(null))};b.send(null)};this.loadXML=function(c,a){var b=new XMLHttpRequest;b.open("GET",c,!0);b.overrideMimeType&&b.overrideMimeType("text/xml");b.onreadystatechange=function(){4===b.readyState&&(0===b.status&&!b.responseText?a("File "+c+" is empty."):200===b.status||0===b.status?a(null,b.responseXML):
+a(b.responseText))};try{b.send(null)}catch(h){a(h.message)}};this.isFile=function(c,a){m.getFileSize(c,function(b){a(-1!==b)})};this.getFileSize=function(c,a){var b=new XMLHttpRequest;b.open("HEAD",c,!0);b.onreadystatechange=function(){if(4===b.readyState){var h=b.getResponseHeader("Content-Length");h?a(parseInt(h,10)):a(-1)}};b.send(null)};this.log=k;this.assert=function(c,a,b){if(!c)throw k("alert","ASSERTION FAILED:\n"+a),b&&b(),a;};this.setTimeout=function(c,a){setTimeout(function(){c()},a)};
+this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(c){return(new DOMParser).parseFromString(c,"text/xml")};this.exit=function(c){k("Calling exit with code "+String(c)+", but exit() is not implemented.")};this.getWindow=function(){return window};this.getNetwork=function(){var c=this.getVariable("now");return void 0===c?{networkStatus:"unavailable"}:
+c}}
+function NodeJSRuntime(){function g(b,a,d){b=f.resolve(e,b);"binary"!==a?m.readFile(b,a,d):m.readFile(b,null,d)}var k=this,m=require("fs"),f=require("path"),e="",c,a;this.ByteArray=function(b){return new Buffer(b)};this.byteArrayFromArray=function(b){var a=new Buffer(b.length),d,l=b.length;for(d=0;d<l;d+=1)a[d]=b[d];return a};this.concatByteArrays=function(b,a){var d=new Buffer(b.length+a.length);b.copy(d,0,0);a.copy(d,b.length,0);return d};this.byteArrayFromString=function(b,a){return new Buffer(b,a)};
+this.byteArrayToString=function(b,a){return b.toString(a)};this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=g;this.loadXML=function(b,a){g(b,"utf-8",function(d,b){if(d)return a(d);a(null,k.parseXML(b))})};this.writeFile=function(b,a,d){b=f.resolve(e,b);m.writeFile(b,a,"binary",function(b){d(b||null)})};this.deleteFile=function(b,a){b=f.resolve(e,b);m.unlink(b,a)};this.read=function(b,a,d,l){b=f.resolve(e,b);m.open(b,"r+",666,function(b,c){if(b)l(b);
+else{var j=new Buffer(d);m.read(c,j,0,d,a,function(d){m.close(c);l(d,j)})}})};this.readFileSync=function(b,a){return!a?"":"binary"===a?m.readFileSync(b,null):m.readFileSync(b,a)};this.isFile=function(b,a){b=f.resolve(e,b);m.stat(b,function(d,b){a(!d&&b.isFile())})};this.getFileSize=function(b,a){b=f.resolve(e,b);m.stat(b,function(d,b){d?a(-1):a(b.size)})};this.log=function(b,a){var d;void 0!==a?d=b:a=b;"alert"===d&&process.stderr.write("\n!!!!! ALERT !!!!!\n");process.stderr.write(a+"\n");"alert"===
+d&&process.stderr.write("!!!!! ALERT !!!!!\n")};this.assert=function(b,a,d){b||(process.stderr.write("ASSERTION FAILED: "+a),d&&d())};this.setTimeout=function(b,a){setTimeout(function(){b()},a)};this.libraryPaths=function(){return[__dirname]};this.setCurrentDirectory=function(b){e=b};this.currentDirectory=function(){return e};this.type=function(){return"NodeJSRuntime"};this.getDOMImplementation=function(){return a};this.parseXML=function(b){return c.parseFromString(b,"text/xml")};this.exit=process.exit;
+this.getWindow=function(){return null};this.getNetwork=function(){return{networkStatus:"unavailable"}};c=new (require("xmldom").DOMParser);a=k.parseXML("<a/>").implementation}
+function RhinoRuntime(){function g(a,b){var c;void 0!==b?c=a:b=a;"alert"===c&&print("\n!!!!! ALERT !!!!!");print(b);"alert"===c&&print("!!!!! ALERT !!!!!")}var k=this,m=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),f,e,c="";m.setValidating(!1);m.setNamespaceAware(!0);m.setExpandEntityReferences(!1);m.setSchema(null);e=Packages.org.xml.sax.EntityResolver({resolveEntity:function(a,b){var c=new Packages.java.io.FileReader(b);return new Packages.org.xml.sax.InputSource(c)}});f=m.newDocumentBuilder();
+f.setEntityResolver(e);this.ByteArray=function(a){return[a]};this.byteArrayFromArray=function(a){return a};this.byteArrayFromString=function(a){var b=[],c,d=a.length;for(c=0;c<d;c+=1)b[c]=a.charCodeAt(c)&255;return b};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.concatByteArrays=function(a,b){return a.concat(b)};this.loadXML=function(a,b){var c=new Packages.java.io.File(a),d;try{d=f.parse(c)}catch(l){print(l);
+b(l);return}b(null,d)};this.readFile=function(a,b,e){c&&(a=c+"/"+a);var d=new Packages.java.io.File(a),l="binary"===b?"latin1":b;d.isFile()?(a=readFile(a,l),"binary"===b&&(a=k.byteArrayFromString(a,"binary")),e(null,a)):e(a+" is not a file.")};this.writeFile=function(a,b,e){c&&(a=c+"/"+a);a=new Packages.java.io.FileOutputStream(a);var d,l=b.length;for(d=0;d<l;d+=1)a.write(b[d]);a.close();e(null)};this.deleteFile=function(a,b){c&&(a=c+"/"+a);(new Packages.java.io.File(a))["delete"]()?b(null):b("Could not delete "+
+a)};this.read=function(a,b,e,d){c&&(a=c+"/"+a);var l;l=a;var q="binary";(new Packages.java.io.File(l)).isFile()?("binary"===q&&(q="latin1"),l=readFile(l,q)):l=null;l?d(null,this.byteArrayFromString(l.substring(b,b+e),"binary")):d("Cannot read "+a)};this.readFileSync=function(a,b){return!b?"":readFile(a,b)};this.isFile=function(a,b){c&&(a=c+"/"+a);var e=new Packages.java.io.File(a);b(e.isFile())};this.getFileSize=function(a,b){c&&(a=c+"/"+a);var e=new Packages.java.io.File(a);b(e.length())};this.log=
+g;this.assert=function(a,b,c){a||(g("alert","ASSERTION FAILED: "+b),c&&c())};this.setTimeout=function(a){a()};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(a){c=a};this.currentDirectory=function(){return c};this.type=function(){return"RhinoRuntime"};this.getDOMImplementation=function(){return f.getDOMImplementation()};this.parseXML=function(a){return f.parse(a)};this.exit=quit;this.getWindow=function(){return null};this.getNetwork=function(){return{networkStatus:"unavailable"}}}
+var runtime=function(){return"undefined"!==String(typeof window)?new BrowserRuntime(window.document.getElementById("logoutput")):"undefined"!==String(typeof require)?new NodeJSRuntime:new RhinoRuntime}();
+(function(){function g(f){var e=f[0],c;c=eval("if (typeof "+e+" === 'undefined') {eval('"+e+" = {};');}"+e);for(e=1;e<f.length-1;e+=1)c.hasOwnProperty(f[e])||(c=c[f[e]]={});return c[f[f.length-1]]}var k={},m={};runtime.loadClass=function(f){function e(b){b=b.replace(".","/")+".js";var d=runtime.libraryPaths(),a,c,e;runtime.currentDirectory&&d.push(runtime.currentDirectory());for(a=0;a<d.length;a+=1){c=d[a];if(!m.hasOwnProperty(c))if((e=runtime.readFileSync(d[a]+"/manifest.js","utf8"))&&e.length)try{m[c]=
+eval(e)}catch(j){m[c]=null,runtime.log("Cannot load manifest for "+c+".")}else m[c]=null;if((c=m[c])&&c.indexOf&&-1!==c.indexOf(b))return d[a]+"/"+b}return null}function c(b){var d,a;a=e(b);if(!a)throw b+" is not listed in any manifest.js.";try{d=runtime.readFileSync(a,"utf8")}catch(c){throw runtime.log("Error loading "+b+" "+c),c;}if(void 0===d)throw"Cannot load class "+b;try{d=eval(b+" = eval(code);")}catch(p){throw runtime.log("Error loading "+b+" "+p),p;}return d}if(!IS_COMPILED_CODE&&!k.hasOwnProperty(f)){var a=
+f.split("."),b;b=g(a);if(!b&&(b=c(f),!b||Runtime.getFunctionName(b)!==a[a.length-1]))throw runtime.log("Loaded code is not for "+a[a.length-1]),"Loaded code is not for "+a[a.length-1];k[f]=!0}}})();
+(function(g){function k(g){if(g.length){var f=g[0];runtime.readFile(f,"utf8",function(e,c){function a(){var d;(d=eval(h))&&runtime.exit(d)}var b="";runtime.libraryPaths();var h=c;-1!==f.indexOf("/")&&(b=f.substring(0,f.indexOf("/")));runtime.setCurrentDirectory(b);e||null===h?(runtime.log(e),runtime.exit(1)):a.apply(null,g)})}}g=g?Array.prototype.slice.call(g):[];"NodeJSRuntime"===runtime.type()?k(process.argv.slice(2)):"RhinoRuntime"===runtime.type()?k(g):k(g.slice(1))})("undefined"!==String(typeof arguments)&&
+arguments);
// Input 2
-core.Base64=function(){function j(a){var b=[],c,e=a.length;for(c=0;c<e;c+=1)b[c]=a.charCodeAt(c)&255;return b}function l(a){var b,c="",e,d=a.length-2;for(e=0;e<d;e+=3)b=a[e]<<16|a[e+1]<<8|a[e+2],c+=u[b>>>18],c+=u[b>>>12&63],c+=u[b>>>6&63],c+=u[b&63];e===d+1?(b=a[e]<<4,c+=u[b>>>6],c+=u[b&63],c+="=="):e===d&&(b=a[e]<<10|a[e+1]<<2,c+=u[b>>>12],c+=u[b>>>6&63],c+=u[b&63],c+="=");return c}function f(a){var a=a.replace(/[^A-Za-z0-9+\/]+/g,""),b=[],c=a.length%4,e,d=a.length,i;for(e=0;e<d;e+=4)i=(s[a.charAt(e)]||
-0)<<18|(s[a.charAt(e+1)]||0)<<12|(s[a.charAt(e+2)]||0)<<6|(s[a.charAt(e+3)]||0),b.push(i>>16,i>>8&255,i&255);b.length-=[0,0,2,1][c];return b}function g(a){var b=[],c,e=a.length,d;for(c=0;c<e;c+=1)d=a[c],128>d?b.push(d):2048>d?b.push(192|d>>>6,128|d&63):b.push(224|d>>>12&15,128|d>>>6&63,128|d&63);return b}function a(a){var b=[],c,e=a.length,d,i,m;for(c=0;c<e;c+=1)d=a[c],128>d?b.push(d):(c+=1,i=a[c],224>d?b.push((d&31)<<6|i&63):(c+=1,m=a[c],b.push((d&15)<<12|(i&63)<<6|m&63)));return b}function c(a){return l(j(a))}
-function b(a){return String.fromCharCode.apply(String,f(a))}function d(b){return a(j(b))}function k(b){for(var b=a(b),c="",e=0;e<b.length;)c+=String.fromCharCode.apply(String,b.slice(e,e+45E3)),e+=45E3;return c}function e(a,b,c){var e="",d,i,m;for(m=b;m<c;m+=1)b=a.charCodeAt(m)&255,128>b?e+=String.fromCharCode(b):(m+=1,d=a.charCodeAt(m)&255,224>b?e+=String.fromCharCode((b&31)<<6|d&63):(m+=1,i=a.charCodeAt(m)&255,e+=String.fromCharCode((b&15)<<12|(d&63)<<6|i&63)));return e}function i(a,b){function c(){var m=
-n+d;m>a.length&&(m=a.length);i+=e(a,n,m);n=m;m=n===a.length;b(i,m)&&!m&&runtime.setTimeout(c,0)}var d=1E5,i="",n=0;a.length<d?b(e(a,0,a.length),!0):("string"!==typeof a&&(a=a.slice()),c())}function h(a){return g(j(a))}function n(a){return String.fromCharCode.apply(String,g(a))}function o(a){return String.fromCharCode.apply(String,g(j(a)))}var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(){var a=[],b;for(b=0;26>b;b+=1)a.push(65+b);for(b=0;26>b;b+=1)a.push(97+b);for(b=
-0;10>b;b+=1)a.push(48+b);a.push(43);a.push(47);return a})();var s=function(a){var b={},c,e;c=0;for(e=a.length;c<e;c+=1)b[a.charAt(c)]=c;return b}(u),p,w,B,A;(B=runtime.getWindow()&&runtime.getWindow().btoa)?p=function(a){return B(o(a))}:(B=c,p=function(a){return l(h(a))});(A=runtime.getWindow()&&runtime.getWindow().atob)?w=function(a){a=A(a);return e(a,0,a.length)}:(A=b,w=function(a){return k(f(a))});return function(){this.convertByteArrayToBase64=this.convertUTF8ArrayToBase64=l;this.convertBase64ToByteArray=
-this.convertBase64ToUTF8Array=f;this.convertUTF16ArrayToByteArray=this.convertUTF16ArrayToUTF8Array=g;this.convertByteArrayToUTF16Array=this.convertUTF8ArrayToUTF16Array=a;this.convertUTF8StringToBase64=c;this.convertBase64ToUTF8String=b;this.convertUTF8StringToUTF16Array=d;this.convertByteArrayToUTF16String=this.convertUTF8ArrayToUTF16String=k;this.convertUTF8StringToUTF16String=i;this.convertUTF16StringToByteArray=this.convertUTF16StringToUTF8Array=h;this.convertUTF16ArrayToUTF8String=n;this.convertUTF16StringToUTF8String=
-o;this.convertUTF16StringToBase64=p;this.convertBase64ToUTF16String=w;this.fromBase64=b;this.toBase64=c;this.atob=A;this.btoa=B;this.utob=o;this.btou=i;this.encode=p;this.encodeURI=function(a){return p(a).replace(/[+\/]/g,function(a){return a==="+"?"-":"_"}).replace(/\\=+$/,"")};this.decode=function(a){return w(a.replace(/[\-_]/g,function(a){return a==="-"?"+":"/"}))}}}();
+core.Base64=function(){function g(d){var b=[],a,c=d.length;for(a=0;a<c;a+=1)b[a]=d.charCodeAt(a)&255;return b}function k(d){var b,a="",c,j=d.length-2;for(c=0;c<j;c+=3)b=d[c]<<16|d[c+1]<<8|d[c+2],a+=r[b>>>18],a+=r[b>>>12&63],a+=r[b>>>6&63],a+=r[b&63];c===j+1?(b=d[c]<<4,a+=r[b>>>6],a+=r[b&63],a+="=="):c===j&&(b=d[c]<<10|d[c+1]<<2,a+=r[b>>>12],a+=r[b>>>6&63],a+=r[b&63],a+="=");return a}function m(d){d=d.replace(/[^A-Za-z0-9+\/]+/g,"");var b=[],a=d.length%4,c,j=d.length,l;for(c=0;c<j;c+=4)l=(x[d.charAt(c)]||
+0)<<18|(x[d.charAt(c+1)]||0)<<12|(x[d.charAt(c+2)]||0)<<6|(x[d.charAt(c+3)]||0),b.push(l>>16,l>>8&255,l&255);b.length-=[0,0,2,1][a];return b}function f(d){var b=[],a,c=d.length,j;for(a=0;a<c;a+=1)j=d[a],128>j?b.push(j):2048>j?b.push(192|j>>>6,128|j&63):b.push(224|j>>>12&15,128|j>>>6&63,128|j&63);return b}function e(d){var b=[],a,c=d.length,j,l,e;for(a=0;a<c;a+=1)j=d[a],128>j?b.push(j):(a+=1,l=d[a],224>j?b.push((j&31)<<6|l&63):(a+=1,e=d[a],b.push((j&15)<<12|(l&63)<<6|e&63)));return b}function c(d){return k(g(d))}
+function a(d){return String.fromCharCode.apply(String,m(d))}function b(d){return e(g(d))}function h(d){d=e(d);for(var b="",a=0;a<d.length;)b+=String.fromCharCode.apply(String,d.slice(a,a+45E3)),a+=45E3;return b}function d(d,b,a){var c="",j,l,e;for(e=b;e<a;e+=1)b=d.charCodeAt(e)&255,128>b?c+=String.fromCharCode(b):(e+=1,j=d.charCodeAt(e)&255,224>b?c+=String.fromCharCode((b&31)<<6|j&63):(e+=1,l=d.charCodeAt(e)&255,c+=String.fromCharCode((b&15)<<12|(j&63)<<6|l&63)));return c}function l(b,a){function c(){var h=
+e+j;h>b.length&&(h=b.length);l+=d(b,e,h);e=h;h=e===b.length;a(l,h)&&!h&&runtime.setTimeout(c,0)}var j=1E5,l="",e=0;b.length<j?a(d(b,0,b.length),!0):("string"!==typeof b&&(b=b.slice()),c())}function q(d){return f(g(d))}function p(d){return String.fromCharCode.apply(String,f(d))}function j(d){return String.fromCharCode.apply(String,f(g(d)))}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=[],w;for(w=0;26>w;w+=1)n.push(65+w);for(w=0;26>w;w+=1)n.push(97+w);for(w=0;10>w;w+=1)n.push(48+
+w);n.push(43);n.push(47);var x,n=r;w={};var v,G;v=0;for(G=n.length;v<G;v+=1)w[n.charAt(v)]=v;x=w;var C,E,u=runtime.getWindow(),s,D;u&&u.btoa?(s=function(d){return u.btoa(d)},C=function(d){return s(j(d))}):(s=c,C=function(d){return k(q(d))});u&&u.atob?(D=function(d){return u.atob(d)},E=function(b){b=D(b);return d(b,0,b.length)}):(D=a,E=function(d){return h(m(d))});return function(){this.convertByteArrayToBase64=this.convertUTF8ArrayToBase64=k;this.convertBase64ToByteArray=this.convertBase64ToUTF8Array=
+m;this.convertUTF16ArrayToByteArray=this.convertUTF16ArrayToUTF8Array=f;this.convertByteArrayToUTF16Array=this.convertUTF8ArrayToUTF16Array=e;this.convertUTF8StringToBase64=c;this.convertBase64ToUTF8String=a;this.convertUTF8StringToUTF16Array=b;this.convertByteArrayToUTF16String=this.convertUTF8ArrayToUTF16String=h;this.convertUTF8StringToUTF16String=l;this.convertUTF16StringToByteArray=this.convertUTF16StringToUTF8Array=q;this.convertUTF16ArrayToUTF8String=p;this.convertUTF16StringToUTF8String=j;
+this.convertUTF16StringToBase64=C;this.convertBase64ToUTF16String=E;this.fromBase64=a;this.toBase64=c;this.atob=D;this.btoa=s;this.utob=j;this.btou=l;this.encode=C;this.encodeURI=function(d){return C(d).replace(/[+\/]/g,function(d){return"+"===d?"-":"_"}).replace(/\\=+$/,"")};this.decode=function(d){return E(d.replace(/[\-_]/g,function(d){return"-"===d?"+":"/"}))}}}();
// Input 3
-core.RawDeflate=function(){function j(){this.dl=this.fc=0}function l(){this.extra_bits=this.static_tree=this.dyn_tree=null;this.max_code=this.max_length=this.elems=this.extra_base=0}function f(a,b,c,e){this.good_length=a;this.max_lazy=b;this.nice_length=c;this.max_chain=e}function g(){this.next=null;this.len=0;this.ptr=[];this.ptr.length=a;this.off=0}var a=8192,c,b,d,k,e=null,i,h,n,o,u,s,p,w,B,A,q,x,E,C,z,F,m,t,r,y,L,T,O,N,v,J,G,R,K,H,D,U,M,I,V,Z,S,$,Y,ha,ca,da,P,ia,pa,aa,ea,W,ba,ja,qa,ra=[0,0,0,
-0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],fa=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Ha=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],va=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ka;ka=[new f(0,0,0,0),new f(4,4,8,4),new f(4,5,16,8),new f(4,6,32,32),new f(4,4,16,16),new f(8,16,32,32),new f(8,16,128,128),new f(8,32,128,256),new f(32,128,258,1024),new f(32,258,258,4096)];var la=function(m){e[h+i++]=m;if(h+i===a){var r;if(0!==i){null!==c?(m=c,c=c.next):m=new g;
-m.next=null;m.len=m.off=0;null===b?b=d=m:d=d.next=m;m.len=i-h;for(r=0;r<m.len;r++)m.ptr[r]=e[h+r];i=h=0}}},ma=function(b){b&=65535;h+i<a-2?(e[h+i++]=b&255,e[h+i++]=b>>>8):(la(b&255),la(b>>>8))},na=function(){q=(q<<5^o[m+3-1]&255)&8191;x=p[32768+q];p[m&32767]=x;p[32768+q]=m},Q=function(a,b){B>16-b?(w|=a<<B,ma(w),w=a>>16-B,B+=b-16):(w|=a<<B,B+=b)},X=function(a,b){Q(b[a].fc,b[a].dl)},wa=function(a,b,c){return a[b].fc<a[c].fc||a[b].fc===a[c].fc&&S[b]<=S[c]},xa=function(a,b,c){var e;for(e=0;e<c&&qa<ja.length;e++)a[b+
-e]=ja.charCodeAt(qa++)&255;return e},sa=function(){var a,b,c=65536-y-m;if(-1===c)c--;else if(65274<=m){for(a=0;32768>a;a++)o[a]=o[a+32768];t-=32768;m-=32768;A-=32768;for(a=0;8192>a;a++)b=p[32768+a],p[32768+a]=32768<=b?b-32768:0;for(a=0;32768>a;a++)b=p[a],p[a]=32768<=b?b-32768:0;c+=32768}r||(a=xa(o,m+y,c),0>=a?r=!0:y+=a)},ya=function(a){var b=L,c=m,e,d=F,i=32506<m?m-32506:0,r=m+258,n=o[c+d-1],h=o[c+d];F>=N&&(b>>=2);do if(e=a,!(o[e+d]!==h||o[e+d-1]!==n||o[e]!==o[c]||o[++e]!==o[c+1])){c+=2;e++;do++c;
-while(o[c]===o[++e]&&o[++c]===o[++e]&&o[++c]===o[++e]&&o[++c]===o[++e]&&o[++c]===o[++e]&&o[++c]===o[++e]&&o[++c]===o[++e]&&o[++c]===o[++e]&&c<r);e=258-(r-c);c=r-258;if(e>d){t=a;d=e;if(258<=e)break;n=o[c+d-1];h=o[c+d]}}while((a=p[a&32767])>i&&0!==--b);return d},ga=function(a,b){s[P++]=b;0===a?v[b].fc++:(a--,v[$[b]+256+1].fc++,J[(256>a?Y[a]:Y[256+(a>>7)])&255].fc++,u[ia++]=a,aa|=ea);ea<<=1;0===(P&7)&&(da[pa++]=aa,aa=0,ea=1);if(2<O&&0===(P&4095)){var c=8*P,e=m-A,d;for(d=0;30>d;d++)c+=J[d].fc*(5+fa[d]);
-c>>=3;if(ia<parseInt(P/2,10)&&c<parseInt(e/2,10))return!0}return 8191===P||8192===ia},ta=function(a,b){for(var c=I[b],e=b<<1;e<=V;){e<V&&wa(a,I[e+1],I[e])&&e++;if(wa(a,c,I[e]))break;I[b]=I[e];b=e;e<<=1}I[b]=c},za=function(a,b){var c=0;do c|=a&1,a>>=1,c<<=1;while(0<--b);return c>>1},Aa=function(a,b){var c=[];c.length=16;var e=0,d;for(d=1;15>=d;d++)e=e+M[d-1]<<1,c[d]=e;for(e=0;e<=b;e++)d=a[e].dl,0!==d&&(a[e].fc=za(c[d]++,d))},ua=function(a){var b=a.dyn_tree,c=a.static_tree,e=a.elems,d,m=-1,i=e;V=0;
-Z=573;for(d=0;d<e;d++)0!==b[d].fc?(I[++V]=m=d,S[d]=0):b[d].dl=0;for(;2>V;)d=I[++V]=2>m?++m:0,b[d].fc=1,S[d]=0,W--,null!==c&&(ba-=c[d].dl);a.max_code=m;for(d=V>>1;1<=d;d--)ta(b,d);do d=I[1],I[1]=I[V--],ta(b,1),c=I[1],I[--Z]=d,I[--Z]=c,b[i].fc=b[d].fc+b[c].fc,S[i]=S[d]>S[c]+1?S[d]:S[c]+1,b[d].dl=b[c].dl=i,I[1]=i++,ta(b,1);while(2<=V);I[--Z]=I[1];i=a.dyn_tree;d=a.extra_bits;var e=a.extra_base,c=a.max_code,r=a.max_length,n=a.static_tree,t,h,f,k,q=0;for(h=0;15>=h;h++)M[h]=0;i[I[Z]].dl=0;for(a=Z+1;573>
-a;a++)if(t=I[a],h=i[i[t].dl].dl+1,h>r&&(h=r,q++),i[t].dl=h,!(t>c))M[h]++,f=0,t>=e&&(f=d[t-e]),k=i[t].fc,W+=k*(h+f),null!==n&&(ba+=k*(n[t].dl+f));if(0!==q){do{for(h=r-1;0===M[h];)h--;M[h]--;M[h+1]+=2;M[r]--;q-=2}while(0<q);for(h=r;0!==h;h--)for(t=M[h];0!==t;)d=I[--a],d>c||(i[d].dl!==h&&(W+=(h-i[d].dl)*i[d].fc,i[d].fc=h),t--)}Aa(b,m)},Ba=function(a,b){var c,e=-1,d,m=a[0].dl,i=0,h=7,r=4;0===m&&(h=138,r=3);a[b+1].dl=65535;for(c=0;c<=b;c++)if(d=m,m=a[c+1].dl,!(++i<h&&d===m))(i<r?K[d].fc+=i:0!==d?(d!==
-e&&K[d].fc++,K[16].fc++):10>=i?K[17].fc++:K[18].fc++,i=0,e=d,0===m)?(h=138,r=3):d===m?(h=6,r=3):(h=7,r=4)},Ca=function(){8<B?ma(w):0<B&&la(w);B=w=0},Da=function(a,b){var c,e=0,d=0,m=0,i=0,h,r;if(0!==P){do{0===(e&7)&&(i=da[m++]);c=s[e++]&255;if(0===(i&1))X(c,a);else if(h=$[c],X(h+256+1,a),r=ra[h],0!==r&&(c-=ha[h],Q(c,r)),c=u[d++],h=(256>c?Y[c]:Y[256+(c>>7)])&255,X(h,b),r=fa[h],0!==r)c-=ca[h],Q(c,r);i>>=1}while(e<P)}X(256,a)},Ea=function(a,b){var c,e=-1,d,m=a[0].dl,i=0,h=7,r=4;0===m&&(h=138,r=3);for(c=
-0;c<=b;c++)if(d=m,m=a[c+1].dl,!(++i<h&&d===m)){if(i<r){do X(d,K);while(0!==--i)}else 0!==d?(d!==e&&(X(d,K),i--),X(16,K),Q(i-3,2)):10>=i?(X(17,K),Q(i-3,3)):(X(18,K),Q(i-11,7));i=0;e=d;0===m?(h=138,r=3):d===m?(h=6,r=3):(h=7,r=4)}},Fa=function(){var a;for(a=0;286>a;a++)v[a].fc=0;for(a=0;30>a;a++)J[a].fc=0;for(a=0;19>a;a++)K[a].fc=0;v[256].fc=1;aa=P=ia=pa=W=ba=0;ea=1},oa=function(a){var b,c,e,d;d=m-A;da[pa]=aa;ua(H);ua(D);Ba(v,H.max_code);Ba(J,D.max_code);ua(U);for(e=18;3<=e&&0===K[va[e]].dl;e--);W+=
-3*(e+1)+14;b=W+3+7>>3;c=ba+3+7>>3;c<=b&&(b=c);if(d+4<=b&&0<=A){Q(0+a,3);Ca();ma(d);ma(~d);for(e=0;e<d;e++)la(o[A+e])}else if(c===b)Q(2+a,3),Da(G,R);else{Q(4+a,3);d=H.max_code+1;b=D.max_code+1;e+=1;Q(d-257,5);Q(b-1,5);Q(e-4,4);for(c=0;c<e;c++)Q(K[va[c]].dl,3);Ea(v,d-1);Ea(J,b-1);Da(v,J)}Fa();0!==a&&Ca()},Ga=function(a,d,m){var r,t,n;for(r=0;null!==b&&r<m;){t=m-r;t>b.len&&(t=b.len);for(n=0;n<t;n++)a[d+r+n]=b.ptr[b.off+n];b.off+=t;b.len-=t;r+=t;0===b.len&&(t=b,b=b.next,t.next=c,c=t)}if(r===m)return r;
-if(h<i){t=m-r;t>i-h&&(t=i-h);for(n=0;n<t;n++)a[d+r+n]=e[h+n];h+=t;r+=t;i===h&&(i=h=0)}return r},Ia=function(a,c,e){var d;if(!k){if(!r){B=w=0;var f,g;if(0===R[0].dl){H.dyn_tree=v;H.static_tree=G;H.extra_bits=ra;H.extra_base=257;H.elems=286;H.max_length=15;H.max_code=0;D.dyn_tree=J;D.static_tree=R;D.extra_bits=fa;D.extra_base=0;D.elems=30;D.max_length=15;D.max_code=0;U.dyn_tree=K;U.static_tree=null;U.extra_bits=Ha;U.extra_base=0;U.elems=19;U.max_length=7;for(g=f=U.max_code=0;28>g;g++){ha[g]=f;for(d=
-0;d<1<<ra[g];d++)$[f++]=g}$[f-1]=g;for(g=f=0;16>g;g++){ca[g]=f;for(d=0;d<1<<fa[g];d++)Y[f++]=g}for(f>>=7;30>g;g++){ca[g]=f<<7;for(d=0;d<1<<fa[g]-7;d++)Y[256+f++]=g}for(d=0;15>=d;d++)M[d]=0;for(d=0;143>=d;)G[d++].dl=8,M[8]++;for(;255>=d;)G[d++].dl=9,M[9]++;for(;279>=d;)G[d++].dl=7,M[7]++;for(;287>=d;)G[d++].dl=8,M[8]++;Aa(G,287);for(d=0;30>d;d++)R[d].dl=5,R[d].fc=za(d,5);Fa()}for(d=0;8192>d;d++)p[32768+d]=0;T=ka[O].max_lazy;N=ka[O].good_length;L=ka[O].max_chain;A=m=0;y=xa(o,0,65536);if(0>=y)r=!0,y=
-0;else{for(r=!1;262>y&&!r;)sa();for(d=q=0;2>d;d++)q=(q<<5^o[d]&255)&8191}b=null;h=i=0;3>=O?(F=2,z=0):(z=2,C=0);n=!1}k=!0;if(0===y)return n=!0,0}if((d=Ga(a,c,e))===e)return e;if(n)return d;if(3>=O)for(;0!==y&&null===b;){na();0!==x&&32506>=m-x&&(z=ya(x),z>y&&(z=y));if(3<=z)if(g=ga(m-t,z-3),y-=z,z<=T){z--;do m++,na();while(0!==--z);m++}else m+=z,z=0,q=o[m]&255,q=(q<<5^o[m+1]&255)&8191;else g=ga(0,o[m]&255),y--,m++;g&&(oa(0),A=m);for(;262>y&&!r;)sa()}else for(;0!==y&&null===b;){na();F=z;E=t;z=2;0!==x&&
-F<T&&32506>=m-x&&(z=ya(x),z>y&&(z=y),3===z&&4096<m-t&&z--);if(3<=F&&z<=F){g=ga(m-1-E,F-3);y-=F-1;F-=2;do m++,na();while(0!==--F);C=0;z=2;m++;g&&(oa(0),A=m)}else 0!==C?ga(0,o[m-1]&255)&&(oa(0),A=m):C=1,m++,y--;for(;262>y&&!r;)sa()}0===y&&(0!==C&&ga(0,o[m-1]&255),oa(1),n=!0);return d+Ga(a,d+c,e-d)};this.deflate=function(m,i){var h,t;ja=m;qa=0;"undefined"===typeof i&&(i=6);(h=i)?1>h?h=1:9<h&&(h=9):h=6;O=h;r=k=!1;if(null===e){c=b=d=null;e=[];e.length=a;o=[];o.length=65536;u=[];u.length=8192;s=[];s.length=
-32832;p=[];p.length=65536;v=[];v.length=573;for(h=0;573>h;h++)v[h]=new j;J=[];J.length=61;for(h=0;61>h;h++)J[h]=new j;G=[];G.length=288;for(h=0;288>h;h++)G[h]=new j;R=[];R.length=30;for(h=0;30>h;h++)R[h]=new j;K=[];K.length=39;for(h=0;39>h;h++)K[h]=new j;H=new l;D=new l;U=new l;M=[];M.length=16;I=[];I.length=573;S=[];S.length=573;$=[];$.length=256;Y=[];Y.length=512;ha=[];ha.length=29;ca=[];ca.length=30;da=[];da.length=1024}for(var n=Array(1024),f=[];0<(h=Ia(n,0,n.length));){var g=[];g.length=h;for(t=
-0;t<h;t++)g[t]=String.fromCharCode(n[t]);f[f.length]=g.join("")}ja=null;return f.join("")}};
+core.RawDeflate=function(){function g(){this.dl=this.fc=0}function k(){this.extra_bits=this.static_tree=this.dyn_tree=null;this.max_code=this.max_length=this.elems=this.extra_base=0}function m(d,b,a,c){this.good_length=d;this.max_lazy=b;this.nice_length=a;this.max_chain=c}function f(){this.next=null;this.len=0;this.ptr=[];this.ptr.length=e;this.off=0}var e=8192,c,a,b,h,d=null,l,q,p,j,r,n,w,x,v,G,C,E,u,s,D,J,A,z,y,B,Q,M,t,K,I,S,N,P,H,F,L,V,T,R,Y,ca,W,da,ba,ja,fa,ga,Z,ka,ra,X,$,O,ea,la,sa,ta=[0,0,0,
+0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ha=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Ja=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],xa=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ma;ma=[new m(0,0,0,0),new m(4,4,8,4),new m(4,5,16,8),new m(4,6,32,32),new m(4,4,16,16),new m(8,16,32,32),new m(8,16,128,128),new m(8,32,128,256),new m(32,128,258,1024),new m(32,258,258,4096)];var na=function(j){d[q+l++]=j;if(q+l===e){var h;if(0!==l){null!==c?(j=c,c=c.next):j=new f;
+j.next=null;j.len=j.off=0;null===a?a=b=j:b=b.next=j;j.len=l-q;for(h=0;h<j.len;h++)j.ptr[h]=d[q+h];l=q=0}}},oa=function(b){b&=65535;q+l<e-2?(d[q+l++]=b&255,d[q+l++]=b>>>8):(na(b&255),na(b>>>8))},pa=function(){C=(C<<5^j[A+3-1]&255)&8191;E=w[32768+C];w[A&32767]=E;w[32768+C]=A},U=function(d,b){v>16-b?(x|=d<<v,oa(x),x=d>>16-v,v+=b-16):(x|=d<<v,v+=b)},aa=function(d,b){U(b[d].fc,b[d].dl)},ya=function(d,b,a){return d[b].fc<d[a].fc||d[b].fc===d[a].fc&&W[b]<=W[a]},za=function(d,b,a){var c;for(c=0;c<a&&sa<la.length;c++)d[b+
+c]=la.charCodeAt(sa++)&255;return c},ua=function(){var d,b,a=65536-B-A;if(-1===a)a--;else if(65274<=A){for(d=0;32768>d;d++)j[d]=j[d+32768];z-=32768;A-=32768;G-=32768;for(d=0;8192>d;d++)b=w[32768+d],w[32768+d]=32768<=b?b-32768:0;for(d=0;32768>d;d++)b=w[d],w[d]=32768<=b?b-32768:0;a+=32768}y||(d=za(j,A+B,a),0>=d?y=!0:B+=d)},Aa=function(d){var b=Q,a=A,c,e=J,l=32506<A?A-32506:0,h=A+258,p=j[a+e-1],r=j[a+e];J>=K&&(b>>=2);do if(c=d,!(j[c+e]!==r||j[c+e-1]!==p||j[c]!==j[a]||j[++c]!==j[a+1])){a+=2;c++;do++a;
+while(j[a]===j[++c]&&j[++a]===j[++c]&&j[++a]===j[++c]&&j[++a]===j[++c]&&j[++a]===j[++c]&&j[++a]===j[++c]&&j[++a]===j[++c]&&j[++a]===j[++c]&&a<h);c=258-(h-a);a=h-258;if(c>e){z=d;e=c;if(258<=c)break;p=j[a+e-1];r=j[a+e]}}while((d=w[d&32767])>l&&0!==--b);return e},ia=function(d,b){n[Z++]=b;0===d?I[b].fc++:(d--,I[da[b]+256+1].fc++,S[(256>d?ba[d]:ba[256+(d>>7)])&255].fc++,r[ka++]=d,X|=$);$<<=1;0===(Z&7)&&(ga[ra++]=X,X=0,$=1);if(2<t&&0===(Z&4095)){var a=8*Z,c=A-G,j;for(j=0;30>j;j++)a+=S[j].fc*(5+ha[j]);
+a>>=3;if(ka<parseInt(Z/2,10)&&a<parseInt(c/2,10))return!0}return 8191===Z||8192===ka},va=function(d,b){for(var a=R[b],c=b<<1;c<=Y;){c<Y&&ya(d,R[c+1],R[c])&&c++;if(ya(d,a,R[c]))break;R[b]=R[c];b=c;c<<=1}R[b]=a},Ba=function(d,b){var a=0;do a|=d&1,d>>=1,a<<=1;while(0<--b);return a>>1},Ca=function(d,b){var a=[];a.length=16;var c=0,j;for(j=1;15>=j;j++)c=c+T[j-1]<<1,a[j]=c;for(c=0;c<=b;c++)j=d[c].dl,0!==j&&(d[c].fc=Ba(a[j]++,j))},wa=function(d){var b=d.dyn_tree,a=d.static_tree,c=d.elems,j,e=-1,l=c;Y=0;
+ca=573;for(j=0;j<c;j++)0!==b[j].fc?(R[++Y]=e=j,W[j]=0):b[j].dl=0;for(;2>Y;)j=R[++Y]=2>e?++e:0,b[j].fc=1,W[j]=0,O--,null!==a&&(ea-=a[j].dl);d.max_code=e;for(j=Y>>1;1<=j;j--)va(b,j);do j=R[1],R[1]=R[Y--],va(b,1),a=R[1],R[--ca]=j,R[--ca]=a,b[l].fc=b[j].fc+b[a].fc,W[l]=W[j]>W[a]+1?W[j]:W[a]+1,b[j].dl=b[a].dl=l,R[1]=l++,va(b,1);while(2<=Y);R[--ca]=R[1];l=d.dyn_tree;j=d.extra_bits;var c=d.extra_base,a=d.max_code,h=d.max_length,p=d.static_tree,r,n,f,g,k=0;for(n=0;15>=n;n++)T[n]=0;l[R[ca]].dl=0;for(d=ca+
+1;573>d;d++)r=R[d],n=l[l[r].dl].dl+1,n>h&&(n=h,k++),l[r].dl=n,r>a||(T[n]++,f=0,r>=c&&(f=j[r-c]),g=l[r].fc,O+=g*(n+f),null!==p&&(ea+=g*(p[r].dl+f)));if(0!==k){do{for(n=h-1;0===T[n];)n--;T[n]--;T[n+1]+=2;T[h]--;k-=2}while(0<k);for(n=h;0!==n;n--)for(r=T[n];0!==r;)j=R[--d],j>a||(l[j].dl!==n&&(O+=(n-l[j].dl)*l[j].fc,l[j].fc=n),r--)}Ca(b,e)},Da=function(d,b){var a,c=-1,j,l=d[0].dl,e=0,h=7,r=4;0===l&&(h=138,r=3);d[b+1].dl=65535;for(a=0;a<=b;a++)j=l,l=d[a+1].dl,++e<h&&j===l||(e<r?H[j].fc+=e:0!==j?(j!==c&&
+H[j].fc++,H[16].fc++):10>=e?H[17].fc++:H[18].fc++,e=0,c=j,0===l?(h=138,r=3):j===l?(h=6,r=3):(h=7,r=4))},Ea=function(){8<v?oa(x):0<v&&na(x);v=x=0},Fa=function(d,b){var a,c=0,j=0,l=0,e=0,h,p;if(0!==Z){do 0===(c&7)&&(e=ga[l++]),a=n[c++]&255,0===(e&1)?aa(a,d):(h=da[a],aa(h+256+1,d),p=ta[h],0!==p&&(a-=ja[h],U(a,p)),a=r[j++],h=(256>a?ba[a]:ba[256+(a>>7)])&255,aa(h,b),p=ha[h],0!==p&&(a-=fa[h],U(a,p))),e>>=1;while(c<Z)}aa(256,d)},Ga=function(d,b){var a,c=-1,j,e=d[0].dl,l=0,h=7,r=4;0===e&&(h=138,r=3);for(a=
+0;a<=b;a++)if(j=e,e=d[a+1].dl,!(++l<h&&j===e)){if(l<r){do aa(j,H);while(0!==--l)}else 0!==j?(j!==c&&(aa(j,H),l--),aa(16,H),U(l-3,2)):10>=l?(aa(17,H),U(l-3,3)):(aa(18,H),U(l-11,7));l=0;c=j;0===e?(h=138,r=3):j===e?(h=6,r=3):(h=7,r=4)}},Ha=function(){var d;for(d=0;286>d;d++)I[d].fc=0;for(d=0;30>d;d++)S[d].fc=0;for(d=0;19>d;d++)H[d].fc=0;I[256].fc=1;X=Z=ka=ra=O=ea=0;$=1},qa=function(d){var a,b,c,l;l=A-G;ga[ra]=X;wa(F);wa(L);Da(I,F.max_code);Da(S,L.max_code);wa(V);for(c=18;3<=c&&0===H[xa[c]].dl;c--);O+=
+3*(c+1)+14;a=O+3+7>>3;b=ea+3+7>>3;b<=a&&(a=b);if(l+4<=a&&0<=G){U(0+d,3);Ea();oa(l);oa(~l);for(c=0;c<l;c++)na(j[G+c])}else if(b===a)U(2+d,3),Fa(N,P);else{U(4+d,3);l=F.max_code+1;a=L.max_code+1;c+=1;U(l-257,5);U(a-1,5);U(c-4,4);for(b=0;b<c;b++)U(H[xa[b]].dl,3);Ga(I,l-1);Ga(S,a-1);Fa(I,S)}Ha();0!==d&&Ea()},Ia=function(b,j,e){var h,r,p;for(h=0;null!==a&&h<e;){r=e-h;r>a.len&&(r=a.len);for(p=0;p<r;p++)b[j+h+p]=a.ptr[a.off+p];a.off+=r;a.len-=r;h+=r;0===a.len&&(r=a,a=a.next,r.next=c,c=r)}if(h===e)return h;
+if(q<l){r=e-h;r>l-q&&(r=l-q);for(p=0;p<r;p++)b[j+h+p]=d[q+p];q+=r;h+=r;l===q&&(l=q=0)}return h},Ka=function(d,b,c){var e;if(!h){if(!y){v=x=0;var r,n;if(0===P[0].dl){F.dyn_tree=I;F.static_tree=N;F.extra_bits=ta;F.extra_base=257;F.elems=286;F.max_length=15;F.max_code=0;L.dyn_tree=S;L.static_tree=P;L.extra_bits=ha;L.extra_base=0;L.elems=30;L.max_length=15;L.max_code=0;V.dyn_tree=H;V.static_tree=null;V.extra_bits=Ja;V.extra_base=0;V.elems=19;V.max_length=7;for(n=r=V.max_code=0;28>n;n++){ja[n]=r;for(e=
+0;e<1<<ta[n];e++)da[r++]=n}da[r-1]=n;for(n=r=0;16>n;n++){fa[n]=r;for(e=0;e<1<<ha[n];e++)ba[r++]=n}for(r>>=7;30>n;n++){fa[n]=r<<7;for(e=0;e<1<<ha[n]-7;e++)ba[256+r++]=n}for(e=0;15>=e;e++)T[e]=0;for(e=0;143>=e;)N[e++].dl=8,T[8]++;for(;255>=e;)N[e++].dl=9,T[9]++;for(;279>=e;)N[e++].dl=7,T[7]++;for(;287>=e;)N[e++].dl=8,T[8]++;Ca(N,287);for(e=0;30>e;e++)P[e].dl=5,P[e].fc=Ba(e,5);Ha()}for(e=0;8192>e;e++)w[32768+e]=0;M=ma[t].max_lazy;K=ma[t].good_length;Q=ma[t].max_chain;G=A=0;B=za(j,0,65536);if(0>=B)y=
+!0,B=0;else{for(y=!1;262>B&&!y;)ua();for(e=C=0;2>e;e++)C=(C<<5^j[e]&255)&8191}a=null;q=l=0;3>=t?(J=2,D=0):(D=2,s=0);p=!1}h=!0;if(0===B)return p=!0,0}if((e=Ia(d,b,c))===c)return c;if(p)return e;if(3>=t)for(;0!==B&&null===a;){pa();0!==E&&32506>=A-E&&(D=Aa(E),D>B&&(D=B));if(3<=D)if(n=ia(A-z,D-3),B-=D,D<=M){D--;do A++,pa();while(0!==--D);A++}else A+=D,D=0,C=j[A]&255,C=(C<<5^j[A+1]&255)&8191;else n=ia(0,j[A]&255),B--,A++;n&&(qa(0),G=A);for(;262>B&&!y;)ua()}else for(;0!==B&&null===a;){pa();J=D;u=z;D=2;
+0!==E&&(J<M&&32506>=A-E)&&(D=Aa(E),D>B&&(D=B),3===D&&4096<A-z&&D--);if(3<=J&&D<=J){n=ia(A-1-u,J-3);B-=J-1;J-=2;do A++,pa();while(0!==--J);s=0;D=2;A++;n&&(qa(0),G=A)}else 0!==s?ia(0,j[A-1]&255)&&(qa(0),G=A):s=1,A++,B--;for(;262>B&&!y;)ua()}0===B&&(0!==s&&ia(0,j[A-1]&255),qa(1),p=!0);return e+Ia(d,e+b,c-e)};this.deflate=function(l,p){var f,q;la=l;sa=0;"undefined"===String(typeof p)&&(p=6);(f=p)?1>f?f=1:9<f&&(f=9):f=6;t=f;y=h=!1;if(null===d){c=a=b=null;d=[];d.length=e;j=[];j.length=65536;r=[];r.length=
+8192;n=[];n.length=32832;w=[];w.length=65536;I=[];I.length=573;for(f=0;573>f;f++)I[f]=new g;S=[];S.length=61;for(f=0;61>f;f++)S[f]=new g;N=[];N.length=288;for(f=0;288>f;f++)N[f]=new g;P=[];P.length=30;for(f=0;30>f;f++)P[f]=new g;H=[];H.length=39;for(f=0;39>f;f++)H[f]=new g;F=new k;L=new k;V=new k;T=[];T.length=16;R=[];R.length=573;W=[];W.length=573;da=[];da.length=256;ba=[];ba.length=512;ja=[];ja.length=29;fa=[];fa.length=30;ga=[];ga.length=1024}for(var m=Array(1024),x=[];0<(f=Ka(m,0,m.length));){var B=
+[];B.length=f;for(q=0;q<f;q++)B[q]=String.fromCharCode(m[q]);x[x.length]=B.join("")}la=null;return x.join("")}};
// Input 4
-core.ByteArray=function(j){this.pos=0;this.data=j;this.readUInt32LE=function(){var j=this.data,f=this.pos+=4;return j[--f]<<24|j[--f]<<16|j[--f]<<8|j[--f]};this.readUInt16LE=function(){var j=this.data,f=this.pos+=2;return j[--f]<<8|j[--f]}};
+core.ByteArray=function(g){this.pos=0;this.data=g;this.readUInt32LE=function(){var g=this.data,m=this.pos+=4;return g[--m]<<24|g[--m]<<16|g[--m]<<8|g[--m]};this.readUInt16LE=function(){var g=this.data,m=this.pos+=2;return g[--m]<<8|g[--m]}};
// Input 5
-core.ByteArrayWriter=function(j){var l=this,f=new runtime.ByteArray(0);this.appendByteArrayWriter=function(g){f=runtime.concatByteArrays(f,g.getByteArray())};this.appendByteArray=function(g){f=runtime.concatByteArrays(f,g)};this.appendArray=function(g){f=runtime.concatByteArrays(f,runtime.byteArrayFromArray(g))};this.appendUInt16LE=function(f){l.appendArray([f&255,f>>8&255])};this.appendUInt32LE=function(f){l.appendArray([f&255,f>>8&255,f>>16&255,f>>24&255])};this.appendString=function(g){f=runtime.concatByteArrays(f,
-runtime.byteArrayFromString(g,j))};this.getLength=function(){return f.length};this.getByteArray=function(){return f}};
+core.ByteArrayWriter=function(g){var k=this,m=new runtime.ByteArray(0);this.appendByteArrayWriter=function(f){m=runtime.concatByteArrays(m,f.getByteArray())};this.appendByteArray=function(f){m=runtime.concatByteArrays(m,f)};this.appendArray=function(f){m=runtime.concatByteArrays(m,runtime.byteArrayFromArray(f))};this.appendUInt16LE=function(f){k.appendArray([f&255,f>>8&255])};this.appendUInt32LE=function(f){k.appendArray([f&255,f>>8&255,f>>16&255,f>>24&255])};this.appendString=function(f){m=runtime.concatByteArrays(m,
+runtime.byteArrayFromString(f,g))};this.getLength=function(){return m.length};this.getByteArray=function(){return m}};
// Input 6
-core.RawInflate=function(){var j,l,f=null,g,a,c,b,d,k,e,i,h,n,o,u,s,p,w=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],B=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],A=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],q=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],x=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[16,17,18,
-0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],C=function(){this.list=this.next=null},z=function(){this.n=this.b=this.e=0;this.t=null},F=function(a,b,c,d,e,m){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var h=Array(this.BMAX+1),i,r,t,n,f,k,g,q=Array(this.BMAX+1),o,j,p,y=new z,x=Array(this.BMAX);n=Array(this.N_MAX);var E,s=Array(this.BMAX+1),B,A,u;u=this.root=null;for(f=0;f<h.length;f++)h[f]=0;for(f=0;f<q.length;f++)q[f]=0;for(f=0;f<x.length;f++)x[f]=null;for(f=0;f<n.length;f++)n[f]=
-0;for(f=0;f<s.length;f++)s[f]=0;i=256<b?a[256]:this.BMAX;o=a;j=0;f=b;do h[o[j]]++,j++;while(0<--f);if(h[0]==b)this.root=null,this.status=this.m=0;else{for(k=1;k<=this.BMAX&&0==h[k];k++);g=k;m<k&&(m=k);for(f=this.BMAX;0!=f&&0==h[f];f--);t=f;m>f&&(m=f);for(B=1<<k;k<f;k++,B<<=1)if(0>(B-=h[k])){this.status=2;this.m=m;return}if(0>(B-=h[f]))this.status=2,this.m=m;else{h[f]+=B;s[1]=k=0;o=h;j=1;for(p=2;0<--f;)s[p++]=k+=o[j++];o=a;f=j=0;do if(0!=(k=o[j++]))n[s[k]++]=f;while(++f<b);b=s[t];s[0]=f=0;o=n;j=0;
-n=-1;E=q[0]=0;p=null;for(A=0;g<=t;g++)for(a=h[g];0<a--;){for(;g>E+q[1+n];){E+=q[1+n];n++;A=(A=t-E)>m?m:A;if((r=1<<(k=g-E))>a+1){r-=a+1;for(p=g;++k<A&&!((r<<=1)<=h[++p]);)r-=h[p]}E+k>i&&E<i&&(k=i-E);A=1<<k;q[1+n]=k;p=Array(A);for(r=0;r<A;r++)p[r]=new z;u=null==u?this.root=new C:u.next=new C;u.next=null;u.list=p;x[n]=p;0<n&&(s[n]=f,y.b=q[n],y.e=16+k,y.t=p,k=(f&(1<<E)-1)>>E-q[n],x[n-1][k].e=y.e,x[n-1][k].b=y.b,x[n-1][k].n=y.n,x[n-1][k].t=y.t)}y.b=g-E;j>=b?y.e=99:o[j]<c?(y.e=256>o[j]?16:15,y.n=o[j++]):
-(y.e=e[o[j]-c],y.n=d[o[j++]-c]);r=1<<g-E;for(k=f>>E;k<A;k+=r)p[k].e=y.e,p[k].b=y.b,p[k].n=y.n,p[k].t=y.t;for(k=1<<g-1;0!=(f&k);k>>=1)f^=k;for(f^=k;(f&(1<<E)-1)!=s[n];)E-=q[n],n--}this.m=q[1];this.status=0!=B&&1!=t?1:0}}},m=function(a){for(;b<a;)c|=(s.length==p?-1:s[p++])<<b,b+=8},t=function(a){return c&w[a]},r=function(a){c>>=a;b-=a},y=function(a,b,c){var f,k,g;if(0==c)return 0;for(g=0;;){m(o);k=h.list[t(o)];for(f=k.e;16<f;){if(99==f)return-1;r(k.b);f-=16;m(f);k=k.t[t(f)];f=k.e}r(k.b);if(16==f)l&=
-32767,a[b+g++]=j[l++]=k.n;else{if(15==f)break;m(f);e=k.n+t(f);r(f);m(u);k=n.list[t(u)];for(f=k.e;16<f;){if(99==f)return-1;r(k.b);f-=16;m(f);k=k.t[t(f)];f=k.e}r(k.b);m(f);i=l-k.n-t(f);for(r(f);0<e&&g<c;)e--,i&=32767,l&=32767,a[b+g++]=j[l++]=j[i++]}if(g==c)return c}d=-1;return g},L,T=function(a,b,c){var d,e,f,i,k,g,j,p=Array(316);for(d=0;d<p.length;d++)p[d]=0;m(5);g=257+t(5);r(5);m(5);j=1+t(5);r(5);m(4);d=4+t(4);r(4);if(286<g||30<j)return-1;for(e=0;e<d;e++)m(3),p[E[e]]=t(3),r(3);for(;19>e;e++)p[E[e]]=
-0;o=7;e=new F(p,19,19,null,null,o);if(0!=e.status)return-1;h=e.root;o=e.m;i=g+j;for(d=f=0;d<i;)if(m(o),k=h.list[t(o)],e=k.b,r(e),e=k.n,16>e)p[d++]=f=e;else if(16==e){m(2);e=3+t(2);r(2);if(d+e>i)return-1;for(;0<e--;)p[d++]=f}else{17==e?(m(3),e=3+t(3),r(3)):(m(7),e=11+t(7),r(7));if(d+e>i)return-1;for(;0<e--;)p[d++]=0;f=0}o=9;e=new F(p,g,257,B,A,o);0==o&&(e.status=1);if(0!=e.status)return-1;h=e.root;o=e.m;for(d=0;d<j;d++)p[d]=p[d+g];u=6;e=new F(p,j,0,q,x,u);n=e.root;u=e.m;return 0==u&&257<g||0!=e.status?
--1:y(a,b,c)};this.inflate=function(E,C){null==j&&(j=Array(65536));b=c=l=0;d=-1;k=!1;e=i=0;h=null;s=E;p=0;var z=new runtime.ByteArray(C);a:{var w,G;for(w=0;w<C&&!(k&&-1==d);){if(0<e){if(0!=d)for(;0<e&&w<C;)e--,i&=32767,l&=32767,z[0+w++]=j[l++]=j[i++];else{for(;0<e&&w<C;)e--,l&=32767,m(8),z[0+w++]=j[l++]=t(8),r(8);0==e&&(d=-1)}if(w==C)break}if(-1==d){if(k)break;m(1);0!=t(1)&&(k=!0);r(1);m(2);d=t(2);r(2);h=null;e=0}switch(d){case 0:G=z;var R=0+w,K=C-w,H=void 0,H=b&7;r(H);m(16);H=t(16);r(16);m(16);if(H!=
-(~c&65535))G=-1;else{r(16);e=H;for(H=0;0<e&&H<K;)e--,l&=32767,m(8),G[R+H++]=j[l++]=t(8),r(8);0==e&&(d=-1);G=H}break;case 1:if(null!=h)G=y(z,0+w,C-w);else b:{G=z;R=0+w;K=C-w;if(null==f){for(var D=void 0,H=Array(288),D=void 0,D=0;144>D;D++)H[D]=8;for(;256>D;D++)H[D]=9;for(;280>D;D++)H[D]=7;for(;288>D;D++)H[D]=8;a=7;D=new F(H,288,257,B,A,a);if(0!=D.status){alert("HufBuild error: "+D.status);G=-1;break b}f=D.root;a=D.m;for(D=0;30>D;D++)H[D]=5;L=5;D=new F(H,30,0,q,x,L);if(1<D.status){f=null;alert("HufBuild error: "+
-D.status);G=-1;break b}g=D.root;L=D.m}h=f;n=g;o=a;u=L;G=y(G,R,K)}break;case 2:G=null!=h?y(z,0+w,C-w):T(z,0+w,C-w);break;default:G=-1}if(-1==G)break a;w+=G}}s=null;return z}};
+core.RawInflate=function(){var g,k,m=null,f,e,c,a,b,h,d,l,q,p,j,r,n,w,x=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],v=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],G=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],C=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],u=[16,17,18,
+0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],s=function(){this.list=this.next=null},D=function(){this.n=this.b=this.e=0;this.t=null},J=function(d,b,a,c,j,e){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var l=Array(this.BMAX+1),h,r,n,p,f,g,q,k=Array(this.BMAX+1),m,w,x,B=new D,y=Array(this.BMAX);p=Array(this.N_MAX);var v,z=Array(this.BMAX+1),Q,M,C;C=this.root=null;for(f=0;f<l.length;f++)l[f]=0;for(f=0;f<k.length;f++)k[f]=0;for(f=0;f<y.length;f++)y[f]=null;for(f=0;f<p.length;f++)p[f]=
+0;for(f=0;f<z.length;f++)z[f]=0;h=256<b?d[256]:this.BMAX;m=d;w=0;f=b;do l[m[w]]++,w++;while(0<--f);if(l[0]==b)this.root=null,this.status=this.m=0;else{for(g=1;g<=this.BMAX&&0==l[g];g++);q=g;e<g&&(e=g);for(f=this.BMAX;0!=f&&0==l[f];f--);n=f;e>f&&(e=f);for(Q=1<<g;g<f;g++,Q<<=1)if(0>(Q-=l[g])){this.status=2;this.m=e;return}if(0>(Q-=l[f]))this.status=2,this.m=e;else{l[f]+=Q;z[1]=g=0;m=l;w=1;for(x=2;0<--f;)z[x++]=g+=m[w++];m=d;f=w=0;do if(0!=(g=m[w++]))p[z[g]++]=f;while(++f<b);b=z[n];z[0]=f=0;m=p;w=0;
+p=-1;v=k[0]=0;x=null;for(M=0;q<=n;q++)for(d=l[q];0<d--;){for(;q>v+k[1+p];){v+=k[1+p];p++;M=(M=n-v)>e?e:M;if((r=1<<(g=q-v))>d+1){r-=d+1;for(x=q;++g<M&&!((r<<=1)<=l[++x]);)r-=l[x]}v+g>h&&v<h&&(g=h-v);M=1<<g;k[1+p]=g;x=Array(M);for(r=0;r<M;r++)x[r]=new D;C=null==C?this.root=new s:C.next=new s;C.next=null;C.list=x;y[p]=x;0<p&&(z[p]=f,B.b=k[p],B.e=16+g,B.t=x,g=(f&(1<<v)-1)>>v-k[p],y[p-1][g].e=B.e,y[p-1][g].b=B.b,y[p-1][g].n=B.n,y[p-1][g].t=B.t)}B.b=q-v;w>=b?B.e=99:m[w]<a?(B.e=256>m[w]?16:15,B.n=m[w++]):
+(B.e=j[m[w]-a],B.n=c[m[w++]-a]);r=1<<q-v;for(g=f>>v;g<M;g+=r)x[g].e=B.e,x[g].b=B.b,x[g].n=B.n,x[g].t=B.t;for(g=1<<q-1;0!=(f&g);g>>=1)f^=g;for(f^=g;(f&(1<<v)-1)!=z[p];)v-=k[p],p--}this.m=k[1];this.status=0!=Q&&1!=n?1:0}}},A=function(d){for(;a<d;){var b=c,j;j=n.length==w?-1:n[w++];c=b|j<<a;a+=8}},z=function(d){return c&x[d]},y=function(d){c>>=d;a-=d},B=function(a,c,e){var h,f,n;if(0==e)return 0;for(n=0;;){A(j);f=q.list[z(j)];for(h=f.e;16<h;){if(99==h)return-1;y(f.b);h-=16;A(h);f=f.t[z(h)];h=f.e}y(f.b);
+if(16==h)k&=32767,a[c+n++]=g[k++]=f.n;else{if(15==h)break;A(h);d=f.n+z(h);y(h);A(r);f=p.list[z(r)];for(h=f.e;16<h;){if(99==h)return-1;y(f.b);h-=16;A(h);f=f.t[z(h)];h=f.e}y(f.b);A(h);l=k-f.n-z(h);for(y(h);0<d&&n<e;)d--,l&=32767,k&=32767,a[c+n++]=g[k++]=g[l++]}if(n==e)return e}b=-1;return n},Q,M=function(d,b,a){var c,e,l,h,f,n,g,k=Array(316);for(c=0;c<k.length;c++)k[c]=0;A(5);n=257+z(5);y(5);A(5);g=1+z(5);y(5);A(4);c=4+z(4);y(4);if(286<n||30<g)return-1;for(e=0;e<c;e++)A(3),k[u[e]]=z(3),y(3);for(;19>
+e;e++)k[u[e]]=0;j=7;e=new J(k,19,19,null,null,j);if(0!=e.status)return-1;q=e.root;j=e.m;h=n+g;for(c=l=0;c<h;)if(A(j),f=q.list[z(j)],e=f.b,y(e),e=f.n,16>e)k[c++]=l=e;else if(16==e){A(2);e=3+z(2);y(2);if(c+e>h)return-1;for(;0<e--;)k[c++]=l}else{17==e?(A(3),e=3+z(3),y(3)):(A(7),e=11+z(7),y(7));if(c+e>h)return-1;for(;0<e--;)k[c++]=0;l=0}j=9;e=new J(k,n,257,v,G,j);0==j&&(e.status=1);if(0!=e.status)return-1;q=e.root;j=e.m;for(c=0;c<g;c++)k[c]=k[c+n];r=6;e=new J(k,g,0,C,E,r);p=e.root;r=e.m;return 0==r&&
+257<n||0!=e.status?-1:B(d,b,a)};this.inflate=function(x,K){null==g&&(g=Array(65536));a=c=k=0;b=-1;h=!1;d=l=0;q=null;n=x;w=0;var I=new runtime.ByteArray(K);a:{var u,s;for(u=0;u<K&&!(h&&-1==b);){if(0<d){if(0!=b)for(;0<d&&u<K;)d--,l&=32767,k&=32767,I[0+u++]=g[k++]=g[l++];else{for(;0<d&&u<K;)d--,k&=32767,A(8),I[0+u++]=g[k++]=z(8),y(8);0==d&&(b=-1)}if(u==K)break}if(-1==b){if(h)break;A(1);0!=z(1)&&(h=!0);y(1);A(2);b=z(2);y(2);q=null;d=0}switch(b){case 0:s=I;var D=0+u,H=K-u,F=void 0,F=a&7;y(F);A(16);F=z(16);
+y(16);A(16);if(F!=(~c&65535))s=-1;else{y(16);d=F;for(F=0;0<d&&F<H;)d--,k&=32767,A(8),s[D+F++]=g[k++]=z(8),y(8);0==d&&(b=-1);s=F}break;case 1:if(null!=q)s=B(I,0+u,K-u);else b:{s=I;D=0+u;H=K-u;if(null==m){for(var L=void 0,F=Array(288),L=void 0,L=0;144>L;L++)F[L]=8;for(;256>L;L++)F[L]=9;for(;280>L;L++)F[L]=7;for(;288>L;L++)F[L]=8;e=7;L=new J(F,288,257,v,G,e);if(0!=L.status){alert("HufBuild error: "+L.status);s=-1;break b}m=L.root;e=L.m;for(L=0;30>L;L++)F[L]=5;Q=5;L=new J(F,30,0,C,E,Q);if(1<L.status){m=
+null;alert("HufBuild error: "+L.status);s=-1;break b}f=L.root;Q=L.m}q=m;p=f;j=e;r=Q;s=B(s,D,H)}break;case 2:s=null!=q?B(I,0+u,K-u):M(I,0+u,K-u);break;default:s=-1}if(-1==s)break a;u+=s}}n=null;return I}};
// Input 7
-core.Cursor=function(j,l){function f(a,b){for(var d=b;d&&d!==a;)d=d.parentNode;return d||b}function g(){var c,b,d;if(a.parentNode){b=0;for(c=a.parentNode.firstChild;c&&c!==a;)b+=1,c=c.nextSibling;a.previousSibling&&3===a.previousSibling.nodeType&&a.nextSibling&&3===a.nextSibling.nodeType&&(d=a.nextSibling,a.previousSibling.appendData(d.nodeValue));for(c=0;c<j.rangeCount;c+=1){var k=j.getRangeAt(c),e=b,i=void 0,h=void 0,i=a.parentNode,h=f(a,k.startContainer);f(a,k.endContainer);h===a?k.setStart(i,
-e):h===i&&k.startOffset>e&&k.setStart(i,k.startOffset-1);k.endContainer===a?k.setEnd(i,e):k.endContainer===i&&k.endOffset>e&&k.setEnd(i,k.endOffset-1)}if(d){for(c=0;c<j.rangeCount;c+=1){var k=j.getRangeAt(c),e=a.previousSibling,i=d,h=b,n=e.length-i.length;k.startContainer===i?k.setStart(e,n+k.startOffset):k.startContainer===e.parentNode&&k.startOffset===h&&k.setStart(e,n);k.endContainer===i?k.setEnd(e,n+k.endOffset):k.endContainer===e.parentNode&&k.endOffset===h&&k.setEnd(e,n)}d.parentNode.removeChild(d)}a.parentNode.removeChild(a)}}
-var a;a=l.createElementNS("urn:webodf:names:cursor","cursor");this.getNode=function(){return a};this.updateToSelection=function(){g();if(j.focusNode){var c=j.focusNode,b=j.focusOffset;if(3===c.nodeType){var d,f,e,i;i=c.parentNode;0===b?i.insertBefore(a,c):b===c.length?i.appendChild(a):(d=c.length,f=c.nextSibling,e=l.createTextNode(c.substringData(b,d)),c.deleteData(b,d),f?i.insertBefore(e,f):i.appendChild(e),i.insertBefore(a,e))}else if(9!==c.nodeType){for(d=c.firstChild;d&&b;)d=d.nextSibling,b-=
-1;c.insertBefore(a,d)}}};this.remove=function(){g()}};
+core.Selection=function(g){var k=this,m=[];this.getRangeAt=function(f){return m[f]};this.addRange=function(f){0===m.length&&(k.focusNode=f.startContainer,k.focusOffset=f.startOffset);m.push(f);k.rangeCount+=1};this.removeAllRanges=function(){m=[];k.rangeCount=0;k.focusNode=null;k.focusOffset=0};this.collapse=function(f,e){runtime.assert(0<=e,"invalid offset "+e+" in Selection.collapse");m.length=k.rangeCount=1;var c=m[0];c||(m[0]=c=g.createRange());c.setStart(f,e);c.collapse(!0);k.focusNode=f;k.focusOffset=
+e};this.extend=function(){};this.rangeCount=0;this.focusNode=null;this.focusOffset=0};
// Input 8
-core.UnitTest=function(){};core.UnitTest.prototype.setUp=function(){};core.UnitTest.prototype.tearDown=function(){};core.UnitTest.prototype.description=function(){};core.UnitTest.prototype.tests=function(){};core.UnitTest.prototype.asyncTests=function(){};
-core.UnitTestRunner=function(){function j(a){g+=1;runtime.log("fail",a)}function l(a,c){var b;try{if(a.length!==c.length)return!1;for(b=0;b<a.length;b+=1)if(a[b]!==c[b])return!1}catch(d){return!1}return!0}function f(a,c,b){("string"!==typeof c||"string"!==typeof b)&&runtime.log("WARN: shouldBe() expects string arguments");var d,f;try{f=eval(c)}catch(e){d=e}a=eval(b);d?j(c+" should be "+a+". Threw exception "+d):(0===a?f===a&&1/f===1/a:f===a||("number"===typeof a&&isNaN(a)?"number"===typeof f&&isNaN(f):
-Object.prototype.toString.call(a)===Object.prototype.toString.call([])&&l(f,a)))?runtime.log("pass",c+" is "+b):typeof f===typeof a?j(c+" should be "+a+". Was "+(0===f&&0>1/f?"-0":""+f)+"."):j(c+" should be "+a+" (of type "+typeof a+"). Was "+f+" (of type "+typeof f+").")}var g=0;this.shouldBeNull=function(a,c){f(a,c,"null")};this.shouldBeNonNull=function(a,c){var b,d;try{d=eval(c)}catch(f){b=f}b?j(c+" should be non-null. Threw exception "+b):null!==d?runtime.log("pass",c+" is non-null."):j(c+" should be non-null. Was "+
-d)};this.shouldBe=f;this.countFailedTests=function(){return g}};
-core.UnitTester=function(){var j=0,l={};this.runTests=function(f,g){function a(b){if(0===b.length)l[c]=e,j+=d.countFailedTests(),g();else{h=b[0];var f=Runtime.getFunctionName(h);runtime.log("Running "+f);o=d.countFailedTests();k.setUp();h(function(){k.tearDown();e[f]=o===d.countFailedTests();a(b.slice(1))})}}var c=Runtime.getFunctionName(f),b,d=new core.UnitTestRunner,k=new f(d),e={},i,h,n,o;if(c.hasOwnProperty(l))runtime.log("Test "+c+" has already run.");else{runtime.log("Running "+c+": "+k.description());
-n=k.tests();for(i=0;i<n.length;i+=1)h=n[i],b=Runtime.getFunctionName(h),runtime.log("Running "+b),o=d.countFailedTests(),k.setUp(),h(),k.tearDown(),e[b]=o===d.countFailedTests();a(k.asyncTests())}};this.countFailedTests=function(){return j};this.results=function(){return l}};
+core.LoopWatchDog=function(g,k){var m=Date.now(),f=0;this.check=function(){var e;if(g&&(e=Date.now(),e-m>g))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0<k&&(f+=1,f>k))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}};
// Input 9
-core.PointWalker=function(j){function l(a){for(var c=-1;a;)a=a.previousSibling,c+=1;return c}var f=j,g=null,a=j&&j.firstChild,c=0;this.setPoint=function(b,d){f=b;c=d;if(3===f.nodeType)g=a=null;else{for(a=f.firstChild;d;)d-=1,a=a.nextSibling;g=a?a.previousSibling:f.lastChild}};this.stepForward=function(){var b;return 3===f.nodeType&&(b="number"===typeof f.nodeValue.length?f.nodeValue.length:f.nodeValue.length(),c<b)?(c+=1,!0):a?(1===a.nodeType?(f=a,g=null,a=f.firstChild,c=0):3===a.nodeType?(f=a,a=
-g=null,c=0):(g=a,a=a.nextSibling,c+=1),!0):f!==j?(g=f,a=g.nextSibling,f=f.parentNode,c=l(g)+1,!0):!1};this.stepBackward=function(){return 3===f.nodeType&&0<c?(c-=1,!0):g?(1===g.nodeType?(f=g,g=f.lastChild,a=null,c=l(g)+1):3===g.nodeType?(f=g,a=g=null,c="number"===typeof f.nodeValue.length?f.nodeValue.length:f.nodeValue.length()):(a=g,g=g.previousSibling,c-=1),!0):f!==j?(a=f,g=a.previousSibling,f=f.parentNode,c=l(a),!0):!1};this.node=function(){return f};this.position=function(){return c};this.precedingSibling=
-function(){return g};this.followingSibling=function(){return a}};
+runtime.loadClass("core.Selection");
+core.Cursor=function(g,k){function m(c){var a=f.nextSibling,b=0;e.parentNode&&(e.parentNode.removeChild(e),a&&3===a.nodeType&&(a.insertData(0,e.nodeValue),b=e.length));c(a,b);f.parentNode&&f.parentNode.removeChild(f)}var f,e;this.getNode=function(){return f};this.getSelection=function(){return g};this.updateToSelection=function(c,a){m(c);if(g.focusNode){var b=g.focusNode,h=g.focusOffset;if(3===b.nodeType){var d=b.parentNode;0<h&&(e.data=b.substringData(0,h),b.deleteData(0,h),d.insertBefore(e,b));
+d.insertBefore(f,b);a(f.nextSibling,h)}else if(1===b.nodeType){for(d=b.firstChild;null!==d&&0<h;)d=d.nextSibling,h-=1;b.insertBefore(f,d);a(f.nextSibling,0)}}};this.remove=function(c){m(c)};f=k.createElementNS("urn:webodf:names:cursor","cursor");e=k.createTextNode("")};
// Input 10
-core.Async=function(){this.forEach=function(j,l,f){function g(a){b!==c&&(a?(b=c,f(a)):(b+=1,b===c&&f(null)))}var a,c=j.length,b=0;for(a=0;a<c;a+=1)l(j[a],g)}};
+core.EditInfo=function(g,k){var m,f={};this.getNode=function(){return m};this.getOdtDocument=function(){return k};this.getEdits=function(){return f};this.getSortedEdits=function(){var e=[],c;for(c in f)f.hasOwnProperty(c)&&e.push({memberid:c,time:f[c].time});e.sort(function(a,b){return a.time-b.time});return e};this.addEdit=function(e,c){var a,b=e.split("___")[0];if(!f[e])for(a in f)if(f.hasOwnProperty(a)&&a.split("___")[0]===b){delete f[a];break}f[e]={time:c}};this.clearEdits=function(){f={}};m=
+k.getDOM().createElementNS("urn:webodf:names:editinfo","editinfo");g.insertBefore(m,g.firstChild)};
// Input 11
+core.UnitTest=function(){};core.UnitTest.prototype.setUp=function(){};core.UnitTest.prototype.tearDown=function(){};core.UnitTest.prototype.description=function(){};core.UnitTest.prototype.tests=function(){};core.UnitTest.prototype.asyncTests=function(){};
+core.UnitTest.provideTestAreaDiv=function(){var g=runtime.getWindow().document,k=g.getElementById("testarea");runtime.assert(!k,'Unclean test environment, found a div with id "testarea".');k=g.createElement("div");k.setAttribute("id","testarea");g.body.appendChild(k);return k};
+core.UnitTest.cleanupTestAreaDiv=function(){var g=runtime.getWindow().document,k=g.getElementById("testarea");runtime.assert(!!k&&k.parentNode===g.body,'Test environment broken, found no div with id "testarea" below body.');g.body.removeChild(k)};
+core.UnitTestRunner=function(){function g(e){f+=1;runtime.log("fail",e)}function k(e,c){var a;try{if(e.length!==c.length)return!1;for(a=0;a<e.length;a+=1)if(e[a]!==c[a])return!1}catch(b){return!1}return!0}function m(e,c,a){("string"!==typeof c||"string"!==typeof a)&&runtime.log("WARN: shouldBe() expects string arguments");var b,h;try{h=eval(c)}catch(d){b=d}e=eval(a);b?g(c+" should be "+e+". Threw exception "+b):(0===e?h===e&&1/h===1/e:h===e||("number"===typeof e&&isNaN(e)?"number"===typeof h&&isNaN(h):
+Object.prototype.toString.call(e)===Object.prototype.toString.call([])&&k(h,e)))?runtime.log("pass",c+" is "+a):String(typeof h)===String(typeof e)?(a=0===h&&0>1/h?"-0":String(h),g(c+" should be "+e+". Was "+a+".")):g(c+" should be "+e+" (of type "+typeof e+"). Was "+h+" (of type "+typeof h+").")}var f=0;this.shouldBeNull=function(e,c){m(e,c,"null")};this.shouldBeNonNull=function(e,c){var a,b;try{b=eval(c)}catch(h){a=h}a?g(c+" should be non-null. Threw exception "+a):null!==b?runtime.log("pass",c+
+" is non-null."):g(c+" should be non-null. Was "+b)};this.shouldBe=m;this.countFailedTests=function(){return f}};
+core.UnitTester=function(){var g=0,k={};this.runTests=function(m,f){function e(a){if(0===a.length)k[c]=d,g+=b.countFailedTests(),f();else{q=a[0];var l=Runtime.getFunctionName(q);runtime.log("Running "+l);j=b.countFailedTests();h.setUp();q(function(){h.tearDown();d[l]=j===b.countFailedTests();e(a.slice(1))})}}var c=Runtime.getFunctionName(m),a,b=new core.UnitTestRunner,h=new m(b),d={},l,q,p,j;if(k.hasOwnProperty(c))runtime.log("Test "+c+" has already run.");else{runtime.log("Running "+c+": "+h.description());
+p=h.tests();for(l=0;l<p.length;l+=1)q=p[l],a=Runtime.getFunctionName(q),runtime.log("Running "+a),j=b.countFailedTests(),h.setUp(),q(),h.tearDown(),d[a]=j===b.countFailedTests();e(h.asyncTests())}};this.countFailedTests=function(){return g};this.results=function(){return k}};
+// Input 12
+core.PositionIterator=function(g,k,m,f){function e(){this.acceptNode=function(d){return 3===d.nodeType&&0===d.length?2:1}}function c(d){this.acceptNode=function(b){return 3===b.nodeType&&0===b.length?2:d.acceptNode(b)}}function a(){var d=b.currentNode.nodeType;h=3===d?b.currentNode.length-1:1===d?1:0}var b,h;this.nextPosition=function(){if(b.currentNode===g)return!1;0===h&&1===b.currentNode.nodeType?null===b.firstChild()&&(h=1):3===b.currentNode.nodeType&&h+1<b.currentNode.length?h+=1:null!==b.nextSibling()?
+h=0:(b.parentNode(),h=1);return!0};this.previousPosition=function(){var d=!0;if(0===h)if(null===b.previousSibling()){b.parentNode();if(b.currentNode===g)return b.firstChild(),!1;h=0}else a();else 3===b.currentNode.nodeType?h-=1:null!==b.lastChild()?a():b.currentNode===g?d=!1:h=0;return d};this.container=function(){var d=b.currentNode,a=d.nodeType;return 0===h&&3!==a?d.parentNode:d};this.offset=function(){if(3===b.currentNode.nodeType)return h;var d=0,a=b.currentNode,c,e;for(c=1===h?b.lastChild():
+b.previousSibling();c;){if(3!==c.nodeType||c.nextSibling!==e||3!==e.nodeType)d+=1;e=c;c=b.previousSibling()}b.currentNode=a;return d};this.domOffset=function(){if(3===b.currentNode.nodeType)return h;var d=0,a=b.currentNode,c;for(c=1===h?b.lastChild():b.previousSibling();c;)d+=1,c=b.previousSibling();b.currentNode=a;return d};this.unfilteredDomOffset=function(){if(3===b.currentNode.nodeType)return h;for(var d=0,a=b.currentNode,a=1===h?a.lastChild:a.previousSibling;a;)d+=1,a=a.previousSibling;return d};
+this.textOffset=function(){if(3!==b.currentNode.nodeType)return 0;for(var d=h,a=b.currentNode;b.previousSibling()&&3===b.currentNode.nodeType;)d+=b.currentNode.length;b.currentNode=a;return d};this.substr=function(d,a){var c=b.currentNode,e="";if(3!==c.nodeType)return e;for(;b.previousSibling();)if(3!==b.currentNode.nodeType){b.nextSibling();break}do e+=b.currentNode.data;while(b.nextSibling()&&3===b.currentNode.nodeType);b.currentNode=c;return e.substr(d,a)};this.setPosition=function(d,a){runtime.assert(null!==
+d,"PositionIterator.setPosition called with container===null");b.currentNode=d;if(3===d.nodeType){h=a;if(a>d.length)throw"Error in setPosition: "+a+" > "+d.length;if(0>a)throw"Error in setPosition: "+a+" < 0";if(a===d.length)if(b.nextSibling())h=0;else if(b.parentNode())h=1;else throw"Error in setPosition: position not valid.";return!0}for(var c=a,e=b.firstChild(),j;0<a&&e;){a-=1;j=e;for(e=b.nextSibling();e&&3===e.nodeType&&3===j.nodeType&&e.previousSibling===j;)j=e,e=b.nextSibling()}if(0!==a)throw"Error in setPosition: offset "+
+c+" is out of range.";null===e?(b.currentNode=d,h=1):h=0;return!0};this.moveToEnd=function(){b.currentNode=g;h=1};m=(m?new c(m):new e).acceptNode;m.acceptNode=m;b=g.ownerDocument.createTreeWalker(g,k||4294967295,m,f);h=0;null===b.firstChild()&&(h=1)};
+// Input 13
+runtime.loadClass("core.PositionIterator");core.PositionFilter=function(){};core.PositionFilter.FilterResult={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3};core.PositionFilter.prototype.acceptPosition=function(){};(function(){return core.PositionFilter})();
+// Input 14
+core.Async=function(){this.forEach=function(g,k,m){function f(b){a!==c&&(b?(a=c,m(b)):(a+=1,a===c&&m(null)))}var e,c=g.length,a=0;for(e=0;e<c;e+=1)k(g[e],f)}};
+// Input 15
runtime.loadClass("core.RawInflate");runtime.loadClass("core.ByteArray");runtime.loadClass("core.ByteArrayWriter");runtime.loadClass("core.Base64");
-core.Zip=function(j,l){function f(a){var b=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,
+core.Zip=function(g,k){function m(d){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,
853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,
4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,
225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,
2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,
-2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],c,e,d=a.length,f=0,f=0;c=-1;for(e=0;e<d;e+=1)f=(c^a[e])&255,f=b[f],c=c>>>8^f;return c^-1}function g(a){return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&15,a>>5&63,(a&31)<<1)}function a(a){var b=a.getFullYear();return 1980>b?0:b-1980<<
-25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function c(a,b){var c,e,d,f,h,i,m,n=this;this.load=function(b){if(void 0!==n.data)b(null,n.data);else{var d=h+34+c+e+256;d+m>o&&(d=o-m);runtime.read(a,m,d,function(c,e){if(c)b(c,e);else a:{var d=e,m=new core.ByteArray(d),k=m.readUInt32LE(),g;if(67324752!==k)b("File entry signature is wrong."+k.toString()+" "+d.length.toString(),null);else{m.pos+=22;k=m.readUInt16LE();g=m.readUInt16LE();m.pos+=k+g;if(f){d=d.slice(m.pos,
-m.pos+h);if(h!==d.length){b("The amount of compressed bytes read was "+d.length.toString()+" instead of "+h.toString()+" for "+n.filename+" in "+a+".",null);break a}d=s(d,i)}else d=d.slice(m.pos,m.pos+i);i!==d.length?b("The amount of bytes read was "+d.length.toString()+" instead of "+i.toString()+" for "+n.filename+" in "+a+".",null):(n.data=d,b(null,d))}}})}};this.set=function(a,b,c,e){n.filename=a;n.data=b;n.compressed=c;n.date=e};this.error=null;b&&(33639248!==b.readUInt32LE()?this.error="Central directory entry has wrong signature at position "+
-(b.pos-4).toString()+' for file "'+a+'": '+b.data.length.toString():(b.pos+=6,f=b.readUInt16LE(),this.date=g(b.readUInt32LE()),b.readUInt32LE(),h=b.readUInt32LE(),i=b.readUInt32LE(),c=b.readUInt16LE(),e=b.readUInt16LE(),d=b.readUInt16LE(),b.pos+=8,m=b.readUInt32LE(),this.filename=runtime.byteArrayToString(b.data.slice(b.pos,b.pos+c),"utf8"),b.pos+=c+e+d))}function b(a,b){if(22!==a.length)b("Central directory length should be 22.",p);else{var e=new core.ByteArray(a),d;d=e.readUInt32LE();101010256!==
-d?b("Central directory signature is wrong: "+d.toString(),p):0!==e.readUInt16LE()?b("Zip files with non-zero disk numbers are not supported.",p):0!==e.readUInt16LE()?b("Zip files with non-zero disk numbers are not supported.",p):(d=e.readUInt16LE(),u=e.readUInt16LE(),d!==u?b("Number of entries is inconsistent.",p):(d=e.readUInt32LE(),e=e.readUInt16LE(),e=o-22-d,runtime.read(j,e,o-e,function(a,e){a:{var d=new core.ByteArray(e),f,m;n=[];for(f=0;f<u;f+=1){m=new c(j,d);if(m.error){b(m.error,p);break a}n[n.length]=
-m}b(null,p)}})))}}function d(a,b){var c=null,e,d;for(d=0;d<n.length;d+=1)if(e=n[d],e.filename===a){c=e;break}c?c.data?b(null,c.data):c.load(b):b(a+" not found.",null)}function k(a,b){d(a,function(a,c){if(a)return b(a,null);c=runtime.byteArrayToString(c,"utf8");b(null,c)})}function e(b){var c=new core.ByteArrayWriter("utf8"),e=0;c.appendArray([80,75,3,4,20,0,0,0,0,0]);b.data&&(e=b.data.length);c.appendUInt32LE(a(b.date));c.appendUInt32LE(f(b.data));c.appendUInt32LE(e);c.appendUInt32LE(e);c.appendUInt16LE(b.filename.length);
-c.appendUInt16LE(0);c.appendString(b.filename);b.data&&c.appendByteArray(b.data);return c}function i(b,c){var e=new core.ByteArrayWriter("utf8"),d=0;e.appendArray([80,75,1,2,20,0,20,0,0,0,0,0]);b.data&&(d=b.data.length);e.appendUInt32LE(a(b.date));e.appendUInt32LE(f(b.data));e.appendUInt32LE(d);e.appendUInt32LE(d);e.appendUInt16LE(b.filename.length);e.appendArray([0,0,0,0,0,0,0,0,0,0,0,0]);e.appendUInt32LE(c);e.appendString(b.filename);return e}function h(a,b){if(a===n.length)b(null);else{var c=n[a];
-void 0!==c.data?h(a+1,b):c.load(function(c){c?b(c):h(a+1,b)})}}var n,o,u,s=(new core.RawInflate).inflate,p=this,w=new core.Base64;this.load=d;this.save=function(a,b,e,d){var f,h;for(f=0;f<n.length;f+=1)if(h=n[f],h.filename===a){h.set(a,b,e,d);return}h=new c(j);h.set(a,b,e,d);n.push(h)};this.write=function(a){h(0,function(b){if(b)a(b);else{var b=new core.ByteArrayWriter("utf8"),c,d,f,h=[0];for(c=0;c<n.length;c+=1)b.appendByteArrayWriter(e(n[c])),h.push(b.getLength());f=b.getLength();for(c=0;c<n.length;c+=
-1)d=n[c],b.appendByteArrayWriter(i(d,h[c]));c=b.getLength()-f;b.appendArray([80,75,5,6,0,0,0,0]);b.appendUInt16LE(n.length);b.appendUInt16LE(n.length);b.appendUInt32LE(c);b.appendUInt32LE(f);b.appendArray([0,0]);runtime.writeFile(j,b.getByteArray(),a)}})};this.loadContentXmlAsFragments=function(a,b){k(a,function(a,c){if(a)return b.rootElementReady(a);b.rootElementReady(null,c,!0)})};this.loadAsString=k;this.loadAsDOM=function(a,b){k(a,function(a,c){a?b(a,null):(c=(new DOMParser).parseFromString(c,
-"text/xml"),b(null,c))})};this.loadAsDataURL=function(a,b,c){d(a,function(a,e){if(a)return c(a,null);var d=0,f;b||(b=80===e[1]&&78===e[2]&&71===e[3]?"image/png":255===e[0]&&216===e[1]&&255===e[2]?"image/jpeg":71===e[0]&&73===e[1]&&70===e[2]?"image/gif":"");for(f="data:"+b+";base64,";d<e.length;)f+=w.convertUTF8ArrayToBase64(e.slice(d,Math.min(d+45E3,e.length))),d+=45E3;c(null,f)})};this.getEntries=function(){return n.slice()};o=-1;null===l?n=[]:runtime.getFileSize(j,function(a){o=a;0>o?l("File '"+
-j+"' cannot be read.",p):runtime.read(j,o-22,22,function(a,c){a||null===l?l(a,p):b(c,l)})})};
-// Input 12
+2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],b,c,e=d.length,j=0,j=0;b=-1;for(c=0;c<e;c+=1)j=(b^d[c])&255,j=a[j],b=b>>>8^j;return b^-1}function f(d){var a=d.getFullYear();return 1980>a?0:a-1980<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1}function e(d,
+a){var b,c,e,j,l,h,f,n=this;this.load=function(a){if(void 0!==n.data)a(null,n.data);else{var b=l+34+c+e+256;b+f>p&&(b=p-f);runtime.read(d,f,b,function(b,c){if(b||null===c)a(b,c);else a:{var e=c,f=new core.ByteArray(e),g=f.readUInt32LE(),p;if(67324752!==g)a("File entry signature is wrong."+g.toString()+" "+e.length.toString(),null);else{f.pos+=22;g=f.readUInt16LE();p=f.readUInt16LE();f.pos+=g+p;if(j){e=e.slice(f.pos,f.pos+l);if(l!==e.length){a("The amount of compressed bytes read was "+e.length.toString()+
+" instead of "+l.toString()+" for "+n.filename+" in "+d+".",null);break a}e=r(e,h)}else e=e.slice(f.pos,f.pos+h);h!==e.length?a("The amount of bytes read was "+e.length.toString()+" instead of "+h.toString()+" for "+n.filename+" in "+d+".",null):(n.data=e,a(null,e))}}})}};this.set=function(d,a,b,c){n.filename=d;n.data=a;n.compressed=b;n.date=c};this.error=null;a&&(b=a.readUInt32LE(),33639248!==b?this.error="Central directory entry has wrong signature at position "+(a.pos-4).toString()+' for file "'+
+d+'": '+a.data.length.toString():(a.pos+=6,j=a.readUInt16LE(),b=a.readUInt32LE(),this.date=new Date((b>>25&127)+1980,(b>>21&15)-1,b>>16&31,b>>11&15,b>>5&63,(b&31)<<1),a.readUInt32LE(),l=a.readUInt32LE(),h=a.readUInt32LE(),c=a.readUInt16LE(),e=a.readUInt16LE(),b=a.readUInt16LE(),a.pos+=8,f=a.readUInt32LE(),this.filename=runtime.byteArrayToString(a.data.slice(a.pos,a.pos+c),"utf8"),a.pos+=c+e+b))}function c(d,a){var b=null,c,e;for(e=0;e<q.length;e+=1)if(c=q[e],c.filename===d){b=c;break}b?b.data?a(null,
+b.data):b.load(a):a(d+" not found.",null)}function a(d){var a=new core.ByteArrayWriter("utf8"),b=0;a.appendArray([80,75,3,4,20,0,0,0,0,0]);d.data&&(b=d.data.length);a.appendUInt32LE(f(d.date));a.appendUInt32LE(m(d.data));a.appendUInt32LE(b);a.appendUInt32LE(b);a.appendUInt16LE(d.filename.length);a.appendUInt16LE(0);a.appendString(d.filename);d.data&&a.appendByteArray(d.data);return a}function b(d,a){var b=new core.ByteArrayWriter("utf8"),c=0;b.appendArray([80,75,1,2,20,0,20,0,0,0,0,0]);d.data&&(c=
+d.data.length);b.appendUInt32LE(f(d.date));b.appendUInt32LE(m(d.data));b.appendUInt32LE(c);b.appendUInt32LE(c);b.appendUInt16LE(d.filename.length);b.appendArray([0,0,0,0,0,0,0,0,0,0,0,0]);b.appendUInt32LE(a);b.appendString(d.filename);return b}function h(d,a){if(d===q.length)a(null);else{var b=q[d];void 0!==b.data?h(d+1,a):b.load(function(b){b?a(b):h(d+1,a)})}}function d(d,c){h(0,function(e){if(e)c(e);else{e=new core.ByteArrayWriter("utf8");var j,l,h,f=[0];for(j=0;j<q.length;j+=1)e.appendByteArrayWriter(a(q[j])),
+f.push(e.getLength());h=e.getLength();for(j=0;j<q.length;j+=1)l=q[j],e.appendByteArrayWriter(b(l,f[j]));j=e.getLength()-h;e.appendArray([80,75,5,6,0,0,0,0]);e.appendUInt16LE(q.length);e.appendUInt16LE(q.length);e.appendUInt32LE(j);e.appendUInt32LE(h);e.appendArray([0,0]);d(e.getByteArray())}})}function l(a,b){d(function(d){runtime.writeFile(a,d,b)},b)}var q,p,j,r=(new core.RawInflate).inflate,n=this,w=new core.Base64;this.load=c;this.save=function(d,a,b,c){var j,l;for(j=0;j<q.length;j+=1)if(l=q[j],
+l.filename===d){l.set(d,a,b,c);return}l=new e(g);l.set(d,a,b,c);q.push(l)};this.write=function(d){l(g,d)};this.writeAs=l;this.createByteArray=d;this.loadContentXmlAsFragments=function(d,a){n.loadAsString(d,function(d,b){if(d)return a.rootElementReady(d);a.rootElementReady(null,b,!0)})};this.loadAsString=function(d,a){c(d,function(d,b){if(d||null===b)return a(d,null);var c=runtime.byteArrayToString(b,"utf8");a(null,c)})};this.loadAsDOM=function(d,a){n.loadAsString(d,function(d,b){if(d||null===b)a(d,
+null);else{var c=(new DOMParser).parseFromString(b,"text/xml");a(null,c)}})};this.loadAsDataURL=function(d,a,b){c(d,function(d,c){if(d)return b(d,null);var e=0,j;a||(a=80===c[1]&&78===c[2]&&71===c[3]?"image/png":255===c[0]&&216===c[1]&&255===c[2]?"image/jpeg":71===c[0]&&73===c[1]&&70===c[2]?"image/gif":"");for(j="data:"+a+";base64,";e<c.length;)j+=w.convertUTF8ArrayToBase64(c.slice(e,Math.min(e+45E3,c.length))),e+=45E3;b(null,j)})};this.getEntries=function(){return q.slice()};p=-1;null===k?q=[]:runtime.getFileSize(g,
+function(d){p=d;0>p?k("File '"+g+"' cannot be read.",n):runtime.read(g,p-22,22,function(d,a){if(d||null===k||null===a)k(d,n);else if(22!==a.length)k("Central directory length should be 22.",n);else{var b=new core.ByteArray(a),c;c=b.readUInt32LE();101010256!==c?k("Central directory signature is wrong: "+c.toString(),n):(c=b.readUInt16LE(),0!==c?k("Zip files with non-zero disk numbers are not supported.",n):(c=b.readUInt16LE(),0!==c?k("Zip files with non-zero disk numbers are not supported.",n):(c=
+b.readUInt16LE(),j=b.readUInt16LE(),c!==j?k("Number of entries is inconsistent.",n):(c=b.readUInt32LE(),b=b.readUInt16LE(),b=p-22-c,runtime.read(g,b,p-b,function(d,a){if(d||null===a)k(d,n);else a:{var b=new core.ByteArray(a),c,l;q=[];for(c=0;c<j;c+=1){l=new e(g,b);if(l.error){k(l.error,n);break a}q[q.length]=l}k(null,n)}})))))}})})};
+// Input 16
+core.CSSUnits=function(){var g={"in":1,cm:2.54,mm:25.4,pt:72,pc:12};this.convert=function(k,m,f){return k*g[f]/g[m]};this.convertMeasure=function(g,m){var f,e;g&&m?(f=parseFloat(g),e=g.replace(f.toString(),""),f=this.convert(f,e,m)):f="";return f.toString()}};
+// Input 17
xmldom.LSSerializerFilter=function(){};
-// Input 13
-"function"!==typeof Object.create&&(Object.create=function(j){var l=function(){};l.prototype=j;return new l});
-xmldom.LSSerializer=function(){function j(f,g){var a="",c=Object.create(f),b=l.filter?l.filter.acceptNode(g):1,d;if(1===b){d="";var k=g.attributes,e,i,h,n="",o;if(k){c[g.namespaceURI]!==g.prefix&&(c[g.namespaceURI]=g.prefix);d+="<"+g.nodeName;e=k.length;for(i=0;i<e;i+=1)if(h=k.item(i),"http://www.w3.org/2000/xmlns/"!==h.namespaceURI&&(o=l.filter?l.filter.acceptNode(h):1,1===o)){if(h.namespaceURI){o=h.prefix;var u=h.namespaceURI;c.hasOwnProperty(u)?o=c[u]+":":(c[u]!==o&&(c[u]=o),o+=":")}else o="";
-n+=" "+(o+h.localName+'="'+h.nodeValue+'"')}for(i in c)c.hasOwnProperty(i)&&((o=c[i])?"xmlns"!==o&&(d+=" xmlns:"+c[i]+'="'+i+'"'):d+=' xmlns="'+i+'"');d+=n+">"}a+=d}if(1===b||3===b){for(d=g.firstChild;d;)a+=j(c,d),d=d.nextSibling;g.nodeValue&&(a+=g.nodeValue)}1===b&&(c="",1===g.nodeType&&(c+="</"+g.nodeName+">"),a+=c);return a}var l=this;this.filter=null;this.writeToString=function(f,g){if(!f)return"";var a;if(g){a=g;var c={},b;for(b in a)a.hasOwnProperty(b)&&(c[a[b]]=b);a=c}else a={};return j(a,
-f)}};
-// Input 14
-xmldom.RelaxNGParser=function(){function j(a,b){this.message=function(){b&&(a+=1===b.nodeType?" Element ":" Node ",a+=b.nodeName,b.nodeValue&&(a+=" with value '"+b.nodeValue+"'"),a+=".");return a}}function l(a){if(2>=a.e.length)return a;var b={name:a.name,e:a.e.slice(0,2)};return l({name:a.name,e:[b].concat(a.e.slice(2))})}function f(a){var a=a.split(":",2),b="",c;1===a.length?a=["",a[0]]:b=a[0];for(c in d)d[c]===b&&(a[0]=c);return a}function g(a,b){for(var c=0,d,k,j=a.name;a.e&&c<a.e.length;)if(d=
-a.e[c],"ref"===d.name){k=b[d.a.name];if(!k)throw d.a.name+" was not defined.";d=a.e.slice(c+1);a.e=a.e.slice(0,c);a.e=a.e.concat(k.e);a.e=a.e.concat(d)}else c+=1,g(d,b);d=a.e;if("choice"===j&&(!d||!d[1]||"empty"===d[1].name))!d||!d[0]||"empty"===d[0].name?(delete a.e,a.name="empty"):(d[1]=d[0],d[0]={name:"empty"});if("group"===j||"interleave"===j)"empty"===d[0].name?"empty"===d[1].name?(delete a.e,a.name="empty"):(j=a.name=d[1].name,a.names=d[1].names,d=a.e=d[1].e):"empty"===d[1].name&&(j=a.name=
-d[0].name,a.names=d[0].names,d=a.e=d[0].e);"oneOrMore"===j&&"empty"===d[0].name&&(delete a.e,a.name="empty");if("attribute"===j){k=a.names?a.names.length:0;for(var s,p=a.localnames=[k],w=a.namespaces=[k],c=0;c<k;c+=1)s=f(a.names[c]),w[c]=s[0],p[c]=s[1]}"interleave"===j&&("interleave"===d[0].name?"interleave"===d[1].name?a.e=d[0].e.concat(d[1].e):a.e=[d[1]].concat(d[0].e):"interleave"===d[1].name&&(a.e=[d[0]].concat(d[1].e)))}function a(b,c){for(var d=0,f;b.e&&d<b.e.length;)f=b.e[d],"elementref"===
-f.name?(f.id=f.id||0,b.e[d]=c[f.id]):"element"!==f.name&&a(f,c),d+=1}var c=this,b,d={"http://www.w3.org/XML/1998/namespace":"xml"},k;k=function(a,b,c){var g=[],j,u,s=a.localName,p=[];j=a.attributes;var w=s,B=p,A={},q,x;for(q=0;q<j.length;q+=1)if(x=j.item(q),x.namespaceURI)"http://www.w3.org/2000/xmlns/"===x.namespaceURI&&(d[x.value]=x.localName);else{"name"===x.localName&&("element"===w||"attribute"===w)&&B.push(x.value);if("name"===x.localName||"combine"===x.localName||"type"===x.localName){var E=
-x,C;C=x.value;C=C.replace(/^\s\s*/,"");for(var z=/\s/,F=C.length-1;z.test(C.charAt(F));)F-=1;C=C.slice(0,F+1);E.value=C}A[x.localName]=x.value}j=A;j.combine=j.combine||void 0;a=a.firstChild;w=g;B=p;for(A="";a;){if(1===a.nodeType&&"http://relaxng.org/ns/structure/1.0"===a.namespaceURI){if(q=k(a,b,w))"name"===q.name?B.push(d[q.a.ns]+":"+q.text):"choice"===q.name&&q.names&&q.names.length&&(B=B.concat(q.names),delete q.names),w.push(q)}else 3===a.nodeType&&(A+=a.nodeValue);a=a.nextSibling}a=A;"value"!==
-s&&"param"!==s&&(a=/^\s*([\s\S]*\S)?\s*$/.exec(a)[1]);"value"===s&&void 0===j.type&&(j.type="token",j.datatypeLibrary="");if(("attribute"===s||"element"===s)&&void 0!==j.name)u=f(j.name),g=[{name:"name",text:u[1],a:{ns:u[0]}}].concat(g),delete j.name;"name"===s||"nsName"===s||"value"===s?void 0===j.ns&&(j.ns=""):delete j.ns;"name"===s&&(u=f(a),j.ns=u[0],a=u[1]);if(1<g.length&&("define"===s||"oneOrMore"===s||"zeroOrMore"===s||"optional"===s||"list"===s||"mixed"===s))g=[{name:"group",e:l({name:"group",
-e:g}).e}];2<g.length&&"element"===s&&(g=[g[0]].concat({name:"group",e:l({name:"group",e:g.slice(1)}).e}));1===g.length&&"attribute"===s&&g.push({name:"text",text:a});if(1===g.length&&("choice"===s||"group"===s||"interleave"===s))s=g[0].name,p=g[0].names,j=g[0].a,a=g[0].text,g=g[0].e;else if(2<g.length&&("choice"===s||"group"===s||"interleave"===s))g=l({name:s,e:g}).e;"mixed"===s&&(s="interleave",g=[g[0],{name:"text"}]);"optional"===s&&(s="choice",g=[g[0],{name:"empty"}]);"zeroOrMore"===s&&(s="choice",
-g=[{name:"oneOrMore",e:[g[0]]},{name:"empty"}]);if("define"===s&&j.combine){a:{w=j.combine;B=j.name;A=g;for(q=0;c&&q<c.length;q+=1)if(x=c[q],"define"===x.name&&x.a&&x.a.name===B){x.e=[{name:w,e:x.e.concat(A)}];c=x;break a}c=null}if(c)return}c={name:s};g&&0<g.length&&(c.e=g);for(u in j)if(j.hasOwnProperty(u)){c.a=j;break}void 0!==a&&(c.text=a);p&&0<p.length&&(c.names=p);"element"===s&&(c.id=b.length,b.push(c),c={name:"elementref",id:c.id});return c};this.parseRelaxNGDOM=function(e,f){var h=[],n=k(e&&
-e.documentElement,h,void 0),o,l,s={};for(o=0;o<n.e.length;o+=1)l=n.e[o],"define"===l.name?s[l.a.name]=l:"start"===l.name&&(b=l);if(!b)return[new j("No Relax NG start element was found.")];g(b,s);for(o in s)s.hasOwnProperty(o)&&g(s[o],s);for(o=0;o<h.length;o+=1)g(h[o],s);f&&(c.rootPattern=f(b.e[0],h));a(b,h);for(o=0;o<h.length;o+=1)a(h[o],h);c.start=b;c.elements=h;c.nsmap=d;return null}};
-// Input 15
+// Input 18
+"function"!==typeof Object.create&&(Object.create=function(g){var k=function(){};k.prototype=g;return new k});
+xmldom.LSSerializer=function(){function g(m,f){var e="",c=Object.create(m),a=k.filter?k.filter.acceptNode(f):1,b;if(1===a){b="";var h=f.attributes,d,l,q,p="",j;if(h){f.namespaceURI&&c[f.namespaceURI]!==f.prefix&&(c[f.namespaceURI]=f.prefix);b+="<"+f.nodeName;d=h.length;for(l=0;l<d;l+=1)if(q=h.item(l),"http://www.w3.org/2000/xmlns/"!==q.namespaceURI&&(j=k.filter?k.filter.acceptNode(q):1,1===j)){if(q.namespaceURI){j=q.prefix;var r=q.namespaceURI;c.hasOwnProperty(r)?j=c[r]+":":(c[r]!==j&&(c[r]=j),j+=
+":")}else j="";p+=" "+(j+q.localName+'="'+q.nodeValue+'"')}for(l in c)c.hasOwnProperty(l)&&((j=c[l])?"xmlns"!==j&&(b+=" xmlns:"+c[l]+'="'+l+'"'):b+=' xmlns="'+l+'"');b+=p+">"}e+=b}if(1===a||3===a){for(b=f.firstChild;b;)e+=g(c,b),b=b.nextSibling;f.nodeValue&&(e+=f.nodeValue)}1===a&&(c="",1===f.nodeType&&(c+="</"+f.nodeName+">"),e+=c);return e}var k=this;this.filter=null;this.writeToString=function(k,f){if(!k)return"";var e;if(f){e=f;var c={},a;for(a in e)e.hasOwnProperty(a)&&(c[e[a]]=a);e=c}else e=
+{};return g(e,k)}};
+// Input 19
+xmldom.RelaxNGParser=function(){function g(d,a){this.message=function(){a&&(d+=1===a.nodeType?" Element ":" Node ",d+=a.nodeName,a.nodeValue&&(d+=" with value '"+a.nodeValue+"'"),d+=".");return d}}function k(d){if(2>=d.e.length)return d;var a={name:d.name,e:d.e.slice(0,2)};return k({name:d.name,e:[a].concat(d.e.slice(2))})}function m(d){d=d.split(":",2);var a="",c;1===d.length?d=["",d[0]]:a=d[0];for(c in b)b[c]===a&&(d[0]=c);return d}function f(d,a){for(var b=0,c,e,h=d.name;d.e&&b<d.e.length;)if(c=
+d.e[b],"ref"===c.name){e=a[c.a.name];if(!e)throw c.a.name+" was not defined.";c=d.e.slice(b+1);d.e=d.e.slice(0,b);d.e=d.e.concat(e.e);d.e=d.e.concat(c)}else b+=1,f(c,a);c=d.e;if("choice"===h&&(!c||!c[1]||"empty"===c[1].name))!c||!c[0]||"empty"===c[0].name?(delete d.e,d.name="empty"):(c[1]=c[0],c[0]={name:"empty"});if("group"===h||"interleave"===h)"empty"===c[0].name?"empty"===c[1].name?(delete d.e,d.name="empty"):(h=d.name=c[1].name,d.names=c[1].names,c=d.e=c[1].e):"empty"===c[1].name&&(h=d.name=
+c[0].name,d.names=c[0].names,c=d.e=c[0].e);"oneOrMore"===h&&"empty"===c[0].name&&(delete d.e,d.name="empty");if("attribute"===h){e=d.names?d.names.length:0;for(var n,g=d.localnames=[e],k=d.namespaces=[e],b=0;b<e;b+=1)n=m(d.names[b]),k[b]=n[0],g[b]=n[1]}"interleave"===h&&("interleave"===c[0].name?d.e="interleave"===c[1].name?c[0].e.concat(c[1].e):[c[1]].concat(c[0].e):"interleave"===c[1].name&&(d.e=[c[0]].concat(c[1].e)))}function e(d,a){for(var b=0,c;d.e&&b<d.e.length;)c=d.e[b],"elementref"===c.name?
+(c.id=c.id||0,d.e[b]=a[c.id]):"element"!==c.name&&e(c,a),b+=1}var c=this,a,b={"http://www.w3.org/XML/1998/namespace":"xml"},h;h=function(d,a,c){var e=[],j,f,n=d.localName,g=[];j=d.attributes;var x=n,v=g,G={},C,E;for(C=0;C<j.length;C+=1)if(E=j.item(C),E.namespaceURI)"http://www.w3.org/2000/xmlns/"===E.namespaceURI&&(b[E.value]=E.localName);else{"name"===E.localName&&("element"===x||"attribute"===x)&&v.push(E.value);if("name"===E.localName||"combine"===E.localName||"type"===E.localName){var u=E,s;s=
+E.value;s=s.replace(/^\s\s*/,"");for(var D=/\s/,J=s.length-1;D.test(s.charAt(J));)J-=1;s=s.slice(0,J+1);u.value=s}G[E.localName]=E.value}j=G;j.combine=j.combine||void 0;d=d.firstChild;x=e;v=g;for(G="";d;){if(1===d.nodeType&&"http://relaxng.org/ns/structure/1.0"===d.namespaceURI){if(C=h(d,a,x))"name"===C.name?v.push(b[C.a.ns]+":"+C.text):"choice"===C.name&&(C.names&&C.names.length)&&(v=v.concat(C.names),delete C.names),x.push(C)}else 3===d.nodeType&&(G+=d.nodeValue);d=d.nextSibling}d=G;"value"!==n&&
+"param"!==n&&(d=/^\s*([\s\S]*\S)?\s*$/.exec(d)[1]);"value"===n&&void 0===j.type&&(j.type="token",j.datatypeLibrary="");if(("attribute"===n||"element"===n)&&void 0!==j.name)f=m(j.name),e=[{name:"name",text:f[1],a:{ns:f[0]}}].concat(e),delete j.name;"name"===n||"nsName"===n||"value"===n?void 0===j.ns&&(j.ns=""):delete j.ns;"name"===n&&(f=m(d),j.ns=f[0],d=f[1]);if(1<e.length&&("define"===n||"oneOrMore"===n||"zeroOrMore"===n||"optional"===n||"list"===n||"mixed"===n))e=[{name:"group",e:k({name:"group",
+e:e}).e}];2<e.length&&"element"===n&&(e=[e[0]].concat({name:"group",e:k({name:"group",e:e.slice(1)}).e}));1===e.length&&"attribute"===n&&e.push({name:"text",text:d});if(1===e.length&&("choice"===n||"group"===n||"interleave"===n))n=e[0].name,g=e[0].names,j=e[0].a,d=e[0].text,e=e[0].e;else if(2<e.length&&("choice"===n||"group"===n||"interleave"===n))e=k({name:n,e:e}).e;"mixed"===n&&(n="interleave",e=[e[0],{name:"text"}]);"optional"===n&&(n="choice",e=[e[0],{name:"empty"}]);"zeroOrMore"===n&&(n="choice",
+e=[{name:"oneOrMore",e:[e[0]]},{name:"empty"}]);if("define"===n&&j.combine){a:{x=j.combine;v=j.name;G=e;for(C=0;c&&C<c.length;C+=1)if(E=c[C],"define"===E.name&&E.a&&E.a.name===v){E.e=[{name:x,e:E.e.concat(G)}];c=E;break a}c=null}if(c)return}c={name:n};e&&0<e.length&&(c.e=e);for(f in j)if(j.hasOwnProperty(f)){c.a=j;break}void 0!==d&&(c.text=d);g&&0<g.length&&(c.names=g);"element"===n&&(c.id=a.length,a.push(c),c={name:"elementref",id:c.id});return c};this.parseRelaxNGDOM=function(d,l){var k=[],m=h(d&&
+d.documentElement,k,void 0),j,r,n={};for(j=0;j<m.e.length;j+=1)r=m.e[j],"define"===r.name?n[r.a.name]=r:"start"===r.name&&(a=r);if(!a)return[new g("No Relax NG start element was found.")];f(a,n);for(j in n)n.hasOwnProperty(j)&&f(n[j],n);for(j=0;j<k.length;j+=1)f(k[j],n);l&&(c.rootPattern=l(a.e[0],k));e(a,k);for(j=0;j<k.length;j+=1)e(k[j],k);c.start=a;c.elements=k;c.nsmap=b;return null}};
+// Input 20
runtime.loadClass("xmldom.RelaxNGParser");
-xmldom.RelaxNG=function(){function j(a){return function(){var b;return function(){void 0===b&&(b=a());return b}}()}function l(a,b){return function(){var c={},d=0;return function(e){var f=e.hash||e.toString(),h;h=c[f];if(void 0!==h)return h;c[f]=h=b(e);h.hash=a+d.toString();d+=1;return h}}()}function f(a){return function(){var b={};return function(c){var d,e;e=b[c.localName];if(void 0===e)b[c.localName]=e={};else if(d=e[c.namespaceURI],void 0!==d)return d;return e[c.namespaceURI]=d=a(c)}}()}function g(a,
-b,c){return function(){var d={},e=0;return function(f,h){var i=b&&b(f,h),g,k;if(void 0!==i)return i;i=f.hash||f.toString();g=h.hash||h.toString();k=d[i];if(void 0===k)d[i]=k={};else if(i=k[g],void 0!==i)return i;k[g]=i=c(f,h);i.hash=a+e.toString();e+=1;return i}}()}function a(b,c){"choice"===c.p1.type?a(b,c.p1):b[c.p1.hash]=c.p1;"choice"===c.p2.type?a(b,c.p2):b[c.p2.hash]=c.p2}function c(a,b){return{type:"element",nc:a,nullable:!1,textDeriv:function(){return q},startTagOpenDeriv:function(c){return a.contains(c)?
-o(b,x):q},attDeriv:function(){return q},startTagCloseDeriv:function(){return this}}}function b(){return{type:"list",nullable:!1,hash:"list",textDeriv:function(){return x}}}function d(a,b,c,f){if(b===q)return q;if(f>=c.length)return b;0===f&&(f=0);for(var h=c.item(f);h.namespaceURI===e;){f+=1;if(f>=c.length)return b;h=c.item(f)}return h=d(a,b.attDeriv(a,c.item(f)),c,f+1)}function k(a,b,c){c.e[0].a?(a.push(c.e[0].text),b.push(c.e[0].a.ns)):k(a,b,c.e[0]);c.e[1].a?(a.push(c.e[1].text),b.push(c.e[1].a.ns)):
-k(a,b,c.e[1])}var e="http://www.w3.org/2000/xmlns/",i,h,n,o,u,s,p,w,B,A,q={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return q},startTagOpenDeriv:function(){return q},attDeriv:function(){return q},startTagCloseDeriv:function(){return q},endTagDeriv:function(){return q}},x={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return q},startTagOpenDeriv:function(){return q},attDeriv:function(){return q},startTagCloseDeriv:function(){return x},endTagDeriv:function(){return q}},
-E={type:"text",nullable:!0,hash:"text",textDeriv:function(){return E},startTagOpenDeriv:function(){return q},attDeriv:function(){return q},startTagCloseDeriv:function(){return E},endTagDeriv:function(){return q}},C,z,F;i=g("choice",function(a,b){if(a===q)return b;if(b===q||a===b)return a},function(b,c){var d={},e;a(d,{p1:b,p2:c});c=b=void 0;for(e in d)d.hasOwnProperty(e)&&(void 0===b?b=d[e]:c=void 0===c?d[e]:i(c,d[e]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable,
-textDeriv:function(c,d){return i(a.textDeriv(c,d),b.textDeriv(c,d))},startTagOpenDeriv:f(function(c){return i(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,d){return i(a.attDeriv(c,d),b.attDeriv(c,d))},startTagCloseDeriv:j(function(){return i(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:j(function(){return i(a.endTagDeriv(),b.endTagDeriv())})}}(b,c)});h=function(a,b,c){return function(){var d={},e=0;return function(f,h){var i=b&&b(f,h),k,g;if(void 0!==i)return i;
-i=f.hash||f.toString();k=h.hash||h.toString();i<k&&(g=i,i=k,k=g,g=f,f=h,h=g);g=d[i];if(void 0===g)d[i]=g={};else if(i=g[k],void 0!==i)return i;g[k]=i=c(f,h);i.hash=a+e.toString();e+=1;return i}}()}("interleave",function(a,b){if(a===q||b===q)return q;if(a===x)return b;if(b===x)return a},function(a,b){return{type:"interleave",p1:a,p2:b,nullable:a.nullable&&b.nullable,textDeriv:function(c,d){return i(h(a.textDeriv(c,d),b),h(a,b.textDeriv(c,d)))},startTagOpenDeriv:f(function(c){return i(C(function(a){return h(a,
-b)},a.startTagOpenDeriv(c)),C(function(b){return h(a,b)},b.startTagOpenDeriv(c)))}),attDeriv:function(c,d){return i(h(a.attDeriv(c,d),b),h(a,b.attDeriv(c,d)))},startTagCloseDeriv:j(function(){return h(a.startTagCloseDeriv(),b.startTagCloseDeriv())})}});n=g("group",function(a,b){if(a===q||b===q)return q;if(a===x)return b;if(b===x)return a},function(a,b){return{type:"group",p1:a,p2:b,nullable:a.nullable&&b.nullable,textDeriv:function(c,d){var e=n(a.textDeriv(c,d),b);return a.nullable?i(e,b.textDeriv(c,
-d)):e},startTagOpenDeriv:function(c){var d=C(function(a){return n(a,b)},a.startTagOpenDeriv(c));return a.nullable?i(d,b.startTagOpenDeriv(c)):d},attDeriv:function(c,d){return i(n(a.attDeriv(c,d),b),n(a,b.attDeriv(c,d)))},startTagCloseDeriv:j(function(){return n(a.startTagCloseDeriv(),b.startTagCloseDeriv())})}});o=g("after",function(a,b){if(a===q||b===q)return q},function(a,b){return{type:"after",p1:a,p2:b,nullable:!1,textDeriv:function(c,d){return o(a.textDeriv(c,d),b)},startTagOpenDeriv:f(function(c){return C(function(a){return o(a,
-b)},a.startTagOpenDeriv(c))}),attDeriv:function(c,d){return o(a.attDeriv(c,d),b)},startTagCloseDeriv:j(function(){return o(a.startTagCloseDeriv(),b)}),endTagDeriv:j(function(){return a.nullable?b:q})}});u=l("oneormore",function(a){return a===q?q:{type:"oneOrMore",p:a,nullable:a.nullable,textDeriv:function(b,c){return n(a.textDeriv(b,c),i(this,x))},startTagOpenDeriv:function(b){var c=this;return C(function(a){return n(a,i(c,x))},a.startTagOpenDeriv(b))},attDeriv:function(b,c){return n(a.attDeriv(b,
-c),i(this,x))},startTagCloseDeriv:j(function(){return u(a.startTagCloseDeriv())})}});p=g("attribute",void 0,function(a,b){return{type:"attribute",nullable:!1,nc:a,p:b,attDeriv:function(c,d){return a.contains(d)&&(b.nullable&&/^\s+$/.test(d.nodeValue)||b.textDeriv(c,d.nodeValue).nullable)?x:q},startTagCloseDeriv:function(){return q}}});s=l("value",function(a){return{type:"value",nullable:!1,value:a,textDeriv:function(b,c){return c===a?x:q},attDeriv:function(){return q},startTagCloseDeriv:function(){return this}}});
-B=l("data",function(a){return{type:"data",nullable:!1,dataType:a,textDeriv:function(){return x},attDeriv:function(){return q},startTagCloseDeriv:function(){return this}}});C=function t(a,b){return"after"===b.type?o(b.p1,a(b.p2)):"choice"===b.type?i(t(a,b.p1),t(a,b.p2)):b};z=function(a,b,c){for(var e=c.currentNode,b=b.startTagOpenDeriv(e),b=d(a,b,e.attributes,0),f=b=b.startTagCloseDeriv(),e=c.currentNode,b=c.firstChild(),h=[],g;b;)1===b.nodeType?h.push(b):3===b.nodeType&&!/^\s*$/.test(b.nodeValue)&&
-h.push(b.nodeValue),b=c.nextSibling();0===h.length&&(h=[""]);g=f;for(f=0;g!==q&&f<h.length;f+=1)b=h[f],"string"===typeof b?g=/^\s*$/.test(b)?i(g,g.textDeriv(a,b)):g.textDeriv(a,b):(c.currentNode=b,g=z(a,g,c));c.currentNode=e;return b=g.endTagDeriv()};w=function(a){var b,c,d;if("name"===a.name)b=a.text,c=a.a.ns,a={name:b,ns:c,hash:"{"+c+"}"+b,contains:function(a){return a.namespaceURI===c&&a.localName===b}};else if("choice"===a.name){b=[];c=[];k(b,c,a);a="";for(d=0;d<b.length;d+=1)a+="{"+c[d]+"}"+
-b[d]+",";a={hash:a,contains:function(a){var d;for(d=0;d<b.length;d+=1)if(b[d]===a.localName&&c[d]===a.namespaceURI)return!0;return!1}}}else a={hash:"anyName",contains:function(){return!0}};return a};A=function r(a,d){var e,f;if("elementref"===a.name){e=a.id||0;a=d[e];if(void 0!==a.name){var g=a;e=d[g.id]={hash:"element"+g.id.toString()};g=c(w(g.e[0]),A(g.e[1],d));for(f in g)g.hasOwnProperty(f)&&(e[f]=g[f]);f=e}else f=a;return f}switch(a.name){case "empty":return x;case "notAllowed":return q;case "text":return E;
-case "choice":return i(r(a.e[0],d),r(a.e[1],d));case "interleave":e=r(a.e[0],d);for(f=1;f<a.e.length;f+=1)e=h(e,r(a.e[f],d));return e;case "group":return n(r(a.e[0],d),r(a.e[1],d));case "oneOrMore":return u(r(a.e[0],d));case "attribute":return p(w(a.e[0]),r(a.e[1],d));case "value":return s(a.text);case "data":return e=a.a&&a.a.type,void 0===e&&(e=""),B(e);case "list":return b()}throw"No support for "+a.name;};this.makePattern=function(a,b){var c={},d;for(d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return d=
-A(a,c)};this.validate=function(a,b){var c;a.currentNode=a.root;c=z(null,F,a);c.nullable?b(null):(runtime.log("Error in Relax NG validation: "+c),b(["Error in Relax NG validation: "+c]))};this.init=function(a){F=a}};
-// Input 16
+xmldom.RelaxNG=function(){function g(d){var a;return function(){void 0===a&&(a=d());return a}}function k(d,a){var b={},c=0;return function(e){var j=e.hash||e.toString(),h;h=b[j];if(void 0!==h)return h;b[j]=h=a(e);h.hash=d+c.toString();c+=1;return h}}function m(d){var a={};return function(b){var c,e;e=a[b.localName];if(void 0===e)a[b.localName]=e={};else if(c=e[b.namespaceURI],void 0!==c)return c;return e[b.namespaceURI]=c=d(b)}}function f(d,a,b){var c={},e=0;return function(j,h){var l=a&&a(j,h),f,
+n;if(void 0!==l)return l;l=j.hash||j.toString();f=h.hash||h.toString();n=c[l];if(void 0===n)c[l]=n={};else if(l=n[f],void 0!==l)return l;n[f]=l=b(j,h);l.hash=d+e.toString();e+=1;return l}}function e(d,a){"choice"===a.p1.type?e(d,a.p1):d[a.p1.hash]=a.p1;"choice"===a.p2.type?e(d,a.p2):d[a.p2.hash]=a.p2}function c(d,a,e,j){if(a===v)return v;if(j>=e.length)return a;0===j&&(j=0);for(var h=e.item(j);h.namespaceURI===b;){j+=1;if(j>=e.length)return a;h=e.item(j)}return h=c(d,a.attDeriv(d,e.item(j)),e,j+1)}
+function a(d,b,c){c.e[0].a?(d.push(c.e[0].text),b.push(c.e[0].a.ns)):a(d,b,c.e[0]);c.e[1].a?(d.push(c.e[1].text),b.push(c.e[1].a.ns)):a(d,b,c.e[1])}var b="http://www.w3.org/2000/xmlns/",h,d,l,q,p,j,r,n,w,x,v={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return v},startTagOpenDeriv:function(){return v},attDeriv:function(){return v},startTagCloseDeriv:function(){return v},endTagDeriv:function(){return v}},G={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return v},
+startTagOpenDeriv:function(){return v},attDeriv:function(){return v},startTagCloseDeriv:function(){return G},endTagDeriv:function(){return v}},C={type:"text",nullable:!0,hash:"text",textDeriv:function(){return C},startTagOpenDeriv:function(){return v},attDeriv:function(){return v},startTagCloseDeriv:function(){return C},endTagDeriv:function(){return v}},E,u,s;h=f("choice",function(d,a){if(d===v)return a;if(a===v||d===a)return d},function(d,a){var b={},c;e(b,{p1:d,p2:a});a=d=void 0;for(c in b)b.hasOwnProperty(c)&&
+(void 0===d?d=b[c]:a=void 0===a?b[c]:h(a,b[c]));var j=d,l=a;return{type:"choice",p1:j,p2:l,nullable:j.nullable||l.nullable,textDeriv:function(d,a){return h(j.textDeriv(d,a),l.textDeriv(d,a))},startTagOpenDeriv:m(function(d){return h(j.startTagOpenDeriv(d),l.startTagOpenDeriv(d))}),attDeriv:function(d,a){return h(j.attDeriv(d,a),l.attDeriv(d,a))},startTagCloseDeriv:g(function(){return h(j.startTagCloseDeriv(),l.startTagCloseDeriv())}),endTagDeriv:g(function(){return h(j.endTagDeriv(),l.endTagDeriv())})}});
+var D=function(d,a){if(d===v||a===v)return v;if(d===G)return a;if(a===G)return d},J={},A=0;d=function(a,b){var c=D&&D(a,b),e,j;if(void 0!==c)return c;c=a.hash||a.toString();e=b.hash||b.toString();c<e&&(j=c,c=e,e=j,j=a,a=b,b=j);j=J[c];if(void 0===j)J[c]=j={};else if(c=j[e],void 0!==c)return c;var l=a,f=b,c={type:"interleave",p1:l,p2:f,nullable:l.nullable&&f.nullable,textDeriv:function(a,b){return h(d(l.textDeriv(a,b),f),d(l,f.textDeriv(a,b)))},startTagOpenDeriv:m(function(a){return h(E(function(a){return d(a,
+f)},l.startTagOpenDeriv(a)),E(function(a){return d(l,a)},f.startTagOpenDeriv(a)))}),attDeriv:function(a,b){return h(d(l.attDeriv(a,b),f),d(l,f.attDeriv(a,b)))},startTagCloseDeriv:g(function(){return d(l.startTagCloseDeriv(),f.startTagCloseDeriv())})};j[e]=c;c.hash="interleave"+A.toString();A+=1;return c};l=f("group",function(d,a){if(d===v||a===v)return v;if(d===G)return a;if(a===G)return d},function(d,a){return{type:"group",p1:d,p2:a,nullable:d.nullable&&a.nullable,textDeriv:function(b,c){var e=l(d.textDeriv(b,
+c),a);return d.nullable?h(e,a.textDeriv(b,c)):e},startTagOpenDeriv:function(b){var c=E(function(d){return l(d,a)},d.startTagOpenDeriv(b));return d.nullable?h(c,a.startTagOpenDeriv(b)):c},attDeriv:function(b,c){return h(l(d.attDeriv(b,c),a),l(d,a.attDeriv(b,c)))},startTagCloseDeriv:g(function(){return l(d.startTagCloseDeriv(),a.startTagCloseDeriv())})}});q=f("after",function(d,a){if(d===v||a===v)return v},function(d,a){return{type:"after",p1:d,p2:a,nullable:!1,textDeriv:function(b,c){return q(d.textDeriv(b,
+c),a)},startTagOpenDeriv:m(function(b){return E(function(d){return q(d,a)},d.startTagOpenDeriv(b))}),attDeriv:function(b,c){return q(d.attDeriv(b,c),a)},startTagCloseDeriv:g(function(){return q(d.startTagCloseDeriv(),a)}),endTagDeriv:g(function(){return d.nullable?a:v})}});p=k("oneormore",function(d){return d===v?v:{type:"oneOrMore",p:d,nullable:d.nullable,textDeriv:function(a,b){return l(d.textDeriv(a,b),h(this,G))},startTagOpenDeriv:function(a){var b=this;return E(function(d){return l(d,h(b,G))},
+d.startTagOpenDeriv(a))},attDeriv:function(a,b){return l(d.attDeriv(a,b),h(this,G))},startTagCloseDeriv:g(function(){return p(d.startTagCloseDeriv())})}});r=f("attribute",void 0,function(d,a){return{type:"attribute",nullable:!1,nc:d,p:a,attDeriv:function(b,c){return d.contains(c)&&(a.nullable&&/^\s+$/.test(c.nodeValue)||a.textDeriv(b,c.nodeValue).nullable)?G:v},startTagCloseDeriv:function(){return v}}});j=k("value",function(d){return{type:"value",nullable:!1,value:d,textDeriv:function(a,b){return b===
+d?G:v},attDeriv:function(){return v},startTagCloseDeriv:function(){return this}}});w=k("data",function(d){return{type:"data",nullable:!1,dataType:d,textDeriv:function(){return G},attDeriv:function(){return v},startTagCloseDeriv:function(){return this}}});E=function y(d,a){return"after"===a.type?q(a.p1,d(a.p2)):"choice"===a.type?h(y(d,a.p1),y(d,a.p2)):a};u=function(d,a,b){var e=b.currentNode;a=a.startTagOpenDeriv(e);a=c(d,a,e.attributes,0);var j=a=a.startTagCloseDeriv(),e=b.currentNode;a=b.firstChild();
+for(var l=[],f;a;)1===a.nodeType?l.push(a):3===a.nodeType&&!/^\s*$/.test(a.nodeValue)&&l.push(a.nodeValue),a=b.nextSibling();0===l.length&&(l=[""]);f=j;for(j=0;f!==v&&j<l.length;j+=1)a=l[j],"string"===typeof a?f=/^\s*$/.test(a)?h(f,f.textDeriv(d,a)):f.textDeriv(d,a):(b.currentNode=a,f=u(d,f,b));b.currentNode=e;return a=f.endTagDeriv()};n=function(d){var b,c,e;if("name"===d.name)b=d.text,c=d.a.ns,d={name:b,ns:c,hash:"{"+c+"}"+b,contains:function(d){return d.namespaceURI===c&&d.localName===b}};else if("choice"===
+d.name){b=[];c=[];a(b,c,d);d="";for(e=0;e<b.length;e+=1)d+="{"+c[e]+"}"+b[e]+",";d={hash:d,contains:function(d){var a;for(a=0;a<b.length;a+=1)if(b[a]===d.localName&&c[a]===d.namespaceURI)return!0;return!1}}}else d={hash:"anyName",contains:function(){return!0}};return d};x=function B(a,b){var c,e;if("elementref"===a.name){c=a.id||0;a=b[c];if(void 0!==a.name){var f=a;c=b[f.id]={hash:"element"+f.id.toString()};var g=n(f.e[0]),k=x(f.e[1],b),f={type:"element",nc:g,nullable:!1,textDeriv:function(){return v},
+startTagOpenDeriv:function(a){return g.contains(a)?q(k,G):v},attDeriv:function(){return v},startTagCloseDeriv:function(){return this}};for(e in f)f.hasOwnProperty(e)&&(c[e]=f[e]);return c}return a}switch(a.name){case "empty":return G;case "notAllowed":return v;case "text":return C;case "choice":return h(B(a.e[0],b),B(a.e[1],b));case "interleave":c=B(a.e[0],b);for(e=1;e<a.e.length;e+=1)c=d(c,B(a.e[e],b));return c;case "group":return l(B(a.e[0],b),B(a.e[1],b));case "oneOrMore":return p(B(a.e[0],b));
+case "attribute":return r(n(a.e[0]),B(a.e[1],b));case "value":return j(a.text);case "data":return c=a.a&&a.a.type,void 0===c&&(c=""),w(c);case "list":return{type:"list",nullable:!1,hash:"list",textDeriv:function(){return G}}}throw"No support for "+a.name;};this.makePattern=function(a,d){var b={},c;for(c in d)d.hasOwnProperty(c)&&(b[c]=d[c]);return c=x(a,b)};this.validate=function(a,d){var b;a.currentNode=a.root;b=u(null,s,a);b.nullable?d(null):(runtime.log("Error in Relax NG validation: "+b),d(["Error in Relax NG validation: "+
+b]))};this.init=function(a){s=a}};
+// Input 21
runtime.loadClass("xmldom.RelaxNGParser");
-xmldom.RelaxNG2=function(){function j(a,c){this.message=function(){c&&(a+=1===c.nodeType?" Element ":" Node ",a+=c.nodeName,c.nodeValue&&(a+=" with value '"+c.nodeValue+"'"),a+=".");return a}}function l(b,c,f,e){return"empty"===b.name?null:a(b,c,f,e)}function f(a,d){if(2!==a.e.length)throw"Element with wrong # of elements: "+a.e.length;for(var f=d.currentNode,e=f?f.nodeType:0,g=null;1<e;){if(8!==e&&(3!==e||!/^\s+$/.test(d.currentNode.nodeValue)))return[new j("Not allowed node of type "+e+".")];e=
-(f=d.nextSibling())?f.nodeType:0}if(!f)return[new j("Missing element "+a.names)];if(a.names&&-1===a.names.indexOf(c[f.namespaceURI]+":"+f.localName))return[new j("Found "+f.nodeName+" instead of "+a.names+".",f)];if(d.firstChild()){for(g=l(a.e[1],d,f);d.nextSibling();)if(e=d.currentNode.nodeType,(!d.currentNode||!(3===d.currentNode.nodeType&&/^\s+$/.test(d.currentNode.nodeValue)))&&8!==e)return[new j("Spurious content.",d.currentNode)];if(d.parentNode()!==f)return[new j("Implementation error.")]}else g=
-l(a.e[1],d,f);d.nextSibling();return g}var g,a,c;a=function(b,c,g,e){var i=b.name,h=null;if("text"===i)a:{for(var n=(b=c.currentNode)?b.nodeType:0;b!==g&&3!==n;){if(1===n){h=[new j("Element not allowed here.",b)];break a}n=(b=c.nextSibling())?b.nodeType:0}c.nextSibling();h=null}else if("data"===i)h=null;else if("value"===i)e!==b.text&&(h=[new j("Wrong value, should be '"+b.text+"', not '"+e+"'",g)]);else if("list"===i)h=null;else if("attribute"===i)a:{if(2!==b.e.length)throw"Attribute with wrong # of elements: "+
-b.e.length;i=b.localnames.length;for(h=0;h<i;h+=1){e=g.getAttributeNS(b.namespaces[h],b.localnames[h]);""===e&&!g.hasAttributeNS(b.namespaces[h],b.localnames[h])&&(e=void 0);if(void 0!==n&&void 0!==e){h=[new j("Attribute defined too often.",g)];break a}n=e}h=void 0===n?[new j("Attribute not found: "+b.names,g)]:l(b.e[1],c,g,n)}else if("element"===i)h=f(b,c,g);else if("oneOrMore"===i){e=0;do n=c.currentNode,i=a(b.e[0],c,g),e+=1;while(!i&&n!==c.currentNode);1<e?(c.currentNode=n,h=null):h=i}else if("choice"===
-i){if(2!==b.e.length)throw"Choice with wrong # of options: "+b.e.length;n=c.currentNode;if("empty"===b.e[0].name){if(i=a(b.e[1],c,g,e))c.currentNode=n;h=null}else{if(i=l(b.e[0],c,g,e))c.currentNode=n,i=a(b.e[1],c,g,e);h=i}}else if("group"===i){if(2!==b.e.length)throw"Group with wrong # of members: "+b.e.length;h=a(b.e[0],c,g)||a(b.e[1],c,g)}else if("interleave"===i)a:{for(var n=b.e.length,e=[n],o=n,u,s,p,w;0<o;){u=0;s=c.currentNode;for(h=0;h<n;h+=1)p=c.currentNode,!0!==e[h]&&e[h]!==p&&(w=b.e[h],(i=
-a(w,c,g))?(c.currentNode=p,void 0===e[h]&&(e[h]=!1)):p===c.currentNode||"oneOrMore"===w.name||"choice"===w.name&&("oneOrMore"===w.e[0].name||"oneOrMore"===w.e[1].name)?(u+=1,e[h]=p):(u+=1,e[h]=!0));if(s===c.currentNode&&u===o)break;if(0===u){for(h=0;h<n;h+=1)if(!1===e[h]){h=[new j("Interleave does not match.",g)];break a}break}for(h=o=0;h<n;h+=1)!0!==e[h]&&(o+=1)}h=null}else throw i+" not allowed in nonEmptyPattern.";return h};this.validate=function(a,c){a.currentNode=a.root;var f=l(g.e[0],a,a.root);
-c(f)};this.init=function(a,d){g=a;c=d}};
-// Input 17
+xmldom.RelaxNG2=function(){function g(a,b){this.message=function(){b&&(a+=1===b.nodeType?" Element ":" Node ",a+=b.nodeName,b.nodeValue&&(a+=" with value '"+b.nodeValue+"'"),a+=".");return a}}function k(a,b,c,d){return"empty"===a.name?null:e(a,b,c,d)}function m(a,b){if(2!==a.e.length)throw"Element with wrong # of elements: "+a.e.length;for(var e=b.currentNode,d=e?e.nodeType:0,l=null;1<d;){if(8!==d&&(3!==d||!/^\s+$/.test(b.currentNode.nodeValue)))return[new g("Not allowed node of type "+d+".")];d=
+(e=b.nextSibling())?e.nodeType:0}if(!e)return[new g("Missing element "+a.names)];if(a.names&&-1===a.names.indexOf(c[e.namespaceURI]+":"+e.localName))return[new g("Found "+e.nodeName+" instead of "+a.names+".",e)];if(b.firstChild()){for(l=k(a.e[1],b,e);b.nextSibling();)if(d=b.currentNode.nodeType,(!b.currentNode||!(3===b.currentNode.nodeType&&/^\s+$/.test(b.currentNode.nodeValue)))&&8!==d)return[new g("Spurious content.",b.currentNode)];if(b.parentNode()!==e)return[new g("Implementation error.")]}else l=
+k(a.e[1],b,e);b.nextSibling();return l}var f,e,c;e=function(a,b,c,d){var l=a.name,f=null;if("text"===l)a:{for(var p=(a=b.currentNode)?a.nodeType:0;a!==c&&3!==p;){if(1===p){f=[new g("Element not allowed here.",a)];break a}p=(a=b.nextSibling())?a.nodeType:0}b.nextSibling();f=null}else if("data"===l)f=null;else if("value"===l)d!==a.text&&(f=[new g("Wrong value, should be '"+a.text+"', not '"+d+"'",c)]);else if("list"===l)f=null;else if("attribute"===l)a:{if(2!==a.e.length)throw"Attribute with wrong # of elements: "+
+a.e.length;l=a.localnames.length;for(f=0;f<l;f+=1){d=c.getAttributeNS(a.namespaces[f],a.localnames[f]);""===d&&!c.hasAttributeNS(a.namespaces[f],a.localnames[f])&&(d=void 0);if(void 0!==p&&void 0!==d){f=[new g("Attribute defined too often.",c)];break a}p=d}f=void 0===p?[new g("Attribute not found: "+a.names,c)]:k(a.e[1],b,c,p)}else if("element"===l)f=m(a,b,c);else if("oneOrMore"===l){d=0;do p=b.currentNode,l=e(a.e[0],b,c),d+=1;while(!l&&p!==b.currentNode);1<d?(b.currentNode=p,f=null):f=l}else if("choice"===
+l){if(2!==a.e.length)throw"Choice with wrong # of options: "+a.e.length;p=b.currentNode;if("empty"===a.e[0].name){if(l=e(a.e[1],b,c,d))b.currentNode=p;f=null}else{if(l=k(a.e[0],b,c,d))b.currentNode=p,l=e(a.e[1],b,c,d);f=l}}else if("group"===l){if(2!==a.e.length)throw"Group with wrong # of members: "+a.e.length;f=e(a.e[0],b,c)||e(a.e[1],b,c)}else if("interleave"===l)a:{p=a.e.length;d=[p];for(var j=p,r,n,w,x;0<j;){r=0;n=b.currentNode;for(f=0;f<p;f+=1)w=b.currentNode,!0!==d[f]&&d[f]!==w&&(x=a.e[f],(l=
+e(x,b,c))?(b.currentNode=w,void 0===d[f]&&(d[f]=!1)):w===b.currentNode||"oneOrMore"===x.name||"choice"===x.name&&("oneOrMore"===x.e[0].name||"oneOrMore"===x.e[1].name)?(r+=1,d[f]=w):(r+=1,d[f]=!0));if(n===b.currentNode&&r===j){f=null;break a}if(0===r){for(f=0;f<p;f+=1)if(!1===d[f]){f=[new g("Interleave does not match.",c)];break a}f=null;break a}for(f=j=0;f<p;f+=1)!0!==d[f]&&(j+=1)}f=null}else throw l+" not allowed in nonEmptyPattern.";return f};this.validate=function(a,b){a.currentNode=a.root;var c=
+k(f.e[0],a,a.root);b(c)};this.init=function(a,b){f=a;c=b}};
+// Input 22
xmldom.OperationalTransformInterface=function(){};xmldom.OperationalTransformInterface.prototype.retain=function(){};xmldom.OperationalTransformInterface.prototype.insertCharacters=function(){};xmldom.OperationalTransformInterface.prototype.insertElementStart=function(){};xmldom.OperationalTransformInterface.prototype.insertElementEnd=function(){};xmldom.OperationalTransformInterface.prototype.deleteCharacters=function(){};xmldom.OperationalTransformInterface.prototype.deleteElementStart=function(){};
xmldom.OperationalTransformInterface.prototype.deleteElementEnd=function(){};xmldom.OperationalTransformInterface.prototype.replaceAttributes=function(){};xmldom.OperationalTransformInterface.prototype.updateAttributes=function(){};
-// Input 18
+// Input 23
xmldom.OperationalTransformDOM=function(){this.retain=function(){};this.insertCharacters=function(){};this.insertElementStart=function(){};this.insertElementEnd=function(){};this.deleteCharacters=function(){};this.deleteElementStart=function(){};this.deleteElementEnd=function(){};this.replaceAttributes=function(){};this.updateAttributes=function(){};this.atEnd=function(){return!0}};
-// Input 19
-xmldom.XPath=function(){function j(a,b,c){return-1!==a&&(a<b||-1===b)&&(a<c||-1===c)}function l(a){for(var b=[],c=0,d=a.length,e;c<d;){var f=a,g=d,i=b,k="",l=[],E=f.indexOf("[",c),C=f.indexOf("/",c),z=f.indexOf("=",c);j(C,E,z)?(k=f.substring(c,C),c=C+1):j(E,C,z)?(k=f.substring(c,E),c=h(f,E,l)):j(z,C,E)?(k=f.substring(c,z),c=z):(k=f.substring(c,g),c=g);i.push({location:k,predicates:l});if(c<d&&"="===a[c]){e=a.substring(c+1,d);if(2<e.length&&("'"===e[0]||'"'===e[0]))e=e.slice(1,e.length-1);else try{e=
-parseInt(e,10)}catch(F){}c=d}}return{steps:b,value:e}}function f(){}function g(){var a,c=!1;this.setNode=function(c){a=c};this.reset=function(){c=!1};this.next=function(){var b=c?null:a;c=!0;return b}}function a(a,c,b){this.reset=function(){a.reset()};this.next=function(){for(var d=a.next();d&&!(d=d.getAttributeNodeNS(c,b));)d=a.next();return d}}function c(a,c){var b=a.next(),d=null;this.reset=function(){a.reset();b=a.next();d=null};this.next=function(){for(;b;){if(d)if(c&&d.firstChild)d=d.firstChild;
-else{for(;!d.nextSibling&&d!==b;)d=d.parentNode;d===b?b=a.next():d=d.nextSibling}else{do(d=b.firstChild)||(b=a.next());while(b&&!d)}if(d&&1===d.nodeType)return d}return null}}function b(a,c){this.reset=function(){a.reset()};this.next=function(){for(var b=a.next();b&&!c(b);)b=a.next();return b}}function d(a,c,d){var c=c.split(":",2),e=d(c[0]),f=c[1];return new b(a,function(a){return a.localName===f&&a.namespaceURI===e})}function k(a,c,d){var e=new g,f=i(e,c,d),h=c.value;return void 0===h?new b(a,function(a){e.setNode(a);
-f.reset();return f.next()}):new b(a,function(a){e.setNode(a);f.reset();return(a=f.next())&&a.nodeValue===h})}function e(a,c,b){var d=a.ownerDocument,e=[],e=new g;e.setNode(a);a=l(c);e=i(e,a,b);a=[];for(b=e.next();b;)a.push(b),b=e.next();return e=a}var i,h;h=function(a,c,b){for(var d=c,e=a.length,f=0;d<e;)"]"===a[d]?(f-=1,0>=f&&b.push(l(a.substring(c,d)))):"["===a[d]&&(0>=f&&(c=d+1),f+=1),d+=1;return d};f.prototype.next=function(){};f.prototype.reset=function(){};i=function(b,e,f){var g,h,i,j;for(g=
-0;g<e.steps.length;g+=1){i=e.steps[g];h=i.location;""===h?b=new c(b,!1):"@"===h[0]?(j=h.slice(1).split(":",2),b=new a(b,f(j[0]),j[1])):"."!==h&&(b=new c(b,!1),-1!==h.indexOf(":")&&(b=d(b,h,f)));for(h=0;h<i.predicates.length;h+=1)j=i.predicates[h],b=k(b,j,f)}return b};xmldom.XPath=function(){this.getODFElementsWithXPath=e};return xmldom.XPath}();
-// Input 20
-odf.StyleInfo=function(){function j(f,g){for(var a=l[f.localName],c=a&&a[f.namespaceURI],b=c?c.length:0,d,k,e,a=0;a<b;a+=1)if(d=f.getAttributeNS(c[a].ns,c[a].localname))k=c[a].keygroup,(e=g[k])||(e=g[k]={}),e[d]=1;for(a=f.firstChild;a;)1===a.nodeType&&(c=a,j(c,g)),a=a.nextSibling}var l;this.UsedKeysList=function(f){var g={};this.uses=function(a){var c=a.localName,b=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","name")||a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0",
-"name"),a="style"===c?a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","family"):"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"===a.namespaceURI?"data":c;return(a=g[a])?0<a[b]:!1};j(f,g)};this.canElementHaveStyle=function(f,g){var a=l[g.localName];return(a=a&&a[g.namespaceURI])&&0<a.length};l=function(f){var g,a,c,b,d,j={},e;for(g in f)if(f.hasOwnProperty(g)){c=f[g];d=c.length;for(a=0;a<d;a+=1)b=c[a],e=j[b.en]=j[b.en]||{},e=e[b.ens]=e[b.ens]||[],e.push({ns:b.ans,localname:b.a,
-keygroup:g})}return j}({text:[{ens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",en:"tab-stop",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"leader-text-style"},{ens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",en:"drop-cap",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"notes-configuration",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"citation-body-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",
-en:"notes-configuration",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"citation-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"a",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"alphabetical-index",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"linenumbering-configuration",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",
-a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"list-level-style-number",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"ruby-text",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"span",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"a",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",
-a:"visited-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",en:"text-properties",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"text-line-through-text-style"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"alphabetical-index-source",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"main-entry-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-bibliography",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},
-{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-chapter",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-link-end",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-link-start",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",
+// Input 24
+xmldom.XPath=function(){function g(a,d,b){return-1!==a&&(a<d||-1===d)&&(a<b||-1===b)}function k(a){for(var d=[],b=0,c=a.length,e;b<c;){var f=a,l=c,h=d,k="",m=[],u=f.indexOf("[",b),s=f.indexOf("/",b),D=f.indexOf("=",b);g(s,u,D)?(k=f.substring(b,s),b=s+1):g(u,s,D)?(k=f.substring(b,u),b=q(f,u,m)):g(D,s,u)?(k=f.substring(b,D),b=D):(k=f.substring(b,l),b=l);h.push({location:k,predicates:m});if(b<c&&"="===a[b]){e=a.substring(b+1,c);if(2<e.length&&("'"===e[0]||'"'===e[0]))e=e.slice(1,e.length-1);else try{e=
+parseInt(e,10)}catch(J){}b=c}}return{steps:d,value:e}}function m(){}function f(){var a,d=!1;this.setNode=function(d){a=d};this.reset=function(){d=!1};this.next=function(){var b=d?null:a;d=!0;return b}}function e(a,d,b){this.reset=function(){a.reset()};this.next=function(){for(var c=a.next();c&&!(c=c.getAttributeNodeNS(d,b));)c=a.next();return c}}function c(a,d){var b=a.next(),c=null;this.reset=function(){a.reset();b=a.next();c=null};this.next=function(){for(;b;){if(c)if(d&&c.firstChild)c=c.firstChild;
+else{for(;!c.nextSibling&&c!==b;)c=c.parentNode;c===b?b=a.next():c=c.nextSibling}else{do(c=b.firstChild)||(b=a.next());while(b&&!c)}if(c&&1===c.nodeType)return c}return null}}function a(a,d){this.reset=function(){a.reset()};this.next=function(){for(var b=a.next();b&&!d(b);)b=a.next();return b}}function b(d,b,c){b=b.split(":",2);var e=c(b[0]),f=b[1];return new a(d,function(a){return a.localName===f&&a.namespaceURI===e})}function h(d,b,c){var e=new f,h=l(e,b,c),g=b.value;return void 0===g?new a(d,function(a){e.setNode(a);
+h.reset();return h.next()}):new a(d,function(a){e.setNode(a);h.reset();return(a=h.next())&&a.nodeValue===g})}function d(a,d,b){var c=a.ownerDocument,e=[],h=null;if(!c||!c.evaluate){e=new f;e.setNode(a);a=k(d);e=l(e,a,b);a=[];for(b=e.next();b;)a.push(b),b=e.next();e=a}else{b=c.evaluate(d,a,b,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null);for(h=b.iterateNext();null!==h;)1===h.nodeType&&e.push(h),h=b.iterateNext()}return e}var l,q;q=function(a,d,b){for(var c=d,e=a.length,f=0;c<e;)"]"===a[c]?(f-=1,0>=
+f&&b.push(k(a.substring(d,c)))):"["===a[c]&&(0>=f&&(d=c+1),f+=1),c+=1;return c};m.prototype.next=function(){};m.prototype.reset=function(){};l=function(a,d,f){var l,g,k,m;for(l=0;l<d.steps.length;l+=1){k=d.steps[l];g=k.location;""===g?a=new c(a,!1):"@"===g[0]?(m=g.slice(1).split(":",2),a=new e(a,f(m[0]),m[1])):"."!==g&&(a=new c(a,!1),-1!==g.indexOf(":")&&(a=b(a,g,f)));for(g=0;g<k.predicates.length;g+=1)m=k.predicates[g],a=h(a,m,f)}return a};xmldom.XPath=function(){this.getODFElementsWithXPath=d};
+return xmldom.XPath}();
+// Input 25
+runtime.loadClass("xmldom.XPath");
+odf.StyleInfo=function(){function g(a,d){for(var b=k[a.localName],c=b&&b[a.namespaceURI],e=c?c.length:0,f,l,b=0;b<e;b+=1)if(f=a.getAttributeNS(c[b].ns,c[b].localname))l=c[b].keyname,l=d[l]=d[l]||{},l[f]=1;for(b=a.firstChild;b;)1===b.nodeType&&(c=b,g(c,d)),b=b.nextSibling}var k,m=new xmldom.XPath;this.UsedStyleList=function(a){var d={};this.uses=function(a){var b=a.localName,c=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","name")||a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","name");
+a="style"===b?a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","family"):"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"===a.namespaceURI?"data":b;return(a=d[a])?0<a[c]:!1};g(a,d)};this.canElementHaveStyle=function(a,d){var b=k[d.localName],b=b&&b[d.namespaceURI];return 0<(b?b.length:0)};this.hasDerivedStyles=function(a,d,b){var c=d("style"),e=b.getAttributeNS(c,"name");b=b.getAttributeNS(c,"family");return m.getODFElementsWithXPath(a,"//style:*[@style:parent-style-name='"+
+e+"'][@style:family='"+b+"']",d).length?!0:!1};var f={text:[{ens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",en:"tab-stop",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"leader-text-style"},{ens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",en:"drop-cap",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"notes-configuration",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"citation-body-style-name"},
+{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"notes-configuration",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"citation-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"a",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"alphabetical-index",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"linenumbering-configuration",
+ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"list-level-style-number",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"ruby-text",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"span",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",
+en:"a",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"visited-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",en:"text-properties",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"text-line-through-text-style"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"alphabetical-index-source",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"main-entry-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-bibliography",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",
+a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-chapter",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-link-end",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-link-start",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",
en:"index-entry-page-number",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-span",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-tab-stop",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-text",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",
a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-title-template",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"list-level-style-bullet",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"outline-level-style",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"}],paragraph:[{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",
en:"caption",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"circle",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"connector",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"control",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",
@@ -256,88 +283,488 @@ en:"modification-date",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"
a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"table-formula",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"time",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-defined",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",
en:"user-field-get",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-field-input",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"variable-get",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"variable-input",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",
a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"variable-set",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"data-style-name"}],"page-layout":[{ens:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",en:"notes",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"page-layout-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",en:"handout-master",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"page-layout-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",
-en:"master-page",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"page-layout-name"}]})};
-// Input 21
-odf.Style2CSS=function(){function j(a,b){var c={},d,e,f;if(!b)return c;for(d=b.firstChild;d;){d.namespaceURI===h&&"style"===d.localName?f=d.getAttributeNS(h,"family"):d.namespaceURI===n&&"list-style"===d.localName&&(f="list");if(e=f&&d.getAttributeNS&&d.getAttributeNS(h,"name"))c[f]||(c[f]={}),c[f][e]=d;d=d.nextSibling}return c}function l(a,c){if(!c||!a)return null;if(a[c])return a[c];var b,d;for(b in a)if(a.hasOwnProperty(b)&&(d=l(a[b].derivedStyles,c)))return d;return null}function f(a,c,b){var d=
-c[a],e,g;d&&((e=d.getAttributeNS(h,"parent-style-name"),g=null,e&&(g=l(b,e),!g&&c[e]&&(f(e,c,b),g=c[e],c[e]=null)),g)?(g.derivedStyles||(g.derivedStyles={}),g.derivedStyles[a]=d):b[a]=d)}function g(a,c){for(var b in a)a.hasOwnProperty(b)&&(f(b,a,c),a[b]=null)}function a(a,c){var b=u[a],d;if(null===b)return null;d="["+b+'|style-name="'+c+'"]';"presentation"===b&&(b="draw",d='[presentation|style-name="'+c+'"]');return b+"|"+s[a].join(d+","+b+"|")+d}function c(b,d,e){var f=[],g,h;f.push(a(b,d));for(g in e.derivedStyles)if(e.derivedStyles.hasOwnProperty(g))for(h in d=
-c(b,g,e.derivedStyles[g]),d)d.hasOwnProperty(h)&&f.push(d[h]);return f}function b(a,b,c){if(!a)return null;for(a=a.firstChild;a;){if(a.namespaceURI===b&&a.localName===c)return b=a;a=a.nextSibling}return null}function d(a,b){var c="",d,e;for(d in b)b.hasOwnProperty(d)&&(d=b[d],(e=a.getAttributeNS(d[0],d[1]))&&(c+=d[2]+":"+e+";"));return c}function k(a,b,c,d){b='text|list[text|style-name="'+b+'"]';for(c=(c=c.getAttributeNS(n,"level"))&&parseInt(c,10);1<c;)b+=" > text|list-item > text|list",c-=1;try{a.insertRule(b+
-" > list-item:before{"+d+"}",a.cssRules.length)}catch(e){throw e;}}function e(a,f,g,j){if("list"===f)for(var l=j.firstChild,m,t;l;){if(l.namespaceURI===n)if(m=l,"list-level-style-number"===l.localName){t=m;var r=t.getAttributeNS(h,"num-format"),o=t.getAttributeNS(h,"num-suffix"),s="",s={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},u="",u=t.getAttributeNS(h,"num-prefix")||"",u=s.hasOwnProperty(r)?u+(" counter(list, "+s[r]+")"):r?u+("'"+r+"';"):u+" ''";o&&(u+=" '"+o+
-"'");t=s="content: "+u+";";k(a,g,m,t)}else"list-level-style-image"===l.localName?(t="content: none;",k(a,g,m,t)):"list-level-style-bullet"===l.localName&&(t="content: '"+m.getAttributeNS(n,"bullet-char")+"';",k(a,g,m,t));l=l.nextSibling}else{g=c(f,g,j).join(",");l="";if(m=b(j,h,"text-properties")){t=""+d(m,p);r=m.getAttributeNS(h,"text-underline-style");"solid"===r&&(t+="text-decoration: underline;");if(r=m.getAttributeNS(h,"font-name"))(r='"'+r+'"')&&(t+="font-family: "+r+";");l+=t}if(m=b(j,h,"paragraph-properties")){t=
-m;m=""+d(t,B);t=t.getElementsByTagNameNS(h,"background-image");if(0<t.length&&(r=t.item(0).getAttributeNS(i,"href")))m+="background-image: url('odfkit:"+r+"');",t=t.item(0),m+=d(t,w);l+=m}if(m=b(j,h,"graphic-properties"))m=""+d(m,A),l+=m;if(m=b(j,h,"table-cell-properties"))m=""+d(m,q),l+=m;if(0!==l.length)try{a.insertRule(g+"{"+l+"}",a.cssRules.length)}catch(O){throw O;}}for(var N in j.derivedStyles)j.derivedStyles.hasOwnProperty(N)&&e(a,f,N,j.derivedStyles[N])}var i="http://www.w3.org/1999/xlink",
-h="urn:oasis:names:tc:opendocument:xmlns:style:1.0",n="urn:oasis:names:tc:opendocument:xmlns:text:1.0",o={draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:h,svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",text:n,xlink:i},u=
-{graphic:"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text"},s={graphic:"circle,connected,control,custom-shape,ellipse,frame,g,line,measure,page,page-thumbnail,path,polygon,polyline,rect,regular-polygon".split(","),paragraph:"alphabetical-index-entry-template,h,illustration-index-entry-template,index-source-style,object-index-entry-template,p,table-index-entry-template,table-of-content-entry-template,user-index-entry-template".split(","),
-presentation:"caption,circle,connector,control,custom-shape,ellipse,frame,g,line,measure,page-thumbnail,path,polygon,polyline,rect,regular-polygon".split(","),ruby:["ruby","ruby-text"],section:"alphabetical-index,bibliography,illustration-index,index-title,object-index,section,table-of-content,table-index,user-index".split(","),table:["background","table"],"table-cell":"body,covered-table-cell,even-columns,even-rows,first-column,first-row,last-column,last-row,odd-columns,odd-rows,table-cell".split(","),
-"table-column":["table-column"],"table-row":["table-row"],text:"a,index-entry-chapter,index-entry-link-end,index-entry-link-start,index-entry-page-number,index-entry-span,index-entry-tab-stop,index-entry-text,index-title-template,linenumbering-configuration,list-level-style-number,list-level-style-bullet,outline-level-style,span".split(","),list:["list-item"]},p=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","color","color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
-"background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-weight","font-weight"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-style","font-style"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-size","font-size"]],w=[[h,"repeat","background-repeat"]],B=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
+en:"master-page",ans:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",a:"page-layout-name"}]},e,c,a,b,h,d={},l;for(e in f)if(f.hasOwnProperty(e)){b=f[e];a=b.length;for(c=0;c<a;c+=1)h=b[c],l=d[h.en]=d[h.en]||{},l=l[h.ens]=l[h.ens]||[],l.push({ns:h.ans,localname:h.a,keyname:e})}k=d};
+// Input 26
+odf.Style2CSS=function(){function g(a,d){var b={},c,e,f;if(!d)return b;for(c=d.firstChild;c;){if(f=c.namespaceURI===p&&("style"===c.localName||"default-style"===c.localName)?c.getAttributeNS(p,"family"):c.namespaceURI===r&&"list-style"===c.localName?"list":void 0)(e=c.getAttributeNS&&c.getAttributeNS(p,"name"))||(e=""),f=b[f]=b[f]||{},f[e]=c;c=c.nextSibling}return b}function k(a,d){if(!d||!a)return null;if(a[d])return a[d];var b,c;for(b in a)if(a.hasOwnProperty(b)&&(c=k(a[b].derivedStyles,d)))return c;
+return null}function m(a,d,b){var c=d[a],e,f;c&&(e=c.getAttributeNS(p,"parent-style-name"),f=null,e&&(f=k(b,e),!f&&d[e]&&(m(e,d,b),f=d[e],d[e]=null)),f?(f.derivedStyles||(f.derivedStyles={}),f.derivedStyles[a]=c):b[a]=c)}function f(a,d){for(var b in a)a.hasOwnProperty(b)&&(m(b,a,d),a[b]=null)}function e(a,d){var b=w[a],c;c="";if(null===b)return null;c=d?"["+b+'|style-name="'+d+'"]':"["+b+"|style-name]";"presentation"===b&&(b="draw",c=d?'[presentation|style-name="'+d+'"]':"[presentation|style-name]");
+return c=b+"|"+x[a].join(c+","+b+"|")+c}function c(a,d,b){var f=[],j,l;f.push(e(a,d));for(j in b.derivedStyles)if(b.derivedStyles.hasOwnProperty(j))for(l in d=c(a,j,b.derivedStyles[j]),d)d.hasOwnProperty(l)&&f.push(d[l]);return f}function a(a,d,b){if(!a)return null;for(a=a.firstChild;a;){if(a.namespaceURI===d&&a.localName===b)return d=a;a=a.nextSibling}return null}function b(a,d){var b="",c,e;for(c in d)d.hasOwnProperty(c)&&(c=d[c],(e=a.getAttributeNS(c[0],c[1]))&&(b+=c[2]+":"+e+";"));return b}function h(a,
+d){var b={},c,e,f;if(!d)return d;for(c=d.firstChild;c;){if(1===c.nodeType&&(f=c.getAttributeNS(j,"font-family"),e=c.getAttributeNS(p,"name"),(f||c.getElementsByTagNameNS(j,"font-face-uri")[0])&&e))b[e]||(b[e]={}),b[e]=f;c=c.nextSibling}return b}function d(a,d,b,c){d='text|list[text|style-name="'+d+'"]';var e=b.getAttributeNS(r,"level"),f;b=b.firstChild.firstChild;var j,l="";b&&(f=b.attributes,j=f["fo:text-indent"].value,f=f["fo:margin-left"].value);j||(j="-0.6cm");b="-"===j.charAt(0)?j.substring(1):
+"-"+j;for(e=e&&parseInt(e,10);1<e;)d+=" > text|list-item > text|list",e-=1;e=d+" > text|list-item > *:not(text|list):first-child";void 0!==f&&(f=e+"{margin-left:"+f+";}",a.insertRule(f,a.cssRules.length));l=d+" > text|list-item > *:not(text|list):first-child:before{"+c+";";l+="counter-increment:list;";l+="margin-left:"+j+";";l+="width:"+b+";";l+="display:inline-block}";try{a.insertRule(l,a.cssRules.length)}catch(h){throw h;}}function l(e,f,j,h){if("list"===f)for(var g=h.firstChild,k,n;g;){if(g.namespaceURI===
+r)if(k=g,"list-level-style-number"===g.localName){n=k;var m=n.getAttributeNS(p,"num-format"),w=n.getAttributeNS(p,"num-suffix"),x="",x={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},P="",P=n.getAttributeNS(p,"num-prefix")||"",P=x.hasOwnProperty(m)?P+(" counter(list, "+x[m]+")"):m?P+("'"+m+"';"):P+" ''";w&&(P+=" '"+w+"'");n=x="content: "+P+";";d(e,j,k,n)}else"list-level-style-image"===g.localName?(n="content: none;",d(e,j,k,n)):"list-level-style-bullet"===g.localName&&
+(n="content: '"+k.getAttributeNS(r,"bullet-char")+"';",d(e,j,k,n));g=g.nextSibling}else{j=c(f,j,h).join(",");k="";if(g=a(h,p,"text-properties")){m=g;w="";g=""+b(m,v);n=m.getAttributeNS(p,"text-underline-style");"solid"===n&&(w+=" underline");n=m.getAttributeNS(p,"text-line-through-style");"solid"===n&&(w+=" line-through");w.length&&(g+="text-decoration:"+w+";");if(m=m.getAttributeNS(p,"font-name"))n=A[m],g+="font-family: "+(n||m)+";";k+=g}if(g=a(h,p,"paragraph-properties")){n=g;g=""+b(n,C);n=n.getElementsByTagNameNS(p,
+"background-image");if(0<n.length&&(m=n.item(0).getAttributeNS(q,"href")))g+="background-image: url('odfkit:"+m+"');",n=n.item(0),g+=b(n,G);k+=g}if(g=a(h,p,"graphic-properties"))g=""+b(g,E),k+=g;if(g=a(h,p,"table-cell-properties"))g=""+b(g,u),k+=g;if(g=a(h,p,"table-row-properties"))g=""+b(g,D),k+=g;if(g=a(h,p,"table-column-properties"))g=""+b(g,s),k+=g;if(g=a(h,p,"table-properties"))g=""+b(g,J),k+=g;"table"===f&&runtime.log(k);if(0!==k.length)try{e.insertRule(j+"{"+k+"}",e.cssRules.length)}catch(H){throw H;
+}}for(var F in h.derivedStyles)h.derivedStyles.hasOwnProperty(F)&&l(e,f,F,h.derivedStyles[F])}var q="http://www.w3.org/1999/xlink",p="urn:oasis:names:tc:opendocument:xmlns:style:1.0",j="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",r="urn:oasis:names:tc:opendocument:xmlns:text:1.0",n={draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",
+style:p,svg:j,table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",text:r,xlink:q,xml:"http://www.w3.org/XML/1998/namespace"},w={graphic:"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text"},x={graphic:"circle connected control custom-shape ellipse frame g line measure page page-thumbnail path polygon polyline rect regular-polygon".split(" "),paragraph:"alphabetical-index-entry-template h illustration-index-entry-template index-source-style object-index-entry-template p table-index-entry-template table-of-content-entry-template user-index-entry-template".split(" "),
+presentation:"caption circle connector control custom-shape ellipse frame g line measure page-thumbnail path polygon polyline rect regular-polygon".split(" "),ruby:["ruby","ruby-text"],section:"alphabetical-index bibliography illustration-index index-title object-index section table-of-content table-index user-index".split(" "),table:["background","table"],"table-cell":"body covered-table-cell even-columns even-rows first-column first-row last-column last-row odd-columns odd-rows table-cell".split(" "),
+"table-column":["table-column"],"table-row":["table-row"],text:"a index-entry-chapter index-entry-link-end index-entry-link-start index-entry-page-number index-entry-span index-entry-tab-stop index-entry-text index-title-template linenumbering-configuration list-level-style-number list-level-style-bullet outline-level-style span".split(" "),list:["list-item"]},v=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","color","color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
+"background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-weight","font-weight"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-style","font-style"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-size","font-size"]],G=[[p,"repeat","background-repeat"]],C=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
"text-align","text-align"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","padding-left","padding-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","padding-right","padding-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","padding-top","padding-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","padding-bottom","padding-bottom"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-left","border-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
"border-right","border-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-top","border-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-bottom","border-bottom"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-left","margin-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-right","margin-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-top","margin-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
-"margin-bottom","margin-bottom"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border","border"]],A=[["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","fill-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","fill","background"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","min-height","min-height"],["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","stroke","border"],["urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",
-"stroke-color","border-color"]],q=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-left","border-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-right","border-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-top","border-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-bottom","border-bottom"]];
-this.namespaces=o;this.namespaceResolver=function(a){return o[a]||null};this.namespaceResolver.lookupNamespaceURI=this.namespaceResolver;this.style2css=function(a,b,c){for(var d,f,h,i,k;a.cssRules.length;)a.deleteRule(a.cssRules.length-1);d=null;b&&(d=b.ownerDocument);c&&(d=c.ownerDocument);if(d){for(f in o)if(o.hasOwnProperty(f)){i="@namespace "+f+" url("+o[f]+");";try{a.insertRule(i,a.cssRules.length)}catch(p){}}b=j(d,b);f=j(d,c);c={};for(k in u)if(u.hasOwnProperty(k))for(h in d=c[k]={},g(b[k],
-d),g(f[k],d),d)d.hasOwnProperty(h)&&e(a,k,h,d[h])}}};
-// Input 22
-runtime.loadClass("core.Base64");runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.Style2CSS");
-odf.FontLoader=function(){function j(c,b,d,f,e){var g,h=0,l;for(l in c)c.hasOwnProperty(l)&&(h===d&&(g=l),h+=1);if(!g)return e();b.load(c[g].href,function(h,l){if(h)runtime.log(h);else{var n=f,n=document.styleSheets[0],p='@font-face { font-family: "'+g+'"; src: url(data:application/x-font-ttf;charset=binary;base64,'+a.convertUTF8ArrayToBase64(l)+') format("truetype"); }';try{n.insertRule(p,n.cssRules.length)}catch(w){runtime.log("Problem inserting rule in CSS: "+p)}}return j(c,b,d+1,f,e)})}function l(a,
-b,d){j(a,b,0,d,function(){})}var f=new odf.Style2CSS,g=new xmldom.XPath,a=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(a,b,d){var j={},e,i,h;if(a){a=g.getODFElementsWithXPath(a,"style:font-face[svg:font-face-src]",f.namespaceResolver);for(e=0;e<a.length;e+=1)i=a[e],h=i.getAttributeNS(f.namespaces.style,"name"),i=g.getODFElementsWithXPath(i,"svg:font-face-src/svg:font-face-uri",f.namespaceResolver),0<i.length&&(i=i[0].getAttributeNS(f.namespaces.xlink,"href"),j[h]={href:i})}l(j,
-b,d)}};return odf.FontLoader}();
-// Input 23
-runtime.loadClass("core.Base64");runtime.loadClass("core.Zip");runtime.loadClass("xmldom.LSSerializer");runtime.loadClass("odf.StyleInfo");runtime.loadClass("odf.Style2CSS");runtime.loadClass("odf.FontLoader");
-odf.OdfContainer=function(){function j(a,b,c){for(a=a?a.firstChild:null;a;){if(a.localName===c&&a.namespaceURI===b)return a;a=a.nextSibling}return null}function l(a){var b,c=h.length;for(b=0;b<c;b+=1)if(a.namespaceURI===e&&a.localName===h[b])return b;return-1}function f(a,b){var c=a.automaticStyles,e;b&&(e=new d.UsedKeysList(b));this.acceptNode=function(a){return"http://www.w3.org/1999/xhtml"===a.namespaceURI?3:e&&a.parentNode===c&&1===a.nodeType?e.uses(a)?1:2:1}}function g(a,b){if(b){var c=l(b),
-d,e=a.firstChild;if(-1!==c){for(;e;){d=l(e);if(-1!==d&&d>c)break;e=e.nextSibling}a.insertBefore(b,e)}}}function a(a){this.OdfContainer=a}function c(a,b,c){var d=this;this.size=0;this.type=null;this.name=a;this.container=b;this.onchange=this.onreadystatechange=this.document=this.mimetype=this.url=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.load=function(){var b=u[a];this.mimetype=b;c.loadAsDataURL(a,b,function(a,b){d.url=b;if(d.onchange)d.onchange(d);if(d.onstatereadychange)d.onstatereadychange(d)})};
-this.abort=function(){}}function b(){this.length=0;this.item=function(){}}var d=new odf.StyleInfo,k=new odf.Style2CSS,e="urn:oasis:names:tc:opendocument:xmlns:office:1.0",i="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",h="meta,settings,scripts,font-face-decls,styles,automatic-styles,master-styles,body".split(","),n=new core.Base64,o=new odf.FontLoader,u={};a.prototype=new function(){};a.prototype.constructor=a;a.namespaceURI=e;a.localName="document";c.prototype.load=function(){};c.prototype.getUrl=
-function(){return this.data?"data:;base64,"+n.toBase64(this.data):null};odf.OdfContainer=function p(d,h){function l(a){for(var b=a.firstChild,c;b;)c=b.nextSibling,1===b.nodeType?l(b):7===b.nodeType&&a.removeChild(b),b=c}function n(a){var b=v.rootElement.ownerDocument,c;if(a){l(a.documentElement);try{c=b.importNode(a.documentElement,!0)}catch(d){}}return c}function x(a){v.state=a;if(v.onchange)v.onchange(v);if(v.onstatereadychange)v.onstatereadychange(v)}function E(a){var a=n(a),b=v.rootElement;!a||
-"document-styles"!==a.localName||a.namespaceURI!==e?x(p.INVALID):(b.fontFaceDecls=j(a,e,"font-face-decls"),g(b,b.fontFaceDecls),b.styles=j(a,e,"styles"),g(b,b.styles),b.automaticStyles=j(a,e,"automatic-styles"),g(b,b.automaticStyles),b.masterStyles=j(a,e,"master-styles"),g(b,b.masterStyles),o.loadFonts(b.fontFaceDecls,J,null))}function C(a){var a=n(a),b,c,d;if(!a||"document-content"!==a.localName||a.namespaceURI!==e)x(p.INVALID);else{b=v.rootElement;c=j(a,e,"font-face-decls");if(b.fontFaceDecls&&
-c)for(d=c.firstChild;d;)b.fontFaceDecls.appendChild(d),d=c.firstChild;else c&&(b.fontFaceDecls=c,g(b,c));c=j(a,e,"automatic-styles");if(b.automaticStyles&&c)for(d=c.firstChild;d;)b.automaticStyles.appendChild(d),d=c.firstChild;else c&&(b.automaticStyles=c,g(b,c));b.body=j(a,e,"body");g(b,b.body)}}function z(a){var a=n(a),b;if(a&&!("document-meta"!==a.localName||a.namespaceURI!==e))b=v.rootElement,b.meta=j(a,e,"meta"),g(b,b.meta)}function F(a){var a=n(a),b;if(a&&!("document-settings"!==a.localName||
-a.namespaceURI!==e))b=v.rootElement,b.settings=j(a,e,"settings"),g(b,b.settings)}function m(a,b){J.loadAsDOM(a,b)}function t(){m("styles.xml",function(a,b){E(b);v.state!==p.INVALID&&m("content.xml",function(a,b){C(b);v.state!==p.INVALID&&m("meta.xml",function(a,b){z(b);v.state!==p.INVALID&&m("settings.xml",function(a,b){b&&F(b);m("META-INF/manifest.xml",function(a,b){if(b){var c=n(b),d;if(c&&!("manifest"!==c.localName||c.namespaceURI!==i)){d=v.rootElement;d.manifest=c;for(c=d.manifest.firstChild;c;)1===
-c.nodeType&&"file-entry"===c.localName&&c.namespaceURI===i&&(u[c.getAttributeNS(i,"full-path")]=c.getAttributeNS(i,"media-type")),c=c.nextSibling}}v.state!==p.INVALID&&x(p.DONE)})})})})})}function r(a,b){var c="",d;for(d in b)b.hasOwnProperty(d)&&(c+=" xmlns:"+d+'="'+b[d]+'"');return'<?xml version="1.0" encoding="UTF-8"?><office:'+a+" "+c+' office:version="1.2">'}function y(){var a=k.namespaces,b=new xmldom.LSSerializer,c=r("document-meta",a);b.filter=new f(v.rootElement);c+=b.writeToString(v.rootElement.meta,
-a);return c+"</office:document-meta>"}function L(){var a=k.namespaces,b=new xmldom.LSSerializer,c=r("document-settings",a);b.filter=new f(v.rootElement);c+=b.writeToString(v.rootElement.settings,a);return c+"</office:document-settings>"}function T(){var a=k.namespaces,b=new xmldom.LSSerializer,c=r("document-styles",a);b.filter=new f(v.rootElement,v.rootElement.masterStyles);c+=b.writeToString(v.rootElement.fontFaceDecls,a);c+=b.writeToString(v.rootElement.styles,a);c+=b.writeToString(v.rootElement.automaticStyles,
-a);c+=b.writeToString(v.rootElement.masterStyles,a);return c+"</office:document-styles>"}function O(){var a=k.namespaces,b=new xmldom.LSSerializer,c=r("document-content",a);b.filter=new f(v.rootElement,v.rootElement.body);c+=b.writeToString(v.rootElement.automaticStyles,a);c+=b.writeToString(v.rootElement.body,a);return c+"</office:document-content>"}function N(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else{var d=n(c);!d||"document"!==d.localName||d.namespaceURI!==e?x(p.INVALID):(v.rootElement=
-d,d.fontFaceDecls=j(d,e,"font-face-decls"),d.styles=j(d,e,"styles"),d.automaticStyles=j(d,e,"automatic-styles"),d.masterStyles=j(d,e,"master-styles"),d.body=j(d,e,"body"),d.meta=j(d,e,"meta"),x(p.DONE))}})}var v=this,J=null;this.onstatereadychange=h;this.parts=this.rootElement=this.state=this.onchange=null;this.getPart=function(a){return new c(a,v,J)};this.save=function(a){var b;b=runtime.byteArrayFromString(L(),"utf8");J.save("settings.xml",b,!0,new Date);b=runtime.byteArrayFromString(y(),"utf8");
-J.save("meta.xml",b,!0,new Date);b=runtime.byteArrayFromString(T(),"utf8");J.save("styles.xml",b,!0,new Date);b=runtime.byteArrayFromString(O(),"utf8");J.save("content.xml",b,!0,new Date);J.write(function(b){a(b)})};this.state=p.LOADING;this.rootElement=function(a){var b=document.createElementNS(a.namespaceURI,a.localName),c,a=new a;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}(a);this.parts=new b(this);J=new core.Zip(d,function(a,b){J=b;a?N(d,function(b){a&&(J.error=a+"\n"+b,x(p.INVALID))}):
-t()})};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=5;odf.OdfContainer.getContainer=function(a){return new odf.OdfContainer(a,null)};return odf.OdfContainer}();
-// Input 24
-odf.Formatting=function(){function j(f){function g(a,b){for(var d=a&&a.firstChild;d&&b;)d=d.nextSibling,b-=1;return d}var a=g(f.startContainer,f.startOffset);g(f.endContainer,f.endOffset);this.next=function(){return null===a?a:null}}var l=new odf.StyleInfo;this.setOdfContainer=function(){};this.isCompletelyBold=function(){return!1};this.getAlignment=function(f){this.getParagraphStyles(f)};this.getParagraphStyles=function(f){var g,a,c,b=[];for(g=0;g<f.length;g+=0){a=void 0;c=[];for(a=(new j(f[g])).next();a;)l.canElementHaveStyle("paragraph",
-a)&&c.push(a);for(a=0;a<c.length;a+=1)-1===b.indexOf(c[a])&&b.push(c[a])}return b};this.getTextStyles=function(){return[]}};
-// Input 25
-runtime.loadClass("odf.OdfContainer");runtime.loadClass("odf.Formatting");runtime.loadClass("xmldom.XPath");
-odf.OdfCanvas=function(){function j(a){function b(){for(;0<c.cssRules.length;)c.deleteRule(0);c.insertRule("office|presentation draw|page {display:none;}",0);c.insertRule("office|presentation draw|page:nth-child("+d+") {display:block;}",1)}var c=a.sheet,d=1;this.showNextPage=function(){d+=1;b()};this.showPreviousPage=function(){1<d&&(d-=1,b())};this.css=a}function l(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function f(a){function b(a,c){for(;c;){if(c===
-a)return!0;c=c.parentNode}return!1}function c(){var f=[],g=runtime.getWindow().getSelection(),h,i;for(h=0;h<g.rangeCount;h+=1)i=g.getRangeAt(h),null!==i&&b(a,i.startContainer)&&b(a,i.endContainer)&&f.push(i);if(f.length===d.length){for(g=0;g<f.length&&!(f[g]===d[g]?0:null===f[g]||null===d[g]||f[g].startContainer!==d[g].startContainer||f[g].startOffset!==d[g].startOffset||f[g].endContainer!==d[g].endContainer||f[g].endOffset!==d[g].endOffset);g+=1);if(g===f.length)return}d=f;var g=[f.length],j,k=a.ownerDocument;
-for(h=0;h<f.length;h+=1)i=f[h],j=k.createRange(),j.setStart(i.startContainer,i.startOffset),j.setEnd(i.endContainer,i.endOffset),g[h]=j;d=g;g=e.length;for(f=0;f<g;f+=1)e[f](a,d)}var d=[],e=[];this.addListener=function(a,b){var c,d=e.length;for(c=0;c<d;c+=1)if(e[c]===b)return;e.push(b)};l(a,"mouseup",c);l(a,"keyup",c);l(a,"keydown",c)}function g(a){for(a=a.firstChild;a;){if(a.namespaceURI===o&&"binary-data"===a.localName)return"data:image/png;base64,"+a.textContent;a=a.nextSibling}return""}function a(a,
-b,c,d){function e(b){b='draw|image[styleid="'+a+'"] {'+("background-image: url("+b+");")+"}";d.insertRule(b,d.cssRules.length)}c.setAttribute("styleid",a);var f=c.getAttributeNS(p,"href"),h;if(f)try{b.getPartUrl?(f=b.getPartUrl(f),e(f)):(h=b.getPart(f),h.onchange=function(a){e(a.url)},h.load())}catch(i){runtime.log("slight problem: "+i)}else f=g(c),e(f)}function c(b,c,d){function e(b,c,d,f){x.addToQueue(function(){a(b,c,d,f)})}var f,g;f=c.getElementsByTagNameNS(h,"image");for(c=0;c<f.length;c+=1)g=
-f.item(c),e("image"+c,b,g,d)}function b(a,b,c){function d(a,b){"video/"===b.substr(0,6)?(e=h.createElementNS(h.documentElement.namespaceURI,"video"),e.setAttribute("controls","controls"),f=h.createElement("source"),f.setAttribute("src",a),f.setAttribute("type",b),e.appendChild(f),c.parentNode.appendChild(e)):c.innerHtml="Unrecognised Plugin"}var e,f,h=c.ownerDocument,i;if(a=c.getAttributeNS(p,"href"))try{b.getPartUrl?(a=b.getPartUrl(a),d(a,"video/mp4")):(i=b.getPart(a),i.onchange=function(a){d(a.url,
-a.mimetype)},i.load())}catch(j){runtime.log("slight problem: "+j)}else runtime.log("using MP4 data fallback"),a=g(c),d(a,"video/mp4")}function d(a,c,d){function e(a,c,d,f){x.addToQueue(function(){b(a,c,d,f)})}var f,g;f=c.getElementsByTagNameNS(h,"plugin");runtime.log("Loading Videos:");for(c=0;c<f.length;c+=1)runtime.log("...Found a video."),g=f.item(c),e("video"+c,a,g,d)}function k(a){var b=a.getElementsByTagName("style"),c=a.getElementsByTagName("head")[0],d="",e,b=b&&0<b.length?b[0].cloneNode(!1):
-a.createElement("style");for(e in i)i.hasOwnProperty(e)&&e&&(d+="@namespace "+e+" url("+i[e]+");\n");b.appendChild(a.createTextNode(d));c.appendChild(b);return b}var e=new odf.Style2CSS,i=e.namespaces,h=i.draw,n=i.fo,o=i.office,u=i.svg,s=i.text,p=i.xlink,w=runtime.getWindow(),B=new xmldom.XPath,A={},q,x=new function(){function a(d){c=!0;runtime.setTimeout(function(){try{d()}catch(e){runtime.log(e)}c=!1;0<b.length&&a(b.pop())},10)}var b=[],c=!1;this.clearQueue=function(){b.length=0};this.addToQueue=
-function(d){if(0===b.length&&!c)return a(d);b.push(d)}};odf.OdfCanvas=function(a){function b(){var c=a.firstChild.firstChild;c&&(a.style.WebkitTransform="scale("+v+")",a.style.WebkitTransformOrigin="left top",a.style.width=Math.round(v*c.offsetWidth)+"px",a.style.height=Math.round(v*c.offsetHeight)+"px")}function g(f){function i(){for(var g=a;g.firstChild;)g.removeChild(g.firstChild);a.style.display="inline-block";g=f.rootElement;a.ownerDocument.importNode(g,!0);o.setOdfContainer(f);var j=T;(new odf.Style2CSS).style2css(j.sheet,
-g.styles,g.automaticStyles);var j=f,k=O.sheet,l;l=g.body;var p,q,w;q=[];for(p=l.firstChild;p&&p!==l;)if(p.namespaceURI===h&&(q[q.length]=p),p.firstChild)p=p.firstChild;else{for(;p&&p!==l&&!p.nextSibling;)p=p.parentNode;p&&p.nextSibling&&(p=p.nextSibling)}for(w=0;w<q.length;w+=1){p=q[w];var t="frame"+w,x=k;p.setAttribute("styleid",t);var v=void 0,y=p.getAttributeNS(s,"anchor-type"),G=p.getAttributeNS(u,"x"),z=p.getAttributeNS(u,"y"),F=p.getAttributeNS(u,"width"),L=p.getAttributeNS(u,"height"),P=p.getAttributeNS(n,
-"min-height"),N=p.getAttributeNS(n,"min-width");if("as-char"===y)v="display: inline-block;";else if(y||G||z)v="position: absolute;";else if(F||L||P||N)v="display: block;";G&&(v+="left: "+G+";");z&&(v+="top: "+z+";");F&&(v+="width: "+F+";");L&&(v+="height: "+L+";");P&&(v+="min-height: "+P+";");N&&(v+="min-width: "+N+";");v&&(v="draw|"+p.localName+'[styleid="'+t+'"] {'+v+"}",x.insertRule(v,x.cssRules.length))}w=B.getODFElementsWithXPath(l,".//*[*[@text:anchor-type='paragraph']]",e.namespaceResolver);
-for(q=0;q<w.length;q+=1)l=w[q],l.setAttributeNS&&l.setAttributeNS("urn:webodf","containsparagraphanchor",!0);k.insertRule("draw|page { background-color:#fff; }",k.cssRules.length);for(l=a;l.firstChild;)l.removeChild(l.firstChild);l=m.createElement("div");l.style.display="inline-block";l.style.background="white";l.appendChild(g);a.appendChild(l);c(j,g.body,k);d(j,g.body,k);b();if(A.hasOwnProperty("statereadychange")){g=A.statereadychange;for(j=0;j<g.length;j+=1)g[j](void 0)}}p===f&&(p.state===odf.OdfContainer.DONE?
-i():p.onchange=i)}function i(){if(q){for(var a=q.ownerDocument.createDocumentFragment();q.firstChild;)a.insertBefore(q.firstChild,null);q.parentNode.replaceChild(a,q)}}var m=a.ownerDocument,p,o=new odf.Formatting,y=new f(a),L=new j(k(m)),T=k(m),O=k(m),N=!1,v=1;this.odfContainer=function(){return p};this.slidevisibilitycss=function(){return L.css};this.load=this.load=function(b){x.clearQueue();a.innerHTML="loading "+b;p=new odf.OdfContainer(b,function(a){p=a;g(a)});p.onstatereadychange=g};this.save=
-function(a){i();p.save(a)};this.setEditable=function(a){(N=a)||i()};this.addListener=function(a,b){if("selectionchange"===a)y.addListener(a,b);else{var c=A[a];void 0===c&&(c=A[a]=[]);b&&-1===c.indexOf(b)&&c.push(b)}};this.getFormatting=function(){return o};this.setZoomLevel=function(a){v=a;b()};this.getZoomLevel=function(){return v};this.fitToContainingElement=function(c,d){var e=a.offsetHeight/v;v=c/(a.offsetWidth/v);d/e<v&&(v=d/e);b()};this.fitToWidth=function(c){v=c/(a.offsetWidth/v);b()};this.fitToHeight=
-function(c){v=c/(a.offsetHeight/v);b()};this.showNextPage=function(){L.showNextPage()};this.showPreviousPage=function(){L.showPreviousPage()};this.showAllPages=function(){};l(a,"click",function(a){for(var a=a||w.event,b=a.target,c=w.getSelection(),d=0<c.rangeCount?c.getRangeAt(0):null,e=d&&d.startContainer,f=d&&d.startOffset,g=d&&d.endContainer,h=d&&d.endOffset;b&&!(("p"===b.localName||"h"===b.localName)&&b.namespaceURI===s);)b=b.parentNode;N&&b&&b.parentNode!==q&&((q?q.parentNode&&i():(q=b.ownerDocument.createElement("p"),
-q.style||(q=b.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","p")),q.style.margin="0px",q.style.padding="0px",q.style.border="0px",q.setAttribute("contenteditable",!0)),b.parentNode.replaceChild(q,b),q.appendChild(b),q.focus(),d&&(c.removeAllRanges(),d=b.ownerDocument.createRange(),d.setStart(e,f),d.setEnd(g,h),c.addRange(d)),a.preventDefault)?(a.preventDefault(),a.stopPropagation()):(a.returnValue=!1,a.cancelBubble=!0))})};return odf.OdfCanvas}();
-// Input 26
-runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.Style2CSS");
-gui.PresenterUI=function(){var j=new odf.Style2CSS,l=new xmldom.XPath,f=j.namespaceResolver;return function(g){var a=this;a.setInitialSlideMode=function(){a.startSlideMode("single")};a.keyDownHandler=function(c){if(!(c.target.isContentEditable||"input"===c.target.nodeName))switch(c.keyCode){case 84:a.toggleToolbar();break;case 37:case 8:a.prevSlide();break;case 39:case 32:a.nextSlide();break;case 36:a.firstSlide();break;case 35:a.lastSlide()}};a.root=function(){return a.odf_canvas.odfContainer().rootElement};
-a.firstSlide=function(){a.slideChange(function(){return 0})};a.lastSlide=function(){a.slideChange(function(a,b){return b-1})};a.nextSlide=function(){a.slideChange(function(a,b){return a+1<b?a+1:-1})};a.prevSlide=function(){a.slideChange(function(a){return 1>a?-1:a-1})};a.slideChange=function(c){var b=a.getPages(a.odf_canvas.odfContainer().rootElement),d=-1,f=0;b.forEach(function(a){a=a[1];a.hasAttribute("slide_current")&&(d=f,a.removeAttribute("slide_current"));f+=1});c=c(d,b.length);-1===c&&(c=d);
-b[c][1].setAttribute("slide_current","1");document.getElementById("pagelist").selectedIndex=c;"cont"===a.slide_mode&&window.scrollBy(0,b[c][1].getBoundingClientRect().top-30)};a.selectSlide=function(c){a.slideChange(function(a,d){return c>=d||0>c?-1:c})};a.scrollIntoContView=function(c){var b=a.getPages(a.odf_canvas.odfContainer().rootElement);0!==b.length&&window.scrollBy(0,b[c][1].getBoundingClientRect().top-30)};a.getPages=function(a){var a=a.getElementsByTagNameNS(f("draw"),"page"),b=[],d;for(d=
-0;d<a.length;d+=1)b.push([a[d].getAttribute("draw:name"),a[d]]);return b};a.fillPageList=function(c,b){for(var d=a.getPages(c),f,e,g;b.firstChild;)b.removeChild(b.firstChild);for(f=0;f<d.length;f+=1)e=document.createElement("option"),g=l.getODFElementsWithXPath(d[f][1],'./draw:frame[@presentation:class="title"]//draw:text-box/text:p',xmldom.XPath),g=0<g.length?g[0].textContent:d[f][0],e.textContent=f+1+": "+g,b.appendChild(e)};a.startSlideMode=function(c){var b=document.getElementById("pagelist"),
-d=a.odf_canvas.slidevisibilitycss().sheet;for(a.slide_mode=c;0<d.cssRules.length;)d.deleteRule(0);a.selectSlide(0);"single"===a.slide_mode?(d.insertRule("draw|page { position:fixed; left:0px;top:30px; z-index:1; }",0),d.insertRule("draw|page[slide_current] { z-index:2;}",1),d.insertRule("draw|page { -webkit-transform: scale(1);}",2),a.fitToWindow(),window.addEventListener("resize",a.fitToWindow,!1)):"cont"===a.slide_mode&&window.removeEventListener("resize",a.fitToWindow,!1);a.fillPageList(a.odf_canvas.odfContainer().rootElement,
-b)};a.toggleToolbar=function(){var c,b,d;c=a.odf_canvas.slidevisibilitycss().sheet;b=-1;for(d=0;d<c.cssRules.length;d+=1)if(".toolbar"===c.cssRules[d].cssText.substring(0,8)){b=d;break}-1<b?c.deleteRule(b):c.insertRule(".toolbar { position:fixed; left:0px;top:-200px; z-index:0; }",0)};a.fitToWindow=function(){var c=a.getPages(a.root()),b=(window.innerHeight-40)/c[0][1].clientHeight,c=(window.innerWidth-10)/c[0][1].clientWidth,b=b<c?b:c,c=a.odf_canvas.slidevisibilitycss().sheet;c.deleteRule(2);c.insertRule("draw|page { \n-moz-transform: scale("+
-b+"); \n-moz-transform-origin: 0% 0%; -webkit-transform-origin: 0% 0%; -webkit-transform: scale("+b+"); -o-transform-origin: 0% 0%; -o-transform: scale("+b+"); -ms-transform-origin: 0% 0%; -ms-transform: scale("+b+"); }",2)};a.load=function(c){a.odf_canvas.load(c)};a.odf_element=g;a.odf_canvas=new odf.OdfCanvas(a.odf_element);a.odf_canvas.addListener("statereadychange",a.setInitialSlideMode);a.slide_mode="undefined";document.addEventListener("keydown",a.keyDownHandler,!1)}}();
+"margin-bottom","margin-bottom"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border","border"]],E=[["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","fill-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","fill","background"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","min-height","min-height"],["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","stroke","border"],[j,"stroke-color","border-color"]],u=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
+"background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-left","border-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-right","border-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-top","border-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-bottom","border-bottom"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border","border"]],s=[[p,"column-width",
+"width"]],D=[[p,"row-height","height"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","keep-together",null]],J=[[p,"width","width"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-left","margin-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-right","margin-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-top","margin-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-bottom",
+"margin-bottom"]],A={};this.namespaces=n;this.namespaceResolver=function(a){return n[a]||null};this.namespaceResolver.lookupNamespaceURI=this.namespaceResolver;this.makeFontFaceDeclsMap=h;this.style2css=function(a,d,b,c){for(var e,j,k,m,r;a.cssRules.length;)a.deleteRule(a.cssRules.length-1);e=null;b&&(e=b.ownerDocument);c&&(e=c.ownerDocument);if(e){for(j in n)if(n.hasOwnProperty(j)){m="@namespace "+j+" url("+n[j]+");";try{a.insertRule(m,a.cssRules.length)}catch(p){}}A=h(e,d);d=g(e,b);b=g(e,c);c={};
+for(r in w)if(w.hasOwnProperty(r))for(k in e=c[r]={},f(d[r],e),f(b[r],e),e)e.hasOwnProperty(k)&&l(a,r,k,e[k])}}};
// Input 27
-gui.Caret=function(j,l){l.ownerDocument.createElementNS("urn:webodf:names:cursor","cursor");this.updateToSelection=function(){1===j.rangeCount&&j.getRangeAt(0)}};
+runtime.loadClass("core.Base64");runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.Style2CSS");
+odf.FontLoader=function(){function g(e,c,a,b,h){var d,l=0,k;for(k in e)e.hasOwnProperty(k)&&(l===a&&(d=k),l+=1);if(!d)return h();c.load(e[d].href,function(l,j){if(l)runtime.log(l);else{var k=b;k||(k=document.styleSheets[0]);var n="@font-face { font-family: '"+(e[d].family||d)+"'; src: url(data:application/x-font-ttf;charset=binary;base64,"+f.convertUTF8ArrayToBase64(j)+') format("truetype"); }';try{k.insertRule(n,k.cssRules.length)}catch(m){runtime.log("Problem inserting rule in CSS: "+n)}}return g(e,
+c,a+1,b,h)})}var k=new odf.Style2CSS,m=new xmldom.XPath,f=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(e,c,a){var b={},f,d,l,q;if(e){e=m.getODFElementsWithXPath(e,"style:font-face[svg:font-face-src]",k.namespaceResolver);for(f=0;f<e.length;f+=1)d=e[f],l=d.getAttributeNS(k.namespaces.style,"name"),q=d.getAttributeNS(k.namespaces.svg,"font-family"),d=m.getODFElementsWithXPath(d,"svg:font-face-src/svg:font-face-uri",k.namespaceResolver),0<d.length&&(d=d[0].getAttributeNS(k.namespaces.xlink,
+"href"),b[l]={href:d,family:q})}g(b,c,0,a,function(){})}};return odf.FontLoader}();
// Input 28
-runtime.loadClass("core.Cursor");
-gui.SelectionMover=function(j,l){function f(a,c){if(0!==j.rangeCount){var f=j.getRangeAt(0);if(f.startContainer&&1===f.startContainer.nodeType){l.setPoint(f.startContainer,f.startOffset);c();f=l.node();l.position();var e=[],g;for(g=0;g<j.rangeCount;g+=1)e[g]=j.getRangeAt(g);j.removeAllRanges();0===e.length&&(e[0]=f.ownerDocument.createRange());e[e.length-1].setStart(l.node(),l.position());for(g=0;g<e.length;g+=1)j.addRange(e[g])}}}function g(){c.updateToSelection();for(var a=c.getNode().getBoundingClientRect(),
-d=a.left,f=a.top,a=!1;!a;){c.remove();if(j.focusNode&&1===j.focusNode.nodeType){l.setPoint(j.focusNode,j.focusOffset);l.stepForward();var a=l.node(),e=l.position();j.collapse(a,e);c.updateToSelection()}a=c.getNode().getBoundingClientRect();a=a.top!==f&&a.left>d}}var a=l.node().ownerDocument,c=new core.Cursor(j,a);this.movePointForward=function(a){f(a,l.stepForward)};this.movePointBackward=function(a){f(a,l.stepBackward)};this.moveLineForward=function(a){j.modify?j.modify(a?"extend":"move","forward",
-"line"):f(a,g)};this.moveLineBackward=function(a){j.modify?j.modify(a?"extend":"move","backward","line"):f(a,function(){})};return this};
+runtime.loadClass("core.Base64");runtime.loadClass("core.Zip");runtime.loadClass("xmldom.LSSerializer");runtime.loadClass("odf.StyleInfo");runtime.loadClass("odf.Style2CSS");runtime.loadClass("odf.FontLoader");
+odf.OdfContainer=function(){function g(a,d,b){for(a=a?a.firstChild:null;a;){if(a.localName===b&&a.namespaceURI===d)return a;a=a.nextSibling}return null}function k(a){var b,c=q.length;for(b=0;b<c;b+=1)if(a.namespaceURI===d&&a.localName===q[b])return b;return-1}function m(a,d){var c=a.automaticStyles,e;d&&(e=new b.UsedStyleList(d));this.acceptNode=function(a){return"http://www.w3.org/1999/xhtml"===a.namespaceURI?3:a.namespaceURI&&a.namespaceURI.match(/^urn:webodf:/)?2:e&&a.parentNode===c&&1===a.nodeType?
+e.uses(a)?1:2:1}}function f(a,d){if(d){var b=k(d),c,e=a.firstChild;if(-1!==b){for(;e;){c=k(e);if(-1!==c&&c>b)break;e=e.nextSibling}a.insertBefore(d,e)}}}function e(a){this.OdfContainer=a}function c(a,d,b){var c=this;this.size=0;this.type=null;this.name=a;this.container=d;this.onchange=this.onreadystatechange=this.document=this.mimetype=this.url=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.load=function(){if(null!==b){var d=r[a];this.mimetype=d;b.loadAsDataURL(a,d,function(a,
+d){c.url=d;if(c.onchange)c.onchange(c);if(c.onstatereadychange)c.onstatereadychange(c)})}};this.abort=function(){}}function a(){this.length=0;this.item=function(){}}var b=new odf.StyleInfo,h=new odf.Style2CSS,d="urn:oasis:names:tc:opendocument:xmlns:office:1.0",l="urn:webodf:names:origin",q="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),p=new core.Base64,j=new odf.FontLoader,r={};e.prototype=new function(){};e.prototype.constructor=e;e.namespaceURI=d;
+e.localName="document";c.prototype.load=function(){};c.prototype.getUrl=function(){return this.data?"data:;base64,"+p.toBase64(this.data):null};odf.OdfContainer=function w(b,k){function p(a){for(var d=a.firstChild,b;d;)b=d.nextSibling,1===d.nodeType?p(d):7===d.nodeType&&a.removeChild(d),d=b}function q(a,d){for(var b=a&&a.firstChild;b;)1===b.nodeType&&b.setAttributeNS(l,"origin",d),b=b.nextSibling}function E(a,d){var b=null,c,e;if(a){b=a.cloneNode(!0);for(c=b.firstChild;c;)e=c.nextSibling,1===c.nodeType&&
+c.getAttributeNS(l,"origin")!==d&&b.removeChild(c),c=e}return b}function u(a){var d=t.rootElement.ownerDocument,b;if(a){p(a.documentElement);try{b=d.importNode(a.documentElement,!0)}catch(c){}}return b}function s(a){t.state=a;if(t.onchange)t.onchange(t);if(t.onstatereadychange)t.onstatereadychange(t)}function D(a,d){var b="",c;for(c in d)d.hasOwnProperty(c)&&(b+=" xmlns:"+c+'="'+d[c]+'"');return'<?xml version="1.0" encoding="UTF-8"?><office:'+a+" "+b+' office:version="1.2">'}function J(){var a=h.namespaces,
+d=new xmldom.LSSerializer,b=D("document-meta",a);d.filter=new m(t.rootElement);b+=d.writeToString(t.rootElement.meta,a);return b+"</office:document-meta>"}function A(){var a=runtime.parseXML("<manifest:manifest xmlns:manifest='urn:oasis:names:tc:opendocument:xmlns:manifest:1.0' manifest:version='1.2'><manifest:file-entry manifest:media-type='application/vnd.oasis.opendocument.text' manifest:full-path='/'/><manifest:file-entry manifest:media-type='text/xml' manifest:full-path='content.xml'/><manifest:file-entry manifest:media-type='text/xml' manifest:full-path='styles.xml'/><manifest:file-entry manifest:media-type='text/xml' manifest:full-path='meta.xml'/><manifest:file-entry manifest:media-type='text/xml' manifest:full-path='settings.xml'/></manifest:manifest>"),
+d=new xmldom.LSSerializer;d.filter=new m(t.rootElement);return d.writeToString(a,h.namespaces)}function z(){var a=h.namespaces,d=new xmldom.LSSerializer,b=D("document-settings",a);d.filter=new m(t.rootElement);b+=d.writeToString(t.rootElement.settings,a);return b+"</office:document-settings>"}function y(){var a=h.namespaces,d=new xmldom.LSSerializer,b=E(t.rootElement.automaticStyles,"styles.xml"),c=D("document-styles",a);d.filter=new m(t.rootElement);c+=d.writeToString(t.rootElement.fontFaceDecls,
+a);c+=d.writeToString(t.rootElement.styles,a);c+=d.writeToString(b,a);c+=d.writeToString(t.rootElement.masterStyles,a);return c+"</office:document-styles>"}function B(){var a=h.namespaces,d=new xmldom.LSSerializer,b=E(t.rootElement.automaticStyles,"content.xml"),c=D("document-content",a);d.filter=new m(t.rootElement);c+=d.writeToString(b,a);c+=d.writeToString(t.rootElement.body,a);return c+"</office:document-content>"}function Q(){var a,d=new Date;a=runtime.byteArrayFromString(z(),"utf8");K.save("settings.xml",
+a,!0,d);a=runtime.byteArrayFromString(J(),"utf8");K.save("meta.xml",a,!0,d);a=runtime.byteArrayFromString(y(),"utf8");K.save("styles.xml",a,!0,d);a=runtime.byteArrayFromString(B(),"utf8");K.save("content.xml",a,!0,d);a=runtime.byteArrayFromString(A(),"utf8");K.save("META-INF/manifest.xml",a,!0,d)}function M(a,d){Q();K.writeAs(a,function(a){d(a)})}var t=this,K;this.onstatereadychange=k;this.parts=this.rootElement=this.state=this.onchange=null;this.getPart=function(a){return new c(a,t,K)};this.createByteArray=
+function(a,d){Q();K.createByteArray(a,d)};this.saveAs=M;this.save=function(a){M(b,a)};this.getUrl=function(){return b};this.state=w.LOADING;var I=document.createElementNS(e.namespaceURI,e.localName),S,N=new e;for(S in N)N.hasOwnProperty(S)&&(I[S]=N[S]);this.rootElement=I;this.parts=new a(this);if(b)K=new core.Zip(b,function(a,c){K=c;a?runtime.loadXML(b,function(b,c){if(b)a&&(K.error=a+"\n"+b,s(w.INVALID));else{var e=u(c);!e||"document"!==e.localName||e.namespaceURI!==d?s(w.INVALID):(t.rootElement=
+e,e.fontFaceDecls=g(e,d,"font-face-decls"),e.styles=g(e,d,"styles"),e.automaticStyles=g(e,d,"automatic-styles"),e.masterStyles=g(e,d,"master-styles"),e.body=g(e,d,"body"),e.meta=g(e,d,"meta"),s(w.DONE))}}):K.loadAsDOM("styles.xml",function(a,b){var c=u(b),e=t.rootElement;!c||"document-styles"!==c.localName||c.namespaceURI!==d?s(w.INVALID):(e.fontFaceDecls=g(c,d,"font-face-decls"),f(e,e.fontFaceDecls),e.styles=g(c,d,"styles"),f(e,e.styles),e.automaticStyles=g(c,d,"automatic-styles"),q(e.automaticStyles,
+"styles.xml"),f(e,e.automaticStyles),e.masterStyles=g(c,d,"master-styles"),f(e,e.masterStyles),e.fontFaceDecls&&j.loadFonts(e.fontFaceDecls,K,null));t.state!==w.INVALID&&K.loadAsDOM("content.xml",function(a,b){var c=u(b),e,j,l;if(!c||"document-content"!==c.localName||c.namespaceURI!==d)s(w.INVALID);else{e=t.rootElement;j=g(c,d,"font-face-decls");if(e.fontFaceDecls&&j)for(l=j.firstChild;l;)e.fontFaceDecls.appendChild(l),l=j.firstChild;else j&&(e.fontFaceDecls=j,f(e,j));j=g(c,d,"automatic-styles");
+q(j,"content.xml");if(e.automaticStyles&&j)for(l=j.firstChild;l;)e.automaticStyles.appendChild(l),l=j.firstChild;else j&&(e.automaticStyles=j,f(e,j));e.body=g(c,d,"body");f(e,e.body)}t.state!==w.INVALID&&K.loadAsDOM("meta.xml",function(a,b){var c=u(b),e;if(c&&!("document-meta"!==c.localName||c.namespaceURI!==d))e=t.rootElement,e.meta=g(c,d,"meta"),f(e,e.meta);t.state!==w.INVALID&&K.loadAsDOM("settings.xml",function(a,b){if(b){var c=u(b),e;if(c&&!("document-settings"!==c.localName||c.namespaceURI!==
+d))e=t.rootElement,e.settings=g(c,d,"settings"),f(e,e.settings)}K.loadAsDOM("META-INF/manifest.xml",function(a,d){if(d){var b=u(d),c;if(b&&!("manifest"!==b.localName||"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"!==b.namespaceURI)){c=t.rootElement;c.manifest=b;for(b=c.manifest.firstChild;b;)1===b.nodeType&&("file-entry"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===b.namespaceURI)&&(r[b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","full-path")]=
+b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","media-type")),b=b.nextSibling}}t.state!==w.INVALID&&s(w.DONE)})})})})})});else{I=new core.Zip("",null);S=runtime.byteArrayFromString("application/vnd.oasis.opendocument.text","utf8");var N=t.rootElement,P=document.createElementNS(d,"text");I.save("mimetype",S,!1,new Date);N.body=document.createElementNS(d,"body");N.body.appendChild(P);N.appendChild(N.body);s(w.DONE);K=I}};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=
+2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=5;odf.OdfContainer.getContainer=function(a){return new odf.OdfContainer(a,null)};return odf.OdfContainer}();
// Input 29
-runtime.loadClass("core.PointWalker");runtime.loadClass("core.Cursor");
-gui.XMLEdit=function(j,l){function f(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function g(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function a(){var a=j.ownerDocument.defaultView.getSelection();a&&!(0>=a.rangeCount)&&s&&(a=a.getRangeAt(0),s.setPoint(a.startContainer,a.startOffset))}function c(){var a=j.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();s&&s.node()&&(b=s.node(),c=b.ownerDocument.createRange(),
-c.setStart(b,s.position()),c.collapse(!0),a.addRange(c))}function b(b){var d=b.charCode||b.keyCode;if(s=null,s&&37===d)a(),s.stepBackward(),c();else if(16<=d&&20>=d||33<=d&&40>=d)return;g(b)}function d(){}function k(a){j.ownerDocument.defaultView.getSelection().getRangeAt(0);g(a)}function e(a){for(var b=a.firstChild;b&&b!==a;)1===b.nodeType&&e(b),b=b.nextSibling||b.parentNode;var c,d,f,b=a.attributes;c="";for(f=b.length-1;0<=f;f-=1)d=b.item(f),c=c+" "+d.nodeName+'="'+d.nodeValue+'"';a.setAttribute("customns_name",
-a.nodeName);a.setAttribute("customns_atts",c);b=a.firstChild;for(d=/^\s*$/;b&&b!==a;)c=b,b=b.nextSibling||b.parentNode,3===c.nodeType&&d.test(c.nodeValue)&&c.parentNode.removeChild(c)}function i(a,b){for(var c=a.firstChild,d,e,f;c&&c!==a;){if(1===c.nodeType){i(c,b);d=c.attributes;for(f=d.length-1;0<=f;f-=1)e=d.item(f),"http://www.w3.org/2000/xmlns/"===e.namespaceURI&&!b[e.nodeValue]&&(b[e.nodeValue]=e.localName)}c=c.nextSibling||c.parentNode}}function h(){var a=j.ownerDocument.createElement("style"),
-b;b={};i(j,b);var c={},d,e,f=0;for(d in b)if(b.hasOwnProperty(d)&&d){e=b[d];if(!e||c.hasOwnProperty(e)||"xmlns"===e){do e="ns"+f,f+=1;while(c.hasOwnProperty(e));b[d]=e}c[e]=!0}a.type="text/css";b="@namespace customns url(customns);\n"+n;a.appendChild(j.ownerDocument.createTextNode(b));l=l.parentNode.replaceChild(a,l)}var n,o,u,s=null;j.id||(j.id="xml"+(""+Math.random()).substring(2));o="#"+j.id+" ";n=o+"*,"+o+":visited, "+o+":link {display:block; margin: 0px; margin-left: 10px; font-size: medium; color: black; background: white; font-variant: normal; font-weight: normal; font-style: normal; font-family: sans-serif; text-decoration: none; white-space: pre-wrap; height: auto; width: auto}\n"+
-o+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+o+":after {color: blue; content: '</' attr(customns_name) '>';}\n"+o+"{overflow: auto;}\n";(function(a){f(a,"click",k);f(a,"keydown",b);f(a,"keypress",d);f(a,"drop",g);f(a,"dragend",g);f(a,"beforepaste",g);f(a,"paste",g)})(j);this.updateCSS=h;this.setXML=function(a){a=a.documentElement||a;u=a=j.ownerDocument.importNode(a,true);for(e(a);j.lastChild;)j.removeChild(j.lastChild);j.appendChild(a);h();s=new core.PointWalker(a)};
-this.getXML=function(){return u}};
+odf.Formatting=function(){function g(a){function d(a,d){for(var b=a&&a.firstChild;b&&d;)b=b.nextSibling,d-=1;return b}var b=d(a.startContainer,a.startOffset);d(a.endContainer,a.endOffset);this.next=function(){return null===b?b:null}}function k(a,d){for(var b in d)if(d.hasOwnProperty(b))try{a[b]=d[b].constructor===Object?k(a[b],d[b]):d[b]}catch(c){a[b]=d[b]}return a}function m(a,d,c){for(a=a.firstChild;a;){if(1===a.nodeType&&a.namespaceURI===b.style&&"style"===a.localName&&a.getAttributeNS(b.style,
+"family")===c&&a.getAttributeNS(b.style,"name")===d)return a;a=a.nextSibling}return null}function f(a){for(var d={},c=a.firstChild;c;){if(1===c.nodeType&&c.namespaceURI===b.style){d[c.nodeName]={};for(a=0;a<c.attributes.length;a+=1)d[c.nodeName][c.attributes[a].name]=c.attributes[a].value}c=c.nextSibling}return d}var e,c=new odf.StyleInfo,a=new odf.Style2CSS,b=a.namespaces;this.setOdfContainer=function(a){e=a};this.getFontMap=function(){return a.makeFontFaceDeclsMap(e.rootElement.ownerDocument,e.rootElement.fontFaceDecls)};
+this.isCompletelyBold=function(){return!1};this.getAlignment=function(a){this.getParagraphStyles(a)};this.getParagraphStyles=function(a){var d,b,e,f=[];for(d=0;d<a.length;d+=1){b=void 0;e=[];for(b=(new g(a[d])).next();b;)c.canElementHaveStyle("paragraph",b)&&e.push(b);for(b=0;b<e.length;b+=1)-1===f.indexOf(e[b])&&f.push(e[b])}return f};this.getAvailableParagraphStyles=function(){for(var a=e.rootElement.styles&&e.rootElement.styles.firstChild,d,c,f=[];a;)1===a.nodeType&&("style"===a.localName&&a.namespaceURI===
+b.style)&&(c=a,d=c.getAttributeNS(b.style,"family"),"paragraph"===d&&(d=c.getAttributeNS(b.style,"name"),c=c.getAttributeNS(b.style,"display-name")||d,d&&c&&f.push({name:d,displayName:c}))),a=a.nextSibling;return f};this.isStyleUsed=function(b){var d;d=c.hasDerivedStyles(e.rootElement,a.namespaceResolver,b);b=(new c.UsedStyleList(e.rootElement.styles)).uses(b)||(new c.UsedStyleList(e.rootElement.automaticStyles)).uses(b)||(new c.UsedStyleList(e.rootElement.body)).uses(b);return d||b};this.getStyleElement=
+m;this.getStyleAttributes=f;this.getInheritedStyleAttributes=function(a,d){var c;c={};for(var e={},g=d;g;)c=f(g),e=k(c,e),g=(c=g.getAttributeNS(b.style,"parent-style-name"))?m(a,c,d.getAttributeNS(b.style,"family")):null;a:{c=d.getAttributeNS(b.style,"family");for(g=a.firstChild;g;){if(1===g.nodeType&&g.namespaceURI===b.style&&"default-style"===g.localName&&g.getAttributeNS(b.style,"family")===c){c=g;break a}g=g.nextSibling}c=null}c=f(c);return e=k(c,e)};this.getFirstNamedParentStyleNameOrSelf=function(a){for(var d=
+e.rootElement.automaticStyles,c=e.rootElement.styles,f;null!==(f=m(d,a,"paragraph"));)a=f.getAttributeNS(b.style,"parent-style-name");f=m(c,a,"paragraph");return!f?null:a};this.hasParagraphStyle=function(a){return m(e.rootElement.automaticStyles,a,"paragraph")||m(e.rootElement.styles,a,"paragraph")};this.getParagraphStyleAttribute=function(a,d,c){for(var f=e.rootElement.automaticStyles,g=e.rootElement.styles,j;null!==(j=m(f,a,"paragraph"));){if(a=j.getAttributeNS(d,c))return a;a=j.getAttributeNS(b.style,
+"parent-style-name")}for(;null!==(j=m(g,a,"paragraph"));){if(a=j.getAttributeNS(d,c))return a;a=j.getAttributeNS(b.style,"parent-style-name")}return null};this.getTextStyles=function(){return[]}};
// Input 30
-(function(){return"core/Async.js,core/Base64.js,core/ByteArray.js,core/ByteArrayWriter.js,core/Cursor.js,core/JSLint.js,core/PointWalker.js,core/RawDeflate.js,core/RawInflate.js,core/UnitTester.js,core/Zip.js,gui/Caret.js,gui/SelectionMover.js,gui/XMLEdit.js,gui/PresenterUI.js,odf/FontLoader.js,odf/Formatting.js,odf/OdfCanvas.js,odf/OdfContainer.js,odf/Style2CSS.js,odf/StyleInfo.js,xmldom/LSSerializer.js,xmldom/LSSerializerFilter.js,xmldom/OperationalTransformDOM.js,xmldom/OperationalTransformInterface.js,xmldom/RelaxNG.js,xmldom/RelaxNG2.js,xmldom/RelaxNGParser.js,xmldom/XPath.js".split(",")})();
+runtime.loadClass("odf.OdfContainer");runtime.loadClass("odf.Formatting");runtime.loadClass("xmldom.XPath");
+odf.OdfCanvas=function(){function g(){function a(c){d=!0;runtime.setTimeout(function(){try{c()}catch(e){runtime.log(e)}d=!1;0<b.length&&a(b.pop())},10)}var b=[],d=!1;this.clearQueue=function(){b.length=0};this.addToQueue=function(c){if(0===b.length&&!d)return a(c);b.push(c)}}function k(a){function b(){for(;0<d.cssRules.length;)d.deleteRule(0);d.insertRule("office|presentation draw|page {display:none;}",0);d.insertRule("office|presentation draw|page:nth-child("+c+") {display:block;}",1)}var d=a.sheet,
+c=1;this.showFirstPage=function(){c=1;b()};this.showNextPage=function(){c+=1;b()};this.showPreviousPage=function(){1<c&&(c-=1,b())};this.showPage=function(a){0<a&&(c=a,b())};this.css=a}function m(a,b,d){a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent?a.attachEvent("on"+b,d):a["on"+b]=d}function f(a){function b(a,d){for(;d;){if(d===a)return!0;d=d.parentNode}return!1}function d(){var f=[],j=runtime.getWindow().getSelection(),l,g;for(l=0;l<j.rangeCount;l+=1)g=j.getRangeAt(l),null!==g&&(b(a,
+g.startContainer)&&b(a,g.endContainer))&&f.push(g);if(f.length===c.length){for(j=0;j<f.length&&!(l=f[j],g=c[j],l=l===g?!1:null===l||null===g?!0:l.startContainer!==g.startContainer||l.startOffset!==g.startOffset||l.endContainer!==g.endContainer||l.endOffset!==g.endOffset,l);j+=1);if(j===f.length)return}c=f;var j=[f.length],h,k=a.ownerDocument;for(l=0;l<f.length;l+=1)g=f[l],h=k.createRange(),h.setStart(g.startContainer,g.startOffset),h.setEnd(g.endContainer,g.endOffset),j[l]=h;c=j;j=e.length;for(f=
+0;f<j;f+=1)e[f](a,c)}var c=[],e=[];this.addListener=function(a,b){var d,c=e.length;for(d=0;d<c;d+=1)if(e[d]===b)return;e.push(b)};m(a,"mouseup",d);m(a,"keyup",d);m(a,"keydown",d)}function e(a,b){(new odf.Style2CSS).style2css(b.sheet,a.fontFaceDecls,a.styles,a.automaticStyles)}function c(a){for(a=a.firstChild;a;){if(a.namespaceURI===q&&"binary-data"===a.localName)return"data:image/png;base64,"+a.textContent;a=a.nextSibling}return""}function a(a){var b=a.getElementsByTagName("head")[0],d=a.createElementNS(b.namespaceURI,
+"style"),c="",e;d.setAttribute("type","text/css");d.setAttribute("media","screen, print, handheld, projection");for(e in h)h.hasOwnProperty(e)&&e&&(c+="@namespace "+e+" url("+h[e]+");\n");d.appendChild(a.createTextNode(c));b.appendChild(d);return d}var b=new odf.Style2CSS,h=b.namespaces,d=h.draw,l=h.fo,q=h.office,p=h.style,j=h.svg,r=h.table,n=h.text,w=h.xlink,x=h.xml,v=runtime.getWindow(),G=new xmldom.XPath;odf.OdfCanvas=function(h){function q(){var a=h.firstChild;a.firstChild&&(1<t?(a.style.MozTransformOrigin=
+"center top",a.style.WebkitTransformOrigin="center top",a.style.OTransformOrigin="center top",a.style.msTransformOrigin="center top"):(a.style.MozTransformOrigin="left top",a.style.WebkitTransformOrigin="left top",a.style.OTransformOrigin="left top",a.style.msTransformOrigin="left top"),a.style.WebkitTransform="scale("+t+")",a.style.MozTransform="scale("+t+")",a.style.OTransform="scale("+t+")",a.style.msTransform="scale("+t+")",h.style.width=Math.round(t*a.offsetWidth)+"px",h.style.height=Math.round(t*
+a.offsetHeight)+"px")}function u(){function a(){for(var f=h;f.firstChild;)f.removeChild(f.firstChild);h.style.display="inline-block";var g=J.rootElement;h.ownerDocument.importNode(g,!0);A.setOdfContainer(J);e(g,B);var k=J,f=Q.sheet,m;m=g.body;var s,t,u;t=[];for(s=m.firstChild;s&&s!==m;)if(s.namespaceURI===d&&(t[t.length]=s),s.firstChild)s=s.firstChild;else{for(;s&&s!==m&&!s.nextSibling;)s=s.parentNode;s&&s.nextSibling&&(s=s.nextSibling)}for(u=0;u<t.length;u+=1){s=t[u];var F="frame"+String(u),y=f;
+s.setAttribute("styleid",F);var z=void 0,I=s.getAttributeNS(n,"anchor-type"),H=s.getAttributeNS(j,"x"),M=s.getAttributeNS(j,"y"),N=s.getAttributeNS(j,"width"),P=s.getAttributeNS(j,"height"),X=s.getAttributeNS(l,"min-height"),$=s.getAttributeNS(l,"min-width");if("as-char"===I)z="display: inline-block;";else if(I||H||M)z="position: absolute;";else if(N||P||X||$)z="display: block;";H&&(z+="left: "+H+";");M&&(z+="top: "+M+";");N&&(z+="width: "+N+";");P&&(z+="height: "+P+";");X&&(z+="min-height: "+X+";");
+$&&(z+="min-width: "+$+";");z&&(z="draw|"+s.localName+'[styleid="'+F+'"] {'+z+"}",y.insertRule(z,y.cssRules.length))}u=G.getODFElementsWithXPath(m,".//*[*[@text:anchor-type='paragraph']]",b.namespaceResolver);for(t=0;t<u.length;t+=1)m=u[t],m.setAttributeNS&&m.setAttributeNS("urn:webodf","containsparagraphanchor",!0);f.insertRule("draw|page { background-color:#fff; }",f.cssRules.length);for(m=h;m.firstChild;)m.removeChild(m.firstChild);m=D.createElementNS(h.namespaceURI,"div");m.style.display="inline-block";
+m.style.background="white";m.appendChild(g);h.appendChild(m);t=g.body.getElementsByTagNameNS(r,"table-cell");for(m=0;m<t.length;m+=1)u=t.item(m),u.hasAttributeNS(r,"number-columns-spanned")&&u.setAttribute("colspan",u.getAttributeNS(r,"number-columns-spanned")),u.hasAttributeNS(r,"number-rows-spanned")&&u.setAttribute("rowspan",u.getAttributeNS(r,"number-rows-spanned"));m=function(a,b){b.hasAttributeNS(w,"href")&&(b.onclick=function(){v.open(b.getAttributeNS(w,"href"))})};u=g.body.getElementsByTagNameNS(n,
+"a");for(t=0;t<u.length;t+=1)F=u.item(t),m(k,F,f);m=function(a,b,d,e){S.addToQueue(function(){var f=function(b){b='draw|image[styleid="'+a+'"] {'+("background-image: url("+b+");")+"}";e.insertRule(b,e.cssRules.length)};d.setAttribute("styleid",a);var j=d.getAttributeNS(w,"href"),g;if(j)try{b.getPartUrl?(j=b.getPartUrl(j),f(j)):(g=b.getPart(j),g.onchange=function(a){f(a.url)},g.load())}catch(l){runtime.log("slight problem: "+l)}else j=c(d),f(j)})};u=g.body.getElementsByTagNameNS(d,"image");for(t=0;t<
+u.length;t+=1)F=u.item(t),m("image"+String(t),k,F,f);m=function(a,b,d){S.addToQueue(function(){var a=function(a,b){var c=g.documentElement.namespaceURI;"video/"===b.substr(0,6)?(e=g.createElementNS(c,"video"),e.setAttribute("controls","controls"),f=g.createElementNS(c,"source"),f.setAttribute("src",a),f.setAttribute("type",b),e.appendChild(f),d.parentNode.appendChild(e)):d.innerHtml="Unrecognised Plugin"},e,f,j,g=d.ownerDocument,l;if(j=d.getAttributeNS(w,"href"))try{b.getPartUrl?(j=b.getPartUrl(j),
+a(j,"video/mp4")):(l=b.getPart(j),l.onchange=function(b){a(b.url,b.mimetype)},l.load())}catch(h){runtime.log("slight problem: "+h)}else runtime.log("using MP4 data fallback"),j=c(d),a(j,"video/mp4")})};u=g.body.getElementsByTagNameNS(d,"plugin");for(t=0;t<u.length;t+=1)F=u.item(t),m("video"+String(t),k,F,f);t=g.body;k={};m={};var O;u=v.document.getElementsByTagNameNS(n,"list-style");for(g=0;g<u.length;g+=1)y=u.item(g),(z=y.getAttributeNS(p,"name"))&&(m[z]=y);t=t.getElementsByTagNameNS(n,"list");for(g=
+0;g<t.length;g+=1)if(y=t.item(g),u=y.getAttributeNS(x,"id")){F=y.getAttributeNS(n,"continue-list");y.setAttribute("id",u);s="text|list#"+u+" > text|list-item > *:first-child:before {";if(z=y.getAttributeNS(n,"style-name"))y=m[z],O=y.firstChild,y=void 0,"list-level-style-number"===O.localName?(y=O.getAttributeNS(p,"num-format"),z=O.getAttributeNS(p,"num-suffix"),I="",I={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},H=void 0,H=O.getAttributeNS(p,"num-prefix")||"",H=I.hasOwnProperty(y)?
+H+(" counter(list, "+I[y]+")"):y?H+("'"+y+"';"):H+" ''",z&&(H+=" '"+z+"'"),y=I="content: "+H+";"):"list-level-style-image"===O.localName?y="content: none;":"list-level-style-bullet"===O.localName&&(y="content: '"+O.getAttributeNS(n,"bullet-char")+"';"),O=y;if(F){for(y=k[F];y;)F=y,y=k[F];s+="counter-increment:"+F+";";O?(O=O.replace("list",F),s+=O):s+="content:counter("+F+");"}else F="",O?(O=O.replace("list",u),s+=O):s+="content: counter("+u+");",s+="counter-increment:"+u+";",f.insertRule("text|list#"+
+u+" {counter-reset:"+u+"}",f.cssRules.length);s+="}";k[u]=F;s&&f.insertRule(s,f.cssRules.length)}q();f=[J];if(K.hasOwnProperty("statereadychange")){O=K.statereadychange;for(g=0;g<O.length;g+=1)O[g].apply(null,f)}}J.state===odf.OdfContainer.DONE?a():(runtime.log("WARNING: refreshOdf called but ODF was not DONE."),runtime.setTimeout(function V(){J.state===odf.OdfContainer.DONE?a():(runtime.log("will be back later..."),runtime.setTimeout(V,500))},100))}function s(){if(I){for(var a=I.ownerDocument.createDocumentFragment();I.firstChild;)a.insertBefore(I.firstChild,
+null);I.parentNode.replaceChild(a,I)}}var D=h.ownerDocument,J,A=new odf.Formatting,z=new f(h),y,B,Q,M=!1,t=1,K={},I,S=new g,N=D,P=N.getElementsByTagName("head")[0],H;"undefined"!==String(typeof webodf_css)?(H=N.createElementNS(P.namespaceURI,"style"),H.setAttribute("media","screen, print, handheld, projection"),H.appendChild(N.createTextNode(webodf_css))):(H=N.createElementNS(P.namespaceURI,"link"),N="webodf.css",runtime.currentDirectory&&(N=runtime.currentDirectory()+"/../"+N),H.setAttribute("href",
+N),H.setAttribute("rel","stylesheet"));H.setAttribute("type","text/css");P.appendChild(H);y=new k(a(D));B=a(D);Q=a(D);this.refreshCSS=function(){e(J.rootElement,B)};this.odfContainer=function(){return J};this.slidevisibilitycss=function(){return y.css};this.setOdfContainer=function(a){J=a;u()};this.load=this.load=function(a){S.clearQueue();h.innerHTML="loading "+a;h.removeAttribute("style");J=new odf.OdfContainer(a,function(a){J=a;u()})};this.save=function(a){s();J.save(a)};this.setEditable=function(a){(M=
+a)||s()};this.addListener=function(a,b){switch(a){case "selectionchange":z.addListener(a,b);break;case "click":m(h,a,b);break;default:var d=K[a];void 0===d&&(d=K[a]=[]);b&&-1===d.indexOf(b)&&d.push(b)}};this.getFormatting=function(){return A};this.setZoomLevel=function(a){t=a;q()};this.getZoomLevel=function(){return t};this.fitToContainingElement=function(a,b){var d=h.offsetHeight/t;t=a/(h.offsetWidth/t);b/d<t&&(t=b/d);q()};this.fitToWidth=function(a){t=a/(h.offsetWidth/t);q()};this.fitSmart=function(a,
+b){var d,c;d=h.offsetWidth/t;c=h.offsetHeight/t;d=a/d;void 0!==b&&b/c<d&&(d=b/c);t=Math.min(1,d);q()};this.fitToHeight=function(a){t=a/(h.offsetHeight/t);q()};this.showFirstPage=function(){y.showFirstPage()};this.showNextPage=function(){y.showNextPage()};this.showPreviousPage=function(){y.showPreviousPage()};this.showPage=function(a){y.showPage(a)};this.showAllPages=function(){};this.getElement=function(){return h}};return odf.OdfCanvas}();
+// Input 31
+runtime.loadClass("odf.OdfCanvas");
+odf.CommandLineTools=function(){this.roundTrip=function(g,k,m){new odf.OdfContainer(g,function(f){if(f.state===odf.OdfContainer.INVALID)return m("Document "+g+" is invalid.");f.state===odf.OdfContainer.DONE?f.saveAs(k,function(e){m(e)}):m("Document was not completely loaded.")})};this.render=function(g,k,m){for(k=k.getElementsByTagName("body")[0];k.firstChild;)k.removeChild(k.firstChild);k=new odf.OdfCanvas(k);k.addListener("statereadychange",function(f){m(f)});k.load(g)}};
+// Input 32
+ops.Operation=function(){};
+// Input 33
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.OpAddCursor=function(g){var k,m;this.init=function(f){k=f.memberid;m=f.timestamp};this.execute=function(){var f=g.getOdtDocument(),e=new ops.OdtCursor(k,f);f.addCursor(e);g.emit(ops.Session.signalCursorAdded,e)};this.spec=function(){return{optype:"AddCursor",memberid:k,timestamp:m}}};
+// Input 34
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.OpRemoveCursor=function(g){var k,m;this.init=function(f){k=f.memberid;m=f.timestamp};this.execute=function(){g.getOdtDocument().removeCursor(k);g.emit(ops.Session.signalCursorRemoved,k)};this.spec=function(){return{optype:"RemoveCursor",memberid:k,timestamp:m}}};
+// Input 35
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.OpMoveCursor=function(g){var k,m,f;this.init=function(e){k=e.memberid;m=e.timestamp;f=e.number};this.execute=function(){var e=g.getOdtDocument(),c=e.getCursor(k),e=e.getPositionFilter(),a;runtime.assert(void 0!==c,"cursor for ["+k+"] not found (MoveCursor).");a=c.getStepCounter();if(0<f)e=a.countForwardSteps(f,e);else if(0>f)e=-a.countBackwardSteps(-f,e);else return;c.move(e);g.emit(ops.Session.signalCursorMoved,c)};this.spec=function(){return{optype:"MoveCursor",memberid:k,timestamp:m,number:f}}};
+// Input 36
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.OpInsertText=function(g){var k,m,f,e;this.init=function(c){k=c.memberid;m=c.timestamp;f=c.position;e=c.text};this.execute=function(){g.getOdtDocument().insertText(k,m,f,e)};this.spec=function(){return{optype:"InsertText",memberid:k,timestamp:m,position:f,text:e}}};
+// Input 37
+ops.OpRemoveText=function(g){var k,m,f,e,c;this.init=function(a){k=a.memberid;m=a.timestamp;f=a.position;e=a.length;c=a.text};this.execute=function(){g.getOdtDocument().removeText(k,m,f,e)};this.spec=function(){return{optype:"RemoveText",memberid:k,timestamp:m,position:f,length:e,text:c}}};
+// Input 38
+ops.OpSplitParagraph=function(g){var k,m,f;this.init=function(e){k=e.memberid;m=e.timestamp;f=e.position};this.execute=function(){var e=g.getOdtDocument(),c,a,b,h,d;if(c=e.getPositionInTextNode(f))if(a=e.getParagraphElement(c.textNode)){0===c.offset?(d=c.textNode.previousSibling,b=null):(c.textNode.nextSibling&&("urn:webodf:names:cursor"===c.textNode.nextSibling.namespaceURI&&"cursor"===c.textNode.nextSibling.localName)&&(b=c.textNode.cloneNode(!1),c.textNode.parentNode.insertBefore(b,c.textNode),
+c.textNode.parentNode.removeChild(c.textNode),c.textNode="",c.textNode=b),d=c.textNode,b=c.offset>=c.textNode.length?null:c.textNode.splitText(c.offset));for(c=c.textNode;c!==a;)if(c=c.parentNode,h=c.cloneNode(!1),d){for(b&&h.appendChild(b);d.nextSibling;)h.appendChild(d.nextSibling);c.parentNode.insertBefore(h,c.nextSibling);d=c;b=h}else c.parentNode.insertBefore(h,c),d=h,b=c;e.emit("paragraphEdited",{element:a,memberId:k,timeStamp:m});e.emit("paragraphEdited",{element:b,memberId:k,timeStamp:m})}};
+this.spec=function(){return{optype:"SplitParagraph",memberid:k,timestamp:m,position:f}}};
+// Input 39
+ops.OpSetParagraphStyle=function(g){var k,m,f,e,c;this.init=function(a){k=a.memberid;m=a.timestamp;f=a.position;e=a.styleNameBefore;c=a.styleNameAfter};this.execute=function(){var a,b=g.getOdtDocument();b.setParagraphStyle(k,m,f,e,c);if(a=b.getPositionInTextNode(f))a=b.getParagraphElement(a.textNode),g.emit(ops.Session.signalParagraphChanged,a)};this.spec=function(){return{optype:"SetParagraphStyle",memberid:k,timestamp:m,position:f,styleNameBefore:e,styleNameAfter:c}}};
+// Input 40
+ops.OpUpdateParagraphStyle=function(g){var k,m,f,e,c;this.init=function(a){k=a.memberid;m=a.timestamp;f=a.position;e=a.styleName;c=a.info};this.execute=function(){g.getOdtDocument().updateParagraphStyle(e,c);g.emit(ops.Session.signalParagraphStyleModified,e)};this.spec=function(){return{optype:"UpdateParagraphStyle",memberid:k,timestamp:m,position:f,styleName:e,info:c}}};
+// Input 41
+ops.OpCloneStyle=function(g){var k,m,f,e,c;this.init=function(a){k=a.memberid;m=a.timestamp;f=a.styleName;e=a.newStyleName;c=a.newStyleDisplayName};this.execute=function(){var a=g.getOdtDocument(),b=a.getParagraphStyleElement(f),h=b.cloneNode(!0);h.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:name",e);h.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:display-name",c);b.parentNode.appendChild(h);a.getOdfCanvas().refreshCSS();g.emit(ops.Session.signalStyleCreated,
+e)};this.spec=function(){return{optype:"CloneStyle",memberid:k,timestamp:m,styleName:f,newStyleName:e,newStyleDisplayName:c}}};
+// Input 42
+ops.OpDeleteStyle=function(g){var k,m,f;this.init=function(e){k=e.memberid;m=e.timestamp;f=e.styleName};this.execute=function(){g.getOdtDocument().deleteStyle(f);g.emit(ops.Session.signalStyleDeleted,f)};this.spec=function(){return{optype:"DeleteStyle",memberid:k,timestamp:m,styleName:f}}};
+// Input 43
+runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");runtime.loadClass("ops.OpUpdateParagraphStyle");runtime.loadClass("ops.OpCloneStyle");runtime.loadClass("ops.OpDeleteStyle");
+ops.OperationFactory=function(g){this.create=function(k){var m=null;"AddCursor"===k.optype?m=new ops.OpAddCursor(g):"InsertText"===k.optype?m=new ops.OpInsertText(g):"RemoveText"===k.optype?m=new ops.OpRemoveText(g):"SplitParagraph"===k.optype?m=new ops.OpSplitParagraph(g):"SetParagraphStyle"===k.optype?m=new ops.OpSetParagraphStyle(g):"UpdateParagraphStyle"===k.optype?m=new ops.OpUpdateParagraphStyle(g):"CloneStyle"===k.optype?m=new ops.OpCloneStyle(g):"DeleteStyle"===k.optype?m=new ops.OpDeleteStyle(g):
+"MoveCursor"===k.optype?m=new ops.OpMoveCursor(g):"RemoveCursor"===k.optype&&(m=new ops.OpRemoveCursor(g));m&&m.init(k);return m}};
+// Input 44
+runtime.loadClass("core.Cursor");
+ops.OdtCursor=function(g,k){var m=this,f,e;this.removeFromOdtDocument=function(){e.remove(function(){})};this.move=function(a){var b=0;0<a?b=f.movePointForward(a):0>=a&&(b=-f.movePointBackward(-a));m.handleUpdate();return b};this.handleUpdate=function(){};this.getStepCounter=function(){return f.getStepCounter()};this.getMemberId=function(){return g};this.getNode=function(){return e.getNode()};this.getSelection=function(){return e.getSelection()};this.getOdtDocument=function(){return k};var c;c=new core.Selection(k.getDOM());
+e=new core.Cursor(c,k.getDOM());e.getNode().setAttributeNS("urn:webodf:names:cursor","memberId",g);f=k.getSelectionManager().createSelectionMover(e)};
+// Input 45
+runtime.loadClass("core.Cursor");runtime.loadClass("core.PositionIterator");runtime.loadClass("core.PositionFilter");runtime.loadClass("core.LoopWatchDog");
+gui.SelectionMover=function(g,k,m,f){function e(a,b,d){b=a;f=f||q.adaptToCursorRemoval;m=m||q.adaptToInsertedCursor;for(g.remove(f);0<b&&d();)b-=1;0<a-b&&p.collapse(j.container(),j.unfilteredDomOffset());g.updateToSelection(f,m);return a-b}function c(a,b){for(var d=j.container(),c=j.offset(),e=new core.LoopWatchDog(1E3),f=0,g=0;0<a&&j.nextPosition();)f+=1,e.check(),1===b.acceptPosition(j)&&(g+=f,f=0,a-=1);j.setPosition(d,c);return g}function a(a,b){for(var d=j.container(),c=j.offset(),e=new core.LoopWatchDog(1E3),
+f=0,g=0;0<a&&j.previousPosition();)f+=1,e.check(),1===b.acceptPosition(j)&&(g+=f,f=0,a-=1);j.setPosition(d,c);return g}function b(a,b){for(var d=j.container(),c=j.offset(),e,f=0,g=d.ownerDocument.createRange();0<a;){var l=g,h=b,k=j.container(),m=j.offset(),p=0,q=0,z=null,y=void 0,B=void 0,Q=0,M=void 0,t=void 0,K=void 0,I=void 0,M=void 0;l.setStart(k,m);M=l.getClientRects()[0];I=t=M.top;for(K=M.left;j.previousPosition();)if(p+=1,1===h.acceptPosition(j)&&(q+=p,p=0,k=j.container(),m=j.offset(),l.setStart(k,
+m),M=l.getClientRects()[0],M.top!==t)){if(M.top!==I)break;I=t;M=Math.abs(K-M.left);if(null===z||M<B)z=k,y=m,B=M,Q=q}null!==z?(j.setPosition(z,y),q=Q):q=0;e+=q;if(0===e)break;f+=e;a-=1}g.detach();j.setPosition(d,c);return f}function h(a,b){var d=j.container(),c=j.offset(),e=g.getNode().firstChild,l=new core.LoopWatchDog(1E3),h=0,k=0,u=e.offsetTop;f=f||q.adaptToCursorRemoval;for(m=m||q.adaptToInsertedCursor;0<a&&j.nextPosition();)l.check(),h+=1,1===b.acceptPosition(j)&&(p.collapse(j.container(),j.offset()),
+g.updateToSelection(f,m),u=e.offsetTop,u!==e.offsetTop&&(k+=h,h=0,a-=1));j.setPosition(d,c);p.collapse(j.container(),j.offset());g.updateToSelection(f,m);return k}function d(a,b){for(var d=0,c;a.parentNode!==b;)runtime.assert(null!==a.parentNode,"parent is null"),a=a.parentNode;for(c=b.firstChild;c!==a;)d+=1,c=c.nextSibling;return d}function l(a,b,c){runtime.assert(null!==a,"SelectionMover.countStepsToPosition called with element===null");var e=j.container(),f=j.offset(),g=0,l=new core.LoopWatchDog(1E3),
+h;j.setPosition(a,b);a=j.container();runtime.assert(null!==a,"SelectionMover.countStepsToPosition: positionIterator.container() returned null");b=j.offset();j.setPosition(e,f);h=a;var k=b,m=f;if(h===e)h=m-k;else{var p=h.compareDocumentPosition(e);2===p?p=-1:4===p?p=1:10===p?(k=d(h,e),p=k<m?1:-1):(m=d(e,h),p=m<k?-1:1);h=p}if(0>h){for(;j.nextPosition();)if(l.check(),1===c.acceptPosition(j)&&(g+=1),j.container()===a&&j.offset()===b)return j.setPosition(e,f),g;j.setPosition(e,f)}else if(0<h){for(;j.previousPosition();)if(l.check(),
+1===c.acceptPosition(j)&&(g-=1),j.container()===a&&j.offset()===b)return j.setPosition(e,f),g;j.setPosition(e,f)}return g}var q=this,p=g.getSelection(),j;this.movePointForward=function(a,b){return e(a,b,j.nextPosition)};this.movePointBackward=function(a,b){return e(a,b,j.previousPosition)};this.getStepCounter=function(){return{countForwardSteps:c,countBackwardSteps:a,countLineDownSteps:h,countLinesUpSteps:b,countStepsToPosition:l}};this.adaptToCursorRemoval=function(a,b){if(!(0===b||null===a||3!==
+a.nodeType)){var d=j.container();d===a&&j.setPosition(d,j.offset()+b)}};this.adaptToInsertedCursor=function(a,b){if(!(0===b||null===a||3!==a.nodeType)){var d=j.container(),c=j.offset();if(d===a)if(c<b){do d=d.previousSibling;while(d&&3!==d.nodeType);d&&j.setPosition(d,c)}else j.setPosition(d,j.offset()-b)}};j=gui.SelectionMover.createPositionIterator(k);p.collapse(j.container(),j.offset());f=f||q.adaptToCursorRemoval;m=m||q.adaptToInsertedCursor;g.updateToSelection(f,m)};
+gui.SelectionMover.createPositionIterator=function(g){var k=new function(){this.acceptNode=function(g){return"urn:webodf:names:cursor"===g.namespaceURI||"urn:webodf:names:editinfo"===g.namespaceURI?2:1}};return new core.PositionIterator(g,5,k,!1)};(function(){return gui.SelectionMover})();
+// Input 46
+gui.Avatar=function(g){var k,m;this.setColor=function(c){m.style.borderColor=c};this.setImageUrl=function(c){m.src=c};this.isVisible=function(){return"block"===k.style.display};this.show=function(){k.style.display="block"};this.hide=function(){k.style.display="none"};this.markAsFocussed=function(c){k.className=c?"active":""};var f=g.ownerDocument,e=f.documentElement.namespaceURI;k=f.createElementNS(e,"div");m=f.createElementNS(e,"img");m.width=64;m.height=64;k.appendChild(m);k.style.width="64px";
+k.style.height="70px";k.style.position="absolute";k.style.top="-80px";k.style.left="-34px";k.style.display="block";g.appendChild(k)};
+// Input 47
+runtime.loadClass("gui.Avatar");runtime.loadClass("ops.OdtCursor");
+gui.Caret=function(g){function k(){a&&c.parentNode&&!b&&(b=!0,f.style.borderColor="transparent"===f.style.borderColor?h:"transparent",runtime.setTimeout(function(){b=!1;k()},500))}function m(a){var b;if("string"===typeof a){if(""===a)return 0;b=/^(\d+)(\.\d+)?px$/.exec(a);runtime.assert(null!==b,"size ["+a+"] does not have unit px.");return parseFloat(b[1])}return a}var f,e,c,a=!1,b=!1,h="";this.setFocus=function(){a=!0;e.markAsFocussed(!0);k()};this.removeFocus=function(){a=!1;e.markAsFocussed(!1);
+f.style.borderColor=h};this.setAvatarImageUrl=function(a){e.setImageUrl(a)};this.setColor=function(a){h!==a&&(h=a,"transparent"!==f.style.borderColor&&(f.style.borderColor=h),e.setColor(h))};this.getCursor=function(){return g};this.getFocusElement=function(){return f};this.toggleHandleVisibility=function(){e.isVisible()?e.hide():e.show()};this.showHandle=function(){e.show()};this.hideHandle=function(){e.hide()};this.ensureVisible=function(){var a,b,d,c,e,h,k,x=g.getOdtDocument().getOdfCanvas().getElement().parentNode;
+e=k=f;d=runtime.getWindow();runtime.assert(null!==d,"Expected to be run in an environment which has a global window, like a browser.");do{e=e.parentElement;if(!e)break;h=d.getComputedStyle(e,null)}while("block"!==h.display);h=e;e=c=0;if(!h||!x)c=d=0;else{b=!1;do{d=h.offsetParent;for(a=h.parentNode;a!==d;){if(a===x){a=h;var v=x,G=0;b=0;var C=void 0,E=runtime.getWindow();for(runtime.assert(null!==E,"Expected to be run in an environment which has a global window, like a browser.");a&&a!==v;)C=E.getComputedStyle(a,
+null),G+=m(C.marginLeft)+m(C.borderLeftWidth)+m(C.paddingLeft),b+=m(C.marginTop)+m(C.borderTopWidth)+m(C.paddingTop),a=a.parentElement;a=G;c+=a;e+=b;b=!0;break}a=a.parentNode}if(b)break;c+=m(h.offsetLeft);e+=m(h.offsetTop);h=d}while(h&&h!==x);d=c;c=e}d+=k.offsetLeft;c+=k.offsetTop;e=d-5;h=c-5;d=d+k.scrollWidth-1+5;k=c+k.scrollHeight-1+5;h<x.scrollTop?x.scrollTop=h:k>x.scrollTop+x.clientHeight-1&&(x.scrollTop=k-x.clientHeight+1);e<x.scrollLeft?x.scrollLeft=e:d>x.scrollLeft+x.clientWidth-1&&(x.scrollLeft=
+d-x.clientWidth+1)};var d=g.getOdtDocument().getDOM();f=d.createElementNS(d.documentElement.namespaceURI,"span");c=g.getNode();c.appendChild(f);e=new gui.Avatar(c)};
+// Input 48
+runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");
+gui.SessionController=function(){gui.SessionController=function(g,k){function m(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function f(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function e(a){f(a)}function c(){var a=runtime.getWindow().getSelection(),b,c=g.getOdtDocument(),e=c.getOdfCanvas().getElement();for(b=a.focusNode;b!==e;){if("urn:webodf:names:cursor"===b.namespaceURI&&"cursor"===b.localName)return;b=b.parentNode}a=c.getDistanceFromCursor(k,
+a.focusNode,a.focusOffset);0!==a&&(b=new ops.OpMoveCursor(g),b.init({memberid:k,number:a}),g.enqueue(b))}function a(a){var b=new ops.OpMoveCursor(g);b.init({memberid:k,number:a});return b}function b(b){var c=b.keyCode,e=null,h=!1;37===c?(e=a(-1),h=!0):39===c?(e=a(1),h=!0):38===c?(e=a(-10),h=!0):40===c?(e=a(10),h=!0):36===c?(e=g.getOdtDocument(),c=null,h=e.getParagraphElement(e.getCursor(k).getNode()),e=e.getDistanceFromCursor(k,h,0),0!==e&&(c=new ops.OpMoveCursor(g),c.init({memberid:k,number:e})),
+e=c,h=!0):35===c?h=!0:8===c?(c=g.getOdtDocument(),e=c.getCursorPosition(k),h=null,c.getPositionInTextNode(e-1)&&(h=new ops.OpRemoveText(g),h.init({memberid:k,position:e,length:-1})),e=h,h=null!==e):46===c&&(c=g.getOdtDocument(),e=c.getCursorPosition(k),h=null,c.getPositionInTextNode(e+1)&&(h=new ops.OpRemoveText(g),h.init({memberid:k,position:e,length:1})),e=h,h=null!==e);e&&g.enqueue(e);h&&f(b)}function h(a){var b,c;c=null===a.which?String.fromCharCode(a.keyCode):0!==a.which&&0!==a.charCode?String.fromCharCode(a.which):
+null;13===a.keyCode?(b=g.getOdtDocument().getCursorPosition(k),c=new ops.OpSplitParagraph(g),c.init({memberid:k,position:b}),g.enqueue(c),f(a)):c&&(!a.altKey&&!a.ctrlKey&&!a.metaKey)&&(b=new ops.OpInsertText(g),b.init({memberid:k,position:g.getOdtDocument().getCursorPosition(k),text:c}),g.enqueue(b),f(a))}new odf.Style2CSS;this.startListening=function(){var a=g.getOdtDocument().getOdfCanvas().getElement();m(a,"keydown",b);m(a,"keypress",h);m(a,"keyup",e);m(a,"copy",e);m(a,"cut",e);m(a,"paste",e);
+m(a,"click",c)};this.startEditing=function(){var a=new ops.OpAddCursor(g);a.init({memberid:k});g.enqueue(a)};this.endEditing=function(){var a=new ops.OpRemoveCursor(g);a.init({memberid:k});g.enqueue(a)};this.getInputMemberId=function(){return k};this.getSession=function(){return g}};return gui.SessionController}();
+// Input 49
+runtime.loadClass("gui.SelectionMover");gui.SelectionManager=function(g){function k(e,c){var a;for(a=0;a<f.length;a+=1)f[a].adaptToCursorRemoval(e,c)}function m(e,c){var a;for(a=0;a<f.length;a+=1)f[a].adaptToInsertedCursor(e,c)}var f=[];this.createSelectionMover=function(e){e=new gui.SelectionMover(e,g,m,k);f.push(e);return e}};
+// Input 50
+ops.UserModel=function(){};ops.UserModel.prototype.getUserDetailsAndUpdates=function(){};ops.UserModel.prototype.unsubscribeUserDetailsUpdates=function(){};
+// Input 51
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.TrivialUserModel=function(){var g={bob:{memberid:"bob",fullname:"Bob Pigeon",color:"red",imageurl:"avatar-pigeon.png"},alice:{memberid:"alice",fullname:"Alice Bee",color:"green",imageurl:"avatar-flower.png"},you:{memberid:"you",fullname:"I, Robot",color:"blue",imageurl:"avatar-joe.png"}};this.getUserDetailsAndUpdates=function(k,m){var f=k.split("___")[0];m(k,g[f]||null)};this.unsubscribeUserDetailsUpdates=function(){}};
+// Input 52
+ops.NowjsUserModel=function(){var g={},k={},m=runtime.getNetwork();this.getUserDetailsAndUpdates=function(f,e){var c=f.split("___")[0],a=g[c],b=k[c]=k[c]||[],h;runtime.assert(void 0!==e,"missing callback");for(h=0;h<b.length&&!(b[h].subscriber===e&&b[h].memberId===f);h+=1);h<b.length?runtime.log("double subscription request for "+f+" in NowjsUserModel::getUserDetailsAndUpdates"):b.push({memberId:f,subscriber:e});void 0===a?m.getUserData(c,function(a){a=a?{userid:a.uid,fullname:a.fullname,imageurl:"/user/"+
+a.uid+"/avatar.png",color:a.color}:null;var b,e;g[c]=a;if(b=k[c])for(e=0;e<b.length;e+=1)b[e].subscriber(b[e].memberId,a);runtime.log("data for user ["+c+"] cached.")}):e(f,a)};this.unsubscribeUserDetailsUpdates=function(f,e){var c;c=f.split("___")[0];var a=k[c];runtime.assert(void 0!==e,"missing subscriber parameter or null");runtime.assert(a,"tried to unsubscribe when no one is subscribed ('"+f+"')");if(a){for(c=0;c<a.length&&!(a[c].subscriber===e&&a[c].memberId===f);c+=1);runtime.assert(c<a.length,
+"tried to unsubscribe when not subscribed for memberId '"+f+"'");a.splice(c,1)}};runtime.assert("ready"===m.networkStatus,"network not ready")};
+// Input 53
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+ops.TrivialOperationRouter=function(){var g=this;this.setOperationFactory=function(k){g.op_factory=k};this.setPlaybackFunction=function(k){g.playback_func=k};this.push=function(k){k=k.spec();k.timestamp=(new Date).getTime();k=g.op_factory.create(k);g.playback_func(k)}};
+// Input 54
+ops.NowjsOperationRouter=function(g,k){function m(d){var e;e=f.op_factory.create(d);runtime.log(" op in: "+runtime.toJson(d));if(null!==e)if(d=Number(d.server_seq),runtime.assert(!isNaN(d),"server seq is not a number"),d===c+1){f.playback_func(e);c=d;b=0;for(e=c+1;a.hasOwnProperty(e);e+=1)f.playback_func(a[e]),delete a[e],runtime.log("op with server seq "+d+" taken from hold (reordered)")}else runtime.assert(d!==c+1,"received incorrect order from server"),runtime.assert(!a.hasOwnProperty(d),"reorder_queue has incoming op"),
+runtime.log("op with server seq "+d+" put on hold"),a[d]=e;else runtime.log("ignoring invalid incoming opspec: "+d)}var f=this,e=runtime.getNetwork(),c=-1,a={},b=0,h=1E3;this.setOperationFactory=function(a){f.op_factory=a};this.setPlaybackFunction=function(a){f.playback_func=a};e.ping=function(a){null!==k&&a(k)};e.receiveOp=function(a,b){a===g&&m(b)};this.push=function(a){a=a.spec();runtime.assert(null!==k,"Router sequence N/A without memberid");h+=1;a.client_nonce="C:"+k+":"+h;a.parent_op=c+"+"+
+b;b+=1;runtime.log("op out: "+runtime.toJson(a));e.deliverOp(g,a)};this.requestReplay=function(a){e.requestReplay(g,function(a){runtime.log("replaying: "+runtime.toJson(a));m(a)},function(b){runtime.log("replay done ("+b+" ops).");a&&a()})};e.memberid=k;e.joinSession(g,function(a){runtime.assert(a,"Trying to join a session which does not exists or where we are already in")})};
+// Input 55
+gui.EditInfoHandle=function(g){var k=[],m,f=g.ownerDocument,e=f.documentElement.namespaceURI;this.setEdits=function(c){k=c;var a,b,g,d;m.innerHTML="";for(c=0;c<k.length;c+=1)a=f.createElementNS(e,"div"),a.className="editInfo",b=f.createElementNS(e,"span"),b.className="editInfoColor",b.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[c].memberid),g=f.createElementNS(e,"span"),g.className="editInfoAuthor",g.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[c].memberid),
+d=f.createElementNS(e,"span"),d.className="editInfoTime",d.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[c].memberid),d.innerHTML=k[c].time,a.appendChild(b),a.appendChild(g),a.appendChild(d),m.appendChild(a)};this.show=function(){m.style.display="block"};this.hide=function(){m.style.display="none"};m=f.createElementNS(e,"div");m.setAttribute("class","editInfoHandle");m.style.display="none";g.appendChild(m)};
+// Input 56
+runtime.loadClass("core.EditInfo");runtime.loadClass("gui.EditInfoHandle");
+gui.EditInfoMarker=function(g){function k(a,b){return window.setTimeout(function(){c.style.opacity=a},b)}var m=this,f,e,c,a,b;this.addEdit=function(f,d){var l=Date.now()-d;g.addEdit(f,d);e.setEdits(g.getSortedEdits());c.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",f);a&&window.clearTimeout(a);b&&window.clearTimeout(b);1E4>l?(k(1,0),a=k(0.5,1E4-l),b=k(0.2,2E4-l)):1E4<=l&&2E4>l?(k(0.5,0),b=k(0.2,2E4-l)):k(0.2,0)};this.getEdits=function(){return g.getEdits()};this.clearEdits=function(){g.clearEdits();
+e.setEdits([]);c.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&c.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return g};this.showHandle=function(){e.show()};this.hideHandle=function(){e.hide()};f=g.getOdtDocument().getDOM();c=f.createElementNS(f.documentElement.namespaceURI,"div");c.setAttribute("class","editInfoMarker");c.onmouseover=function(){m.showHandle()};c.onmouseout=function(){m.hideHandle()};f=g.getNode();f.appendChild(c);
+e=new gui.EditInfoHandle(f)};
+// Input 57
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+runtime.loadClass("gui.Caret");runtime.loadClass("ops.TrivialUserModel");runtime.loadClass("core.EditInfo");runtime.loadClass("gui.EditInfoMarker");
+gui.SessionView=function(){return function(g,k){function m(a,b,c){c=c.split("___")[0];return a+"."+b+'[editinfo|memberid^="'+c+'"]'}function f(b,f){var g=e[b];if(void 0===f)runtime.log('UserModel sent undefined data for member "'+b+'".');else if(null===f&&(f={memberid:b,fullname:"Unknown Identity",color:"black",imageurl:"avatar-joe.png"}),g&&(g.setAvatarImageUrl(f.imageurl),g.setColor(f.color)),a){var g=f.fullname,h=f.color,j=function(a,e,f){f=m(a,e,b)+f;a:{var j=c.firstChild;for(a=m(a,e,b);j;){if(3===
+j.nodeType&&0===j.data.indexOf(a)){a=j;break a}j=j.nextSibling}a=null}a?a.data=f:c.appendChild(document.createTextNode(f))};j("div","editInfoMarker","{ background-color: "+h+"; }");j("span","editInfoColor","{ background-color: "+h+"; }");j("span","editInfoAuthor",':before { content: "'+g+'"; }')}}var e={},c,a=!0,b={};g.getOdtDocument().subscribe("paragraphEdited",function(a){var c=a.element,e=a.memberId;a=a.timeStamp;var f,j="";g.getUserModel();var h=c.getElementsByTagNameNS("urn:webodf:names:editinfo",
+"editinfo")[0];h?(j=h.getAttributeNS("urn:webodf:names:editinfo","id"),f=b[j]):(j=Math.random().toString(),f=new core.EditInfo(c,g.getOdtDocument()),f=new gui.EditInfoMarker(f),h=c.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0],h.setAttributeNS("urn:webodf:names:editinfo","id",j),b[j]=f);f.addEdit(e,new Date(a))});this.enableEditHighlighting=function(){a||(a=!0)};this.disableEditHighlighting=function(){a&&(a=!1)};this.getSession=function(){return g};this.getCaret=function(a){return e[a]};
+var h=document.getElementsByTagName("head")[0];g.subscribe(ops.Session.signalCursorAdded,function(a){var b=k.createCaret(a);a=a.getMemberId();var c=g.getUserModel();e[a]=b;f(a,null);c.getUserDetailsAndUpdates(a,f);runtime.log("+++ View here +++ eagerly created an Caret for '"+a+"'! +++")});g.subscribe(ops.Session.signalCursorRemoved,function(a){delete e[a]});c=document.createElementNS(h.namespaceURI,"style");c.type="text/css";c.media="screen, print, handheld, projection";c.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));
+h.appendChild(c)}}();
+// Input 58
+/*
+
+ Copyright (C) 2012 KO GmbH <copyright@kogmbh.com>
+
+ @licstart
+ The JavaScript code in this page is free software: you can redistribute it
+ and/or modify it under the terms of the GNU Affero General Public License
+ (GNU AGPL) as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version. The code is distributed
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
+
+ As additional permission under GNU AGPL version 3 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU GPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ As a special exception to the AGPL, any HTML file which merely makes function
+ calls to this code, and for that purpose includes it by reference shall be
+ deemed a separate work for copyright law purposes. In addition, the copyright
+ holders of this code give you permission to combine this code with free
+ software libraries that are released under the GNU LGPL. You may copy and
+ distribute such a system following the terms of the GNU AGPL for this code
+ and the LGPL for the libraries. If you modify this code, you may extend this
+ exception to your version of the code, but you are not obligated to do so.
+ If you do not wish to do so, delete this exception statement from your
+ version.
+
+ This license applies to this entire compilation.
+ @licend
+ @source: http://www.webodf.org/
+ @source: http://gitorious.org/webodf/webodf/
+*/
+runtime.loadClass("gui.Caret");gui.CaretFactory=function(g){this.createCaret=function(k){var m=k.getMemberId(),f=g.getSession().getOdtDocument(),e=f.getOdfCanvas().getElement(),c=new gui.Caret(k);m===g.getInputMemberId()&&(runtime.log("Starting to track input on new cursor of "+m),f.subscribe("paragraphEdited",function(a){a.memberId===m&&c.ensureVisible()}),k.handleUpdate=c.ensureVisible,e.setAttribute("tabindex",0),e.onfocus=c.setFocus,e.onblur=c.removeFocus,e.focus(),g.startListening());return c}};
+// Input 59
+runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.Style2CSS");
+gui.PresenterUI=function(){var g=new odf.Style2CSS,k=new xmldom.XPath,m=g.namespaceResolver;return function(f){var e=this;e.setInitialSlideMode=function(){e.startSlideMode("single")};e.keyDownHandler=function(c){if(!c.target.isContentEditable&&"input"!==c.target.nodeName)switch(c.keyCode){case 84:e.toggleToolbar();break;case 37:case 8:e.prevSlide();break;case 39:case 32:e.nextSlide();break;case 36:e.firstSlide();break;case 35:e.lastSlide()}};e.root=function(){return e.odf_canvas.odfContainer().rootElement};
+e.firstSlide=function(){e.slideChange(function(){return 0})};e.lastSlide=function(){e.slideChange(function(c,a){return a-1})};e.nextSlide=function(){e.slideChange(function(c,a){return c+1<a?c+1:-1})};e.prevSlide=function(){e.slideChange(function(c){return 1>c?-1:c-1})};e.slideChange=function(c){var a=e.getPages(e.odf_canvas.odfContainer().rootElement),b=-1,f=0;a.forEach(function(a){a=a[1];a.hasAttribute("slide_current")&&(b=f,a.removeAttribute("slide_current"));f+=1});c=c(b,a.length);-1===c&&(c=b);
+a[c][1].setAttribute("slide_current","1");document.getElementById("pagelist").selectedIndex=c;"cont"===e.slide_mode&&window.scrollBy(0,a[c][1].getBoundingClientRect().top-30)};e.selectSlide=function(c){e.slideChange(function(a,b){return c>=b||0>c?-1:c})};e.scrollIntoContView=function(c){var a=e.getPages(e.odf_canvas.odfContainer().rootElement);0!==a.length&&window.scrollBy(0,a[c][1].getBoundingClientRect().top-30)};e.getPages=function(c){c=c.getElementsByTagNameNS(m("draw"),"page");var a=[],b;for(b=
+0;b<c.length;b+=1)a.push([c[b].getAttribute("draw:name"),c[b]]);return a};e.fillPageList=function(c,a){for(var b=e.getPages(c),f,d,g;a.firstChild;)a.removeChild(a.firstChild);for(f=0;f<b.length;f+=1)d=document.createElement("option"),g=k.getODFElementsWithXPath(b[f][1],'./draw:frame[@presentation:class="title"]//draw:text-box/text:p',xmldom.XPath),g=0<g.length?g[0].textContent:b[f][0],d.textContent=f+1+": "+g,a.appendChild(d)};e.startSlideMode=function(c){var a=document.getElementById("pagelist"),
+b=e.odf_canvas.slidevisibilitycss().sheet;for(e.slide_mode=c;0<b.cssRules.length;)b.deleteRule(0);e.selectSlide(0);"single"===e.slide_mode?(b.insertRule("draw|page { position:fixed; left:0px;top:30px; z-index:1; }",0),b.insertRule("draw|page[slide_current] { z-index:2;}",1),b.insertRule("draw|page { -webkit-transform: scale(1);}",2),e.fitToWindow(),window.addEventListener("resize",e.fitToWindow,!1)):"cont"===e.slide_mode&&window.removeEventListener("resize",e.fitToWindow,!1);e.fillPageList(e.odf_canvas.odfContainer().rootElement,
+a)};e.toggleToolbar=function(){var c,a,b;c=e.odf_canvas.slidevisibilitycss().sheet;a=-1;for(b=0;b<c.cssRules.length;b+=1)if(".toolbar"===c.cssRules[b].cssText.substring(0,8)){a=b;break}-1<a?c.deleteRule(a):c.insertRule(".toolbar { position:fixed; left:0px;top:-200px; z-index:0; }",0)};e.fitToWindow=function(){var c=e.getPages(e.root()),a=(window.innerHeight-40)/c[0][1].clientHeight,c=(window.innerWidth-10)/c[0][1].clientWidth,a=a<c?a:c,c=e.odf_canvas.slidevisibilitycss().sheet;c.deleteRule(2);c.insertRule("draw|page { \n-moz-transform: scale("+
+a+"); \n-moz-transform-origin: 0% 0%; -webkit-transform-origin: 0% 0%; -webkit-transform: scale("+a+"); -o-transform-origin: 0% 0%; -o-transform: scale("+a+"); -ms-transform-origin: 0% 0%; -ms-transform: scale("+a+"); }",2)};e.load=function(c){e.odf_canvas.load(c)};e.odf_element=f;e.odf_canvas=new odf.OdfCanvas(e.odf_element);e.odf_canvas.addListener("statereadychange",e.setInitialSlideMode);e.slide_mode="undefined";document.addEventListener("keydown",e.keyDownHandler,!1)}}();
+// Input 60
+runtime.loadClass("core.PositionIterator");runtime.loadClass("core.Cursor");
+gui.XMLEdit=function(g,k){function m(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function f(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function e(){var a=g.ownerDocument.defaultView.getSelection();a&&(!(0>=a.rangeCount)&&p)&&(a=a.getRangeAt(0),p.setPoint(a.startContainer,a.startOffset))}function c(){var a=g.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();p&&p.node()&&(b=p.node(),c=b.ownerDocument.createRange(),
+c.setStart(b,p.position()),c.collapse(!0),a.addRange(c))}function a(b){for(var c=b.firstChild;c&&c!==b;)1===c.nodeType&&a(c),c=c.nextSibling||c.parentNode;var d,e,f,c=b.attributes;d="";for(f=c.length-1;0<=f;f-=1)e=c.item(f),d=d+" "+e.nodeName+'="'+e.nodeValue+'"';b.setAttribute("customns_name",b.nodeName);b.setAttribute("customns_atts",d);c=b.firstChild;for(e=/^\s*$/;c&&c!==b;)d=c,c=c.nextSibling||c.parentNode,3===d.nodeType&&e.test(d.nodeValue)&&d.parentNode.removeChild(d)}function b(a,c){for(var d=
+a.firstChild,e,f,g;d&&d!==a;){if(1===d.nodeType){b(d,c);e=d.attributes;for(g=e.length-1;0<=g;g-=1)f=e.item(g),"http://www.w3.org/2000/xmlns/"===f.namespaceURI&&!c[f.nodeValue]&&(c[f.nodeValue]=f.localName)}d=d.nextSibling||d.parentNode}}function h(){var a=g.ownerDocument.createElement("style"),c;c={};b(g,c);var e={},f,h,l=0;for(f in c)if(c.hasOwnProperty(f)&&f){h=c[f];if(!h||e.hasOwnProperty(h)||"xmlns"===h){do h="ns"+l,l+=1;while(e.hasOwnProperty(h));c[f]=h}e[h]=!0}a.type="text/css";c="@namespace customns url(customns);\n"+
+d;a.appendChild(g.ownerDocument.createTextNode(c));k=k.parentNode.replaceChild(a,k)}var d,l,q,p=null;g.id||(g.id="xml"+String(Math.random()).substring(2));l="#"+g.id+" ";d=l+"*,"+l+":visited, "+l+":link {display:block; margin: 0px; margin-left: 10px; font-size: medium; color: black; background: white; font-variant: normal; font-weight: normal; font-style: normal; font-family: sans-serif; text-decoration: none; white-space: pre-wrap; height: auto; width: auto}\n"+l+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+
+l+":after {color: blue; content: '</' attr(customns_name) '>';}\n"+l+"{overflow: auto;}\n";l=g;m(l,"click",function(a){g.ownerDocument.defaultView.getSelection().getRangeAt(0);f(a)});m(l,"keydown",function(a){var b=a.charCode||a.keyCode;if(p=null,p&&37===b)e(),p.stepBackward(),c();else if(16<=b&&20>=b||33<=b&&40>=b)return;f(a)});m(l,"keypress",function(){});m(l,"drop",f);m(l,"dragend",f);m(l,"beforepaste",f);m(l,"paste",f);this.updateCSS=h;this.setXML=function(b){b=b.documentElement||b;q=b=g.ownerDocument.importNode(b,
+!0);for(a(b);g.lastChild;)g.removeChild(g.lastChild);g.appendChild(b);h();p=new core.PositionIterator(b)};this.getXML=function(){return q}};
+// Input 61
+ops.SessionPointFilter=function(){this.acceptNode=function(){return 1}};
+// Input 62
+runtime.loadClass("ops.TrivialOperationRouter");runtime.loadClass("gui.SelectionManager");
+ops.OdtDocument=function(g){function k(a){var c=gui.SelectionMover.createPositionIterator(b),e=null,f,g=0;a+=1;1===d.acceptPosition(c)&&(f=c.container(),3===f.nodeType?(e=f,g=0):0===a&&(e=b.ownerDocument.createTextNode(""),f.insertBefore(e,null),g=0));for(;0<a||null===e;){if(!c.nextPosition())return null;if(1===d.acceptPosition(c))if(a-=1,f=c.container(),3===f.nodeType)f!==e?(e=f,g=0):g+=1;else if(null!==e){if(0===a){g=e.length;break}e=null}else if(0===a){e=f.ownerDocument.createTextNode("");f.appendChild(e);
+g=0;break}}if(null===e)return null;for(;0===g&&e.previousSibling&&"cursor"===e.previousSibling.localName;){for(f=e.previousSibling.previousSibling;f&&3!==f.nodeType;)f=f.previousSibling;null===f&&(f=b.ownerDocument.createTextNode(""),e.parentNode.insertBefore(f,e.parentNode.firstChild));e=f;g=e.length}return{textNode:e,offset:g}}function m(b){for(;b&&!(("p"===b.localName||"h"===b.localName)&&b.namespaceURI===a);)b=b.parentNode;return b}function f(a){return g.getFormatting().getStyleElement(g.odfContainer().rootElement.styles,
+a,"paragraph")}function e(a,b,c,d,e){void 0!==d&&(void 0!==e?a.setAttributeNS(b,c,d+e):a.setAttributeNS(b,c,d))}var c=this,a="urn:oasis:names:tc:opendocument:xmlns:text:1.0",b,h,d,l={},q={paragraphEdited:[]};this.getParagraphStyleElement=f;this.getParagraphElement=m;this.getParagraphStyleAttributes=function(a){return(a=f(a))?g.getFormatting().getInheritedStyleAttributes(g.odfContainer().rootElement.styles,a):null};this.getPositionInTextNode=k;this.getDistanceFromCursor=function(a,b,c){a=l[a];var e=
+0;runtime.assert(null!==b,"OdtDocument.getDistanceFromCursor called with node===null");a&&(a=a.getStepCounter().countStepsToPosition,e=a(b,c,d));return e};this.getCursorPosition=function(a){return-c.getDistanceFromCursor(a,b,0)};this.getPositionFilter=function(){return d};this.getOdfCanvas=function(){return g};this.getRootNode=function(){return b};this.getDOM=function(){return b.ownerDocument};this.getSelectionManager=function(){return h};this.insertText=function(a,b,d,e){var f;if(d=k(d)){f=d.textNode;
+f.insertData(d.offset,e);e=f.parentNode;var g=f.nextSibling;e.removeChild(f);e.insertBefore(f,g);c.emit("paragraphEdited",{element:m(d.textNode),memberId:a,timeStamp:b});return!0}return!1};this.removeText=function(a,b,d,e){if(0>e)e=-e,d=k(d-e);else{d=k(d+1);if(1!==d.offset)return runtime.log("unexpected!"),!1;d.offset-=1}return d?(d.textNode.deleteData(d.offset,e),c.emit("paragraphEdited",{element:m(d.textNode),memberId:a,timeStamp:b}),!0):!1};this.setParagraphStyle=function(b,d,e,f,g){var h;h=k(e);
+runtime.log("Setting paragraph style:"+h+" -- "+e+" "+f+"->"+g);return h&&(e=m(h.textNode))?(e.setAttributeNS(a,"text:style-name",g),c.emit("paragraphEdited",{element:e,timeStamp:d,memberId:b}),!0):!1};this.updateParagraphStyle=function(a,c){var d,h,k;if(d=f(a)){h=d.getElementsByTagNameNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","paragraph-properties")[0];k=d.getElementsByTagNameNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","text-properties")[0];void 0===h&&c.paragraphProperties&&
+(h=b.ownerDocument.createElementNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:paragraph-properties"),d.appendChild(h));void 0===k&&c.textProperties&&(k=b.ownerDocument.createElementNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:text-properties"),d.appendChild(k));c.paragraphProperties&&(e(h,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","fo:margin-top",c.paragraphProperties.topMargin,"mm"),e(h,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
+"fo:margin-bottom",c.paragraphProperties.bottomMargin,"mm"),e(h,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","fo:margin-left",c.paragraphProperties.leftMargin,"mm"),e(h,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","fo:margin-right",c.paragraphProperties.rightMargin,"mm"),e(h,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","fo:text-align",c.paragraphProperties.textAlign));if(c.textProperties){e(k,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
+"fo:font-size",c.textProperties.fontSize,"pt");d=c.textProperties.fontName;d=g.getFormatting().getFontMap().hasOwnProperty(d)?!0:!1;if(!d){h=d=c.textProperties.fontName;var l;d&&h&&(l=b.ownerDocument.createElementNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:font-face"),l.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:name",d),l.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","svg:font-family",h),g.odfContainer().rootElement.fontFaceDecls.appendChild(l))}e(k,
+"urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:font-name",c.textProperties.fontName);e(k,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","fo:color",c.textProperties.color);e(k,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","fo:background-color",c.textProperties.backgroundColor);e(k,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","fo:font-weight",c.textProperties.fontWeight);e(k,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","fo:font-style",
+c.textProperties.fontStyle);e(k,"urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:text-underline-style",c.textProperties.underline);e(k,"urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:text-line-through-style",c.textProperties.strikethrough)}g.refreshCSS();return!0}return!1};this.deleteStyle=function(a){a=f(a);a.parentNode.removeChild(a);g.refreshCSS()};this.getCursor=function(a){return l[a]};this.getCursors=function(){var a=[],b;for(b in l)l.hasOwnProperty(b)&&a.push(l[b]);return a};
+this.addCursor=function(a){var b=a.getStepCounter().countForwardSteps(1,d);a.move(b);l[a.getMemberId()]=a};this.removeCursor=function(a){var b=l[a];b&&(b.removeFromOdtDocument(),delete l[a])};this.getMetaData=function(a){for(var b=g.odfContainer().rootElement.firstChild;b&&"meta"!==b.localName;)b=b.nextSibling;for(b=b&&b.firstChild;b&&b.localName!==a;)b=b.nextSibling;for(b=b&&b.firstChild;b&&3!==b.nodeType;)b=b.nextSibling;return b?b.data:null};this.getFormatting=function(){return g.getFormatting()};
+this.emit=function(a,b){var c,d;runtime.assert(q.hasOwnProperty(a),'unknown event fired "'+a+'"');d=q[a];for(c=0;c<d.length;c+=1)d[c](b)};this.subscribe=function(a,b){runtime.assert(q.hasOwnProperty(a),'tried to subscribe to unknown event "'+a+'"');q[a].push(b);runtime.log('event "'+a+'" subscribed.')};d=new function(){var a=core.PositionFilter.FilterResult.FILTER_ACCEPT,b=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(c){var d=c.container();if(3!==d.nodeType)return"p"!==
+d.localName&&"h"!==d.localName&&"span"!==d.localName?b:a;if(0===d.length)return b;d=(d=d.parentNode)&&d.localName;if("p"!==d&&"span"!==d&&"h"!==d)return b;d=c.textOffset();return 0<d&&" "===c.substr(d-1,2)?b:a}};for(var p=g.odfContainer().rootElement.firstChild;p&&"body"!==p.localName;)p=p.nextSibling;for(p=p&&p.firstChild;p&&"text"!==p.localName;)p=p.nextSibling;b=p;h=new gui.SelectionManager(b)};
+// Input 63
+runtime.loadClass("ops.TrivialUserModel");runtime.loadClass("ops.TrivialOperationRouter");runtime.loadClass("ops.OperationFactory");runtime.loadClass("gui.SelectionManager");runtime.loadClass("ops.OdtDocument");
+ops.Session=function(g){function k(a){c=a;a.setPlaybackFunction(m.playOperation);a.setOperationFactory(new ops.OperationFactory(m))}var m=this,f=new ops.OdtDocument(g);new odf.Style2CSS;var e=null,c=null,a={};a[ops.Session.signalCursorAdded]=[];a[ops.Session.signalCursorRemoved]=[];a[ops.Session.signalCursorMoved]=[];a[ops.Session.signalParagraphChanged]=[];a[ops.Session.signalStyleCreated]=[];a[ops.Session.signalStyleDeleted]=[];a[ops.Session.signalParagraphStyleModified]=[];this.setUserModel=function(a){e=
+a};this.setOperationRouter=k;this.getUserModel=function(){return e};this.getOdtDocument=function(){return f};this.emit=function(b,c){var d,e;runtime.assert(a.hasOwnProperty(b),'unknown event fired "'+b+'"');e=a[b];for(d=0;d<e.length;d+=1)e[d](c)};this.subscribe=function(b,c){runtime.assert(a.hasOwnProperty(b),'tried to subscribe to unknown event "'+b+'"');a[b].push(c);runtime.log('event "'+b+'" subscribed.')};this.enqueue=function(a){c.push(a)};this.playOperation=function(a){a.execute(f.getRootNode())};
+e=new ops.TrivialUserModel;k(new ops.TrivialOperationRouter)};ops.Session.signalCursorAdded="cursor/added";ops.Session.signalCursorRemoved="cursor/removed";ops.Session.signalCursorMoved="cursor/moved";ops.Session.signalParagraphChanged="paragraph/changed";ops.Session.signalStyleCreated="style/created";ops.Session.signalStyleDeleted="style/deleted";ops.Session.signalParagraphStyleModified="paragraphstyle/modified";(function(){return ops.Session})();
+// Input 64
+var webodf_css="@namespace draw url(urn:oasis:names:tc:opendocument:xmlns:drawing:1.0);\n@namespace fo url(urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0);\n@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);\n@namespace presentation url(urn:oasis:names:tc:opendocument:xmlns:presentation:1.0);\n@namespace style url(urn:oasis:names:tc:opendocument:xmlns:style:1.0);\n@namespace svg url(urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0);\n@namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0);\n@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);\n@namespace runtimens url(urn:webodf); /* namespace for runtime only */\n@namespace cursor url(urn:webodf:names:cursor);\n@namespace editinfo url(urn:webodf:names:editinfo);\n\noffice|document > *, office|document-content > * {\n display: none;\n}\noffice|body, office|document {\n display: inline-block;\n position: relative;\n}\n\ntext|p, text|h {\n display: block;\n padding: 0;\n margin: 0;\n line-height: normal;\n position: relative;\n}\n*[runtimens|containsparagraphanchor] {\n position: relative;\n}\ntext|s:before { /* this needs to be the number of spaces given by text:c */\n content: ' ';\n}\ntext|tab:before {\n display: inline;\n content: ' ';\n}\ntext|line-break {\n content: \" \";\n display: block;\n}\ntext|tracked-changes {\n /*Consumers that do not support change tracking, should ignore changes.*/\n display: none;\n}\noffice|binary-data {\n display: none;\n}\noffice|text {\n display: block;\n width: 216mm; /* default to A4 width */\n min-height: 279mm;\n padding-left: 32mm;\n padding-right: 32mm;\n padding-top: 25mm;\n padding-bottom: 13mm;\n margin: 2px;\n text-align: left;\n overflow: hidden;\n}\noffice|spreadsheet {\n display: block;\n border-collapse: collapse;\n empty-cells: show;\n font-family: sans-serif;\n font-size: 10pt;\n text-align: left;\n page-break-inside: avoid;\n overflow: hidden;\n}\noffice|presentation {\n display: inline-block;\n text-align: left;\n}\ndraw|page {\n display: block;\n height: 21cm;\n width: 28cm;\n margin: 3px;\n position: relative;\n overflow: hidden;\n}\npresentation|notes {\n display: none;\n}\n@media print {\n draw|page {\n border: 1pt solid black;\n page-break-inside: avoid;\n }\n presentation|notes {\n /*TODO*/\n }\n}\noffice|spreadsheet text|p {\n border: 0px;\n padding: 1px;\n margin: 0px;\n}\noffice|spreadsheet table|table {\n margin: 3px;\n}\noffice|spreadsheet table|table:after {\n /* show sheet name the end of the sheet */\n /*content: attr(table|name);*/ /* gives parsing error in opera */\n}\noffice|spreadsheet table|table-row {\n counter-increment: row;\n}\noffice|spreadsheet table|table-row:before {\n width: 3em;\n background: #cccccc;\n border: 1px solid black;\n text-align: center;\n content: counter(row);\n display: table-cell;\n}\noffice|spreadsheet table|table-cell {\n border: 1px solid #cccccc;\n}\ntable|table {\n display: table;\n}\ndraw|frame table|table {\n width: 100%;\n height: 100%;\n background: white;\n}\ntable|table-header-rows {\n display: table-header-group;\n}\ntable|table-row {\n display: table-row;\n}\ntable|table-column {\n display: table-column;\n}\ntable|table-cell {\n width: 0.889in;\n display: table-cell;\n}\ndraw|frame {\n display: block;\n}\ndraw|image {\n display: block;\n width: 100%;\n height: 100%;\n top: 0px;\n left: 0px;\n background-repeat: no-repeat;\n background-size: 100% 100%;\n -moz-background-size: 100% 100%;\n}\n/* only show the first image in frame */\ndraw|frame > draw|image:nth-of-type(n+2) {\n display: none;\n}\ntext|list:before {\n display: none;\n content:\"\";\n}\ntext|list {\n counter-reset: list;\n}\ntext|list-item {\n display: block;\n}\ntext|number {\n display:none;\n}\n\ntext|a {\n color: blue;\n text-decoration: underline;\n cursor: pointer;\n}\ntext|note-citation {\n vertical-align: super;\n font-size: smaller;\n}\ntext|note-body {\n display: none;\n}\ntext|note:hover text|note-citation {\n background: #dddddd;\n}\ntext|note:hover text|note-body {\n display: block;\n left:1em;\n max-width: 80%;\n position: absolute;\n background: #ffffaa;\n}\nsvg|title, svg|desc {\n display: none;\n}\nvideo {\n width: 100%;\n height: 100%\n}\n\n/* below set up the cursor */\ncursor|cursor {\n display: inline;\n width: 0px;\n height: 1em;\n /* making the position relative enables the avatar to use\n the cursor as reference for its absolute position */\n position: relative;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n height: 1em;\n border-left: 2px solid black;\n outline: none;\n}\n\ncursor|cursor > div {\n padding: 3px;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n border: none !important;\n border-radius: 5px;\n opacity: 0.3;\n}\n\ncursor|cursor > div > img {\n border-radius: 5px;\n}\n\ncursor|cursor > div.active {\n opacity: 0.8;\n}\n\ncursor|cursor > div:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 43%;\n}\n\n\n.editInfoMarker {\n position: absolute;\n width: 10px;\n height: 100%;\n left: -20px;\n opacity: 0.8;\n top: 0;\n border-radius: 5px;\n background-color: transparent;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n}\n.editInfoMarker:hover {\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);\n}\n\n.editInfoHandle {\n position: absolute;\n background-color: black;\n padding: 5px;\n border-radius: 5px;\n opacity: 0.8;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n bottom: 100%;\n margin-bottom: 10px;\n z-index: 3;\n left: -25px;\n}\n.editInfoHandle:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 5px;\n}\n.editInfo {\n font-family: sans-serif;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n color: white;\n width: 100%;\n height: 12pt;\n}\n.editInfoColor {\n float: left;\n width: 10pt;\n height: 10pt;\n border: 1px solid white;\n}\n.editInfoAuthor {\n float: left;\n margin-left: 5pt;\n font-size: 10pt;\n text-align: left;\n height: 12pt;\n line-height: 12pt;\n}\n.editInfoTime {\n float: right;\n margin-left: 30pt;\n font-size: 8pt;\n font-style: italic;\n color: yellow;\n height: 12pt;\n line-height: 12pt;\n}\n";
diff --git a/files_odfviewer/src/update.sh b/files_odfviewer/src/update.sh
index 91d0f4637..540c77265 100755
--- a/files_odfviewer/src/update.sh
+++ b/files_odfviewer/src/update.sh
@@ -1,5 +1,5 @@
rm -rf webodf
-git clone https://git.gitorious.org/odfkit/webodf.git
+git clone https://git.gitorious.org/webodf/webodf.git
rm -Rf build
mkdir build
cd build