From 6561341e05b0dba4b48ee336bbd65038895211ae Mon Sep 17 00:00:00 2001 From: Tobias Hintze Date: Fri, 16 Aug 2013 16:40:40 +0200 Subject: [PATCH] update from webodf --- js/editor/Editor.js | 10 +- js/editor/SessionListView.js | 10 +- js/editor/boot_editor.js | 18 +- js/webodf-debug.js | 1105 ++++++++++++++++++++++------------ js/webodf.js | 1037 ++++++++++++++++--------------- 5 files changed, 1298 insertions(+), 882 deletions(-) diff --git a/js/editor/Editor.js b/js/editor/Editor.js index 9334e652..df8f4b6e 100644 --- a/js/editor/Editor.js +++ b/js/editor/Editor.js @@ -150,7 +150,10 @@ define("webodf/editor/Editor", [ odfCanvas.addListener("statereadychange", function () { if (!editorReadyCallback) { // already called once, restart session and return - editorSession.sessionController.setUndoManager(new gui.TrivialUndoManager()); + // undo manager is not yet integrated with collaboration + if (! server) { + editorSession.sessionController.setUndoManager(new gui.TrivialUndoManager()); + } editorSession.startEditing(); return; } @@ -161,7 +164,10 @@ define("webodf/editor/Editor", [ editorSession = new EditorSession(session, memberid, { viewOptions: viewOptions }); - editorSession.sessionController.setUndoManager(new gui.TrivialUndoManager()); + // undo manager is not yet integrated with collaboration + if (! server) { + editorSession.sessionController.setUndoManager(new gui.TrivialUndoManager()); + } if (memberListDiv) { memberList = new MemberList(editorSession, memberListDiv); diff --git a/js/editor/SessionListView.js b/js/editor/SessionListView.js index 84ca10b1..d539ec49 100644 --- a/js/editor/SessionListView.js +++ b/js/editor/SessionListView.js @@ -32,10 +32,13 @@ * @source: http://www.webodf.org/ * @source: http://gitorious.org/webodf/webodf/ */ + /*global Node, define, runtime */ -function SessionListView(sessionList, sessionListDiv, cb) { - "use strict"; +define("webodf/editor/SessionListView", [], function () { + "use strict"; + + return function SessionListView(sessionList, sessionListDiv, cb) { var self = this, memberDataChangedHandler; @@ -108,4 +111,5 @@ function SessionListView(sessionList, sessionListDiv, cb) { } init(); -} + }; +}); diff --git a/js/editor/boot_editor.js b/js/editor/boot_editor.js index b64de8f1..40636f29 100644 --- a/js/editor/boot_editor.js +++ b/js/editor/boot_editor.js @@ -305,15 +305,19 @@ var webodfEditor = (function () { } function showSessions() { - var sessionListDiv = document.getElementById("sessionList"), - sessionList = new serverFactory.createSessionList(server), - sessionListView = new SessionListView(sessionList, sessionListDiv, enterSession); + require({ }, ["webodf/editor/SessionListView"], + function (SessionListView) { + var sessionListDiv = document.getElementById("sessionList"), + sessionList = new serverFactory.createSessionList(server), + sessionListView = new SessionListView(sessionList, sessionListDiv, enterSession); - // hide login view - document.getElementById("loginContainer").style.display = "none"; + // hide login view + document.getElementById("loginContainer").style.display = "none"; - // show session list - document.getElementById("sessionListContainer").style.display = ""; + // show session list + document.getElementById("sessionListContainer").style.display = ""; + } + ); } function loginSuccess(userData) { diff --git a/js/webodf-debug.js b/js/webodf-debug.js index 7ab890d6..4311ccc8 100644 --- a/js/webodf-debug.js +++ b/js/webodf-debug.js @@ -741,15 +741,15 @@ function RhinoRuntime() { return bytearray1.concat(bytearray2) }; function loadXML(path, callback) { - var file = new Packages.java.io.File(path), document; + var file = new Packages.java.io.File(path), xmlDocument; try { - document = builder.parse(file) + xmlDocument = builder.parse(file) }catch(err) { print(err); callback(err); return } - callback(null, document) + callback(null, xmlDocument) } function runtimeReadFile(path, encoding, callback) { if(currentDirectory) { @@ -2994,7 +2994,6 @@ core.Utils = function Utils() { this.hashString = hashString }; core.DomUtils = function DomUtils() { - var self = this; function findStablePoint(container, offset) { if(offset < container.childNodes.length) { container = container.childNodes[offset]; @@ -3038,6 +3037,7 @@ core.DomUtils = function DomUtils() { } this.rangesIntersect = rangesIntersect; function getNodesInRange(range, nodeFilter) { + runtime.assert(Boolean(range.startContainer), "Expected to get a range with a startContainer in getNodesInRange()."); var document = range.startContainer.ownerDocument, elements = [], root = (range.commonAncestorContainer), n, treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_ALL, nodeFilter, false); treeWalker.currentNode = range.startContainer; n = range.startContainer; @@ -3084,6 +3084,7 @@ core.DomUtils = function DomUtils() { } this.normalizeTextNodes = normalizeTextNodes; function rangeContainsNode(limits, node) { + runtime.assert(Boolean(node), "Expected to get a node in rangeContainsNode()"); var range = node.ownerDocument.createRange(), nodeLength = node.nodeType === Node.TEXT_NODE ? node.length : node.childNodes.length, result; range.setStart(limits.startContainer, limits.startOffset); range.setEnd(limits.endContainer, limits.endOffset); @@ -3117,7 +3118,7 @@ core.DomUtils = function DomUtils() { function containsNodeForBrokenWebKit(parent, descendant) { return parent === descendant || Boolean(parent.compareDocumentPosition(descendant) & Node.DOCUMENT_POSITION_CONTAINED_BY) } - function init() { + function init(self) { var window = runtime.getWindow(), appVersion, webKitOrSafari; if(window === null) { return @@ -3128,7 +3129,7 @@ core.DomUtils = function DomUtils() { self.containsNode = containsNodeForBrokenWebKit } } - init() + init(this) }; runtime.loadClass("core.DomUtils"); core.Cursor = function Cursor(document, memberId) { @@ -5690,6 +5691,7 @@ xmldom.XPath = function() { return nodelist } function getODFElementsWithXPath(node, xpath, namespaceResolver) { + runtime.assert(Boolean(node), "Expected to get a node in getODFElementsWithXPath()"); var doc = node.ownerDocument, nodes, elements = [], n = null; if(!doc || !doc.evaluate) { elements = fallback(node, xpath, namespaceResolver) @@ -5745,14 +5747,17 @@ xmldom.XPath = function() { @source: http://gitorious.org/webodf/webodf/ */ gui.AnnotationViewManager = function AnnotationViewManager(odfCanvas, odfFragment, annotationsPane) { + runtime.assert(Boolean(odfFragment), "Expected to get an odfFragment"); var annotations = [], doc = odfFragment.ownerDocument, odfUtils = new odf.OdfUtils, CONNECTOR_MARGIN = 30, NOTE_MARGIN = 20, window = runtime.getWindow(); runtime.assert(Boolean(window), "Expected to be run in an environment which has a global window, like a browser."); function wrapAnnotation(annotation) { - var annotationWrapper = doc.createElement("div"), annotationNote = doc.createElement("div"), connectorHorizontal = doc.createElement("div"), connectorAngular = doc.createElement("div"), annotationNode = annotation.node; + var annotationWrapper = doc.createElement("div"), annotationNote = doc.createElement("div"), connectorHorizontal = doc.createElement("div"), connectorAngular = doc.createElement("div"), removeButton = doc.createElement("div"), annotationNode = annotation.node; annotationWrapper.className = "annotationWrapper"; annotationNode.parentNode.insertBefore(annotationWrapper, annotationNode); annotationNote.className = "annotationNote"; annotationNote.appendChild(annotationNode); + removeButton.className = "annotationRemoveButton"; + annotationNote.appendChild(removeButton); connectorHorizontal.className = "annotationConnector horizontal"; connectorAngular.className = "annotationConnector angular"; annotationWrapper.appendChild(annotationNote); @@ -5783,12 +5788,11 @@ gui.AnnotationViewManager = function AnnotationViewManager(odfCanvas, odfFragmen range.detach() } function unhighlightAnnotation(annotation) { - var annotationName = annotation.node.getAttributeNS(odf.Namespaces.officens, "name"), highlightSpans = doc.querySelectorAll('span.annotationHighlight[annotation="' + annotationName + '"]'), i, j, container, children; + var annotationName = annotation.node.getAttributeNS(odf.Namespaces.officens, "name"), highlightSpans = doc.querySelectorAll('span.annotationHighlight[annotation="' + annotationName + '"]'), i, container; for(i = 0;i < highlightSpans.length;i += 1) { container = highlightSpans[i]; - children = container.childNodes; - for(j = 0;j < children.length;j += 1) { - container.parentNode.insertBefore(children[j], container) + while(container.firstChild) { + container.parentNode.insertBefore(container.firstChild, container) } container.parentNode.removeChild(container) } @@ -5859,9 +5863,12 @@ gui.AnnotationViewManager = function AnnotationViewManager(odfCanvas, odfFragmen } this.addAnnotation = addAnnotation; function forgetAnnotation(annotation) { + var index = annotations.indexOf(annotation); unwrapAnnotation(annotation); unhighlightAnnotation(annotation); - annotations.splice(annotations.indexOf(annotation), 1) + if(index !== -1) { + annotations.splice(index, 1) + } } function forgetAnnotations() { while(annotations.length) { @@ -6487,7 +6494,7 @@ odf.OdfUtils = function OdfUtils() { } this.isSignificantWhitespace = isSignificantWhitespace; function getFirstNonWhitespaceChild(node) { - var child = node.firstChild; + var child = node && node.firstChild; while(child && child.nodeType === Node.TEXT_NODE && whitespaceOnly.test(child.nodeValue)) { child = child.nextSibling } @@ -6586,6 +6593,7 @@ odf.OdfUtils = function OdfUtils() { return Boolean(getParagraphElement(textNode) && (!isODFWhitespace(textNode.textContent) || isSignificantWhitespace(textNode, 0))) } function getTextNodes(range, includePartial) { + runtime.assert(Boolean(range.startContainer), "Expected to get a range with a startContainer in getTextNodes()."); var document = range.startContainer.ownerDocument, nodeRange = document.createRange(), textNodes; function nodeFilter(node) { nodeRange.selectNodeContents(node); @@ -6608,6 +6616,7 @@ odf.OdfUtils = function OdfUtils() { } this.getTextNodes = getTextNodes; this.getTextElements = function(range, includeInsignificantWhitespace) { + runtime.assert(Boolean(range.startContainer), "Expected to get a range with a startContainer in getTextElements()."); var document = range.startContainer.ownerDocument, nodeRange = document.createRange(), elements; function nodeFilter(node) { var nodeType = node.nodeType; @@ -6634,6 +6643,7 @@ odf.OdfUtils = function OdfUtils() { return elements }; this.getParagraphElements = function(range) { + runtime.assert(Boolean(range.startContainer), "Expected to get a range with a startContainer in getParagraphElements()."); var document = range.startContainer.ownerDocument, nodeRange = document.createRange(), elements; function nodeFilter(node) { nodeRange.selectNodeContents(node); @@ -6899,16 +6909,16 @@ runtime.loadClass("odf.OdfUtils"); runtime.loadClass("xmldom.XPath"); runtime.loadClass("core.CSSUnits"); odf.Style2CSS = function Style2CSS() { - var drawns = odf.Namespaces.drawns, fons = odf.Namespaces.fons, stylens = odf.Namespaces.stylens, svgns = odf.Namespaces.svgns, textns = odf.Namespaces.textns, xlinkns = odf.Namespaces.xlinkns, presentationns = odf.Namespaces.presentationns, familynamespaceprefixes = {"graphic":"draw", "drawing-page":"draw", "paragraph":"text", "presentation":"presentation", "ruby":"text", "section":"text", "table":"table", "table-cell":"table", "table-column":"table", "table-row":"table", "text":"text", "list":"text", - "page":"office"}, 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"], "drawing-page":["caption", "circle", "connector", "control", "page", "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"]], bgImageSimpleMapping = [[stylens, "repeat", "background-repeat"]], paragraphPropertySimpleMapping = [[fons, "background-color", "background-color"], [fons, "text-align", - "text-align"], [fons, "text-indent", "text-indent"], [fons, "padding", "padding"], [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", "margin"], [fons, "margin-left", "margin-left"], [fons, "margin-right", "margin-right"], - [fons, "margin-top", "margin-top"], [fons, "margin-bottom", "margin-bottom"], [fons, "border", "border"]], graphicPropertySimpleMapping = [[fons, "background-color", "background-color"], [fons, "min-height", "min-height"], [drawns, "stroke", "border"], [svgns, "stroke-color", "border-color"], [svgns, "stroke-width", "border-width"]], 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"]], pageContentPropertySimpleMapping = + var drawns = odf.Namespaces.drawns, fons = odf.Namespaces.fons, stylens = odf.Namespaces.stylens, svgns = odf.Namespaces.svgns, tablens = odf.Namespaces.tablens, textns = odf.Namespaces.textns, xlinkns = odf.Namespaces.xlinkns, presentationns = odf.Namespaces.presentationns, familynamespaceprefixes = {"graphic":"draw", "drawing-page":"draw", "paragraph":"text", "presentation":"presentation", "ruby":"text", "section":"text", "table":"table", "table-cell":"table", "table-column":"table", "table-row":"table", + "text":"text", "list":"text", "page":"office"}, 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"], "drawing-page":["caption", "circle", "connector", "control", "page", "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"]], bgImageSimpleMapping = [[stylens, "repeat", "background-repeat"]], paragraphPropertySimpleMapping = [[fons, "background-color", "background-color"], + [fons, "text-align", "text-align"], [fons, "text-indent", "text-indent"], [fons, "padding", "padding"], [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", "margin"], [fons, "margin-left", "margin-left"], [fons, "margin-right", + "margin-right"], [fons, "margin-top", "margin-top"], [fons, "margin-bottom", "margin-bottom"], [fons, "border", "border"]], graphicPropertySimpleMapping = [[fons, "background-color", "background-color"], [fons, "min-height", "min-height"], [drawns, "stroke", "border"], [svgns, "stroke-color", "border-color"], [svgns, "stroke-width", "border-width"]], 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"]], pageContentPropertySimpleMapping = [[fons, "background-color", "background-color"], [fons, "padding", "padding"], [fons, "padding-left", "padding-left"], [fons, "padding-right", "padding-right"], [fons, "padding-top", "padding-top"], [fons, "padding-bottom", "padding-bottom"], [fons, "border", "border"], [fons, "border-left", "border-left"], [fons, "border-right", "border-right"], [fons, "border-top", "border-top"], [fons, "border-bottom", "border-bottom"], [fons, "margin", "margin"], [fons, "margin-left", "margin-left"], [fons, - "margin-right", "margin-right"], [fons, "margin-top", "margin-top"], [fons, "margin-bottom", "margin-bottom"]], pageSizePropertySimpleMapping = [[fons, "page-width", "width"], [fons, "page-height", "height"]], fontFaceDeclsMap = {}, utils = new odf.OdfUtils, documentType, odfRoot, defaultFontSize, xpath = new xmldom.XPath, cssUnits = new core.CSSUnits; + "margin-right", "margin-right"], [fons, "margin-top", "margin-top"], [fons, "margin-bottom", "margin-bottom"]], pageSizePropertySimpleMapping = [[fons, "page-width", "width"], [fons, "page-height", "height"]], borderPropertyMap = {"border":true, "border-left":true, "border-right":true, "border-top":true, "border-bottom":true, "stroke-width":true}, fontFaceDeclsMap = {}, utils = new odf.OdfUtils, documentType, odfRoot, defaultFontSize, xpath = new xmldom.XPath, cssUnits = new core.CSSUnits; function getStyleMap(stylesnode) { var stylemap = {}, node, name, family, style; if(!stylesnode) { @@ -7042,14 +7052,35 @@ odf.Style2CSS = function Style2CSS() { } return null } + function fixBorderWidth(value) { + var index = value.indexOf(" "), width, theRestOfBorderAttributes; + if(index !== -1) { + width = value.substring(0, index); + theRestOfBorderAttributes = value.substring(index) + }else { + width = value; + theRestOfBorderAttributes = "" + } + width = utils.parseLength(width); + if(width && width.unit === "pt" && width.value < 0.75) { + value = "0.75pt" + theRestOfBorderAttributes + } + return value + } function applySimpleMapping(props, mapping) { var rule = "", r, value; for(r in mapping) { if(mapping.hasOwnProperty(r)) { r = mapping[r]; value = props.getAttributeNS(r[0], r[1]); - if(r[2] && value) { - rule += r[2] + ":" + value + ";" + if(value) { + value = value.trim(); + if(borderPropertyMap.hasOwnProperty(r[1])) { + value = fixBorderWidth(value) + } + if(r[2]) { + rule += r[2] + ":" + value + ";" + } } } } @@ -7200,8 +7231,16 @@ odf.Style2CSS = function Style2CSS() { return rule } function getTableProperties(props) { - var rule = ""; + var rule = "", borderModel; rule += applySimpleMapping(props, tablePropertySimpleMapping); + borderModel = props.getAttributeNS(tablens, "border-model"); + if(borderModel === "collapsing") { + rule += "border-collapse:collapse;" + }else { + if(borderModel === "separating") { + rule += "border-collapse:separate;" + } + } return rule } function addStyleRule(sheet, family, name, node) { @@ -7643,7 +7682,7 @@ odf.OdfContainer = function() { setState(OdfContainer.INVALID); return } - setRootElement(root); + setRootElement((root)); setState(OdfContainer.DONE) } function handleStylesXml(xmldoc) { @@ -8833,14 +8872,16 @@ odf.OdfCanvas = function() { } function getBulletsRule(node) { var itemrule; - if(node.localName === "list-level-style-number") { - itemrule = getNumberRule(node) - }else { - if(node.localName === "list-level-style-image") { - itemrule = getImageRule() + if(node) { + if(node.localName === "list-level-style-number") { + itemrule = getNumberRule(node) }else { - if(node.localName === "list-level-style-bullet") { - itemrule = getBulletRule(node) + if(node.localName === "list-level-style-image") { + itemrule = getImageRule() + }else { + if(node.localName === "list-level-style-bullet") { + itemrule = getBulletRule(node) + } } } } @@ -8867,7 +8908,7 @@ odf.OdfCanvas = function() { styleName = node.getAttributeNS(textns, "style-name"); if(styleName) { node = listStyleMap[styleName]; - bulletRule = getBulletsRule(utils.getFirstNonWhitespaceChild(node)) + bulletRule = getBulletsRule((utils.getFirstNonWhitespaceChild(node))) } if(continueList) { parentList = listMap[continueList]; @@ -8918,7 +8959,7 @@ odf.OdfCanvas = function() { } style.setAttribute("type", "text/css"); head.appendChild(style); - return style + return(style) } function addStyleSheet(document) { var head = document.getElementsByTagName("head")[0], style = document.createElementNS(head.namespaceURI, "style"), text = ""; @@ -8929,11 +8970,12 @@ odf.OdfCanvas = function() { }); style.appendChild(document.createTextNode(text)); head.appendChild(style); - return style + return(style) } odf.OdfCanvas = function OdfCanvas(element) { runtime.assert(element !== null && element !== undefined, "odf.OdfCanvas constructor needs DOM element"); - var self = this, doc = element.ownerDocument, odfcontainer, formatting = new odf.Formatting, selectionWatcher = new SelectionWatcher(element), pageSwitcher, fontcss, stylesxmlcss, positioncss, editable = false, zoomLevel = 1, eventHandlers = {}, editparagraph, loadingQueue = new LoadingQueue; + runtime.assert(element.ownerDocument !== null && element.ownerDocument !== undefined, "odf.OdfCanvas constructor needs DOM"); + var self = this, doc = (element.ownerDocument), odfcontainer, formatting = new odf.Formatting, selectionWatcher = new SelectionWatcher(element), pageSwitcher, fontcss, stylesxmlcss, positioncss, editable = false, zoomLevel = 1, eventHandlers = {}, editparagraph, loadingQueue = new LoadingQueue; addWebODFStyleSheet(doc); pageSwitcher = new PageSwitcher(addStyleSheet(doc)); fontcss = addStyleSheet(doc); @@ -9218,6 +9260,11 @@ odf.OdfCanvas = function() { annotationManager.addAnnotation(annotation) } }; + this.forgetAnnotations = function() { + if(annotationManager) { + annotationManager.forgetAnnotations() + } + }; this.setZoomLevel = function(zoom) { zoomLevel = zoom; fixContainerSize() @@ -9847,11 +9894,11 @@ ops.OpRemoveCursor = function OpRemoveCursor() { timestamp = data.timestamp }; this.transform = function(otherOp, hasPriority) { - var otherOpspec = otherOp.spec(); + var otherOpspec = otherOp.spec(), result = [self]; if(otherOpspec.optype === optype && otherOpspec.memberid === memberid) { - return[] + result = [] } - return[self] + return result }; this.execute = function(odtDocument) { if(!odtDocument.removeCursor(memberid)) { @@ -9924,57 +9971,66 @@ ops.OpMoveCursor = function OpMoveCursor() { return false }; this.transform = function(otherOp, hasPriority) { - var otherOpspec = otherOp.spec(), otherOpType = otherOpspec.optype, end = position + length, otherOpspecEnd, result = [self]; - if(otherOpType === "RemoveText") { - otherOpspecEnd = otherOpspec.position + otherOpspec.length; - if(otherOpspecEnd <= position) { - position -= otherOpspec.length - }else { - if(otherOpspec.position < end) { - if(position < otherOpspec.position) { - if(otherOpspecEnd < end) { - length = length - otherOpspec.length - }else { - length = otherOpspec.position - position - } - }else { - position = otherOpspec.position; - if(otherOpspecEnd < end) { - length = end - otherOpspecEnd + var otherOpspec = otherOp.spec(), otherOptype = otherOpspec.optype, end = position + length, otherOpspecEnd, result = [self]; + switch(otherOptype) { + case "RemoveText": + otherOpspecEnd = otherOpspec.position + otherOpspec.length; + if(otherOpspecEnd <= position) { + position -= otherOpspec.length + }else { + if(otherOpspec.position < end) { + if(position < otherOpspec.position) { + if(otherOpspecEnd < end) { + length = length - otherOpspec.length + }else { + length = otherOpspec.position - position + } }else { - length = 0 + position = otherOpspec.position; + if(otherOpspecEnd < end) { + length = end - otherOpspecEnd + }else { + length = 0 + } } } } - } - }else { - if(otherOpType === "SplitParagraph") { + break; + case "SplitParagraph": if(otherOpspec.position < position) { position += 1 }else { - if(otherOpspec.position > position && otherOpspec.position < end) { + if(otherOpspec.position <= end) { length += 1 } } - }else { - if(otherOpType === "InsertText") { - if(otherOpspec.position < position) { - position += otherOpspec.text.length - }else { - if(otherOpspec.position > position && otherOpspec.position < end) { - length += otherOpspec.text.length - } + break; + case "AddAnnotation": + if(otherOpspec.position < position) { + position += 1 + }else { + if(otherOpspec.position < end) { + length += 1 } + } + break; + case "InsertText": + if(otherOpspec.position < position) { + position += otherOpspec.text.length }else { - if(otherOpType === "RemoveCursor" && otherOpspec.memberid === memberid) { - result = [] - }else { - if(otherOpType === "InsertTable") { - result = null - } + if(otherOpspec.position <= end) { + length += otherOpspec.text.length } } - } + break; + case "RemoveCursor": + if(otherOpspec.memberid === memberid) { + result = [] + } + break; + case "InsertTable": + result = null; + break } return result }; @@ -9997,6 +10053,40 @@ ops.OpMoveCursor = function OpMoveCursor() { return{optype:"MoveCursor", memberid:memberid, timestamp:timestamp, position:position, length:length} } }; +/* + + Copyright (C) 2013 KO GmbH + + @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.OpInsertTable = function OpInsertTable() { var self = this, optype = "InsertTable", memberid, timestamp, initialRows, initialColumns, position, tableName, tableStyleName, tableColumnStyleName, tableCellStyleMatrix, tablens = "urn:oasis:names:tc:opendocument:xmlns:table:1.0", textns = "urn:oasis:names:tc:opendocument:xmlns:text:1.0"; this.init = function(data) { @@ -10012,40 +10102,44 @@ ops.OpInsertTable = function OpInsertTable() { }; this.transform = function(otherOp, hasPriority) { var otherOpspec = otherOp.spec(), otherOptype = otherOpspec.optype, result = [self]; - if(otherOptype === optype) { - result = null - }else { - if(otherOptype === "SplitParagraph") { + switch(otherOptype) { + case optype: + result = null; + break; + case "AddAnnotation": + if(otherOpspec.position < position) { + position += 1 + } + break; + case "SplitParagraph": if(otherOpspec.position < position) { position += 1 }else { if(otherOpspec.position === position && !hasPriority) { position += 1; - return null + result = null } } - }else { - if(otherOptype === "InsertText") { - if(otherOpspec.position < position) { - position += otherOpspec.text.length - }else { - if(otherOpspec.position === position && !hasPriority) { - position += otherOpspec.text.length; - return null - } + break; + case "InsertText": + if(otherOpspec.position < position) { + position += otherOpspec.text.length + }else { + if(otherOpspec.position === position && !hasPriority) { + position += otherOpspec.text.length; + result = null } + } + break; + case "RemoveText": + if(otherOpspec.position + otherOpspec.length <= position) { + position -= otherOpspec.length }else { - if(otherOptype === "RemoveText") { - if(otherOpspec.position + otherOpspec.length <= position) { - position -= otherOpspec.length - }else { - if(otherOpspec.position < position) { - position = otherOpspec.position - } - } + if(otherOpspec.position < position) { + position = otherOpspec.position } } - } + break } return result }; @@ -10183,40 +10277,44 @@ ops.OpInsertText = function OpInsertText() { }; this.transform = function(otherOp, hasPriority) { var otherOpspec = otherOp.spec(), otherOptype = otherOpspec.optype, result = [self]; - if(otherOptype === optype) { - if(otherOpspec.position < position) { - position += otherOpspec.text.length - }else { - if(otherOpspec.position === position && !hasPriority) { - position += otherOpspec.text.length; - return null + switch(otherOptype) { + case optype: + if(otherOpspec.position < position) { + position += otherOpspec.text.length + }else { + if(otherOpspec.position === position && !hasPriority) { + position += otherOpspec.text.length; + result = null + } } - } - }else { - if(otherOptype === "SplitParagraph") { + break; + case "AddAnnotation": + if(otherOpspec.position < position) { + position += 1 + } + break; + case "SplitParagraph": if(otherOpspec.position < position) { position += 1 }else { if(otherOpspec.position === position && !hasPriority) { position += 1; - return null + result = null } } - }else { - if(otherOptype === "InsertTable") { - result = null + break; + case "InsertTable": + result = null; + break; + case "RemoveText": + if(otherOpspec.position + otherOpspec.length <= position) { + position -= otherOpspec.length }else { - if(otherOptype === "RemoveText") { - if(otherOpspec.position + otherOpspec.length <= position) { - position -= otherOpspec.length - }else { - if(otherOpspec.position < position) { - position = otherOpspec.position - } - } + if(otherOpspec.position < position) { + position = otherOpspec.position } } - } + break } return result }; @@ -10237,7 +10335,7 @@ ops.OpInsertText = function OpInsertText() { }) } this.execute = function(odtDocument) { - var domPosition, previousNode, parent, refNode, ownerDocument = odtDocument.getRootNode().ownerDocument, paragraphElement, textns = "urn:oasis:names:tc:opendocument:xmlns:text:1.0", space = " ", tab = "\t", append = true, startIndex = 0, textToInsert, spaceTag, node, i; + var domPosition, previousNode, parent, refNode, ownerDocument = odtDocument.getDOM(), paragraphElement, textns = "urn:oasis:names:tc:opendocument:xmlns:text:1.0", space = " ", tab = "\t", append = true, startIndex = 0, textToInsert, spaceTag, node, i; domPosition = odtDocument.getPositionInTextNode(position, memberid); if(domPosition) { previousNode = domPosition.textNode; @@ -10326,57 +10424,77 @@ runtime.loadClass("odf.Namespaces"); runtime.loadClass("odf.OdfUtils"); runtime.loadClass("core.DomUtils"); ops.OpRemoveText = function OpRemoveText() { - var self = this, optype = "RemoveText", memberid, timestamp, position, length, text, odfUtils, domUtils, editinfons = "urn:webodf:names:editinfo"; + var self = this, optype = "RemoveText", memberid, timestamp, position, length, odfUtils, domUtils, editinfons = "urn:webodf:names:editinfo"; this.init = function(data) { runtime.assert(data.length >= 0, "OpRemoveText only supports positive lengths"); memberid = data.memberid; timestamp = data.timestamp; position = parseInt(data.position, 10); length = parseInt(data.length, 10); - text = data.text; odfUtils = new odf.OdfUtils; domUtils = new core.DomUtils }; this.transform = function(otherOp, hasPriority) { - var otherOpspec = otherOp.spec(), otherOptype = otherOpspec.optype, end = position + length, otherOpspecEnd, result = [self]; - if(otherOptype === optype) { - otherOpspecEnd = otherOpspec.position + otherOpspec.length; - if(otherOpspecEnd <= position) { - position -= otherOpspec.length - }else { - if(otherOpspec.position < end) { - if(position < otherOpspec.position) { - if(otherOpspecEnd < end) { - length = length - otherOpspec.length - }else { - length = otherOpspec.position - position - } - }else { - if(otherOpspecEnd < end) { - position = otherOpspec.position; - length = end - otherOpspecEnd + var otherOpspec = otherOp.spec(), otherOptype = otherOpspec.optype, end = position + length, otherOpspecEnd, helperOp, result = [self]; + switch(otherOptype) { + case optype: + otherOpspecEnd = otherOpspec.position + otherOpspec.length; + if(otherOpspecEnd <= position) { + position -= otherOpspec.length + }else { + if(otherOpspec.position < end) { + if(position < otherOpspec.position) { + if(otherOpspecEnd < end) { + length = length - otherOpspec.length + }else { + length = otherOpspec.position - position + } }else { - result = [] + if(otherOpspecEnd < end) { + position = otherOpspec.position; + length = end - otherOpspecEnd + }else { + result = [] + } } } } - } - }else { - if(otherOptype === "InsertText") { + break; + case "InsertText": if(otherOpspec.position <= position) { position += otherOpspec.text.length - } - }else { - if(otherOptype === "SplitParagraph") { - if(otherOpspec.position <= position) { - position += 1 + }else { + if(otherOpspec.position < end) { + length = otherOpspec.position - position; + helperOp = new ops.OpRemoveText; + helperOp.init({memberid:memberid, timestamp:timestamp, position:otherOpspec.position + otherOpspec.text.length, length:end - otherOpspec.position}); + result = [helperOp, self] } + } + break; + case "SplitParagraph": + if(otherOpspec.position <= position) { + position += 1 }else { - if(otherOptype === "InsertTable") { - result = null + if(otherOpspec.position < end) { + length = otherOpspec.position - position; + helperOp = new ops.OpRemoveText; + helperOp.init({memberid:memberid, timestamp:timestamp, position:otherOpspec.position + 1, length:end - otherOpspec.position}); + result = [helperOp, self] } } - } + break; + case "InsertTable": + result = null; + break; + case "AddAnnotation": + ; + case "RemoveAnnotation": + result = null; + break; + case "ApplyDirectStyling": + result = null; + break } return result }; @@ -10476,7 +10594,7 @@ ops.OpRemoveText = function OpRemoveText() { return true }; this.spec = function() { - return{optype:optype, memberid:memberid, timestamp:timestamp, position:position, length:length, text:text} + return{optype:optype, memberid:memberid, timestamp:timestamp, position:position, length:length} } }; /* @@ -10522,40 +10640,44 @@ ops.OpSplitParagraph = function OpSplitParagraph() { }; this.transform = function(otherOp, hasPriority) { var otherOpspec = otherOp.spec(), otherOptype = otherOpspec.optype, result = [self]; - if(otherOptype === optype) { - if(otherOpspec.position < position) { - position += 1 - }else { - if(otherOpspec.position === position && !hasPriority) { - position += 1; - return null + switch(otherOptype) { + case optype: + if(otherOpspec.position < position) { + position += 1 + }else { + if(otherOpspec.position === position && !hasPriority) { + position += 1; + result = null + } } - } - }else { - if(otherOptype === "InsertText") { + break; + case "AddAnnotation": + if(otherOpspec.position < position) { + position += 1 + } + break; + case "InsertText": if(otherOpspec.position < position) { position += otherOpspec.text.length }else { if(otherOpspec.position === position && !hasPriority) { position += otherOpspec.text.length; - return null + result = null } } - }else { - if(otherOptype === "InsertTable") { - result = null + break; + case "InsertTable": + result = null; + break; + case "RemoveText": + if(otherOpspec.position + otherOpspec.length <= position) { + position -= otherOpspec.length }else { - if(otherOptype === "RemoveText") { - if(otherOpspec.position + otherOpspec.length <= position) { - position -= otherOpspec.length - }else { - if(otherOpspec.position < position) { - position = otherOpspec.position - } - } + if(otherOpspec.position < position) { + position = otherOpspec.position } } - } + break } return result }; @@ -10663,13 +10785,15 @@ ops.OpSetParagraphStyle = function OpSetParagraphStyle() { styleName = data.styleName }; this.transform = function(otherOp, hasPriority) { - var otherOpspec = otherOp.spec(), otherOpType = otherOpspec.optype; - if(otherOpType === "RemoveParagraphStyle") { - if(otherOpspec.styleName === styleName) { - styleName = "" - } + var otherOpspec = otherOp.spec(), otherOpType = otherOpspec.optype, result = [self]; + switch(otherOpType) { + case "RemoveParagraphStyle": + if(otherOpspec.styleName === styleName) { + styleName = "" + } + break } - return[self] + return result }; this.execute = function(odtDocument) { var domPosition, paragraphNode; @@ -10729,17 +10853,17 @@ ops.OpSetParagraphStyle = function OpSetParagraphStyle() { @source: http://gitorious.org/webodf/webodf/ */ ops.OpUpdateParagraphStyle = function OpUpdateParagraphStyle() { - var self = this, optype = "UpdateParagraphStyle", memberid, timestamp, styleName, setProperties, removedProperties, stylens = "urn:oasis:names:tc:opendocument:xmlns:style:1.0", svgns = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; - function removePropertiesFromStyleNode(node, removedPropertyNames) { - var i, propertyNameParts; - for(i = 0;i < removedPropertyNames.length;i += 1) { - propertyNameParts = removedPropertyNames[i].split(":"); - node.removeAttributeNS(odf.Namespaces.resolvePrefix(propertyNameParts[0]), propertyNameParts[1]) + var self = this, optype = "UpdateParagraphStyle", memberid, timestamp, styleName, setProperties, removedProperties, paragraphPropertiesName = "style:paragraph-properties", textPropertiesName = "style:text-properties", stylens = "urn:oasis:names:tc:opendocument:xmlns:style:1.0", svgns = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; + function removedAttributesFromStyleNode(node, removedAttributeNames) { + var i, attributeNameParts, attributeNameList = removedAttributeNames ? removedAttributeNames.split(",") : []; + for(i = 0;i < attributeNameList.length;i += 1) { + attributeNameParts = attributeNameList[i].split(":"); + node.removeAttributeNS(odf.Namespaces.resolvePrefix(attributeNameParts[0]), attributeNameParts[1]) } } - function dropShadowedProperties(properties, removedPropertyNames, shadowingProperties, shadowingRemovedPropertyNames) { - var value, i, name; - if(properties && (shadowingProperties || shadowingRemovedPropertyNames)) { + function dropShadowedAttributes(properties, removedProperties, shadowingProperties, shadowingRemovedProperties) { + var value, i, name, removedPropertyNames, shadowingRemovedPropertyNames = shadowingRemovedProperties && shadowingRemovedProperties.attributes ? shadowingRemovedProperties.attributes.split(",") : []; + if(properties && (shadowingProperties || shadowingRemovedPropertyNames.length > 0)) { Object.keys(properties).forEach(function(key) { value = properties[key]; if(shadowingProperties && shadowingProperties[key] !== undefined || shadowingRemovedPropertyNames && shadowingRemovedPropertyNames.indexOf(key) !== -1) { @@ -10749,7 +10873,8 @@ ops.OpUpdateParagraphStyle = function OpUpdateParagraphStyle() { } }) } - if(removedPropertyNames && (shadowingProperties || shadowingRemovedPropertyNames)) { + if(removedProperties && removedProperties.attributes && (shadowingProperties || shadowingRemovedPropertyNames.length > 0)) { + removedPropertyNames = removedProperties.attributes.split(","); for(i = 0;i < removedPropertyNames.length;i += 1) { name = removedPropertyNames[i]; if(shadowingProperties && shadowingProperties[name] !== undefined || shadowingRemovedPropertyNames && shadowingRemovedPropertyNames.indexOf(name) !== -1) { @@ -10757,17 +10882,52 @@ ops.OpUpdateParagraphStyle = function OpUpdateParagraphStyle() { i -= 1 } } + if(removedPropertyNames.length > 0) { + removedProperties.attributes = removedPropertyNames.join(",") + }else { + delete removedProperties.attributes + } } } function hasProperties(properties) { - var i; - for(i in properties) { - if(properties.hasOwnProperty(i)) { + var key; + for(key in properties) { + if(properties.hasOwnProperty(key)) { return true } } return false } + function hasRemovedProperties(properties) { + var key; + for(key in properties) { + if(properties.hasOwnProperty(key)) { + if(key !== "attributes" || properties.attributes.length > 0) { + return true + } + } + } + return false + } + function dropShadowedProperties(otherOpspec, propertiesName) { + var sp = setProperties ? setProperties[propertiesName] : null, rp = removedProperties ? removedProperties[propertiesName] : null; + dropShadowedAttributes(sp, rp, otherOpspec.setProperties ? otherOpspec.setProperties[propertiesName] : null, otherOpspec.removedProperties ? otherOpspec.removedProperties[propertiesName] : null); + if(sp && !hasProperties(sp)) { + delete setProperties[propertiesName] + } + if(rp && !hasRemovedProperties(rp)) { + delete removedProperties[propertiesName] + } + } + function dropStyleReferencingAttributes(deletedStyleName) { + if(setProperties) { + ["style:parent-style-name", "style:next-style-name"].forEach(function(attributeName) { + if(setProperties[attributeName] === deletedStyleName) { + delete setProperties[attributeName] + } + }) + } + } this.init = function(data) { memberid = data.memberid; timestamp = data.timestamp; @@ -10776,68 +10936,82 @@ ops.OpUpdateParagraphStyle = function OpUpdateParagraphStyle() { removedProperties = data.removedProperties }; this.transform = function(otherOp, hasPriority) { - var otherOpspec = otherOp.spec(), otherOpType = otherOpspec.optype; - if(otherOpType === optype) { - if(otherOpspec.styleName === styleName) { - if(!hasPriority) { - dropShadowedProperties(setProperties ? setProperties["style:paragraph-properties"] : null, removedProperties ? removedProperties.paragraphPropertyNames : null, otherOpspec.setProperties ? otherOpspec.setProperties["style:paragraph-properties"] : null, otherOpspec.removedProperties ? otherOpspec.removedProperties.paragraphPropertyNames : null); - dropShadowedProperties(setProperties ? setProperties["style:text-properties"] : null, removedProperties ? removedProperties.textPropertyNames : null, otherOpspec.setProperties ? otherOpspec.setProperties["style:text-properties"] : null, otherOpspec.removedProperties ? otherOpspec.removedProperties.textPropertyNames : null); - if(!(setProperties && (hasProperties(setProperties["style:text-properties"]) || hasProperties(setProperties["style:paragraph-properties"]))) && !(removedProperties && (removedProperties.textPropertyNames.length > 0 || removedProperties.paragraphPropertyNames.length > 0))) { - return[] + var otherOpspec = otherOp.spec(), otherOpType = otherOpspec.optype, result = [self]; + switch(otherOpType) { + case optype: + if(otherOpspec.styleName === styleName) { + if(!hasPriority) { + dropShadowedProperties(otherOpspec, paragraphPropertiesName); + dropShadowedProperties(otherOpspec, textPropertiesName); + dropShadowedAttributes(setProperties || null, removedProperties || null, otherOpspec.setProperties || null, otherOpspec.removedProperties || null); + if(!(setProperties && hasProperties(setProperties)) && !(removedProperties && hasRemovedProperties(removedProperties))) { + result = [] + } } } - } - }else { - if(otherOpType === "RemoveParagraphStyle") { + break; + case "RemoveParagraphStyle": if(otherOpspec.styleName === styleName) { - return[] + result = [] + }else { + dropStyleReferencingAttributes(otherOpspec.styleName) } - } + break } - return[self] + return result }; this.execute = function(odtDocument) { - var styleNode, paragraphPropertiesNode, textPropertiesNode, fontFaceNode, fontName, formatting = odtDocument.getFormatting(); + var formatting = odtDocument.getFormatting(), dom = odtDocument.getDOM(), styleNode = dom.createElementNS(stylens, "style:style"), paragraphPropertiesNode, textPropertiesNode, fontFaceNode, fontName, ns; styleNode = odtDocument.getParagraphStyleElement(styleName); if(styleNode) { paragraphPropertiesNode = styleNode.getElementsByTagNameNS(stylens, "paragraph-properties")[0]; textPropertiesNode = styleNode.getElementsByTagNameNS(stylens, "text-properties")[0]; if(setProperties) { - if(paragraphPropertiesNode === undefined && setProperties["style:paragraph-properties"]) { - paragraphPropertiesNode = odtDocument.getDOM().createElementNS(stylens, "style:paragraph-properties"); - styleNode.appendChild(paragraphPropertiesNode) - } - if(textPropertiesNode === undefined && setProperties["style:text-properties"]) { - textPropertiesNode = odtDocument.getDOM().createElementNS(stylens, "style:text-properties"); - styleNode.appendChild(textPropertiesNode) - } - if(setProperties["style:paragraph-properties"]) { - formatting.updateStyle(paragraphPropertiesNode, setProperties["style:paragraph-properties"]) - } - if(setProperties["style:text-properties"]) { - fontName = setProperties["style:text-properties"]["style:font-name"]; - if(fontName && !formatting.getFontMap().hasOwnProperty(fontName)) { - fontFaceNode = odtDocument.getDOM().createElementNS(stylens, "style:font-face"); - fontFaceNode.setAttributeNS(stylens, "style:name", fontName); - fontFaceNode.setAttributeNS(svgns, "svg:font-family", fontName); - odtDocument.getOdfCanvas().odfContainer().rootElement.fontFaceDecls.appendChild(fontFaceNode) + Object.keys(setProperties).forEach(function(propertyName) { + switch(propertyName) { + case paragraphPropertiesName: + if(paragraphPropertiesNode === undefined) { + paragraphPropertiesNode = dom.createElementNS(stylens, paragraphPropertiesName); + styleNode.appendChild(paragraphPropertiesNode) + } + formatting.updateStyle(paragraphPropertiesNode, setProperties[paragraphPropertiesName]); + break; + case textPropertiesName: + if(textPropertiesNode === undefined) { + textPropertiesNode = dom.createElementNS(stylens, textPropertiesName); + styleNode.appendChild(textPropertiesNode) + } + fontName = setProperties[textPropertiesName]["style:font-name"]; + if(fontName && !formatting.getFontMap().hasOwnProperty(fontName)) { + fontFaceNode = dom.createElementNS(stylens, "style:font-face"); + fontFaceNode.setAttributeNS(stylens, "style:name", fontName); + fontFaceNode.setAttributeNS(svgns, "svg:font-family", fontName); + odtDocument.getOdfCanvas().odfContainer().rootElement.fontFaceDecls.appendChild(fontFaceNode) + } + formatting.updateStyle(textPropertiesNode, setProperties[textPropertiesName]); + break; + default: + if(typeof setProperties[propertyName] !== "object") { + ns = odf.Namespaces.resolvePrefix(propertyName.substr(0, propertyName.indexOf(":"))); + styleNode.setAttributeNS(ns, propertyName, setProperties[propertyName]) + } } - formatting.updateStyle(textPropertiesNode, setProperties["style:text-properties"]) - } + }) } if(removedProperties) { - if(removedProperties.paragraphPropertyNames) { - removePropertiesFromStyleNode(paragraphPropertiesNode, removedProperties.paragraphPropertyNames); + if(removedProperties[paragraphPropertiesName]) { + removedAttributesFromStyleNode(paragraphPropertiesNode, removedProperties[paragraphPropertiesName].attributes); if(paragraphPropertiesNode.attributes.length === 0) { styleNode.removeChild(paragraphPropertiesNode) } } - if(removedProperties.textPropertyNames) { - removePropertiesFromStyleNode(textPropertiesNode, removedProperties.textPropertyNames); + if(removedProperties[textPropertiesName]) { + removedAttributesFromStyleNode(textPropertiesNode, removedProperties[textPropertiesName].attributes); if(textPropertiesNode.attributes.length === 0) { styleNode.removeChild(textPropertiesNode) } } + removedAttributesFromStyleNode(styleNode, removedProperties.attributes) } odtDocument.getOdfCanvas().refreshCSS(); odtDocument.emit(ops.OdtDocument.signalParagraphStyleModified, styleName); @@ -10893,10 +11067,19 @@ ops.OpAddParagraphStyle = function OpAddParagraphStyle() { styleName = data.styleName; setProperties = data.setProperties }; + function dropStyleReferencingAttributes(deletedStyleName) { + if(setProperties) { + ["style:parent-style-name", "style:next-style-name"].forEach(function(attributeName) { + if(setProperties[attributeName] === deletedStyleName) { + delete setProperties[attributeName] + } + }) + } + } this.transform = function(otherOp, hasPriority) { - var otherSpec = otherOp.spec(); - if((otherSpec.optype === "UpdateParagraphStyle" || otherSpec.optype === "RemoveParagraphStyle") && otherSpec.styleName === styleName) { - return null + var otherOpspec = otherOp.spec(); + if(otherOpspec.optype === "RemoveParagraphStyle") { + dropStyleReferencingAttributes(otherOpspec.styleName) } return[self] }; @@ -10985,23 +11168,45 @@ ops.OpRemoveParagraphStyle = function OpRemoveParagraphStyle() { timestamp = data.timestamp; styleName = data.styleName }; + function getStyleReferencingAttributes(setProperties) { + var attributes = []; + if(setProperties) { + ["style:parent-style-name", "style:next-style-name"].forEach(function(attributeName) { + if(setProperties[attributeName] === styleName) { + attributes.push(attributeName) + } + }) + } + return attributes + } this.transform = function(otherOp, hasPriority) { - var otherOpspec = otherOp.spec(), otherOpType = otherOpspec.optype, removeStyleOp; - if(otherOpType === optype) { - if(otherOpspec.styleName === styleName) { - return[] - } - }else { - if(otherOpType === "SetParagraphStyle") { + var otherOpspec = otherOp.spec(), otherOpType = otherOpspec.optype, helperOp, setAttributes, result = [self]; + switch(otherOpType) { + case optype: + if(otherOpspec.styleName === styleName) { + result = [] + } + break; + case "AddParagraphStyle": + ; + case "UpdateParagraphStyle": + setAttributes = getStyleReferencingAttributes(otherOpspec.setProperties); + if(setAttributes.length > 0) { + helperOp = new ops.OpUpdateParagraphStyle; + helperOp.init({styleName:otherOpspec.styleName, removedProperties:{attributes:setAttributes.join(",")}}); + result = [helperOp, self] + } + break; + case "SetParagraphStyle": if(otherOpspec.styleName === styleName) { otherOpspec.styleName = ""; - removeStyleOp = new ops.OpSetParagraphStyle; - removeStyleOp.init(otherOpspec); - return[removeStyleOp, self] + helperOp = new ops.OpSetParagraphStyle; + helperOp.init(otherOpspec); + result = [helperOp, self] } - } + break } - return[self] + return result }; this.execute = function(odtDocument) { var styleNode = odtDocument.getParagraphStyleElement(styleName); @@ -11052,7 +11257,7 @@ ops.OpRemoveParagraphStyle = function OpRemoveParagraphStyle() { @source: http://gitorious.org/webodf/webodf/ */ ops.OpAddAnnotation = function OpAddAnnotation() { - var memberid, timestamp, position, length, name; + var self = this, optype = "AddAnnotation", memberid, timestamp, position, length, name; this.init = function(data) { memberid = data.memberid; timestamp = parseInt(data.timestamp, 10); @@ -11061,13 +11266,53 @@ ops.OpAddAnnotation = function OpAddAnnotation() { name = data.name }; this.transform = function(otherOp, hasPriority) { - if(otherOp || hasPriority) { - return null + var otherOpspec = otherOp.spec(), otherOptype = otherOpspec.optype, end = position + length, result = [self]; + switch(otherOptype) { + case optype: + if(otherOpspec.position < position) { + position += 1 + }else { + if(otherOpspec.position === position && !hasPriority) { + position += 1; + result = null + } + } + break; + case "InsertText": + if(otherOpspec.position <= position) { + position += otherOpspec.text.length + }else { + if(otherOpspec.position <= end) { + length += otherOpspec.text.length + } + } + break; + case "SplitParagraph": + if(otherOpspec.position <= position) { + position += 1 + }else { + if(otherOpspec.position <= end) { + length += 1 + } + } + break; + case "InsertTable": + result = null; + break; + case "RemoveText": + if(otherOpspec.position + otherOpspec.length <= position) { + position -= otherOpspec.length + }else { + if(otherOpspec.position < position) { + position = otherOpspec.position + } + } + break } - return null + return result }; function createAnnotationNode(odtDocument, date) { - var annotationNode, creatorNode, dateNode, listNode, listItemNode, paragraphNode, doc = odtDocument.getRootNode().ownerDocument; + var annotationNode, creatorNode, dateNode, listNode, listItemNode, paragraphNode, doc = odtDocument.getDOM(); annotationNode = doc.createElementNS(odf.Namespaces.officens, "office:annotation"); annotationNode.setAttributeNS(odf.Namespaces.officens, "office:name", name); creatorNode = doc.createElementNS(odf.Namespaces.dcns, "dc:creator"); @@ -11085,13 +11330,13 @@ ops.OpAddAnnotation = function OpAddAnnotation() { return annotationNode } function createAnnotationEnd(odtDocument) { - var annotationEnd, doc = odtDocument.getRootNode().ownerDocument; + var annotationEnd, doc = odtDocument.getDOM(); annotationEnd = doc.createElementNS(odf.Namespaces.officens, "office:annotation-end"); annotationEnd.setAttributeNS(odf.Namespaces.officens, "office:name", name); return annotationEnd } function insertNodeAtPosition(odtDocument, node, insertPosition) { - var previousNode, domPosition = odtDocument.getPositionInTextNode(insertPosition); + var previousNode, domPosition = odtDocument.getPositionInTextNode(insertPosition, memberid); if(domPosition) { previousNode = domPosition.textNode; if(domPosition.offset !== previousNode.length) { @@ -11100,8 +11345,17 @@ ops.OpAddAnnotation = function OpAddAnnotation() { previousNode.parentNode.insertBefore(node, previousNode.nextSibling) } } + function countSteps(number, stepCounter, positionFilter) { + if(number > 0) { + return stepCounter.countForwardSteps(number, positionFilter) + } + if(number < 0) { + return-stepCounter.countBackwardSteps(-number, positionFilter) + } + return 0 + } this.execute = function(odtDocument) { - var annotation = {}; + var annotation = {}, positionFilter = odtDocument.getPositionFilter(), cursor = odtDocument.getCursor(memberid), oldCursorPosition = odtDocument.getCursorPosition(memberid), lengthToMove = position - oldCursorPosition - 1, stepsToParagraph; annotation.node = createAnnotationNode(odtDocument, new Date(timestamp)); if(!annotation.node) { return false @@ -11114,11 +11368,96 @@ ops.OpAddAnnotation = function OpAddAnnotation() { insertNodeAtPosition(odtDocument, annotation.end, position + length) } insertNodeAtPosition(odtDocument, annotation.node, position); + if(cursor) { + stepsToParagraph = countSteps(lengthToMove, cursor.getStepCounter(), positionFilter); + cursor.move(stepsToParagraph); + odtDocument.emit(ops.OdtDocument.signalCursorMoved, cursor) + } odtDocument.getOdfCanvas().addAnnotation(annotation); return true }; this.spec = function() { - return{optype:"AddAnnotation", memberid:memberid, timestamp:timestamp, position:position, length:length, name:name} + return{optype:optype, memberid:memberid, timestamp:timestamp, position:position, length:length, name:name} + } +}; +/* + + Copyright (C) 2012-2013 KO GmbH + + @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("odf.Namespaces"); +runtime.loadClass("core.DomUtils"); +ops.OpRemoveAnnotation = function OpRemoveAnnotation() { + var memberid, timestamp, position, length, domUtils; + this.init = function(data) { + memberid = data.memberid; + timestamp = data.timestamp; + position = parseInt(data.position, 10); + length = parseInt(data.length, 10); + domUtils = new core.DomUtils + }; + this.transform = function(otherOp, hasPriority) { + return null + }; + this.execute = function(odtDocument) { + var iterator = odtDocument.getIteratorAtPosition(position), container = iterator.container(), annotationName, annotationNode = null, annotationEnd = null, cursors; + while(!(container.namespaceURI === odf.Namespaces.officens && container.localName === "annotation")) { + container = container.parentNode + } + if(container === null) { + return false + } + annotationNode = container; + annotationName = annotationNode.getAttributeNS(odf.Namespaces.officens, "name"); + if(annotationName) { + annotationEnd = domUtils.getElementsByTagNameNS(odtDocument.getRootNode(), odf.Namespaces.officens, "annotation-end").filter(function(element) { + return annotationName === element.getAttributeNS(odf.Namespaces.officens, "name") + })[0] || null + } + odtDocument.getOdfCanvas().forgetAnnotations(); + cursors = domUtils.getElementsByTagNameNS(annotationNode, odf.Namespaces.webodfns + ":names:cursor", "cursor"); + while(cursors.length) { + annotationNode.parentNode.insertBefore(cursors.pop(), annotationNode) + } + annotationNode.parentNode.removeChild(annotationNode); + if(annotationEnd) { + annotationEnd.parentNode.removeChild(annotationEnd) + } + odtDocument.fixCursorPositions(); + odtDocument.getOdfCanvas().refreshAnnotations(); + return true + }; + this.spec = function() { + return{optype:"RemoveAnnotation", memberid:memberid, timestamp:timestamp, position:position, length:length} } }; /* @@ -11168,6 +11507,7 @@ runtime.loadClass("ops.OpUpdateParagraphStyle"); runtime.loadClass("ops.OpAddParagraphStyle"); runtime.loadClass("ops.OpRemoveParagraphStyle"); runtime.loadClass("ops.OpAddAnnotation"); +runtime.loadClass("ops.OpRemoveAnnotation"); ops.OperationFactory = function OperationFactory() { var specs; this.register = function(specName, specConstructor) { @@ -11188,7 +11528,7 @@ ops.OperationFactory = function OperationFactory() { } function init() { specs = {AddCursor:constructor(ops.OpAddCursor), ApplyDirectStyling:constructor(ops.OpApplyDirectStyling), InsertTable:constructor(ops.OpInsertTable), InsertText:constructor(ops.OpInsertText), RemoveText:constructor(ops.OpRemoveText), SplitParagraph:constructor(ops.OpSplitParagraph), SetParagraphStyle:constructor(ops.OpSetParagraphStyle), UpdateParagraphStyle:constructor(ops.OpUpdateParagraphStyle), AddParagraphStyle:constructor(ops.OpAddParagraphStyle), RemoveParagraphStyle:constructor(ops.OpRemoveParagraphStyle), - MoveCursor:constructor(ops.OpMoveCursor), RemoveCursor:constructor(ops.OpRemoveCursor), AddAnnotation:constructor(ops.OpAddAnnotation)} + MoveCursor:constructor(ops.OpMoveCursor), RemoveCursor:constructor(ops.OpRemoveCursor), AddAnnotation:constructor(ops.OpAddAnnotation), RemoveAnnotation:constructor(ops.OpRemoveAnnotation)} } init() }; @@ -11198,59 +11538,61 @@ runtime.loadClass("core.PositionFilter"); runtime.loadClass("core.LoopWatchDog"); runtime.loadClass("odf.OdfUtils"); gui.SelectionMover = function SelectionMover(cursor, rootNode) { + runtime.assert(Boolean(rootNode), "Expected to get a rootNode for gui.SelectionMover."); var odfUtils, positionIterator, cachedXOffset, timeoutHandle, FILTER_ACCEPT = core.PositionFilter.FilterResult.FILTER_ACCEPT; - function getOffset(el) { - var x = 0, y = 0; - while(el && el.nodeType === Node.ELEMENT_NODE) { - x += el.offsetLeft - el.scrollLeft; - y += el.offsetTop - el.scrollTop; - el = el.parentNode - } - return{top:y, left:x} - } function getIteratorAtCursor() { positionIterator.setUnfilteredPosition(cursor.getNode(), 0); return positionIterator } - function getRect(container, offset, range) { - var rect, containerOffset; + function getMaximumNodePosition(node) { + return node.nodeType === Node.TEXT_NODE ? node.textContent.length : node.childNodes.length + } + function getClientRect(clientRectangles, useRightEdge) { + var rectangle, simplifiedRectangle = null; + if(clientRectangles) { + rectangle = useRightEdge ? clientRectangles[clientRectangles.length - 1] : clientRectangles[0] + } + if(rectangle) { + simplifiedRectangle = {top:rectangle.top, left:useRightEdge ? rectangle.right : rectangle.left, bottom:rectangle.bottom} + } + return simplifiedRectangle + } + function getVisibleRect(container, offset, range, useRightEdge) { + var rectangle, nodeType = container.nodeType; range.setStart(container, offset); - rect = range.getClientRects()[0]; - if(!rect) { - rect = {}; - if(container.childNodes[offset - 1]) { - range.setStart(container, offset - 1); - range.setEnd(container, offset); - containerOffset = range.getClientRects()[0]; - if(!containerOffset) { - containerOffset = getOffset(container) - } - runtime.assert(containerOffset, "getRect: invalid containerOffset"); - rect.top = containerOffset.top; - rect.left = containerOffset.right; - rect.bottom = containerOffset.bottom - }else { - if(container.nodeType === Node.TEXT_NODE) { + range.collapse(!useRightEdge); + rectangle = getClientRect(range.getClientRects(), useRightEdge === true); + if(!rectangle && offset > 0) { + range.setStart(container, offset - 1); + range.setEnd(container, offset); + rectangle = getClientRect(range.getClientRects(), true) + } + if(!rectangle) { + if(nodeType === Node.ELEMENT_NODE && container.childNodes[offset - 1]) { + rectangle = getVisibleRect(container, offset - 1, range, true) + }else { + if(container.nodeType === Node.TEXT_NODE && offset > 0) { + rectangle = getVisibleRect(container, offset - 1, range, true) + }else { if(container.previousSibling) { - rect = container.previousSibling.getClientRects()[0] - } - if(!rect) { - range.setStart(container, 0); - range.setEnd(container, offset); - rect = range.getClientRects()[0] + rectangle = getVisibleRect(container.previousSibling, getMaximumNodePosition(container.previousSibling), range, true) + }else { + if(container.parentNode && container.parentNode !== rootNode) { + rectangle = getVisibleRect(container.parentNode, 0, range, false) + }else { + range.selectNode(rootNode); + rectangle = getClientRect(range.getClientRects(), false) + } } - }else { - rect = container.getClientRects()[0] } } } - runtime.assert(rect, "getRect invalid rect"); - runtime.assert(rect.top !== undefined, "getRect rect without top property"); - return{top:rect.top, left:rect.left, bottom:rect.bottom} + runtime.assert(Boolean(rectangle), "No visible rectangle found"); + return(rectangle) } function doMove(steps, extend, move) { var left = steps, iterator = getIteratorAtCursor(), initialRect, range = (rootNode.ownerDocument.createRange()), selectionRange = cursor.getSelectedRange() ? cursor.getSelectedRange().cloneRange() : rootNode.ownerDocument.createRange(), newRect, horizontalMovement, o, c, isForwardSelection, window = runtime.getWindow(); - initialRect = getRect((cursor.getNode()), 0, range); + initialRect = getVisibleRect(iterator.container(), iterator.unfilteredDomOffset(), range); while(left > 0 && move()) { left -= 1 } @@ -11268,7 +11610,8 @@ gui.SelectionMover = function SelectionMover(cursor, rootNode) { selectionRange.collapse(true) } cursor.setSelectedRange(selectionRange, isForwardSelection); - newRect = getRect((cursor.getNode()), 0, range); + iterator = getIteratorAtCursor(); + newRect = getVisibleRect(iterator.container(), iterator.unfilteredDomOffset(), range); horizontalMovement = newRect.top === initialRect.top ? true : false; if(horizontalMovement || cachedXOffset === undefined) { cachedXOffset = newRect.left @@ -11359,7 +11702,7 @@ gui.SelectionMover = function SelectionMover(cursor, rootNode) { } function countLineSteps(filter, direction, iterator) { var c = iterator.container(), count = 0, bestContainer = null, bestOffset, bestXDiff = 10, xDiff, bestCount = 0, top, left, lastTop, rect, range = (rootNode.ownerDocument.createRange()), watch = new core.LoopWatchDog(1E3); - rect = getRect(c, iterator.unfilteredDomOffset(), range); + rect = getVisibleRect(c, iterator.unfilteredDomOffset(), range); top = rect.top; if(cachedXOffset === undefined) { left = rect.left @@ -11372,7 +11715,7 @@ gui.SelectionMover = function SelectionMover(cursor, rootNode) { if(filter.acceptPosition(iterator) === FILTER_ACCEPT) { count += 1; c = iterator.container(); - rect = getRect(c, iterator.unfilteredDomOffset(), range); + rect = getVisibleRect(c, iterator.unfilteredDomOffset(), range); if(rect.top !== top) { if(rect.top !== lastTop && lastTop !== top) { break @@ -11419,13 +11762,13 @@ gui.SelectionMover = function SelectionMover(cursor, rootNode) { fnNextPos = iterator.nextPosition; increment = 1 } - lastRect = getRect(iterator.container(), iterator.unfilteredDomOffset(), range); + lastRect = getVisibleRect(iterator.container(), iterator.unfilteredDomOffset(), range); while(fnNextPos.call(iterator)) { if(filter.acceptPosition(iterator) === FILTER_ACCEPT) { if(odfUtils.getParagraphElement(iterator.getCurrentNode()) !== paragraphNode) { break } - rect = getRect(iterator.container(), iterator.unfilteredDomOffset(), range); + rect = getVisibleRect(iterator.container(), iterator.unfilteredDomOffset(), range); if(rect.bottom !== lastRect.bottom) { onSameLine = rect.top >= lastRect.top && rect.bottom < lastRect.bottom || rect.top <= lastRect.top && rect.bottom > lastRect.bottom; if(!onSameLine) { @@ -11837,76 +12180,9 @@ gui.Caret = function Caret(cursor, avatarInitiallyVisible, blinkOnRangeSelect) { }, 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} + function getCaretClientRectWithMargin(caretElement, margin) { + var caretRect = caretElement.getBoundingClientRect(); + return{left:caretRect.left - margin.left, top:caretRect.top - margin.top, right:caretRect.right + margin.right, bottom:caretRect.bottom + margin.bottom} } this.refreshCursorBlinking = function() { if(blinkOnRangeSelect || cursor.getSelectedRange().collapsed) { @@ -11954,20 +12230,21 @@ gui.Caret = function Caret(cursor, avatarInitiallyVisible, blinkOnRangeSelect) { 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 + var canvasElement = cursor.getOdtDocument().getOdfCanvas().getElement(), canvasContainerElement = canvasElement.parentNode, caretRect, canvasContainerRect, horizontalMargin = canvasContainerElement.offsetWidth - canvasContainerElement.clientWidth + 5, verticalMargin = canvasContainerElement.offsetHeight - canvasContainerElement.clientHeight + 5; + caretRect = getCaretClientRectWithMargin(span, {top:verticalMargin, left:horizontalMargin, bottom:verticalMargin, right:horizontalMargin}); + canvasContainerRect = canvasContainerElement.getBoundingClientRect(); + if(caretRect.top < canvasContainerRect.top) { + canvasContainerElement.scrollTop -= canvasContainerRect.top - caretRect.top }else { - if(caretOffsetRect.bottom > canvasContainerElement.scrollTop + canvasContainerElement.clientHeight - 1) { - canvasContainerElement.scrollTop = caretOffsetRect.bottom - canvasContainerElement.clientHeight + 1 + if(caretRect.bottom > canvasContainerRect.bottom) { + canvasContainerElement.scrollTop += caretRect.bottom - canvasContainerRect.bottom } } - if(caretOffsetRect.left < canvasContainerElement.scrollLeft) { - canvasContainerElement.scrollLeft = caretOffsetRect.left + if(caretRect.left < canvasContainerRect.left) { + canvasContainerElement.scrollLeft -= canvasContainerRect.left - caretRect.left }else { - if(caretOffsetRect.right > canvasContainerElement.scrollLeft + canvasContainerElement.clientWidth - 1) { - canvasContainerElement.scrollLeft = caretOffsetRect.right - canvasContainerElement.clientWidth + 1 + if(caretRect.right > canvasContainerRect.right) { + canvasContainerElement.scrollLeft += caretRect.right - canvasContainerRect.right } } }; @@ -12195,6 +12472,7 @@ runtime.loadClass("ops.OpInsertText"); runtime.loadClass("ops.OpRemoveText"); runtime.loadClass("ops.OpSplitParagraph"); runtime.loadClass("ops.OpSetParagraphStyle"); +runtime.loadClass("ops.OpRemoveAnnotation"); runtime.loadClass("gui.ClickHandler"); runtime.loadClass("gui.Clipboard"); runtime.loadClass("gui.KeyboardHandler"); @@ -12326,6 +12604,42 @@ gui.SessionController = function() { canvasElement.focus(); return{anchorNode:anchorNode, anchorOffset:anchorOffset, focusNode:focusNode, focusOffset:focusOffset} } + function getFirstWalkablePositionInNode(node) { + var position = 0, iterator = gui.SelectionMover.createPositionIterator(odtDocument.getRootNode()), watch = new core.LoopWatchDog(1E3), inside = false; + while(iterator.nextPosition()) { + watch.check(); + inside = Boolean(node.compareDocumentPosition(iterator.container()) & Node.DOCUMENT_POSITION_CONTAINED_BY); + if(baseFilter.acceptPosition(iterator) === 1) { + if(inside) { + break + } + position += 1 + } + } + return position + } + function getWalkableNodeLength(node) { + var length = 0, iterator = gui.SelectionMover.createPositionIterator(odtDocument.getRootNode()), inside = false; + iterator.setUnfilteredPosition(node, 0); + do { + inside = Boolean(node.compareDocumentPosition(iterator.container()) & Node.DOCUMENT_POSITION_CONTAINED_BY); + if(!inside && node !== iterator.container()) { + break + } + if(baseFilter.acceptPosition(iterator) === 1) { + length += 1 + } + }while(iterator.nextPosition()); + return length + } + function removeAnnotation(annotationNode) { + var position, length, op; + position = getFirstWalkablePositionInNode(annotationNode); + length = getWalkableNodeLength(annotationNode); + op = new ops.OpRemoveAnnotation; + op.init({memberid:inputMemberId, position:position, length:length}); + session.enqueue(op) + } function selectRange(e) { runtime.setTimeout(function() { var selection = getSelection(e), oldPosition, stepsToAnchor, stepsToFocus, op; @@ -12848,7 +13162,15 @@ gui.SessionController = function() { return false }); keyPressHandler.bind(keyCode.Enter, modifier.None, enqueueParagraphSplittingOps); - clickHandler.subscribe(gui.ClickHandler.signalSingleClick, selectRange); + clickHandler.subscribe(gui.ClickHandler.signalSingleClick, function(event) { + var target = event.target, annotationNode = null; + if(target.className === "annotationRemoveButton") { + annotationNode = domUtils.getElementsByTagNameNS(target.parentNode, odf.Namespaces.officens, "annotation")[0]; + removeAnnotation(annotationNode) + }else { + selectRange(event) + } + }); clickHandler.subscribe(gui.ClickHandler.signalDoubleClick, selectWord); clickHandler.subscribe(gui.ClickHandler.signalTripleClick, selectParagraph) } @@ -13726,8 +14048,7 @@ gui.SessionView = function() { function SessionView(viewOptions, session, caretManager) { var avatarInfoStyles, editInfons = "urn:webodf:names:editinfo", editInfoMap = {}, showEditInfoMarkers = configOption(viewOptions.editInfoMarkersInitiallyVisible, true), showCaretAvatars = configOption(viewOptions.caretAvatarsInitiallyVisible, true), blinkOnRangeSelect = configOption(viewOptions.caretBlinksOnRangeSelect, true); function createAvatarInfoNodeMatch(nodeName, memberId, pseudoClass) { - var userId = memberId.split("___")[0]; - return nodeName + '[editinfo|memberid^="' + userId + '"]' + pseudoClass + return nodeName + '[editinfo|memberid^="' + memberId + '"]' + pseudoClass } function getAvatarInfoStyle(nodeName, memberId, pseudoClass) { var node = avatarInfoStyles.firstChild, nodeMatch = createAvatarInfoNodeMatch(nodeName, memberId, pseudoClass); @@ -14929,7 +15250,7 @@ ops.OdtDocument = function OdtDocument(odfCanvas) { while(lastTextNode.previousSibling && lastTextNode.previousSibling.nodeType === Node.TEXT_NODE) { lastTextNode.previousSibling.appendData(lastTextNode.data); nodeOffset = lastTextNode.length + lastTextNode.previousSibling.length; - lastTextNode = lastTextNode.previousSibling; + lastTextNode = (lastTextNode.previousSibling); lastTextNode.parentNode.removeChild(lastTextNode.nextSibling) } return{textNode:lastTextNode, offset:nodeOffset} @@ -15041,7 +15362,7 @@ ops.OdtDocument = function OdtDocument(odfCanvas) { }; this.getRootNode = getRootNode; this.getDOM = function() { - return getRootNode().ownerDocument + return(getRootNode().ownerDocument) }; this.getCursor = function(memberid) { return cursors[memberid] @@ -15202,5 +15523,5 @@ ops.Session = function Session(odfCanvas) { } init() }; -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@namespace annotation url(urn:webodf:names:annotation);\n@namespace dc url(http://purl.org/dc/elements/1.1/);\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 min-height: 1.3em; /* prevent empty paragraphs and headings from collapsing if they are empty */\n}\n*[runtimens|containsparagraphanchor] {\n position: relative;\n}\ntext|s {\n white-space: pre;\n}\ntext|tab {\n display: inline;\n white-space: pre;\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 text-align: left;\n overflow: visible;\n word-wrap: break-word;\n}\n\noffice|text::selection {\n /** Let's not draw selection highlight that overflows into the office|text\n * node when selecting content across several paragraphs\n */\n background: transparent;\n}\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}\n#shadowContent {\n display: inline-block;\n text-align: left;\n}\ndraw|page {\n display: block;\n position: relative;\n overflow: hidden;\n}\npresentation|notes, presentation|footer-decl, presentation|date-time-decl {\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 word-break: break-all; /* prevent long words from extending out the 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 z-index: 1;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n top: 5%; /* push down the caret; 0px can do the job, 5% looks better, 10% is a bit over */\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\n.annotationWrapper {\n display: inline;\n position: relative;\n}\n\n.annotationNote {\n width: 4cm;\n position: absolute;\n display: inline;\n z-index: 10;\n}\n.annotationNote > office|annotation {\n display: block;\n}\n\n.annotationConnector {\n position: absolute;\n display: inline;\n z-index: 10;\n border-top: 1px dashed brown;\n}\n.annotationConnector.angular {\n -moz-transform-origin: left top;\n -webkit-transform-origin: left top;\n -ms-transform-origin: left top;\n transform-origin: left top;\n}\n.annotationConnector.horizontal {\n left: 0;\n}\n.annotationConnector.horizontal:before {\n content: '';\n display: inline;\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: brown transparent transparent transparent;\n top: -1px;\n left: -5px;\n}\n\noffice|annotation {\n width: 100%;\n height: 100%;\n display: none;\n background: rgb(198, 238, 184);\n background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n box-shadow: 0 3px 4px -3px #ccc;\n}\n\noffice|annotation > dc|creator {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n color: white;\n background-color: brown;\n padding: 4px;\n}\noffice|annotation > dc|date {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n border: 4px solid transparent;\n}\noffice|annotation > text|list {\n display: block;\n padding: 5px;\n}\n\n/* This is very temporary CSS. This must go once\n * we start bundling webodf-default ODF styles for annotations.\n */\noffice|annotation text|p {\n font-size: 10pt;\n color: black;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n font-family: sans-serif;\n}\n\ndc|*::selection {\n background: transparent;\n}\ndc|*::-moz-selection {\n background: transparent;\n}\n\n#annotationsPane {\n background-color: #EAEAEA;\n width: 4cm;\n height: 100%;\n display: inline-block;\n position: absolute;\n outline: 1px solid #ccc;\n}\n\n.annotationHighlight {\n background-color: yellow;\n position: relative;\n}\n"; +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@namespace annotation url(urn:webodf:names:annotation);\n@namespace dc url(http://purl.org/dc/elements/1.1/);\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 min-height: 1.3em; /* prevent empty paragraphs and headings from collapsing if they are empty */\n}\n*[runtimens|containsparagraphanchor] {\n position: relative;\n}\ntext|s {\n white-space: pre;\n}\ntext|tab {\n display: inline;\n white-space: pre;\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 text-align: left;\n overflow: visible;\n word-wrap: break-word;\n}\n\noffice|text::selection {\n /** Let's not draw selection highlight that overflows into the office|text\n * node when selecting content across several paragraphs\n */\n background: transparent;\n}\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}\n#shadowContent {\n display: inline-block;\n text-align: left;\n}\ndraw|page {\n display: block;\n position: relative;\n overflow: hidden;\n}\npresentation|notes, presentation|footer-decl, presentation|date-time-decl {\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 word-break: break-all; /* prevent long words from extending out the 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 z-index: 1;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n top: 5%; /* push down the caret; 0px can do the job, 5% looks better, 10% is a bit over */\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\n.annotationWrapper {\n display: inline;\n position: relative;\n}\n\n.annotationRemoveButton:before {\n content: '\u00d7';\n color: white;\n padding: 5px;\n line-height: 1em;\n}\n\n.annotationRemoveButton {\n width: 20px;\n height: 20px;\n border-radius: 10px;\n background-color: black;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n position: absolute;\n top: -10px;\n left: -10px;\n z-index: 3;\n text-align: center;\n font-family: sans-serif;\n font-style: normal;\n font-weight: normal;\n text-decoration: none;\n font-size: 15px;\n}\n.annotationRemoveButton:hover {\n cursor: pointer;\n box-shadow: 0px 0px 5px rgba(0, 0, 0, 1);\n}\n\n.annotationNote {\n width: 4cm;\n position: absolute;\n display: inline;\n z-index: 10;\n}\n.annotationNote > office|annotation {\n display: block;\n}\n\n.annotationConnector {\n position: absolute;\n display: inline;\n z-index: 2;\n border-top: 1px dashed brown;\n}\n.annotationConnector.angular {\n -moz-transform-origin: left top;\n -webkit-transform-origin: left top;\n -ms-transform-origin: left top;\n transform-origin: left top;\n}\n.annotationConnector.horizontal {\n left: 0;\n}\n.annotationConnector.horizontal:before {\n content: '';\n display: inline;\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: brown transparent transparent transparent;\n top: -1px;\n left: -5px;\n}\n\noffice|annotation {\n width: 100%;\n height: 100%;\n display: none;\n background: rgb(198, 238, 184);\n background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n box-shadow: 0 3px 4px -3px #ccc;\n}\n\noffice|annotation > dc|creator {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n color: white;\n background-color: brown;\n padding: 4px;\n}\noffice|annotation > dc|date {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n border: 4px solid transparent;\n}\noffice|annotation > text|list {\n display: block;\n padding: 5px;\n}\n\n/* This is very temporary CSS. This must go once\n * we start bundling webodf-default ODF styles for annotations.\n */\noffice|annotation text|p {\n font-size: 10pt;\n color: black;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n font-family: sans-serif;\n}\n\ndc|*::selection {\n background: transparent;\n}\ndc|*::-moz-selection {\n background: transparent;\n}\n\n#annotationsPane {\n background-color: #EAEAEA;\n width: 4cm;\n height: 100%;\n display: inline-block;\n position: absolute;\n outline: 1px solid #ccc;\n}\n\n.annotationHighlight {\n background-color: yellow;\n position: relative;\n}\n"; diff --git a/js/webodf.js b/js/webodf.js index f2cc9c3f..0ab2ccbb 100644 --- a/js/webodf.js +++ b/js/webodf.js @@ -37,78 +37,78 @@ var core={},gui={},xmldom={},odf={},ops={}; // Input 1 function Runtime(){}Runtime.ByteArray=function(k){};Runtime.prototype.getVariable=function(k){};Runtime.prototype.toJson=function(k){};Runtime.prototype.fromJson=function(k){};Runtime.ByteArray.prototype.slice=function(k,l){};Runtime.ByteArray.prototype.length=0;Runtime.prototype.byteArrayFromArray=function(k){};Runtime.prototype.byteArrayFromString=function(k,l){};Runtime.prototype.byteArrayToString=function(k,l){};Runtime.prototype.concatByteArrays=function(k,l){}; -Runtime.prototype.read=function(k,l,n,c){};Runtime.prototype.readFile=function(k,l,n){};Runtime.prototype.readFileSync=function(k,l){};Runtime.prototype.loadXML=function(k,l){};Runtime.prototype.writeFile=function(k,l,n){};Runtime.prototype.isFile=function(k,l){};Runtime.prototype.getFileSize=function(k,l){};Runtime.prototype.deleteFile=function(k,l){};Runtime.prototype.log=function(k,l){};Runtime.prototype.setTimeout=function(k,l){};Runtime.prototype.clearTimeout=function(k){}; -Runtime.prototype.libraryPaths=function(){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(k){};Runtime.prototype.getWindow=function(){};Runtime.prototype.assert=function(k,l,n){};var IS_COMPILED_CODE=!0; -Runtime.byteArrayToString=function(k,l){function n(b){var a="",g,e=b.length;for(g=0;gd?a+=String.fromCharCode(d):(g+=1,c=b[g],194<=d&&224>d?a+=String.fromCharCode((d&31)<<6|c&63):(g+=1,f=b[g],224<=d&&240>d?a+=String.fromCharCode((d&15)<<12|(c&63)<<6|f&63):(g+=1,s=b[g],240<=d&&245>d&&(d=(d&7)<<18|(c&63)<<12|(f&63)<<6|s&63,d-=65536,a+=String.fromCharCode((d>>10)+55296,(d&1023)+56320))))); -return a}var b;"utf8"===l?b=c(k):("binary"!==l&&this.log("Unsupported encoding: "+l),b=n(k));return b};Runtime.getVariable=function(k){try{return eval(k)}catch(l){}};Runtime.toJson=function(k){return JSON.stringify(k)};Runtime.fromJson=function(k){return JSON.parse(k)};Runtime.getFunctionName=function(k){return void 0===k.name?(k=/function\s+(\w+)/.exec(k))&&k[1]:k.name}; -function BrowserRuntime(k){function l(a,g){var e,d,b;void 0!==g?b=a:g=a;k?(d=k.ownerDocument,b&&(e=d.createElement("span"),e.className=b,e.appendChild(d.createTextNode(b)),k.appendChild(e),k.appendChild(d.createTextNode(" "))),e=d.createElement("span"),0f?(d[s]=f,s+=1):2048>f?(d[s]=192|f>>>6,d[s+1]=128|f&63,s+=2):(d[s]=224|f>>>12&15,d[s+1]=128|f>>>6&63,d[s+2]=128|f&63,s+=3)}else for("binary"!== -g&&c.log("unknown encoding: "+g),e=a.length,d=new c.ByteArray(e),b=0;bd.status||0===d.status?e(null):e("Status "+String(d.status)+": "+d.responseText|| -d.statusText):e("File "+a+" is empty."))};g=g.buffer&&!d.sendAsBinary?g.buffer:c.byteArrayToString(g,"binary");try{d.sendAsBinary?d.sendAsBinary(g):d.send(g)}catch(h){c.log("HUH? "+h+" "+g),e(h.message)}};this.deleteFile=function(a,g){delete b[a];var e=new XMLHttpRequest;e.open("DELETE",a,!0);e.onreadystatechange=function(){4===e.readyState&&(200>e.status&&300<=e.status?g(e.responseText):g(null))};e.send(null)};this.loadXML=function(a,g){var e=new XMLHttpRequest;e.open("GET",a,!0);e.overrideMimeType&& -e.overrideMimeType("text/xml");e.onreadystatechange=function(){4===e.readyState&&(0!==e.status||e.responseText?200===e.status||0===e.status?g(null,e.responseXML):g(e.responseText):g("File "+a+" is empty."))};try{e.send(null)}catch(d){g(d.message)}};this.isFile=function(a,g){c.getFileSize(a,function(a){g(-1!==a)})};this.getFileSize=function(a,g){var e=new XMLHttpRequest;e.open("HEAD",a,!0);e.onreadystatechange=function(){if(4===e.readyState){var d=e.getResponseHeader("Content-Length");d?g(parseInt(d, -10)):n(a,"binary",function(d,a){d?g(-1):g(a.length)})}};e.send(null)};this.log=l;this.assert=function(a,g,e){if(!a)throw l("alert","ASSERTION FAILED:\n"+g),e&&e(),g;};this.setTimeout=function(a,g){return setTimeout(function(){a()},g)};this.clearTimeout=function(a){clearTimeout(a)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(a){return(new DOMParser).parseFromString(a, +Runtime.prototype.read=function(k,l,h,e){};Runtime.prototype.readFile=function(k,l,h){};Runtime.prototype.readFileSync=function(k,l){};Runtime.prototype.loadXML=function(k,l){};Runtime.prototype.writeFile=function(k,l,h){};Runtime.prototype.isFile=function(k,l){};Runtime.prototype.getFileSize=function(k,l){};Runtime.prototype.deleteFile=function(k,l){};Runtime.prototype.log=function(k,l){};Runtime.prototype.setTimeout=function(k,l){};Runtime.prototype.clearTimeout=function(k){}; +Runtime.prototype.libraryPaths=function(){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(k){};Runtime.prototype.getWindow=function(){};Runtime.prototype.assert=function(k,l,h){};var IS_COMPILED_CODE=!0; +Runtime.byteArrayToString=function(k,l){function h(b){var a="",f,d=b.length;for(f=0;fc?a+=String.fromCharCode(c):(f+=1,e=b[f],194<=c&&224>c?a+=String.fromCharCode((c&31)<<6|e&63):(f+=1,m=b[f],224<=c&&240>c?a+=String.fromCharCode((c&15)<<12|(e&63)<<6|m&63):(f+=1,q=b[f],240<=c&&245>c&&(c=(c&7)<<18|(e&63)<<12|(m&63)<<6|q&63,c-=65536,a+=String.fromCharCode((c>>10)+55296,(c&1023)+56320))))); +return a}var b;"utf8"===l?b=e(k):("binary"!==l&&this.log("Unsupported encoding: "+l),b=h(k));return b};Runtime.getVariable=function(k){try{return eval(k)}catch(l){}};Runtime.toJson=function(k){return JSON.stringify(k)};Runtime.fromJson=function(k){return JSON.parse(k)};Runtime.getFunctionName=function(k){return void 0===k.name?(k=/function\s+(\w+)/.exec(k))&&k[1]:k.name}; +function BrowserRuntime(k){function l(a,f){var d,c,b;void 0!==f?b=a:f=a;k?(c=k.ownerDocument,b&&(d=c.createElement("span"),d.className=b,d.appendChild(c.createTextNode(b)),k.appendChild(d),k.appendChild(c.createTextNode(" "))),d=c.createElement("span"),0m?(c[q]=m,q+=1):2048>m?(c[q]=192|m>>>6,c[q+1]=128|m&63,q+=2):(c[q]=224|m>>>12&15,c[q+1]=128|m>>>6&63,c[q+2]=128|m&63,q+=3)}else for("binary"!== +f&&e.log("unknown encoding: "+f),d=a.length,c=new e.ByteArray(d),b=0;bc.status||0===c.status?d(null):d("Status "+String(c.status)+": "+c.responseText|| +c.statusText):d("File "+a+" is empty."))};f=f.buffer&&!c.sendAsBinary?f.buffer:e.byteArrayToString(f,"binary");try{c.sendAsBinary?c.sendAsBinary(f):c.send(f)}catch(g){e.log("HUH? "+g+" "+f),d(g.message)}};this.deleteFile=function(a,f){delete b[a];var d=new XMLHttpRequest;d.open("DELETE",a,!0);d.onreadystatechange=function(){4===d.readyState&&(200>d.status&&300<=d.status?f(d.responseText):f(null))};d.send(null)};this.loadXML=function(a,f){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?200===d.status||0===d.status?f(null,d.responseXML):f(d.responseText):f("File "+a+" is empty."))};try{d.send(null)}catch(c){f(c.message)}};this.isFile=function(a,f){e.getFileSize(a,function(a){f(-1!==a)})};this.getFileSize=function(a,f){var d=new XMLHttpRequest;d.open("HEAD",a,!0);d.onreadystatechange=function(){if(4===d.readyState){var c=d.getResponseHeader("Content-Length");c?f(parseInt(c, +10)):h(a,"binary",function(c,a){c?f(-1):f(a.length)})}};d.send(null)};this.log=l;this.assert=function(a,f,d){if(!a)throw l("alert","ASSERTION FAILED:\n"+f),d&&d(),f;};this.setTimeout=function(a,f){return setTimeout(function(){a()},f)};this.clearTimeout=function(a){clearTimeout(a)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(a){return(new DOMParser).parseFromString(a, "text/xml")};this.exit=function(a){l("Calling exit with code "+String(a)+", but exit() is not implemented.")};this.getWindow=function(){return window}} -function NodeJSRuntime(){function k(a,e,d){a=c.resolve(b,a);"binary"!==e?n.readFile(a,e,d):n.readFile(a,null,d)}var l=this,n=require("fs"),c=require("path"),b="",h,a;this.ByteArray=function(a){return new Buffer(a)};this.byteArrayFromArray=function(a){var e=new Buffer(a.length),d,b=a.length;for(d=0;d").implementation} -function RhinoRuntime(){function k(a,g){var e;void 0!==g?e=a:g=a;"alert"===e&&print("\n!!!!! ALERT !!!!!");print(g);"alert"===e&&print("!!!!! ALERT !!!!!")}var l=this,n=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),c,b,h="";n.setValidating(!1);n.setNamespaceAware(!0);n.setExpandEntityReferences(!1);n.setSchema(null);b=Packages.org.xml.sax.EntityResolver({resolveEntity:function(a,g){var e=new Packages.java.io.FileReader(g);return new Packages.org.xml.sax.InputSource(e)}});c=n.newDocumentBuilder(); -c.setEntityResolver(b);this.ByteArray=function(a){return[a]};this.byteArrayFromArray=function(a){return a};this.byteArrayFromString=function(a,g){var e=[],d,b=a.length;for(d=0;d").implementation} +function RhinoRuntime(){function k(a,b){var d;void 0!==b?d=a:b=a;"alert"===d&&print("\n!!!!! ALERT !!!!!");print(b);"alert"===d&&print("!!!!! ALERT !!!!!")}var l=this,h=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),e,b,g="";h.setValidating(!1);h.setNamespaceAware(!0);h.setExpandEntityReferences(!1);h.setSchema(null);b=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)}});e=h.newDocumentBuilder(); +e.setEntityResolver(b);this.ByteArray=function(a){return[a]};this.byteArrayFromArray=function(a){return a};this.byteArrayFromString=function(a,b){var d=[],c,g=a.length;for(c=0;c>>18],f+=r[d>>>12&63],f+=r[d>>>6&63],f+=r[d&63];b===e+1?(d=a[b]<<4,f+=r[d>>>6],f+=r[d&63],f+="=="):b===e&&(d=a[b]<<10|a[b+1]<<2,f+=r[d>>>12],f+=r[d>>>6&63],f+=r[d&63],f+="=");return f}function n(a){a=a.replace(/[^A-Za-z0-9+\/]+/g,"");var d=[],f=a.length%4,b,e=a.length,g;for(b=0;b>16,g>>8&255,g&255);d.length-=[0,0,2,1][f];return d}function c(a){var d=[],f,b=a.length,e;for(f=0;fe?d.push(e):2048>e?d.push(192|e>>>6,128|e&63):d.push(224|e>>>12&15,128|e>>>6&63,128|e&63);return d}function b(a){var d=[],f,b=a.length,e,g,m;for(f=0;fe?d.push(e):(f+=1,g=a[f],224>e?d.push((e&31)<<6|g&63):(f+=1,m=a[f],d.push((e&15)<<12|(g&63)<<6|m&63)));return d}function h(a){return l(k(a))} -function a(a){return String.fromCharCode.apply(String,n(a))}function g(a){return b(k(a))}function e(a){a=b(a);for(var d="",f=0;fd?b+=String.fromCharCode(d):(m+=1,e=a.charCodeAt(m)&255,224>d?b+=String.fromCharCode((d&31)<<6|e&63):(m+=1,g=a.charCodeAt(m)&255,b+=String.fromCharCode((d&15)<<12|(e&63)<<6|g&63)));return b}function t(a,f){function b(){var c= -m+e;c>a.length&&(c=a.length);g+=d(a,m,c);m=c;c=m===a.length;f(g,c)&&!c&&runtime.setTimeout(b,0)}var e=1E5,g="",m=0;a.length>>18],b+=p[a>>>12&63],b+=p[a>>>6&63],b+=p[a&63];m===d+1?(a=c[m]<<4,b+=p[a>>>6],b+=p[a&63],b+="=="):m===d&&(a=c[m]<<10|c[m+1]<<2,b+=p[a>>>12],b+=p[a>>>6&63],b+=p[a&63],b+="=");return b}function h(c){c=c.replace(/[^A-Za-z0-9+\/]+/g,"");var a=[],b=c.length%4,m,d=c.length,f;for(m=0;m>16,f>>8&255,f&255);a.length-=[0,0,2,1][b];return a}function e(c){var a=[],b,m=c.length,d;for(b=0;bd?a.push(d):2048>d?a.push(192|d>>>6,128|d&63):a.push(224|d>>>12&15,128|d>>>6&63,128|d&63);return a}function b(c){var a=[],b,m=c.length,d,f,n;for(b=0;bd?a.push(d):(b+=1,f=c[b],224>d?a.push((d&31)<<6|f&63):(b+=1,n=c[b],a.push((d&15)<<12|(f&63)<<6|n&63)));return a}function g(c){return l(k(c))} +function a(c){return String.fromCharCode.apply(String,h(c))}function f(c){return b(k(c))}function d(c){c=b(c);for(var a="",m=0;ma?m+=String.fromCharCode(a):(n+=1,d=c.charCodeAt(n)&255,224>a?m+=String.fromCharCode((a&31)<<6|d&63):(n+=1,f=c.charCodeAt(n)&255,m+=String.fromCharCode((a&15)<<12|(d&63)<<6|f&63)));return m}function t(a,b){function m(){var g= +n+d;g>a.length&&(g=a.length);f+=c(a,n,g);n=g;g=n===a.length;b(f,g)&&!g&&runtime.setTimeout(m,0)}var d=1E5,f="",n=0;a.length>>8):(la(a&255),la(a>>>8))},ca=function(){p=(p<<5^m[B+3-1]&255)&8191;x=w[32768+p];w[B&32767]=x;w[32768+p]=B},U=function(a,d){y>16-d?(u|=a<>16-y,y+=d-16):(u|=a<a;a++)m[a]=m[a+32768];O-=32768;B-=32768;v-=32768;for(a=0;8192>a;a++)d=w[32768+a],w[32768+a]=32768<=d?d-32768:0;for(a=0;32768>a;a++)d=w[a],w[a]=32768<=d?d-32768:0;f+=32768}z||(a=Ba(m,B+I,f),0>=a?z=!0:I+=a)},Ca=function(a){var d=X,f=B,b,e=N,g=32506=ma&&(d>>=2);do if(b=a,m[b+e]===s&&m[b+e-1]===p&&m[b]===m[f]&&m[++b]===m[f+1]){f+=2;b++;do++f;while(m[f]=== -m[++b]&&m[++f]===m[++b]&&m[++f]===m[++b]&&m[++f]===m[++b]&&m[++f]===m[++b]&&m[++f]===m[++b]&&m[++f]===m[++b]&&m[++f]===m[++b]&&fe){O=a;e=b;if(258<=b)break;p=m[f+e-1];s=m[f+e]}a=w[a&32767]}while(a>g&&0!==--d);return e},wa=function(a,d){q[Q++]=d;0===a?da[d].fc++:(a--,da[E[d]+256+1].fc++,ba[(256>a?fa[a]:fa[256+(a>>7)])&255].fc++,r[ja++]=a,ka|=qa);qa<<=1;0===(Q&7)&&(ia[aa++]=ka,ka=0,qa=1);if(2e;e++)f+=ba[e].fc*(5+oa[e]);f>>=3; -if(ja>=1,f<<=1;while(0<--d);return f>>1},Ea=function(a,d){var f=[];f.length=16;var b=0,e;for(e=1;15>=e;e++)b=b+R[e-1]<<1,f[e]=b;for(b=0;b<=d;b++)e=a[b].dl,0!==e&&(a[b].fc=Da(f[e]++,e))},Aa=function(a){var d=a.dyn_tree,f=a.static_tree,b=a.elems,e,g=-1,m=b;S=0;ga=573; -for(e=0;eS;)e=L[++S]=2>g?++g:0,d[e].fc=1,K[e]=0,W--,null!==f&&(C-=f[e].dl);a.max_code=g;for(e=S>>1;1<=e;e--)za(d,e);do e=L[1],L[1]=L[S--],za(d,1),f=L[1],L[--ga]=e,L[--ga]=f,d[m].fc=d[e].fc+d[f].fc,K[m]=K[e]>K[f]+1?K[e]:K[f]+1,d[e].dl=d[f].dl=m,L[1]=m++,za(d,1);while(2<=S);L[--ga]=L[1];m=a.dyn_tree;e=a.extra_bits;var b=a.extra_base,f=a.max_code,c=a.max_length,p=a.static_tree,s,h,r,q,l=0;for(h=0;15>=h;h++)R[h]=0;m[L[ga]].dl=0;for(a=ga+1;573>a;a++)s= -L[a],h=m[m[s].dl].dl+1,h>c&&(h=c,l++),m[s].dl=h,s>f||(R[h]++,r=0,s>=b&&(r=e[s-b]),q=m[s].fc,W+=q*(h+r),null!==p&&(C+=q*(p[s].dl+r)));if(0!==l){do{for(h=c-1;0===R[h];)h--;R[h]--;R[h+1]+=2;R[c]--;l-=2}while(0f||(m[e].dl!==h&&(W+=(h-m[e].dl)*m[e].fc,m[e].fc=h),s--)}Ea(d,g)},Fa=function(a,d){var f,b=-1,e,m=a[0].dl,g=0,c=7,p=4;0===m&&(c=138,p=3);a[d+1].dl=65535;for(f=0;f<=d;f++)e=m,m=a[f+1].dl,++g=g?T[17].fc++:T[18].fc++,g=0,b=e,0===m?(c=138,p=3):e===m?(c=6,p=3):(c=7,p=4))},Ga=function(){8f?fa[f]:fa[256+(f>>7)])&255,Y(c,d),p=oa[c],0!==p&&(f-=Z[c],U(f,p))),g>>=1;while(b=g?(Y(17,T),U(g-3,3)):(Y(18,T),U(g-11,7));g=0;b=e;0===m?(c=138,p=3):e===m?(c=6,p=3):(c=7,p=4)}},Ja=function(){var a;for(a=0;286>a;a++)da[a].fc=0;for(a=0;30>a;a++)ba[a].fc=0;for(a=0;19>a;a++)T[a].fc=0;da[256].fc=1;ka=Q=ja=aa=W=C=0;qa=1},xa=function(a){var d,f,b,e;e=B-v;ia[aa]=ka;Aa(P);Aa(F);Fa(da,P.max_code);Fa(ba,F.max_code);Aa(J);for(b=18;3<=b&&0===T[sa[b]].dl;b--);W+=3*(b+1)+14;d=W+3+7>>3;f=C+ -3+7>>3;f<=d&&(d=f);if(e+4<=d&&0<=v)for(U(0+a,3),Ga(),pa(e),pa(~e),b=0;ba.len&&(c=a.len);for(p=0;pt-f&&(c= -t-f);for(p=0;pr;r++)for(ha[r]=h,c=0;c<1<r;r++)for(Z[r]=h,c=0;c<1<>=7;30>r;r++)for(Z[r]=h<<7,c=0;c<1<=c;c++)R[c]=0;for(c=0;143>=c;)M[c++].dl=8,R[8]++;for(;255>=c;)M[c++].dl=9,R[9]++;for(;279>=c;)M[c++].dl=7,R[7]++;for(;287>=c;)M[c++].dl=8,R[8]++;Ea(M,287);for(c=0;30>c;c++)$[c].dl=5,$[c].fc=Da(c,5);Ja()}for(c=0;8192>c;c++)w[32768+c]=0;ea=ra[V].max_lazy;ma=ra[V].good_length;X=ra[V].max_chain;v=B=0;I=Ba(m,0,65536);if(0>=I)z=!0,I=0;else{for(z=!1;262>I&& -!z;)ya();for(c=p=0;2>c;c++)p=(p<<5^m[c]&255)&8191}a=null;f=t=0;3>=V?(N=2,A=0):(A=2,G=0);s=!1}e=!0;if(0===I)return s=!0,0}c=Ka(d,b,g);if(c===g)return g;if(s)return c;if(3>=V)for(;0!==I&&null===a;){ca();0!==x&&32506>=B-x&&(A=Ca(x),A>I&&(A=I));if(3<=A)if(r=wa(B-O,A-3),I-=A,A<=ea){A--;do B++,ca();while(0!==--A);B++}else B+=A,A=0,p=m[B]&255,p=(p<<5^m[B+1]&255)&8191;else r=wa(0,m[B]&255),I--,B++;r&&(xa(0),v=B);for(;262>I&&!z;)ya()}else for(;0!==I&&null===a;){ca();N=A;D=O;A=2;0!==x&&(N=B-x)&& -(A=Ca(x),A>I&&(A=I),3===A&&4096I&&!z;)ya()}0===I&&(0!==G&&wa(0,m[B-1]&255),xa(1),s=!0);return c+Ka(d,c+b,g-c)};this.deflate=function(f,c){var p,s;na=f;ua=0;"undefined"===String(typeof c)&&(c=6);(p=c)?1>p?p=1:9p;p++)da[p]=new k;ba=[];ba.length=61;for(p=0;61>p;p++)ba[p]=new k;M=[];M.length=288;for(p=0;288>p;p++)M[p]=new k;$=[];$.length=30;for(p=0;30>p;p++)$[p]=new k;T=[];T.length=39;for(p=0;39>p;p++)T[p]=new k;P=new l;F=new l;J=new l;R=[];R.length=16;L=[];L.length=573;K=[];K.length=573;E=[];E.length=256;fa=[];fa.length=512;ha=[];ha.length=29;Z=[];Z.length=30;ia=[];ia.length=1024}var u=Array(1024),t=[],x=[];for(p=La(u,0,u.length);0>>8):(ka(a&255),ka(a>>>8))},ba=function(){s=(s<<5^n[B+3-1]&255)&8191;v=w[32768+s];w[B&32767]=v;w[32768+s]=B},U=function(c,a){y>16-a?(u|=c<>16-y,y+=a-16):(u|=c<c;c++)n[c]=n[c+32768];P-=32768;B-=32768;x-=32768;for(c=0;8192>c;c++)a=w[32768+c],w[32768+c]=32768<=a?a-32768:0;for(c=0;32768>c;c++)a=w[c],w[c]=32768<=a?a-32768:0;b+=32768}z||(c=pa(n,B+J,b),0>=c?z=!0:J+=c)},Ca=function(c){var a=X,b=B,m,d=O,f=32506=qa&&(a>>=2);do if(m=c,n[m+d]===e&&n[m+d-1]===q&&n[m]===n[b]&&n[++m]===n[b+1]){b+= +2;m++;do++b;while(n[b]===n[++m]&&n[++b]===n[++m]&&n[++b]===n[++m]&&n[++b]===n[++m]&&n[++b]===n[++m]&&n[++b]===n[++m]&&n[++b]===n[++m]&&n[++b]===n[++m]&&bd){P=c;d=m;if(258<=m)break;q=n[b+d-1];e=n[b+d]}c=w[c&32767]}while(c>f&&0!==--a);return d},xa=function(c,a){r[H++]=a;0===c?aa[a].fc++:(c--,aa[fa[a]+256+1].fc++,ca[(256>c?M[c]:M[256+(c>>7)])&255].fc++,p[ga++]=c,ja|=ra);ra<<=1;0===(H&7)&&(ia[Z++]=ja,ja=0,ra=1);if(2d;d++)b+=ca[d].fc* +(5+oa[d]);b>>=3;if(ga>=1,b<<=1;while(0<--a);return b>>1},Ea=function(c,a){var b=[];b.length=16;var m=0,d;for(d=1;15>=d;d++)m=m+R[d-1]<<1,b[d]=m;for(m=0;m<=a;m++)d=c[m].dl,0!==d&&(c[m].fc=Da(b[d]++,d))},Ba=function(c){var a=c.dyn_tree,b=c.static_tree,m=c.elems,d,n=-1, +f=m;S=0;ha=573;for(d=0;dS;)d=L[++S]=2>n?++n:0,a[d].fc=1,ea[d]=0,W--,null!==b&&(C-=b[d].dl);c.max_code=n;for(d=S>>1;1<=d;d--)Aa(a,d);do d=L[1],L[1]=L[S--],Aa(a,1),b=L[1],L[--ha]=d,L[--ha]=b,a[f].fc=a[d].fc+a[b].fc,ea[f]=ea[d]>ea[b]+1?ea[d]:ea[b]+1,a[d].dl=a[b].dl=f,L[1]=f++,Aa(a,1);while(2<=S);L[--ha]=L[1];f=c.dyn_tree;d=c.extra_bits;var m=c.extra_base,b=c.max_code,g=c.max_length,q=c.static_tree,e,p,s,h,r=0;for(p=0;15>=p;p++)R[p]=0;f[L[ha]].dl= +0;for(c=ha+1;573>c;c++)e=L[c],p=f[f[e].dl].dl+1,p>g&&(p=g,r++),f[e].dl=p,e>b||(R[p]++,s=0,e>=m&&(s=d[e-m]),h=f[e].fc,W+=h*(p+s),null!==q&&(C+=h*(q[e].dl+s)));if(0!==r){do{for(p=g-1;0===R[p];)p--;R[p]--;R[p+1]+=2;R[g]--;r-=2}while(0b||(f[d].dl!==p&&(W+=(p-f[d].dl)*f[d].fc,f[d].fc=p),e--)}Ea(a,n)},Fa=function(c,a){var b,m=-1,d,f=c[0].dl,n=0,g=7,e=4;0===f&&(g=138,e=3);c[a+1].dl=65535;for(b=0;b<=a;b++)d=f,f=c[b+1].dl,++n=n?T[17].fc++:T[18].fc++,n=0,m=d,0===f?(g=138,e=3):d===f?(g=6,e=3):(g=7,e=4))},Ga=function(){8b?M[b]:M[256+(b>>7)])&255,$(g,a),e=oa[g],0!==e&&(b-=na[g],U(b,e))),n>>=1;while(m=n?($(17,T),U(n-3,3)):($(18,T),U(n-11,7));n=0;m=d;0===f?(g=138,e=3):d===f?(g=6,e=3):(g=7,e=4)}},Ja=function(){var c;for(c=0;286>c;c++)aa[c].fc=0;for(c=0;30>c;c++)ca[c].fc=0;for(c=0;19>c;c++)T[c].fc=0;aa[256].fc=1;ja=H=ga=Z=W=C=0;ra=1},ya=function(c){var a,b,m,d;d=B-x;ia[Z]=ja;Ba(N);Ba(E);Fa(aa,N.max_code);Fa(ca,E.max_code);Ba(K);for(m=18;3<=m&&0===T[ta[m]].dl;m--);W+= +3*(m+1)+14;a=W+3+7>>3;b=C+3+7>>3;b<=a&&(a=b);if(d+4<=a&&0<=x)for(U(0+c,3),Ga(),ma(d),ma(~d),m=0;ma.len&&(e=a.len);for(p=0;pt-m&&(e=t-m);for(p=0;pp;p++)for(G[p]=g,e= +0;e<1<p;p++)for(na[p]=g,e=0;e<1<>=7;30>p;p++)for(na[p]=g<<7,e=0;e<1<=e;e++)R[e]=0;for(e=0;143>=e;)Q[e++].dl=8,R[8]++;for(;255>=e;)Q[e++].dl=9,R[9]++;for(;279>=e;)Q[e++].dl=7,R[7]++;for(;287>=e;)Q[e++].dl=8,R[8]++;Ea(Q,287);for(e=0;30>e;e++)Y[e].dl=5,Y[e].fc=Da(e,5);Ja()}for(e=0;8192>e;e++)w[32768+e]=0;da=sa[V].max_lazy;qa=sa[V].good_length;X=sa[V].max_chain;x=B=0;J=pa(n,0,65536);if(0>=J)z=!0, +J=0;else{for(z=!1;262>J&&!z;)za();for(e=s=0;2>e;e++)s=(s<<5^n[e]&255)&8191}a=null;m=t=0;3>=V?(O=2,D=0):(D=2,F=0);q=!1}d=!0;if(0===J)return q=!0,0}e=Ka(c,b,f);if(e===f)return f;if(q)return e;if(3>=V)for(;0!==J&&null===a;){ba();0!==v&&32506>=B-v&&(D=Ca(v),D>J&&(D=J));if(3<=D)if(p=xa(B-P,D-3),J-=D,D<=da){D--;do B++,ba();while(0!==--D);B++}else B+=D,D=0,s=n[B]&255,s=(s<<5^n[B+1]&255)&8191;else p=xa(0,n[B]&255),J--,B++;p&&(ya(0),x=B);for(;262>J&&!z;)za()}else for(;0!==J&&null===a;){ba();O=D;A=P;D=2;0!== +v&&(O=B-v)&&(D=Ca(v),D>J&&(D=J),3===D&&4096J&&!z;)za()}0===J&&(0!==F&&xa(0,n[B-1]&255),ya(1),q=!0);return e+Ka(c,e+b,f-e)};this.deflate=function(m,e){var q,s;la=m;va=0;"undefined"===String(typeof e)&&(e=6);(q=e)?1>q?q=1:9q;q++)aa[q]=new k;ca=[];ca.length=61;for(q=0;61>q;q++)ca[q]=new k;Q=[];Q.length=288;for(q=0;288>q;q++)Q[q]=new k;Y=[];Y.length=30;for(q=0;30>q;q++)Y[q]=new k;T=[];T.length=39;for(q=0;39>q;q++)T[q]=new k;N=new l;E=new l;K=new l;R=[];R.length=16;L=[];L.length=573;ea=[];ea.length=573;fa=[];fa.length=256;M=[];M.length=512;G=[];G.length=29;na=[];na.length=30;ia=[];ia.length=1024}var h=Array(1024),u=[],v=[];for(q=La(h,0,h.length);0< +q;){v.length=q;for(s=0;s>8&255])};this.appendUInt32LE=function(c){l.appendArray([c&255,c>>8&255,c>>16&255,c>>24&255])};this.appendString=function(c){n=runtime.concatByteArrays(n, -runtime.byteArrayFromString(c,k))};this.getLength=function(){return n.length};this.getByteArray=function(){return n}}; +core.ByteArrayWriter=function(k){var l=this,h=new runtime.ByteArray(0);this.appendByteArrayWriter=function(e){h=runtime.concatByteArrays(h,e.getByteArray())};this.appendByteArray=function(e){h=runtime.concatByteArrays(h,e)};this.appendArray=function(e){h=runtime.concatByteArrays(h,runtime.byteArrayFromArray(e))};this.appendUInt16LE=function(e){l.appendArray([e&255,e>>8&255])};this.appendUInt32LE=function(e){l.appendArray([e&255,e>>8&255,e>>16&255,e>>24&255])};this.appendString=function(e){h=runtime.concatByteArrays(h, +runtime.byteArrayFromString(e,k))};this.getLength=function(){return h.length};this.getByteArray=function(){return h}}; // Input 6 -core.RawInflate=function(){var k,l,n=null,c,b,h,a,g,e,d,t,f,s,m,r,q,w,u=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],y=[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],v=[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],p=[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],D=[16,17,18, -0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],G=function(){this.list=this.next=null},A=function(){this.n=this.b=this.e=0;this.t=null},N=function(a,d,f,b,e,c){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var m=Array(this.BMAX+1),g,p,s,h,r,q,l,k=Array(this.BMAX+1),u,t,w,x=new A,n=Array(this.BMAX);h=Array(this.N_MAX);var v,y=Array(this.BMAX+1),D,B,z;z=this.root=null;for(r=0;rr&&(c=r);for(D=1<(D-=m[q])){this.status=2;this.m=c;return}if(0>(D-=m[r]))this.status=2,this.m=c;else{m[r]+=D;y[1]=q=0;u=m;t=1;for(w=2;0<--r;)y[w++]=q+=u[t++];u=a;r=t=0;do 0!=(q=u[t++])&&(h[y[q]++]=r);while(++rv+k[1+h];){v+=k[1+h];h++;B=(B=s-v)>c?c:B;if((p=1<<(q=l-v))>a+1)for(p-=a+1,w=l;++qg&&v>v-k[h],n[h-1][q].e=x.e,n[h-1][q].b=x.b,n[h-1][q].n=x.n,n[h-1][q].t=x.t)}x.b=l-v;t>=d?x.e=99:u[t]u[t]?16:15,x.n=u[t++]): -(x.e=e[u[t]-f],x.n=b[u[t++]-f]);p=1<>v;q>=1)r^=q;for(r^=q;(r&(1<>=d;a-=d},I=function(a,b,e){var c,p,h;if(0==e)return 0;for(h=0;;){B(m);p=f.list[O(m)];for(c=p.e;16 -c;c++)u[D[c]]=0;m=7;c=new N(u,19,19,null,null,m);if(0!=c.status)return-1;f=c.root;m=c.m;h=l+k;for(e=g=0;ec)u[e++]=g=c;else if(16==c){B(2);c=3+O(2);z(2);if(e+c>h)return-1;for(;0h)return-1;for(;0F;F++)P[F]=8;for(;256>F;F++)P[F]=9;for(;280>F;F++)P[F]=7;for(;288>F;F++)P[F]=8;b=7;F=new N(P,288,257,y,v,b);if(0!=F.status){alert("HufBuild error: "+F.status);M=-1;break b}n=F.root;b=F.m;for(F=0;30>F;F++)P[F]=5;X=5;F=new N(P,30,0,p,x,X);if(1s&&(n=s);for(A=1<(A-=f[h])){this.status=2;this.m=n;return}if(0>(A-=f[s]))this.status=2,this.m=n;else{f[s]+=A;y[1]=h=0;k=f;u=1;for(v=2;0<--s;)y[v++]=h+=k[u++];k=c;s=u=0;do 0!=(h=k[u++])&&(q[y[h]++]=s);while(++sx+l[1+q];){x+=l[1+q];q++;B=(B=p-x)>n?n:B;if((g=1<<(h=r-x))>c+1)for(g-=c+1,v=r;++he&&x>x-l[q],w[q-1][h].e=t.e,w[q-1][h].b=t.b,w[q-1][h].n=t.n,w[q-1][h].t=t.t)}t.b=r-x;u>=a?t.e=99:k[u]k[u]?16:15,t.n=k[u++]): +(t.e=d[k[u]-b],t.n=m[k[u++]-b]);g=1<>x;h>=1)s^=h;for(s^=h;(s&(1<>=c;a-=c},J=function(a,b,d){var e,g,s;if(0==d)return 0;for(s=0;;){B(n);g=m.list[P(n)];for(e=g.e;16 +f;f++)k[A[f]]=0;n=7;f=new O(k,19,19,null,null,n);if(0!=f.status)return-1;m=f.root;n=f.m;g=r+l;for(d=e=0;df)k[d++]=e=f;else if(16==f){B(2);f=3+P(2);z(2);if(d+f>g)return-1;for(;0g)return-1;for(;0E;E++)N[E]=8;for(;256>E;E++)N[E]=9;for(;280>E;E++)N[E]=7;for(;288>E;E++)N[E]=8;b=7;E=new O(N,288,257,y,x,b);if(0!=E.status){alert("HufBuild error: "+E.status);Q=-1;break b}h=E.root;b=E.m;for(E=0;30>E;E++)N[E]=5;X=5;E=new O(N,30,0,s,v,X);if(1k))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0l))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}}; +core.LoopWatchDog=function(k,l){var h=Date.now(),e=0;this.check=function(){var b;if(k&&(b=Date.now(),b-h>k))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0l))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}}; // Input 8 -core.Utils=function(){this.hashString=function(k){var l=0,n,c;n=0;for(c=k.length;n=c.compareBoundaryPoints(c.START_TO_START,b)&&0<=c.compareBoundaryPoints(c.END_TO_END,b)};this.rangesIntersect=function(c,b){return 0>=c.compareBoundaryPoints(c.END_TO_START,b)&&0<=c.compareBoundaryPoints(c.START_TO_END,b)};this.getNodesInRange=function(c,b){var h=[],a,g=c.startContainer.ownerDocument.createTreeWalker(c.commonAncestorContainer,NodeFilter.SHOW_ALL,b,!1);for(a=g.currentNode=c.startContainer;a;){if(b(a)=== -NodeFilter.FILTER_ACCEPT)h.push(a);else if(b(a)===NodeFilter.FILTER_REJECT)break;a=a.parentNode}h.reverse();for(a=g.nextNode();a;)h.push(a),a=g.nextNode();return h};this.normalizeTextNodes=function(c){c&&c.nextSibling&&(c=k(c,c.nextSibling));c&&c.previousSibling&&k(c.previousSibling,c)};this.rangeContainsNode=function(c,b){var h=b.ownerDocument.createRange(),a=b.nodeType===Node.TEXT_NODE?b.length:b.childNodes.length;h.setStart(c.startContainer,c.startOffset);h.setEnd(c.endContainer,c.endOffset);a= -0===h.comparePoint(b,0)&&0===h.comparePoint(b,a);h.detach();return a};this.mergeIntoParent=function(c){for(var b=c.parentNode;c.firstChild;)b.insertBefore(c.firstChild,c);b.removeChild(c);return b};this.getElementsByTagNameNS=function(c,b,h){return Array.prototype.slice.call(c.getElementsByTagNameNS(b,h))};this.rangeIntersectsNode=function(c,b){var h=b.nodeType===Node.TEXT_NODE?b.length:b.childNodes.length;return 0>=c.comparePoint(b,0)&&0<=c.comparePoint(b,h)};this.containsNode=function(c,b){return c=== -b||c.contains(b)};(function(){var c=runtime.getWindow();null!==c&&(c=c.navigator.appVersion.toLowerCase(),c=-1===c.indexOf("chrome")&&(-1!==c.indexOf("applewebkit")||-1!==c.indexOf("safari")))&&(n.containsNode=l)})()}; +core.DomUtils=function(){function k(h,e){if(h.nodeType===Node.TEXT_NODE)if(0===h.length)h.parentNode.removeChild(h);else if(e.nodeType===Node.TEXT_NODE)return e.insertData(0,h.data),h.parentNode.removeChild(h),e;return h}function l(h,e){return h===e||Boolean(h.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)}this.splitBoundaries=function(h){var e=[],b;if(h.startContainer.nodeType===Node.TEXT_NODE||h.endContainer.nodeType===Node.TEXT_NODE){b=h.endContainer;var g=h.endOffset;if(g=h.compareBoundaryPoints(h.START_TO_START,e)&&0<=h.compareBoundaryPoints(h.END_TO_END,e)};this.rangesIntersect=function(h,e){return 0>=h.compareBoundaryPoints(h.END_TO_START,e)&&0<=h.compareBoundaryPoints(h.START_TO_END,e)};this.getNodesInRange=function(h,e){runtime.assert(Boolean(h.startContainer),"Expected to get a range with a startContainer in getNodesInRange().");var b=[],g,a=h.startContainer.ownerDocument.createTreeWalker(h.commonAncestorContainer, +NodeFilter.SHOW_ALL,e,!1);for(g=a.currentNode=h.startContainer;g;){if(e(g)===NodeFilter.FILTER_ACCEPT)b.push(g);else if(e(g)===NodeFilter.FILTER_REJECT)break;g=g.parentNode}b.reverse();for(g=a.nextNode();g;)b.push(g),g=a.nextNode();return b};this.normalizeTextNodes=function(h){h&&h.nextSibling&&(h=k(h,h.nextSibling));h&&h.previousSibling&&k(h.previousSibling,h)};this.rangeContainsNode=function(h,e){runtime.assert(Boolean(e),"Expected to get a node in rangeContainsNode()");var b=e.ownerDocument.createRange(), +g=e.nodeType===Node.TEXT_NODE?e.length:e.childNodes.length;b.setStart(h.startContainer,h.startOffset);b.setEnd(h.endContainer,h.endOffset);g=0===b.comparePoint(e,0)&&0===b.comparePoint(e,g);b.detach();return g};this.mergeIntoParent=function(h){for(var e=h.parentNode;h.firstChild;)e.insertBefore(h.firstChild,h);e.removeChild(h);return e};this.getElementsByTagNameNS=function(h,e,b){return Array.prototype.slice.call(h.getElementsByTagNameNS(e,b))};this.rangeIntersectsNode=function(h,e){var b=e.nodeType=== +Node.TEXT_NODE?e.length:e.childNodes.length;return 0>=h.comparePoint(e,0)&&0<=h.comparePoint(e,b)};this.containsNode=function(h,e){return h===e||h.contains(e)};(function(h){var e=runtime.getWindow();null!==e&&(e=e.navigator.appVersion.toLowerCase(),e=-1===e.indexOf("chrome")&&(-1!==e.indexOf("applewebkit")||-1!==e.indexOf("safari")))&&(h.containsNode=l)})(this)}; // Input 10 runtime.loadClass("core.DomUtils"); -core.Cursor=function(k,l){function n(a){a.parentNode&&(g.push(a.previousSibling),g.push(a.nextSibling),a.parentNode.removeChild(a))}function c(a,d,b){if(d.nodeType===Node.TEXT_NODE){runtime.assert(Boolean(d),"putCursorIntoTextNode: invalid container");var e=d.parentNode;runtime.assert(Boolean(e),"putCursorIntoTextNode: container without parent");runtime.assert(0<=b&&b<=d.length,"putCursorIntoTextNode: offset is out of bounds");0===b?e.insertBefore(a,d):(b!==d.length&&d.splitText(b),e.insertBefore(a, -d.nextSibling))}else if(d.nodeType===Node.ELEMENT_NODE){runtime.assert(Boolean(d),"putCursorIntoContainer: invalid container");for(e=d.firstChild;null!==e&&01/g?"-0":String(g),k(d+" should be "+a+". Was "+c+".")):k(d+" should be "+a+" (of type "+typeof a+"). Was "+g+" (of type "+typeof g+").")}var a=0,g;g=function(a,d){var c=Object.keys(a),f=Object.keys(d);c.sort();f.sort();return l(c,f)&&Object.keys(a).every(function(f){var c= -a[f],g=d[f];return b(c,g)?!0:(k(c+" should be "+g+" for key "+f),!1)})};this.areNodesEqual=c;this.shouldBeNull=function(a,d){h(a,d,"null")};this.shouldBeNonNull=function(a,d){var b,f;try{f=eval(d)}catch(c){b=c}b?k(d+" should be non-null. Threw exception "+b):null!==f?runtime.log("pass",d+" is non-null."):k(d+" should be non-null. Was "+f)};this.shouldBe=h;this.countFailedTests=function(){return a}}; -core.UnitTester=function(){function k(c,b){return""+c+""}var l=0,n={};this.runTests=function(c,b,h){function a(f){if(0===f.length)n[g]=t,l+=e.countFailedTests(),b();else{s=f[0];var c=Runtime.getFunctionName(s);runtime.log("Running "+c);r=e.countFailedTests();d.setUp();s(function(){d.tearDown();t[c]=r===e.countFailedTests();a(f.slice(1))})}}var g=Runtime.getFunctionName(c),e=new core.UnitTestRunner,d=new c(e),t={},f,s,m,r,q="BrowserRuntime"=== -runtime.type();if(n.hasOwnProperty(g))runtime.log("Test "+g+" has already run.");else{q?runtime.log("Running "+k(g,'runSuite("'+g+'");')+": "+d.description()+""):runtime.log("Running "+g+": "+d.description);m=d.tests();for(f=0;fRunning "+k(c,'runTest("'+g+'","'+c+'")')+""):runtime.log("Running "+c),r=e.countFailedTests(),d.setUp(),s(),d.tearDown(),t[c]=r===e.countFailedTests()); -a(d.asyncTests())}};this.countFailedTests=function(){return l};this.results=function(){return n}}; +core.UnitTestRunner=function(){function k(b){a+=1;runtime.log("fail",b)}function l(a,c){var b;try{if(a.length!==c.length)return k("array of length "+a.length+" should be "+c.length+" long"),!1;for(b=0;b1/e?"-0":String(e),k(c+" should be "+a+". Was "+f+".")):k(c+" should be "+a+" (of type "+typeof a+"). Was "+e+" (of type "+typeof e+").")}var a=0,f;f=function(a,c){var f=Object.keys(a),m=Object.keys(c);f.sort();m.sort();return l(f,m)&&Object.keys(a).every(function(m){var f= +a[m],e=c[m];return b(f,e)?!0:(k(f+" should be "+e+" for key "+m),!1)})};this.areNodesEqual=e;this.shouldBeNull=function(a,c){g(a,c,"null")};this.shouldBeNonNull=function(a,c){var b,m;try{m=eval(c)}catch(f){b=f}b?k(c+" should be non-null. Threw exception "+b):null!==m?runtime.log("pass",c+" is non-null."):k(c+" should be non-null. Was "+m)};this.shouldBe=g;this.countFailedTests=function(){return a}}; +core.UnitTester=function(){function k(e,b){return""+e+""}var l=0,h={};this.runTests=function(e,b,g){function a(m){if(0===m.length)h[f]=t,l+=d.countFailedTests(),b();else{q=m[0];var e=Runtime.getFunctionName(q);runtime.log("Running "+e);p=d.countFailedTests();c.setUp();q(function(){c.tearDown();t[e]=p===d.countFailedTests();a(m.slice(1))})}}var f=Runtime.getFunctionName(e),d=new core.UnitTestRunner,c=new e(d),t={},m,q,n,p,r="BrowserRuntime"=== +runtime.type();if(h.hasOwnProperty(f))runtime.log("Test "+f+" has already run.");else{r?runtime.log("Running "+k(f,'runSuite("'+f+'");')+": "+c.description()+""):runtime.log("Running "+f+": "+c.description);n=c.tests();for(m=0;mRunning "+k(e,'runTest("'+f+'","'+e+'")')+""):runtime.log("Running "+e),p=d.countFailedTests(),c.setUp(),q(),c.tearDown(),t[e]=p===d.countFailedTests()); +a(c.asyncTests())}};this.countFailedTests=function(){return l};this.results=function(){return h}}; // Input 13 -core.PositionIterator=function(k,l,n,c){function b(){this.acceptNode=function(a){return a.nodeType===Node.TEXT_NODE&&0===a.length?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}function h(a){this.acceptNode=function(d){return d.nodeType===Node.TEXT_NODE&&0===d.length?NodeFilter.FILTER_REJECT:a.acceptNode(d)}}function a(){var a=e.currentNode.nodeType;d=a===Node.TEXT_NODE?e.currentNode.length-1:a===Node.ELEMENT_NODE?1:0}var g=this,e,d,t;this.nextPosition=function(){if(e.currentNode===k)return!1; -if(0===d&&e.currentNode.nodeType===Node.ELEMENT_NODE)null===e.firstChild()&&(d=1);else if(e.currentNode.nodeType===Node.TEXT_NODE&&d+1 "+a.length),runtime.assert(0<=b,"Error in setPosition: "+b+" < 0"), -b===a.length&&(d=void 0,e.nextSibling()?d=0:e.parentNode()&&(d=1),runtime.assert(void 0!==d,"Error in setPosition: position not valid.")),!0;c=t(a);b "+a.length),runtime.assert(0<=b,"Error in setPosition: "+b+" < 0"), +b===a.length&&(c=void 0,d.nextSibling()?c=0:d.parentNode()&&(c=1),runtime.assert(void 0!==c,"Error in setPosition: position not valid.")),!0;e=t(a);b>>8^e;return b^-1}function c(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 b(a){var d=a.getFullYear();return 1980>d?0:d-1980<< -25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function h(a,d){var b,f,e,g,m,h,q,s=this;this.load=function(d){if(void 0!==s.data)d(null,s.data);else{var b=m+34+f+e+256;b+q>r&&(b=r-q);runtime.read(a,q,b,function(b,c){if(b||null===c)d(b,c);else a:{var f=c,e=new core.ByteArray(f),p=e.readUInt32LE(),r;if(67324752!==p)d("File entry signature is wrong."+p.toString()+" "+f.length.toString(),null);else{e.pos+=22;p=e.readUInt16LE();r=e.readUInt16LE();e.pos+=p+r; -if(g){f=f.slice(e.pos,e.pos+m);if(m!==f.length){d("The amount of compressed bytes read was "+f.length.toString()+" instead of "+m.toString()+" for "+s.filename+" in "+a+".",null);break a}f=w(f,h)}else f=f.slice(e.pos,e.pos+h);h!==f.length?d("The amount of bytes read was "+f.length.toString()+" instead of "+h.toString()+" for "+s.filename+" in "+a+".",null):(s.data=f,d(null,f))}}})}};this.set=function(a,d,b,f){s.filename=a;s.data=d;s.compressed=b;s.date=f};this.error=null;d&&(b=d.readUInt32LE(),33639248!== -b?this.error="Central directory entry has wrong signature at position "+(d.pos-4).toString()+' for file "'+a+'": '+d.data.length.toString():(d.pos+=6,g=d.readUInt16LE(),this.date=c(d.readUInt32LE()),d.readUInt32LE(),m=d.readUInt32LE(),h=d.readUInt32LE(),f=d.readUInt16LE(),e=d.readUInt16LE(),b=d.readUInt16LE(),d.pos+=8,q=d.readUInt32LE(),this.filename=runtime.byteArrayToString(d.data.slice(d.pos,d.pos+f),"utf8"),d.pos+=f+e+b))}function a(a,d){if(22!==a.length)d("Central directory length should be 22.", -u);else{var b=new core.ByteArray(a),f;f=b.readUInt32LE();101010256!==f?d("Central directory signature is wrong: "+f.toString(),u):(f=b.readUInt16LE(),0!==f?d("Zip files with non-zero disk numbers are not supported.",u):(f=b.readUInt16LE(),0!==f?d("Zip files with non-zero disk numbers are not supported.",u):(f=b.readUInt16LE(),q=b.readUInt16LE(),f!==q?d("Number of entries is inconsistent.",u):(f=b.readUInt32LE(),b=b.readUInt16LE(),b=r-22-f,runtime.read(k,b,r-b,function(a,b){if(a||null===b)d(a,u);else a:{var f= -new core.ByteArray(b),c,e;m=[];for(c=0;cr?l("File '"+k+"' cannot be read.",u):runtime.read(k,r-22,22,function(d,b){d||null===l||null===b?l(d,u):a(b,l)})})}; +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,d,f=a.length,m=0,m=0;b=-1;for(d=0;d>>8^m;return b^-1}function e(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 b(a){var c=a.getFullYear();return 1980>c?0:c-1980<< +25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function g(a,c){var b,d,f,m,g,n,h,q=this;this.load=function(c){if(void 0!==q.data)c(null,q.data);else{var b=g+34+d+f+256;b+h>p&&(b=p-h);runtime.read(a,h,b,function(b,d){if(b||null===d)c(b,d);else a:{var f=d,e=new core.ByteArray(f),p=e.readUInt32LE(),s;if(67324752!==p)c("File entry signature is wrong."+p.toString()+" "+f.length.toString(),null);else{e.pos+=22;p=e.readUInt16LE();s=e.readUInt16LE();e.pos+=p+s; +if(m){f=f.slice(e.pos,e.pos+g);if(g!==f.length){c("The amount of compressed bytes read was "+f.length.toString()+" instead of "+g.toString()+" for "+q.filename+" in "+a+".",null);break a}f=w(f,n)}else f=f.slice(e.pos,e.pos+n);n!==f.length?c("The amount of bytes read was "+f.length.toString()+" instead of "+n.toString()+" for "+q.filename+" in "+a+".",null):(q.data=f,c(null,f))}}})}};this.set=function(a,c,b,d){q.filename=a;q.data=c;q.compressed=b;q.date=d};this.error=null;c&&(b=c.readUInt32LE(),33639248!== +b?this.error="Central directory entry has wrong signature at position "+(c.pos-4).toString()+' for file "'+a+'": '+c.data.length.toString():(c.pos+=6,m=c.readUInt16LE(),this.date=e(c.readUInt32LE()),c.readUInt32LE(),g=c.readUInt32LE(),n=c.readUInt32LE(),d=c.readUInt16LE(),f=c.readUInt16LE(),b=c.readUInt16LE(),c.pos+=8,h=c.readUInt32LE(),this.filename=runtime.byteArrayToString(c.data.slice(c.pos,c.pos+d),"utf8"),c.pos+=d+f+b))}function a(a,c){if(22!==a.length)c("Central directory length should be 22.", +u);else{var b=new core.ByteArray(a),d;d=b.readUInt32LE();101010256!==d?c("Central directory signature is wrong: "+d.toString(),u):(d=b.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",u):(d=b.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",u):(d=b.readUInt16LE(),r=b.readUInt16LE(),d!==r?c("Number of entries is inconsistent.",u):(d=b.readUInt32LE(),b=b.readUInt16LE(),b=p-22-d,runtime.read(k,b,p-b,function(a,b){if(a||null===b)c(a,u);else a:{var d= +new core.ByteArray(b),f,m;n=[];for(f=0;fp?l("File '"+k+"' cannot be read.",u):runtime.read(k,p-22,22,function(c,b){c||null===l||null===b?l(c,u):a(b,l)})})}; // Input 18 -core.CSSUnits=function(){var k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12};this.convert=function(l,n,c){return l*k[c]/k[n]};this.convertMeasure=function(k,n){var c,b;k&&n?(c=parseFloat(k),b=k.replace(c.toString(),""),c=this.convert(c,b,n)):c="";return c.toString()};this.getUnits=function(k){return k.substr(k.length-2,k.length)}}; +core.CSSUnits=function(){var k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12};this.convert=function(l,h,e){return l*k[e]/k[h]};this.convertMeasure=function(k,h){var e,b;k&&h?(e=parseFloat(k),b=k.replace(e.toString(),""),e=this.convert(e,b,h)):e="";return e.toString()};this.getUnits=function(k){return k.substr(k.length-2,k.length)}}; // Input 19 xmldom.LSSerializerFilter=function(){}; // Input 20 "function"!==typeof Object.create&&(Object.create=function(k){var l=function(){};l.prototype=k;return new l}); -xmldom.LSSerializer=function(){function k(b){var c=b||{},a=function(a){var d={},b;for(b in a)a.hasOwnProperty(b)&&(d[a[b]]=b);return d}(b),g=[c],e=[a],d=0;this.push=function(){d+=1;c=g[d]=Object.create(c);a=e[d]=Object.create(a)};this.pop=function(){g[d]=void 0;e[d]=void 0;d-=1;c=g[d];a=e[d]};this.getLocalNamespaceDefinitions=function(){return a};this.getQName=function(d){var b=d.namespaceURI,e=0,g;if(!b)return d.localName;if(g=a[b])return g+":"+d.localName;do{g||!d.prefix?(g="ns"+e,e+=1):g=d.prefix; -if(c[g]===b)break;if(!c[g]){c[g]=b;a[b]=g;break}g=null}while(null===g);return g+":"+d.localName}}function l(b){return b.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}function n(b,h){var a="",g=c.filter?c.filter.acceptNode(h):NodeFilter.FILTER_ACCEPT,e;if(g===NodeFilter.FILTER_ACCEPT&&h.nodeType===Node.ELEMENT_NODE){b.push();e=b.getQName(h);var d,k=h.attributes,f,s,m,r="",q;d="<"+e;f=k.length;for(s=0;s")}if(g===NodeFilter.FILTER_ACCEPT||g===NodeFilter.FILTER_SKIP){for(g=h.firstChild;g;)a+=n(b,g),g=g.nextSibling;h.nodeValue&&(a+=l(h.nodeValue))}e&&(a+="",b.pop());return a}var c=this;this.filter=null;this.writeToString=function(b,c){if(!b)return"";var a=new k(c);return n(a,b)}}; +xmldom.LSSerializer=function(){function k(b){var e=b||{},a=function(a){var c={},b;for(b in a)a.hasOwnProperty(b)&&(c[a[b]]=b);return c}(b),f=[e],d=[a],c=0;this.push=function(){c+=1;e=f[c]=Object.create(e);a=d[c]=Object.create(a)};this.pop=function(){f[c]=void 0;d[c]=void 0;c-=1;e=f[c];a=d[c]};this.getLocalNamespaceDefinitions=function(){return a};this.getQName=function(c){var b=c.namespaceURI,d=0,f;if(!b)return c.localName;if(f=a[b])return f+":"+c.localName;do{f||!c.prefix?(f="ns"+d,d+=1):f=c.prefix; +if(e[f]===b)break;if(!e[f]){e[f]=b;a[b]=f;break}f=null}while(null===f);return f+":"+c.localName}}function l(b){return b.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}function h(b,g){var a="",f=e.filter?e.filter.acceptNode(g):NodeFilter.FILTER_ACCEPT,d;if(f===NodeFilter.FILTER_ACCEPT&&g.nodeType===Node.ELEMENT_NODE){b.push();d=b.getQName(g);var c,k=g.attributes,m,q,n,p="",r;c="<"+d;m=k.length;for(q=0;q")}if(f===NodeFilter.FILTER_ACCEPT||f===NodeFilter.FILTER_SKIP){for(f=g.firstChild;f;)a+=h(b,f),f=f.nextSibling;g.nodeValue&&(a+=l(g.nodeValue))}d&&(a+="",b.pop());return a}var e=this;this.filter=null;this.writeToString=function(b,e){if(!b)return"";var a=new k(e);return h(a,b)}}; // Input 21 -xmldom.RelaxNGParser=function(){function k(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 n(a){a=a.split(":",2);var b="",f;1===a.length?a=["",a[0]]:b=a[0];for(f in g)g[f]===b&&(a[0]=f);return a}function c(a,b){for(var f=0,e,g,h=a.name;a.e&&f=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 h(a){a=a.split(":",2);var b="",d;1===a.length?a=["",a[0]]:b=a[0];for(d in f)f[d]===b&&(a[0]=d);return a}function e(a,b){for(var d=0,f,g,p=a.name;a.e&&d=c.length)return b;0===f&&(f=0);for(var e=c.item(f);e.namespaceURI===d;){f+=1;if(f>=c.length)return b;e=c.item(f)}return e=g(a,b.attDeriv(a,c.item(f)),c,f+1)}function e(a,b,d){d.e[0].a?(a.push(d.e[0].text),b.push(d.e[0].a.ns)):e(a,b,d.e[0]);d.e[1].a?(a.push(d.e[1].text),b.push(d.e[1].a.ns)): -e(a,b,d.e[1])}var d="http://www.w3.org/2000/xmlns/",t,f,s,m,r,q,w,u,y,v,p={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return p},startTagOpenDeriv:function(){return p},attDeriv:function(){return p},startTagCloseDeriv:function(){return p},endTagDeriv:function(){return p}},x={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return p},startTagOpenDeriv:function(){return p},attDeriv:function(){return p},startTagCloseDeriv:function(){return x},endTagDeriv:function(){return p}}, -D={type:"text",nullable:!0,hash:"text",textDeriv:function(){return D},startTagOpenDeriv:function(){return p},attDeriv:function(){return p},startTagCloseDeriv:function(){return D},endTagDeriv:function(){return p}},G,A,N;t=c("choice",function(a,b){if(a===p)return b;if(b===p||a===b)return a},function(a,d){var c={},f;b(c,{p1:a,p2:d});d=a=void 0;for(f in c)c.hasOwnProperty(f)&&(void 0===a?a=c[f]:d=void 0===d?c[f]:t(d,c[f]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable, -textDeriv:function(d,c){return t(a.textDeriv(d,c),b.textDeriv(d,c))},startTagOpenDeriv:n(function(d){return t(a.startTagOpenDeriv(d),b.startTagOpenDeriv(d))}),attDeriv:function(d,c){return t(a.attDeriv(d,c),b.attDeriv(d,c))},startTagCloseDeriv:k(function(){return t(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:k(function(){return t(a.endTagDeriv(),b.endTagDeriv())})}}(a,d)});f=function(a,b,d){return function(){var c={},f=0;return function(e,g){var m=b&&b(e,g),h,p;if(void 0!==m)return m; -m=e.hash||e.toString();h=g.hash||g.toString();m=d.length)return b;0===e&&(e=0);for(var m=d.item(e);m.namespaceURI===c;){e+=1;if(e>=d.length)return b;m=d.item(e)}return m=f(a,b.attDeriv(a,d.item(e)),d,e+1)}function d(a,b,c){c.e[0].a?(a.push(c.e[0].text),b.push(c.e[0].a.ns)):d(a,b,c.e[0]);c.e[1].a?(a.push(c.e[1].text),b.push(c.e[1].a.ns)): +d(a,b,c.e[1])}var c="http://www.w3.org/2000/xmlns/",t,m,q,n,p,r,w,u,y,x,s={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return s},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return s},endTagDeriv:function(){return s}},v={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return s},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return v},endTagDeriv:function(){return s}}, +A={type:"text",nullable:!0,hash:"text",textDeriv:function(){return A},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return A},endTagDeriv:function(){return s}},F,D,O;t=e("choice",function(a,b){if(a===s)return b;if(b===s||a===b)return a},function(a,c){var d={},f;b(d,{p1:a,p2:c});c=a=void 0;for(f in d)d.hasOwnProperty(f)&&(void 0===a?a=d[f]:c=void 0===c?d[f]:t(c,d[f]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable, +textDeriv:function(c,d){return t(a.textDeriv(c,d),b.textDeriv(c,d))},startTagOpenDeriv:h(function(c){return t(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,d){return t(a.attDeriv(c,d),b.attDeriv(c,d))},startTagCloseDeriv:k(function(){return t(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:k(function(){return t(a.endTagDeriv(),b.endTagDeriv())})}}(a,c)});m=function(a,b,c){return function(){var d={},f=0;return function(e,m){var g=b&&b(e,m),n,p;if(void 0!==g)return g; +g=e.hash||e.toString();n=m.hash||m.toString();gNode.ELEMENT_NODE;){if(d!==Node.COMMENT_NODE&&(d!==Node.TEXT_NODE||!/^\s+$/.test(b.currentNode.nodeValue)))return[new k("Not allowed node of type "+ -d+".")];d=(c=b.nextSibling())?c.nodeType:0}if(!c)return[new k("Missing element "+a.names)];if(a.names&&-1===a.names.indexOf(h[c.namespaceURI]+":"+c.localName))return[new k("Found "+c.nodeName+" instead of "+a.names+".",c)];if(b.firstChild()){for(n=l(a.e[1],b,c);b.nextSibling();)if(d=b.currentNode.nodeType,!(b.currentNode&&b.currentNode.nodeType===Node.TEXT_NODE&&/^\s+$/.test(b.currentNode.nodeValue)||d===Node.COMMENT_NODE))return[new k("Spurious content.",b.currentNode)];if(b.parentNode()!==c)return[new k("Implementation error.")]}else n= -l(a.e[1],b,c);b.nextSibling();return n}var c,b,h;b=function(a,c,e,d){var h=a.name,f=null;if("text"===h)a:{for(var s=(a=c.currentNode)?a.nodeType:0;a!==e&&3!==s;){if(1===s){f=[new k("Element not allowed here.",a)];break a}s=(a=c.nextSibling())?a.nodeType:0}c.nextSibling();f=null}else if("data"===h)f=null;else if("value"===h)d!==a.text&&(f=[new k("Wrong value, should be '"+a.text+"', not '"+d+"'",e)]);else if("list"===h)f=null;else if("attribute"===h)a:{if(2!==a.e.length)throw"Attribute with wrong # of elements: "+ -a.e.length;h=a.localnames.length;for(f=0;fNode.ELEMENT_NODE;){if(c!==Node.COMMENT_NODE&&(c!==Node.TEXT_NODE||!/^\s+$/.test(b.currentNode.nodeValue)))return[new k("Not allowed node of type "+ +c+".")];c=(d=b.nextSibling())?d.nodeType:0}if(!d)return[new k("Missing element "+a.names)];if(a.names&&-1===a.names.indexOf(g[d.namespaceURI]+":"+d.localName))return[new k("Found "+d.nodeName+" instead of "+a.names+".",d)];if(b.firstChild()){for(e=l(a.e[1],b,d);b.nextSibling();)if(c=b.currentNode.nodeType,!(b.currentNode&&b.currentNode.nodeType===Node.TEXT_NODE&&/^\s+$/.test(b.currentNode.nodeValue)||c===Node.COMMENT_NODE))return[new k("Spurious content.",b.currentNode)];if(b.parentNode()!==d)return[new k("Implementation error.")]}else e= +l(a.e[1],b,d);b.nextSibling();return e}var e,b,g;b=function(a,f,d,c){var e=a.name,g=null;if("text"===e)a:{for(var q=(a=f.currentNode)?a.nodeType:0;a!==d&&3!==q;){if(1===q){g=[new k("Element not allowed here.",a)];break a}q=(a=f.nextSibling())?a.nodeType:0}f.nextSibling();g=null}else if("data"===e)g=null;else if("value"===e)c!==a.text&&(g=[new k("Wrong value, should be '"+a.text+"', not '"+c+"'",d)]);else if("list"===e)g=null;else if("attribute"===e)a:{if(2!==a.e.length)throw"Attribute with wrong # of elements: "+ +a.e.length;e=a.localnames.length;for(g=0;g=g&&d.push(l(a.substring(b,c)))):"["===a[c]&&(0>=g&&(b=c+1),g+=1),c+=1;return c};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};d=function(d,e,h){var k,q,l,u;for(k=0;k=e&&c.push(l(a.substring(b,d)))):"["===a[d]&&(0>=e&&(b=d+1),e+=1),d+=1;return d};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};c=function(c,d,g){var h,k,l,u;for(h=0;h=(q.getBoundingClientRect().top- -y.bottom)/w?e.style.top=Math.abs(q.getBoundingClientRect().top-y.bottom)/w+20+"px":e.style.top="0px");l.style.left=h.getBoundingClientRect().width/w+"px";var h=l.style,q=l.getBoundingClientRect().left/w,u=l.getBoundingClientRect().top/w,y=e.getBoundingClientRect().left/w,v=e.getBoundingClientRect().top/w,p=0,x=0,p=y-q,p=p*p,x=v-u,x=x*x,q=Math.sqrt(p+x);h.width=q+"px";w=Math.asin((e.getBoundingClientRect().top-l.getBoundingClientRect().top)/(w*parseFloat(l.style.width)));l.style.transform="rotate("+ -w+"rad)";l.style.MozTransform="rotate("+w+"rad)";l.style.WebkitTransform="rotate("+w+"rad)";l.style.msTransform="rotate("+w+"rad)";c&&(w=d.getComputedStyle(c,":before").content)&&"none"!==w&&(w=w.substring(1,w.length-1),c.firstChild?c.firstChild.nodeValue=w:c.appendChild(g.createTextNode(w)))}}var a=[],g=l.ownerDocument,e=new odf.OdfUtils,d=runtime.getWindow();runtime.assert(Boolean(d),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=h;this.addAnnotation= -function(d){a.push({node:d.node,end:d.end});b();var e=g.createElement("div"),k=g.createElement("div"),m=g.createElement("div"),l=g.createElement("div"),q=d.node;e.className="annotationWrapper";q.parentNode.insertBefore(e,q);k.className="annotationNote";k.appendChild(q);m.className="annotationConnector horizontal";l.className="annotationConnector angular";e.appendChild(k);e.appendChild(m);e.appendChild(l);d.end&&c(d);h()};this.forgetAnnotations=function(){for(;a.length;){var b=a[0],d=b.node,c=d.parentNode.parentNode; -"div"===c.localName&&(c.parentNode.insertBefore(d,c),c.parentNode.removeChild(c));for(var d=b.node.getAttributeNS(odf.Namespaces.officens,"name"),d=g.querySelectorAll('span.annotationHighlight[annotation="'+d+'"]'),e=c=void 0,h=void 0,k=void 0,c=0;c=(l.getBoundingClientRect().top- +y.bottom)/w?e.style.top=Math.abs(l.getBoundingClientRect().top-y.bottom)/w+20+"px":e.style.top="0px");p.style.left=g.getBoundingClientRect().width/w+"px";var g=p.style,l=p.getBoundingClientRect().left/w,u=p.getBoundingClientRect().top/w,y=e.getBoundingClientRect().left/w,x=e.getBoundingClientRect().top/w,s=0,v=0,s=y-l,s=s*s,v=x-u,v=v*v,l=Math.sqrt(s+v);g.width=l+"px";w=Math.asin((e.getBoundingClientRect().top-p.getBoundingClientRect().top)/(w*parseFloat(p.style.width)));p.style.transform="rotate("+ +w+"rad)";p.style.MozTransform="rotate("+w+"rad)";p.style.WebkitTransform="rotate("+w+"rad)";p.style.msTransform="rotate("+w+"rad)";d&&(w=c.getComputedStyle(d,":before").content)&&"none"!==w&&(w=w.substring(1,w.length-1),d.firstChild?d.firstChild.nodeValue=w:d.appendChild(f.createTextNode(w)))}}runtime.assert(Boolean(l),"Expected to get an odfFragment");var a=[],f=l.ownerDocument,d=new odf.OdfUtils,c=runtime.getWindow();runtime.assert(Boolean(c),"Expected to be run in an environment which has a global window, like a browser."); +this.rerenderAnnotations=g;this.addAnnotation=function(c){a.push({node:c.node,end:c.end});b();var d=f.createElement("div"),h=f.createElement("div"),n=f.createElement("div"),p=f.createElement("div"),k=f.createElement("div"),l=c.node;d.className="annotationWrapper";l.parentNode.insertBefore(d,l);h.className="annotationNote";h.appendChild(l);k.className="annotationRemoveButton";h.appendChild(k);n.className="annotationConnector horizontal";p.className="annotationConnector angular";d.appendChild(h);d.appendChild(n); +d.appendChild(p);c.end&&e(c);g()};this.forgetAnnotations=function(){for(;a.length;){var b=a[0],c=a.indexOf(b),d=b.node,e=d.parentNode.parentNode;"div"===e.localName&&(e.parentNode.insertBefore(d,e),e.parentNode.removeChild(e));b=b.node.getAttributeNS(odf.Namespaces.officens,"name");b=f.querySelectorAll('span.annotationHighlight[annotation="'+b+'"]');e=d=void 0;for(d=0;d=b.value||"%"===b.unit)?null:b;return b||r(a)};this.parseFoLineHeight=function(a){var b;b=(b=m(a))&&(0>b.value|| -"%"===b.unit)?null:b;return b||r(a)};this.getImpactedParagraphs=function(a){var b=a.commonAncestorContainer,d=[];for(b.nodeType===Node.ELEMENT_NODE&&(d=v.getElementsByTagNameNS(b,w,"p").concat(v.getElementsByTagNameNS(b,w,"h")));b&&!k(b);)b=b.parentNode;b&&d.push(b);return d.filter(function(b){return v.rangeIntersectsNode(a,b)})};this.getTextNodes=function(a,b){var d=a.startContainer.ownerDocument.createRange(),c;c=v.getNodesInRange(a,function(c){d.selectNodeContents(c);if(c.nodeType===Node.TEXT_NODE){if(b&& -v.rangesIntersect(a,d)||v.containsRange(a,d))return Boolean(l(c)&&(!n(c.textContent)||s(c,0)))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}else if(v.rangesIntersect(a,d)&&q(c))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT});d.detach();return c};this.getTextElements=function(a,d){var e=a.startContainer.ownerDocument.createRange(),f;f=v.getNodesInRange(a,function(f){var g=f.nodeType;e.selectNodeContents(f);if(g===Node.TEXT_NODE){if(v.containsRange(a,e)&&(d||Boolean(l(f)&&(!n(f.textContent)|| -s(f,0)))))return NodeFilter.FILTER_ACCEPT}else if(b(f)){if(v.containsRange(a,e))return NodeFilter.FILTER_ACCEPT}else if(q(f)||c(f))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT});e.detach();return f};this.getParagraphElements=function(a){var b=a.startContainer.ownerDocument.createRange(),d;d=v.getNodesInRange(a,function(d){b.selectNodeContents(d);if(k(d)){if(v.rangesIntersect(a,b))return NodeFilter.FILTER_ACCEPT}else if(q(d)||c(d))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT}); -b.detach();return d}}; +odf.OdfUtils=function(){function k(a){var b=a&&a.localName;return("p"===b||"h"===b)&&a.namespaceURI===w}function l(a){for(;a&&!k(a);)a=a.parentNode;return a}function h(a){return/^[ \t\r\n]+$/.test(a)}function e(a){var b=a&&a.localName;return/^(span|p|h|a|meta)$/.test(b)&&a.namespaceURI===w||"span"===b&&"annotationHighlight"===a.className?!0:!1}function b(a){var b=a&&a.localName,c,d=!1;b&&(c=a.namespaceURI,c===w?d="s"===b||"tab"===b||"line-break"===b:c===u&&(d="frame"===b&&"as-char"===a.getAttributeNS(w, +"anchor-type")));return d}function g(a){for(;null!==a.firstChild&&e(a);)a=a.firstChild;return a}function a(a){for(;null!==a.lastChild&&e(a);)a=a.lastChild;return a}function f(b){for(;!k(b)&&null===b.previousSibling;)b=b.parentNode;return k(b)?null:a(b.previousSibling)}function d(a){for(;!k(a)&&null===a.nextSibling;)a=a.parentNode;return k(a)?null:g(a.nextSibling)}function c(a){for(var c=!1;a;)if(a.nodeType===Node.TEXT_NODE)if(0===a.length)a=f(a);else return!h(a.data.substr(a.length-1,1));else b(a)? +(c=!0,a=null):a=f(a);return c}function t(a){var c=!1;for(a=a&&g(a);a;){if(a.nodeType===Node.TEXT_NODE&&0=b.value||"%"===b.unit)?null:b;return b||p(a)};this.parseFoLineHeight=function(a){var b;b=(b=n(a))&&(0>b.value|| +"%"===b.unit)?null:b;return b||p(a)};this.getImpactedParagraphs=function(a){var b=a.commonAncestorContainer,c=[];for(b.nodeType===Node.ELEMENT_NODE&&(c=x.getElementsByTagNameNS(b,w,"p").concat(x.getElementsByTagNameNS(b,w,"h")));b&&!k(b);)b=b.parentNode;b&&c.push(b);return c.filter(function(b){return x.rangeIntersectsNode(a,b)})};this.getTextNodes=function(a,b){runtime.assert(Boolean(a.startContainer),"Expected to get a range with a startContainer in getTextNodes().");var c=a.startContainer.ownerDocument.createRange(), +d;d=x.getNodesInRange(a,function(d){c.selectNodeContents(d);if(d.nodeType===Node.TEXT_NODE){if(b&&x.rangesIntersect(a,c)||x.containsRange(a,c))return Boolean(l(d)&&(!h(d.textContent)||q(d,0)))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}else if(x.rangesIntersect(a,c)&&r(d))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT});c.detach();return d};this.getTextElements=function(a,c){runtime.assert(Boolean(a.startContainer),"Expected to get a range with a startContainer in getTextElements()."); +var d=a.startContainer.ownerDocument.createRange(),f;f=x.getNodesInRange(a,function(f){var g=f.nodeType;d.selectNodeContents(f);if(g===Node.TEXT_NODE){if(x.containsRange(a,d)&&(c||Boolean(l(f)&&(!h(f.textContent)||q(f,0)))))return NodeFilter.FILTER_ACCEPT}else if(b(f)){if(x.containsRange(a,d))return NodeFilter.FILTER_ACCEPT}else if(r(f)||e(f))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT});d.detach();return f};this.getParagraphElements=function(a){runtime.assert(Boolean(a.startContainer), +"Expected to get a range with a startContainer in getParagraphElements().");var b=a.startContainer.ownerDocument.createRange(),c;c=x.getNodesInRange(a,function(c){b.selectNodeContents(c);if(k(c)){if(x.rangesIntersect(a,b))return NodeFilter.FILTER_ACCEPT}else if(r(c)||e(c))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT});b.detach();return c}}; // Input 30 /* @@ -565,7 +566,7 @@ b.detach();return d}}; @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("odf.OdfUtils"); -odf.TextSerializer=function(){function k(c){var b="",h=l.filter?l.filter.acceptNode(c):NodeFilter.FILTER_ACCEPT,a=c.nodeType,g;if(h===NodeFilter.FILTER_ACCEPT||h===NodeFilter.FILTER_SKIP)for(g=c.firstChild;g;)b+=k(g),g=g.nextSibling;h===NodeFilter.FILTER_ACCEPT&&(a===Node.ELEMENT_NODE&&n.isParagraph(c)?b+="\n":a===Node.TEXT_NODE&&c.textContent&&(b+=c.textContent));return b}var l=this,n=new odf.OdfUtils;this.filter=null;this.writeToString=function(c){return c?k(c):""}}; +odf.TextSerializer=function(){function k(e){var b="",g=l.filter?l.filter.acceptNode(e):NodeFilter.FILTER_ACCEPT,a=e.nodeType,f;if(g===NodeFilter.FILTER_ACCEPT||g===NodeFilter.FILTER_SKIP)for(f=e.firstChild;f;)b+=k(f),f=f.nextSibling;g===NodeFilter.FILTER_ACCEPT&&(a===Node.ELEMENT_NODE&&h.isParagraph(e)?b+="\n":a===Node.TEXT_NODE&&e.textContent&&(b+=e.textContent));return b}var l=this,h=new odf.OdfUtils;this.filter=null;this.writeToString=function(e){return e?k(e):""}}; // Input 31 /* @@ -602,10 +603,10 @@ odf.TextSerializer=function(){function k(c){var b="",h=l.filter?l.filter.acceptN @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.DomUtils");runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.Namespaces"); -odf.TextStyleApplicator=function(k,l,n){function c(a){function b(a,d){return"object"===typeof a&&"object"===typeof d?Object.keys(a).every(function(c){return b(a[c],d[c])}):a===d}this.isStyleApplied=function(c){c=l.getAppliedStylesForElement(c);return b(a,c)}}function b(b){var c={};this.applyStyleToContainer=function(f){var h;h=f.getAttributeNS(a,"style-name");var m=f.ownerDocument;h=h||"";if(!c.hasOwnProperty(h)){var r=h,q=h,w;q?(w=l.getStyleElement(q,"text"),w.parentNode===n?m=w.cloneNode(!0):(m= -m.createElementNS(g,"style:style"),m.setAttributeNS(g,"style:parent-style-name",q),m.setAttributeNS(g,"style:family","text"),m.setAttributeNS(e,"scope","document-content"))):(m=m.createElementNS(g,"style:style"),m.setAttributeNS(g,"style:family","text"),m.setAttributeNS(e,"scope","document-content"));l.updateStyle(m,b,k);n.appendChild(m);c[r]=m}h=c[h].getAttributeNS(g,"name");f.setAttributeNS(a,"text:style-name",h)}}var h=new core.DomUtils,a=odf.Namespaces.textns,g=odf.Namespaces.stylens,e="urn:webodf:names:scope"; -this.applyStyle=function(d,e,f){var g={},m,k,l,n;runtime.assert(f&&f["style:text-properties"],"applyStyle without any text properties");g["style:text-properties"]=f["style:text-properties"];l=new b(g);n=new c(g);d.forEach(function(b){m=n.isStyleApplied(b);if(!1===m){var d=b.ownerDocument,c=b.parentNode,f,g=b,s=new core.LoopWatchDog(1E3);"span"===c.localName&&c.namespaceURI===a?(b.previousSibling&&!h.rangeContainsNode(e,b.previousSibling)?(d=c.cloneNode(!1),c.parentNode.insertBefore(d,c.nextSibling)): -d=c,f=!0):(d=d.createElementNS(a,"text:span"),c.insertBefore(d,b),f=!1);for(;g&&(g===b||h.rangeContainsNode(e,g));)s.check(),c=g.nextSibling,g.parentNode!==d&&d.appendChild(g),g=c;if(g&&f)for(b=d.cloneNode(!1),d.parentNode.insertBefore(b,d.nextSibling);g;)s.check(),c=g.nextSibling,b.appendChild(g),g=c;k=d;l.applyStyleToContainer(k)}})}}; +odf.TextStyleApplicator=function(k,l,h){function e(a){function b(a,c){return"object"===typeof a&&"object"===typeof c?Object.keys(a).every(function(d){return b(a[d],c[d])}):a===c}this.isStyleApplied=function(d){d=l.getAppliedStylesForElement(d);return b(a,d)}}function b(b){var e={};this.applyStyleToContainer=function(g){var q;q=g.getAttributeNS(a,"style-name");var n=g.ownerDocument;q=q||"";if(!e.hasOwnProperty(q)){var p=q,r=q,w;r?(w=l.getStyleElement(r,"text"),w.parentNode===h?n=w.cloneNode(!0):(n= +n.createElementNS(f,"style:style"),n.setAttributeNS(f,"style:parent-style-name",r),n.setAttributeNS(f,"style:family","text"),n.setAttributeNS(d,"scope","document-content"))):(n=n.createElementNS(f,"style:style"),n.setAttributeNS(f,"style:family","text"),n.setAttributeNS(d,"scope","document-content"));l.updateStyle(n,b,k);h.appendChild(n);e[p]=n}q=e[q].getAttributeNS(f,"name");g.setAttributeNS(a,"text:style-name",q)}}var g=new core.DomUtils,a=odf.Namespaces.textns,f=odf.Namespaces.stylens,d="urn:webodf:names:scope"; +this.applyStyle=function(c,d,f){var h={},n,k,l,w;runtime.assert(f&&f["style:text-properties"],"applyStyle without any text properties");h["style:text-properties"]=f["style:text-properties"];l=new b(h);w=new e(h);c.forEach(function(b){n=w.isStyleApplied(b);if(!1===n){var c=b.ownerDocument,f=b.parentNode,e,h=b,m=new core.LoopWatchDog(1E3);"span"===f.localName&&f.namespaceURI===a?(b.previousSibling&&!g.rangeContainsNode(d,b.previousSibling)?(c=f.cloneNode(!1),f.parentNode.insertBefore(c,f.nextSibling)): +c=f,e=!0):(c=c.createElementNS(a,"text:span"),f.insertBefore(c,b),e=!1);for(;h&&(h===b||g.rangeContainsNode(d,h));)m.check(),f=h.nextSibling,h.parentNode!==c&&c.appendChild(h),h=f;if(h&&e)for(b=c.cloneNode(!1),c.parentNode.insertBefore(b,c.nextSibling);h;)m.check(),f=h.nextSibling,b.appendChild(h),h=f;k=c;l.applyStyleToContainer(k)}})}}; // Input 32 /* @@ -642,47 +643,47 @@ d=c,f=!0):(d=d.createElementNS(a,"text:span"),c.insertBefore(d,b),f=!1);for(;g&& @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("odf.Namespaces");runtime.loadClass("odf.OdfUtils");runtime.loadClass("xmldom.XPath");runtime.loadClass("core.CSSUnits"); -odf.Style2CSS=function(){function k(a){var b={},d,c;if(!a)return b;for(a=a.firstChild;a;){if(c=a.namespaceURI!==r||"style"!==a.localName&&"default-style"!==a.localName?a.namespaceURI===w&&"list-style"===a.localName?"list":a.namespaceURI!==r||"page-layout"!==a.localName&&"default-page-layout"!==a.localName?void 0:"page":a.getAttributeNS(r,"family"))(d=a.getAttributeNS&&a.getAttributeNS(r,"name"))||(d=""),c=b[c]=b[c]||{},c[d]=a;a=a.nextSibling}return b}function l(a,b){if(!b||!a)return null;if(a[b])return a[b]; -var d,c;for(d in a)if(a.hasOwnProperty(d)&&(c=l(a[d].derivedStyles,b)))return c;return null}function n(a,b,d){var c=b[a],e,f;c&&(e=c.getAttributeNS(r,"parent-style-name"),f=null,e&&(f=l(d,e),!f&&b[e]&&(n(e,b,d),f=b[e],b[e]=null)),f?(f.derivedStyles||(f.derivedStyles={}),f.derivedStyles[a]=c):d[a]=c)}function c(a,b){for(var d in a)a.hasOwnProperty(d)&&(n(d,a,b),a[d]=null)}function b(a,b){var d=v[a],c;if(null===d)return null;c=b?"["+d+'|style-name="'+b+'"]':"["+d+"|style-name]";"presentation"===d&& -(d="draw",c=b?'[presentation|style-name="'+b+'"]':"[presentation|style-name]");return d+"|"+p[a].join(c+","+d+"|")+c}function h(a,d,c){var e=[],f,g;e.push(b(a,d));for(f in c.derivedStyles)if(c.derivedStyles.hasOwnProperty(f))for(g in d=h(a,f,c.derivedStyles[f]),d)d.hasOwnProperty(g)&&e.push(d[g]);return e}function a(a,b,d){if(!a)return null;for(a=a.firstChild;a;){if(a.namespaceURI===b&&a.localName===d)return b=a;a=a.nextSibling}return null}function g(a,b){var d="",c,e;for(c in b)b.hasOwnProperty(c)&& -(c=b[c],e=a.getAttributeNS(c[0],c[1]),c[2]&&e&&(d+=c[2]+":"+e+";"));return d}function e(b){return(b=a(b,r,"text-properties"))?V.parseFoFontSize(b.getAttributeNS(m,"font-size")):null}function d(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,d,c){return b+b+d+d+c+c});return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null}function t(a,b,d,c){b='text|list[text|style-name="'+b+'"]';var e=d.getAttributeNS(w,"level"), -f;d=V.getFirstNonWhitespaceChild(d);d=V.getFirstNonWhitespaceChild(d);var g;d&&(f=d.attributes,g=f["fo:text-indent"]?f["fo:text-indent"].value:void 0,f=f["fo:margin-left"]?f["fo:margin-left"].value:void 0);g||(g="-0.6cm");d="-"===g.charAt(0)?g.substring(1):"-"+g;for(e=e&&parseInt(e,10);1 text|list-item > text|list",e-=1;e=b+" > text|list-item > *:not(text|list):first-child";void 0!==f&&(f=e+"{margin-left:"+f+";}",a.insertRule(f,a.cssRules.length));c=b+" > text|list-item > *:not(text|list):first-child:before{"+ -c+";";c+="counter-increment:list;";c+="margin-left:"+g+";";c+="width:"+d+";";c+="display:inline-block}";try{a.insertRule(c,a.cssRules.length)}catch(h){throw h;}}function f(b,c,k,l){if("list"===c)for(var q=l.firstChild,p,n;q;){if(q.namespaceURI===w)if(p=q,"list-level-style-number"===q.localName){var v=p;n=v.getAttributeNS(r,"num-format");var K=v.getAttributeNS(r,"num-suffix"),E={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},v=v.getAttributeNS(r,"num-prefix")||"",v=E.hasOwnProperty(n)? -v+(" counter(list, "+E[n]+")"):n?v+("'"+n+"';"):v+" ''";K&&(v+=" '"+K+"'");n="content: "+v+";";t(b,k,p,n)}else"list-level-style-image"===q.localName?(n="content: none;",t(b,k,p,n)):"list-level-style-bullet"===q.localName&&(n="content: '"+p.getAttributeNS(w,"bullet-char")+"';",t(b,k,p,n));q=q.nextSibling}else if("page"===c)if(K=p=k="",q=l.getElementsByTagNameNS(r,"page-layout-properties")[0],p=q.parentNode.parentNode.parentNode.masterStyles,K="",k+=g(q,I),n=q.getElementsByTagNameNS(r,"background-image"), -0g.value)&&(f="0.75pt"+h)}d[2]&&(c+=d[2]+":"+f+";")}return c}function d(b){return(b=a(b,p,"text-properties"))?aa.parseFoFontSize(b.getAttributeNS(n,"font-size")):null}function c(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,c,d){return b+b+c+c+d+d});return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))? +{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null}function t(a,b,c,d){b='text|list[text|style-name="'+b+'"]';var f=c.getAttributeNS(u,"level"),e;c=aa.getFirstNonWhitespaceChild(c);c=aa.getFirstNonWhitespaceChild(c);var g;c&&(e=c.attributes,g=e["fo:text-indent"]?e["fo:text-indent"].value:void 0,e=e["fo:margin-left"]?e["fo:margin-left"].value:void 0);g||(g="-0.6cm");c="-"===g.charAt(0)?g.substring(1):"-"+g;for(f=f&&parseInt(f,10);1 text|list-item > text|list",f-=1;f=b+" > text|list-item > *:not(text|list):first-child"; +void 0!==e&&(e=f+"{margin-left:"+e+";}",a.insertRule(e,a.cssRules.length));d=b+" > text|list-item > *:not(text|list):first-child:before{"+d+";";d+="counter-increment:list;";d+="margin-left:"+g+";";d+="width:"+c+";";d+="display:inline-block}";try{a.insertRule(d,a.cssRules.length)}catch(h){throw h;}}function m(b,e,h,k){if("list"===e)for(var l=k.firstChild,r,s;l;){if(l.namespaceURI===u)if(r=l,"list-level-style-number"===l.localName){var v=r;s=v.getAttributeNS(p,"num-format");var M=v.getAttributeNS(p, +"num-suffix"),G={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},v=v.getAttributeNS(p,"num-prefix")||"",v=G.hasOwnProperty(s)?v+(" counter(list, "+G[s]+")"):s?v+("'"+s+"';"):v+" ''";M&&(v+=" '"+M+"'");s="content: "+v+";";t(b,h,r,s)}else"list-level-style-image"===l.localName?(s="content: none;",t(b,h,r,s)):"list-level-style-bullet"===l.localName&&(s="content: '"+r.getAttributeNS(u,"bullet-char")+"';",t(b,h,r,s));l=l.nextSibling}else if("page"===e)if(M=r=h="",l=k.getElementsByTagNameNS(p, +"page-layout-properties")[0],r=l.parentNode.parentNode.parentNode.masterStyles,M="",h+=f(l,X),s=l.getElementsByTagNameNS(p,"background-image"),0d)break;e=e.nextSibling}a.insertBefore(b,e)}}}function h(a){this.OdfContainer=a}function a(a, -b,d,c){var e=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(){null!==c&&(this.mimetype=b,c.loadAsDataURL(a,b,function(a,b){a&&runtime.log(a);e.url=b;if(e.onchange)e.onchange(e);if(e.onstatereadychange)e.onstatereadychange(e)}))}}var g=new odf.StyleInfo,e="urn:oasis:names:tc:opendocument:xmlns:office:1.0",d="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", -t="urn:webodf:names:scope",f="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),s=(new Date).getTime()+"_webodf_",m=new core.Base64;h.prototype=new function(){};h.prototype.constructor=h;h.namespaceURI=e;h.localName="document";a.prototype.load=function(){};a.prototype.getUrl=function(){return this.data?"data:;base64,"+m.toBase64(this.data):null};odf.OdfContainer=function q(f,m){function l(a){for(var b=a.firstChild,d;b;)d=b.nextSibling,b.nodeType===Node.ELEMENT_NODE? -l(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=d}function v(a,b){for(var d=a&&a.firstChild;d;)d.nodeType===Node.ELEMENT_NODE&&d.setAttributeNS(t,"scope",b),d=d.nextSibling}function p(a,b){var d=null,c,e,f;if(a)for(d=a.cloneNode(!0),c=d.firstChild;c;)e=c.nextSibling,c.nodeType===Node.ELEMENT_NODE&&(f=c.getAttributeNS(t,"scope"))&&f!==b&&d.removeChild(c),c=e;return d}function x(a){var b=J.rootElement.ownerDocument,d;if(a){l(a.documentElement);try{d=b.importNode(a.documentElement, -!0)}catch(c){}}return d}function D(a){J.state=a;if(J.onchange)J.onchange(J);if(J.onstatereadychange)J.onstatereadychange(J)}function G(a){S=null;J.rootElement=a;a.fontFaceDecls=k(a,e,"font-face-decls");a.styles=k(a,e,"styles");a.automaticStyles=k(a,e,"automatic-styles");a.masterStyles=k(a,e,"master-styles");a.body=k(a,e,"body");a.meta=k(a,e,"meta")}function A(a){a=x(a);var d=J.rootElement;a&&"document-styles"===a.localName&&a.namespaceURI===e?(d.fontFaceDecls=k(a,e,"font-face-decls"),b(d,d.fontFaceDecls), -d.styles=k(a,e,"styles"),b(d,d.styles),d.automaticStyles=k(a,e,"automatic-styles"),v(d.automaticStyles,"document-styles"),b(d,d.automaticStyles),d.masterStyles=k(a,e,"master-styles"),b(d,d.masterStyles),g.prefixStyleNames(d.automaticStyles,s,d.masterStyles)):D(q.INVALID)}function N(a){a=x(a);var d,c,f;if(a&&"document-content"===a.localName&&a.namespaceURI===e){d=J.rootElement;c=k(a,e,"font-face-decls");if(d.fontFaceDecls&&c)for(f=c.firstChild;f;)d.fontFaceDecls.appendChild(f),f=c.firstChild;else c&& -(d.fontFaceDecls=c,b(d,c));c=k(a,e,"automatic-styles");v(c,"document-content");if(d.automaticStyles&&c)for(f=c.firstChild;f;)d.automaticStyles.appendChild(f),f=c.firstChild;else c&&(d.automaticStyles=c,b(d,c));d.body=k(a,e,"body");b(d,d.body)}else D(q.INVALID)}function B(a){a=x(a);var d;a&&("document-meta"===a.localName&&a.namespaceURI===e)&&(d=J.rootElement,d.meta=k(a,e,"meta"),b(d,d.meta))}function O(a){a=x(a);var d;a&&("document-settings"===a.localName&&a.namespaceURI===e)&&(d=J.rootElement,d.settings= -k(a,e,"settings"),b(d,d.settings))}function z(a){a=x(a);var b;if(a&&"manifest"===a.localName&&a.namespaceURI===d)for(b=J.rootElement,b.manifest=a,a=b.manifest.firstChild;a;)a.nodeType===Node.ELEMENT_NODE&&("file-entry"===a.localName&&a.namespaceURI===d)&&(L[a.getAttributeNS(d,"full-path")]=a.getAttributeNS(d,"media-type")),a=a.nextSibling}function I(a){var b=a.shift(),d,c;b?(d=b[0],c=b[1],R.loadAsDOM(d,function(b,d){c(d);b||J.state===q.INVALID||I(a)})):D(q.DONE)}function X(a){var b="";odf.Namespaces.forEachPrefix(function(a, -d){b+=" xmlns:"+a+'="'+d+'"'});return''}function ea(){var a=new xmldom.LSSerializer,b=X("document-meta");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(J.rootElement.meta,odf.Namespaces.namespaceMap);return b+""}function V(a,b){var c=document.createElementNS(d,"manifest:file-entry");c.setAttributeNS(d,"manifest:full-path",a);c.setAttributeNS(d,"manifest:media-type",b);return c}function ma(){var a= -runtime.parseXML(''),b=k(a,d,"manifest"),c=new xmldom.LSSerializer,e;for(e in L)L.hasOwnProperty(e)&&b.appendChild(V(e,L[e]));c.filter=new odf.OdfNodeFilter;return'\n'+c.writeToString(a,odf.Namespaces.namespaceMap)}function da(){var a=new xmldom.LSSerializer,b=X("document-settings");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(J.rootElement.settings,odf.Namespaces.namespaceMap); -return b+""}function ba(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,d=p(J.rootElement.automaticStyles,"document-styles"),c=J.rootElement.masterStyles&&J.rootElement.masterStyles.cloneNode(!0),e=X("document-styles");g.removePrefixFromStyleNames(d,s,c);b.filter=new n(c,d);e+=b.writeToString(J.rootElement.fontFaceDecls,a);e+=b.writeToString(J.rootElement.styles,a);e+=b.writeToString(d,a);e+=b.writeToString(c,a);return e+""}function M(){var a= -odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,d=p(J.rootElement.automaticStyles,"document-content"),e=X("document-content");b.filter=new c(J.rootElement.body,d);e+=b.writeToString(d,a);e+=b.writeToString(J.rootElement.body,a);return e+""}function $(a,b){runtime.loadXML(a,function(a,d){if(a)b(a);else{var c=x(d);c&&"document"===c.localName&&c.namespaceURI===e?(G(c),D(q.DONE)):D(q.INVALID)}})}function T(){function a(b,d){var f;d||(d=b);f=document.createElementNS(e,d); -c[b]=f;c.appendChild(f)}var b=new core.Zip("",null),d=runtime.byteArrayFromString("application/vnd.oasis.opendocument.text","utf8"),c=J.rootElement,f=document.createElementNS(e,"text");b.save("mimetype",d,!1,new Date);a("meta");a("settings");a("scripts");a("fontFaceDecls","font-face-decls");a("styles");a("automaticStyles","automatic-styles");a("masterStyles","master-styles");a("body");c.body.appendChild(f);D(q.DONE);return b}function P(){var a,b=new Date;a=runtime.byteArrayFromString(da(),"utf8"); -R.save("settings.xml",a,!0,b);a=runtime.byteArrayFromString(ea(),"utf8");R.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(ba(),"utf8");R.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(M(),"utf8");R.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(ma(),"utf8");R.save("META-INF/manifest.xml",a,!0,b)}function F(a,b){P();R.writeAs(a,function(a){b(a)})}var J=this,R,L={},S;this.onstatereadychange=m;this.rootElement=this.state=this.onchange=null;this.setRootElement=G;this.getContentElement= -function(){var a;S||(a=J.rootElement.body,S=a.getElementsByTagNameNS(e,"text")[0]||a.getElementsByTagNameNS(e,"presentation")[0]||a.getElementsByTagNameNS(e,"spreadsheet")[0]);return S};this.getDocumentType=function(){var a=J.getContentElement();return a&&a.localName};this.getPart=function(b){return new a(b,L[b],J,R)};this.getPartData=function(a,b){R.load(a,b)};this.createByteArray=function(a,b){P();R.createByteArray(a,b)};this.saveAs=F;this.save=function(a){F(f,a)};this.getUrl=function(){return f}; -this.state=q.LOADING;this.rootElement=function(a){var b=document.createElementNS(a.namespaceURI,a.localName),d;a=new a;for(d in a)a.hasOwnProperty(d)&&(b[d]=a[d]);return b}(h);R=f?new core.Zip(f,function(a,b){R=b;a?$(f,function(b){a&&(R.error=a+"\n"+b,D(q.INVALID))}):I([["styles.xml",A],["content.xml",N],["meta.xml",B],["settings.xml",O],["META-INF/manifest.xml",z]])}):T()};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING= +odf.OdfContainer=function(){function k(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=m.length;for(b=0;bc)break;f=f.nextSibling}a.insertBefore(b,f)}}}function g(a){this.OdfContainer=a}function a(a, +b,c,d){var f=this;this.size=0;this.type=null;this.name=a;this.container=c;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(){null!==d&&(this.mimetype=b,d.loadAsDataURL(a,b,function(a,b){a&&runtime.log(a);f.url=b;if(f.onchange)f.onchange(f);if(f.onstatereadychange)f.onstatereadychange(f)}))}}var f=new odf.StyleInfo,d="urn:oasis:names:tc:opendocument:xmlns:office:1.0",c="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", +t="urn:webodf:names:scope",m="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),q=(new Date).getTime()+"_webodf_",n=new core.Base64;g.prototype=new function(){};g.prototype.constructor=g;g.namespaceURI=d;g.localName="document";a.prototype.load=function(){};a.prototype.getUrl=function(){return this.data?"data:;base64,"+n.toBase64(this.data):null};odf.OdfContainer=function r(m,n){function l(a){for(var b=a.firstChild,c;b;)c=b.nextSibling,b.nodeType===Node.ELEMENT_NODE? +l(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=c}function x(a,b){for(var c=a&&a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&&c.setAttributeNS(t,"scope",b),c=c.nextSibling}function s(a,b){var c=null,d,f,e;if(a)for(c=a.cloneNode(!0),d=c.firstChild;d;)f=d.nextSibling,d.nodeType===Node.ELEMENT_NODE&&(e=d.getAttributeNS(t,"scope"))&&e!==b&&c.removeChild(d),d=f;return c}function v(a){var b=K.rootElement.ownerDocument,c;if(a){l(a.documentElement);try{c=b.importNode(a.documentElement, +!0)}catch(d){}}return c}function A(a){K.state=a;if(K.onchange)K.onchange(K);if(K.onstatereadychange)K.onstatereadychange(K)}function F(a){S=null;K.rootElement=a;a.fontFaceDecls=k(a,d,"font-face-decls");a.styles=k(a,d,"styles");a.automaticStyles=k(a,d,"automatic-styles");a.masterStyles=k(a,d,"master-styles");a.body=k(a,d,"body");a.meta=k(a,d,"meta")}function D(a){a=v(a);var c=K.rootElement;a&&"document-styles"===a.localName&&a.namespaceURI===d?(c.fontFaceDecls=k(a,d,"font-face-decls"),b(c,c.fontFaceDecls), +c.styles=k(a,d,"styles"),b(c,c.styles),c.automaticStyles=k(a,d,"automatic-styles"),x(c.automaticStyles,"document-styles"),b(c,c.automaticStyles),c.masterStyles=k(a,d,"master-styles"),b(c,c.masterStyles),f.prefixStyleNames(c.automaticStyles,q,c.masterStyles)):A(r.INVALID)}function O(a){a=v(a);var c,f,e;if(a&&"document-content"===a.localName&&a.namespaceURI===d){c=K.rootElement;f=k(a,d,"font-face-decls");if(c.fontFaceDecls&&f)for(e=f.firstChild;e;)c.fontFaceDecls.appendChild(e),e=f.firstChild;else f&& +(c.fontFaceDecls=f,b(c,f));f=k(a,d,"automatic-styles");x(f,"document-content");if(c.automaticStyles&&f)for(e=f.firstChild;e;)c.automaticStyles.appendChild(e),e=f.firstChild;else f&&(c.automaticStyles=f,b(c,f));c.body=k(a,d,"body");b(c,c.body)}else A(r.INVALID)}function B(a){a=v(a);var c;a&&("document-meta"===a.localName&&a.namespaceURI===d)&&(c=K.rootElement,c.meta=k(a,d,"meta"),b(c,c.meta))}function P(a){a=v(a);var c;a&&("document-settings"===a.localName&&a.namespaceURI===d)&&(c=K.rootElement,c.settings= +k(a,d,"settings"),b(c,c.settings))}function z(a){a=v(a);var b;if(a&&"manifest"===a.localName&&a.namespaceURI===c)for(b=K.rootElement,b.manifest=a,a=b.manifest.firstChild;a;)a.nodeType===Node.ELEMENT_NODE&&("file-entry"===a.localName&&a.namespaceURI===c)&&(L[a.getAttributeNS(c,"full-path")]=a.getAttributeNS(c,"media-type")),a=a.nextSibling}function J(a){var b=a.shift(),c,d;b?(c=b[0],d=b[1],R.loadAsDOM(c,function(b,c){d(c);b||K.state===r.INVALID||J(a)})):A(r.DONE)}function X(a){var b="";odf.Namespaces.forEachPrefix(function(a, +c){b+=" xmlns:"+a+'="'+c+'"'});return''}function da(){var a=new xmldom.LSSerializer,b=X("document-meta");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(K.rootElement.meta,odf.Namespaces.namespaceMap);return b+""}function V(a,b){var d=document.createElementNS(c,"manifest:file-entry");d.setAttributeNS(c,"manifest:full-path",a);d.setAttributeNS(c,"manifest:media-type",b);return d}function qa(){var a= +runtime.parseXML(''),b=k(a,c,"manifest"),d=new xmldom.LSSerializer,f;for(f in L)L.hasOwnProperty(f)&&b.appendChild(V(f,L[f]));d.filter=new odf.OdfNodeFilter;return'\n'+d.writeToString(a,odf.Namespaces.namespaceMap)}function aa(){var a=new xmldom.LSSerializer,b=X("document-settings");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(K.rootElement.settings,odf.Namespaces.namespaceMap); +return b+""}function ca(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=s(K.rootElement.automaticStyles,"document-styles"),d=K.rootElement.masterStyles&&K.rootElement.masterStyles.cloneNode(!0),e=X("document-styles");f.removePrefixFromStyleNames(c,q,d);b.filter=new h(d,c);e+=b.writeToString(K.rootElement.fontFaceDecls,a);e+=b.writeToString(K.rootElement.styles,a);e+=b.writeToString(c,a);e+=b.writeToString(d,a);return e+""}function Q(){var a= +odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=s(K.rootElement.automaticStyles,"document-content"),d=X("document-content");b.filter=new e(K.rootElement.body,c);d+=b.writeToString(c,a);d+=b.writeToString(K.rootElement.body,a);return d+""}function Y(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else{var f=v(c);f&&"document"===f.localName&&f.namespaceURI===d?(F(f),A(r.DONE)):A(r.INVALID)}})}function T(){function a(b,c){var e;c||(c=b);e=document.createElementNS(d,c); +f[b]=e;f.appendChild(e)}var b=new core.Zip("",null),c=runtime.byteArrayFromString("application/vnd.oasis.opendocument.text","utf8"),f=K.rootElement,e=document.createElementNS(d,"text");b.save("mimetype",c,!1,new Date);a("meta");a("settings");a("scripts");a("fontFaceDecls","font-face-decls");a("styles");a("automaticStyles","automatic-styles");a("masterStyles","master-styles");a("body");f.body.appendChild(e);A(r.DONE);return b}function N(){var a,b=new Date;a=runtime.byteArrayFromString(aa(),"utf8"); +R.save("settings.xml",a,!0,b);a=runtime.byteArrayFromString(da(),"utf8");R.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(ca(),"utf8");R.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(Q(),"utf8");R.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(qa(),"utf8");R.save("META-INF/manifest.xml",a,!0,b)}function E(a,b){N();R.writeAs(a,function(a){b(a)})}var K=this,R,L={},S;this.onstatereadychange=n;this.rootElement=this.state=this.onchange=null;this.setRootElement=F;this.getContentElement= +function(){var a;S||(a=K.rootElement.body,S=a.getElementsByTagNameNS(d,"text")[0]||a.getElementsByTagNameNS(d,"presentation")[0]||a.getElementsByTagNameNS(d,"spreadsheet")[0]);return S};this.getDocumentType=function(){var a=K.getContentElement();return a&&a.localName};this.getPart=function(b){return new a(b,L[b],K,R)};this.getPartData=function(a,b){R.load(a,b)};this.createByteArray=function(a,b){N();R.createByteArray(a,b)};this.saveAs=E;this.save=function(a){E(m,a)};this.getUrl=function(){return m}; +this.state=r.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}(g);R=m?new core.Zip(m,function(a,b){R=b;a?Y(m,function(b){a&&(R.error=a+"\n"+b,A(r.INVALID))}):J([["styles.xml",D],["content.xml",O],["meta.xml",B],["settings.xml",P],["META-INF/manifest.xml",z]])}):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 34 /* @@ -720,9 +721,9 @@ this.state=q.LOADING;this.rootElement=function(a){var b=document.createElementNS @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.Base64");runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.OdfContainer"); -odf.FontLoader=function(){function k(c,b,h,a,g){var e,d=0,l;for(l in c)if(c.hasOwnProperty(l)){if(d===h){e=l;break}d+=1}e?b.getPartData(c[e].href,function(d,l){if(d)runtime.log(d);else{var m="@font-face { font-family: '"+(c[e].family||e)+"'; src: url(data:application/x-font-ttf;charset=binary;base64,"+n.convertUTF8ArrayToBase64(l)+') format("truetype"); }';try{a.insertRule(m,a.cssRules.length)}catch(r){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(r)+"\nRule: "+m)}}k(c,b,h+1,a,g)}): -g&&g()}var l=new xmldom.XPath,n=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(c,b){for(var h=c.rootElement.fontFaceDecls;b.cssRules.length;)b.deleteRule(b.cssRules.length-1);if(h){var a={},g,e,d,n;if(h)for(h=l.getODFElementsWithXPath(h,"style:font-face[svg:font-face-src]",odf.Namespaces.resolvePrefix),g=0;g text|list-item > *:first-child:before {";if(W=z.getAttributeNS(x,"style-name")){z=r[W];Y=O.getFirstNonWhitespaceChild(z);z=void 0;if("list-level-style-number"===Y.localName){z=Y.getAttributeNS(y,"num-format");W=Y.getAttributeNS(y, -"num-suffix");var ta="",ta={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},F=void 0,F=Y.getAttributeNS(y,"num-prefix")||"",F=ta.hasOwnProperty(z)?F+(" counter(list, "+ta[z]+")"):z?F+("'"+z+"';"):F+" ''";W&&(F+=" '"+W+"'");z=ta="content: "+F+";"}else"list-level-style-image"===Y.localName?z="content: none;":"list-level-style-bullet"===Y.localName&&(z="content: '"+Y.getAttributeNS(x,"bullet-char")+"';");Y=z}if(E){for(z=n[E];z;)E=z,z=n[E];U+="counter-increment:"+E+";";Y? -(Y=Y.replace("list",E),U+=Y):U+="content:counter("+E+");"}else E="",Y?(Y=Y.replace("list",A),U+=Y):U+="content: counter("+A+");",U+="counter-increment:"+A+";",m.insertRule("text|list#"+A+" {counter-reset:"+A+"}",m.cssRules.length);U+="}";n[A]=E;U&&m.insertRule(U,m.cssRules.length)}k.insertBefore(I,k.firstChild);v();D(g);if(!c&&(g=[S],ja.hasOwnProperty("statereadychange")))for(m=ja.statereadychange,k=0;k text|list-item > *:first-child:before {";if(W=z.getAttributeNS(v,"style-name")){z=p[W];$=P.getFirstNonWhitespaceChild(z);z=void 0;if($)if("list-level-style-number"===$.localName){z=$.getAttributeNS(y,"num-format");W=$.getAttributeNS(y, +"num-suffix");var ua="",ua={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},pa=void 0,pa=$.getAttributeNS(y,"num-prefix")||"",pa=ua.hasOwnProperty(z)?pa+(" counter(list, "+ua[z]+")"):z?pa+("'"+z+"';"):pa+" ''";W&&(pa+=" '"+W+"'");z=ua="content: "+pa+";"}else"list-level-style-image"===$.localName?z="content: none;":"list-level-style-bullet"===$.localName&&(z="content: '"+$.getAttributeNS(v,"bullet-char")+"';");$=z}if(E){for(z=k[E];z;)E=z,z=k[E];U+="counter-increment:"+ +E+";";$?($=$.replace("list",E),U+=$):U+="content:counter("+E+");"}else E="",$?($=$.replace("list",A),U+=$):U+="content: counter("+A+");",U+="counter-increment:"+A+";",h.insertRule("text|list#"+A+" {counter-reset:"+A+"}",h.cssRules.length);U+="}";k[A]=E;U&&h.insertRule(U,h.cssRules.length)}n.insertBefore(J,n.firstChild);x();D(e);if(!d&&(e=[S],ga.hasOwnProperty("statereadychange")))for(h=ga.statereadychange,n=0;nl?(runtime.log("connection to server timed out."),n("timeout")):(b+=100,runtime.getWindow().setTimeout(c,100)):(runtime.log("connection to collaboration server established."),n("ready"))}var b=0;k|| -(k=runtime.getVariable("now"),void 0===k&&(k={networkStatus:"unavailable"}),c())};this.networkStatus=function(){return k?k.networkStatus:"unavailable"};this.login=function(l,n,c,b){k?k.login(l,n,c,b):b("Not connected to server")};this.joinSession=function(l,n,c,b){k.joinSession(l,n,function(b){k.memberid=b;c(b)},b)}}; +ops.NowjsServer=function(){var k;this.getNowObject=function(){return k};this.getGenesisUrl=function(l){return"/session/"+l+"/genesis"};this.connect=function(l,h){function e(){"unavailable"===k.networkStatus?(runtime.log("connection to server unavailable."),h("unavailable")):"ready"!==k.networkStatus?b>l?(runtime.log("connection to server timed out."),h("timeout")):(b+=100,runtime.getWindow().setTimeout(e,100)):(runtime.log("connection to collaboration server established."),h("ready"))}var b=0;k|| +(k=runtime.getVariable("now"),void 0===k&&(k={networkStatus:"unavailable"}),e())};this.networkStatus=function(){return k?k.networkStatus:"unavailable"};this.login=function(l,h,e,b){k?k.login(l,h,e,b):b("Not connected to server")};this.joinSession=function(l,h,e,b){k.joinSession(l,h,function(b){k.memberid=b;e(b)},b)}}; // Input 40 /* @@ -945,9 +947,9 @@ ops.NowjsServer=function(){var k;this.getNowObject=function(){return k};this.get @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.Base64");runtime.loadClass("core.ByteArrayWriter"); -ops.PullBoxServer=function(k){function l(b,a){var c=new XMLHttpRequest,e=new core.ByteArrayWriter("utf8"),d=JSON.stringify(b);runtime.log("Sending message to server: "+d);e.appendString(d);e=e.getByteArray();c.open("POST",k.url,!0);c.onreadystatechange=function(){4===c.readyState&&((200>c.status||300<=c.status)&&0===c.status&&runtime.log("Status "+String(c.status)+": "+c.responseText||c.statusText),a(c.responseText))};e=e.buffer&&!c.sendAsBinary?e.buffer:runtime.byteArrayToString(e,"binary");try{c.sendAsBinary? -c.sendAsBinary(e):c.send(e)}catch(l){runtime.log("Problem with calling server: "+l+" "+e),a(l.message)}}var n=this,c,b=new core.Base64;k=k||{};k.url=k.url||"/WSER";this.getGenesisUrl=function(b){return"/session/"+b+"/genesis"};this.call=l;this.getToken=function(){return c};this.setToken=function(b){c=b};this.connect=function(b,a){a("ready")};this.networkStatus=function(){return"ready"};this.login=function(h,a,g,e){l({command:"login",args:{login:b.toBase64(h),password:b.toBase64(a)}},function(a){var b= -runtime.fromJson(a);runtime.log("Login reply: "+a);b.hasOwnProperty("token")?(c=b.token,runtime.log("Caching token: "+n.getToken()),g(b)):e(a)})};this.joinSession=function(b,a,c,e){l({command:"join_session",args:{user_id:b,es_id:a}},function(a){var b=runtime.fromJson(a);runtime.log("join_session reply: "+a);b.hasOwnProperty("success")&&b.success?c(b.member_id):e&&e()})}}; +ops.PullBoxServer=function(k){function l(b,a){var f=new XMLHttpRequest,d=new core.ByteArrayWriter("utf8"),c=JSON.stringify(b);runtime.log("Sending message to server: "+c);d.appendString(c);d=d.getByteArray();f.open("POST",k.url,!0);f.onreadystatechange=function(){4===f.readyState&&((200>f.status||300<=f.status)&&0===f.status&&runtime.log("Status "+String(f.status)+": "+f.responseText||f.statusText),a(f.responseText))};d=d.buffer&&!f.sendAsBinary?d.buffer:runtime.byteArrayToString(d,"binary");try{f.sendAsBinary? +f.sendAsBinary(d):f.send(d)}catch(e){runtime.log("Problem with calling server: "+e+" "+d),a(e.message)}}var h=this,e,b=new core.Base64;k=k||{};k.url=k.url||"/WSER";this.getGenesisUrl=function(b){return"/session/"+b+"/genesis"};this.call=l;this.getToken=function(){return e};this.setToken=function(b){e=b};this.connect=function(b,a){a("ready")};this.networkStatus=function(){return"ready"};this.login=function(g,a,f,d){l({command:"login",args:{login:b.toBase64(g),password:b.toBase64(a)}},function(a){var b= +runtime.fromJson(a);runtime.log("Login reply: "+a);b.hasOwnProperty("token")?(e=b.token,runtime.log("Caching token: "+h.getToken()),f(b)):d(a)})};this.joinSession=function(b,a,f,d){l({command:"join_session",args:{user_id:b,es_id:a}},function(a){var b=runtime.fromJson(a);runtime.log("join_session reply: "+a);b.hasOwnProperty("success")&&b.success?f(b.member_id):d&&d()})}}; // Input 41 /* @@ -1019,7 +1021,7 @@ ops.Operation=function(){};ops.Operation.prototype.init=function(k){};ops.Operat @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpAddCursor=function(){var k=this,l,n;this.init=function(c){l=c.memberid;n=c.timestamp};this.transform=function(c,b){return[k]};this.execute=function(c){var b=c.getCursor(l);if(b)return!1;b=new ops.OdtCursor(l,c);c.addCursor(b);c.emit(ops.OdtDocument.signalCursorAdded,b);return!0};this.spec=function(){return{optype:"AddCursor",memberid:l,timestamp:n}}}; +ops.OpAddCursor=function(){var k=this,l,h;this.init=function(e){l=e.memberid;h=e.timestamp};this.transform=function(e,b){return[k]};this.execute=function(e){var b=e.getCursor(l);if(b)return!1;b=new ops.OdtCursor(l,e);e.addCursor(b);e.emit(ops.OdtDocument.signalCursorAdded,b);return!0};this.spec=function(){return{optype:"AddCursor",memberid:l,timestamp:h}}}; // Input 43 /* @@ -1056,8 +1058,8 @@ ops.OpAddCursor=function(){var k=this,l,n;this.init=function(c){l=c.memberid;n=c @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.DomUtils");runtime.loadClass("odf.OdfUtils"); -gui.StyleHelper=function(k){function l(b,h,a){var g=!0,e;b.collapsed?(e=b.startContainer,e.hasChildNodes()&&b.startOffsetc&&g.positionc&&g.positiond?-g.countBackwardSteps(-d,e):0;a.move(d);b&&(e=0b?-g.countBackwardSteps(-b, -e):0,a.move(e,!0));h.emit(ops.OdtDocument.signalCursorMoved,a);return!0};this.spec=function(){return{optype:"MoveCursor",memberid:l,timestamp:n,position:c,length:b}}}; +ops.OpMoveCursor=function(){var k=this,l,h,e,b;this.init=function(g){l=g.memberid;h=g.timestamp;e=parseInt(g.position,10);b=void 0!==g.length?parseInt(g.length,10):0};this.merge=function(g){return"MoveCursor"===g.optype&&g.memberid===l?(e=g.position,b=g.length,h=g.timestamp,!0):!1};this.transform=function(g,a){var f=g.spec(),d=e+b,c,h=[k];switch(f.optype){case "RemoveText":c=f.position+f.length;c<=e?e-=f.length:f.positionc?-f.countBackwardSteps(-c, +d):0;a.move(c);b&&(d=0b?-f.countBackwardSteps(-b,d):0,a.move(d,!0));g.emit(ops.OdtDocument.signalCursorMoved,a);return!0};this.spec=function(){return{optype:"MoveCursor",memberid:l,timestamp:h,position:e,length:b}}}; // Input 47 -ops.OpInsertTable=function(){function k(a,d){var c;if(1===t.length)c=t[0];else if(3===t.length)switch(a){case 0:c=t[0];break;case b-1:c=t[2];break;default:c=t[1]}else c=t[a];if(1===c.length)return c[0];if(3===c.length)switch(d){case 0:return c[0];case h-1:return c[2];default:return c[1]}return c[d]}var l=this,n,c,b,h,a,g,e,d,t;this.init=function(f){n=f.memberid;c=f.timestamp;a=parseInt(f.position,10);b=parseInt(f.initialRows,10);h=parseInt(f.initialColumns,10);g=f.tableName;e=f.tableStyleName;d=f.tableColumnStyleName; -t=f.tableCellStyleMatrix};this.transform=function(b,d){var c=b.spec(),e=c.optype,g=[l];if("InsertTable"===e)g=null;else if("SplitParagraph"===e)if(c.position + + @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.OpInsertTable=function(){function k(a,c){var d;if(1===t.length)d=t[0];else if(3===t.length)switch(a){case 0:d=t[0];break;case b-1:d=t[2];break;default:d=t[1]}else d=t[a];if(1===d.length)return d[0];if(3===d.length)switch(c){case 0:return d[0];case g-1:return d[2];default:return d[1]}return d[c]}var l=this,h,e,b,g,a,f,d,c,t;this.init=function(m){h=m.memberid;e=m.timestamp;a=parseInt(m.position,10);b=parseInt(m.initialRows,10);g=parseInt(m.initialColumns,10);f=m.tableName;d=m.tableStyleName;c=m.tableColumnStyleName; +t=m.tableCellStyleMatrix};this.transform=function(b,c){var d=b.spec(),f=[l];switch(d.optype){case "InsertTable":f=null;break;case "AddAnnotation":d.position=a.textNode.length?null:a.textNode.splitText(a.offset));for(a=a.textNode;a!==e;)if(a=a.parentNode,d=a.cloneNode(!1),f){for(k&&d.appendChild(k);f.nextSibling;)d.appendChild(f.nextSibling); -a.parentNode.insertBefore(d,a.nextSibling);f=a;k=d}else a.parentNode.insertBefore(d,a),f=d,k=a;b.isListItem(k)&&(k=k.childNodes[0]);h.fixCursorPositions(l);h.getOdfCanvas().refreshSize();h.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:l,timeStamp:n});h.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:k,memberId:l,timeStamp:n});h.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph",memberid:l,timestamp:n,position:c}}}; +ops.OpSplitParagraph=function(){var k=this,l,h,e,b=new odf.OdfUtils;this.init=function(b){l=b.memberid;h=b.timestamp;e=parseInt(b.position,10)};this.transform=function(b,a){var f=b.spec(),d=[k];switch(f.optype){case "SplitParagraph":f.position=a.textNode.length?null:a.textNode.splitText(a.offset));for(a=a.textNode;a!==d;)if(a=a.parentNode,c=a.cloneNode(!1),m){for(k&&c.appendChild(k);m.nextSibling;)c.appendChild(m.nextSibling); +a.parentNode.insertBefore(c,a.nextSibling);m=a;k=c}else a.parentNode.insertBefore(c,a),m=c,k=a;b.isListItem(k)&&(k=k.childNodes[0]);g.fixCursorPositions(l);g.getOdfCanvas().refreshSize();g.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:f,memberId:l,timeStamp:h});g.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:k,memberId:l,timeStamp:h});g.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph",memberid:l,timestamp:h,position:e}}}; // Input 51 /* @@ -1330,8 +1367,8 @@ a.parentNode.insertBefore(d,a.nextSibling);f=a;k=d}else a.parentNode.insertBefor @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpSetParagraphStyle=function(){var k=this,l,n,c,b;this.init=function(h){l=h.memberid;n=h.timestamp;c=h.position;b=h.styleName};this.transform=function(c,a){var g=c.spec();"RemoveParagraphStyle"===g.optype&&g.styleName===b&&(b="");return[k]};this.execute=function(h){var a;if(a=h.getPositionInTextNode(c))if(a=h.getParagraphElement(a.textNode))return""!==b?a.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",b):a.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0", -"style-name"),h.getOdfCanvas().refreshSize(),h.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,timeStamp:n,memberId:l}),h.getOdfCanvas().rerenderAnnotations(),!0;return!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:l,timestamp:n,position:c,styleName:b}}}; +ops.OpSetParagraphStyle=function(){var k=this,l,h,e,b;this.init=function(g){l=g.memberid;h=g.timestamp;e=g.position;b=g.styleName};this.transform=function(e,a){var f=e.spec(),d=[k];switch(f.optype){case "RemoveParagraphStyle":f.styleName===b&&(b="")}return d};this.execute=function(g){var a;if(a=g.getPositionInTextNode(e))if(a=g.getParagraphElement(a.textNode))return""!==b?a.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",b):a.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0", +"style-name"),g.getOdfCanvas().refreshSize(),g.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,timeStamp:h,memberId:l}),g.getOdfCanvas().rerenderAnnotations(),!0;return!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:l,timestamp:h,position:e,styleName:b}}}; // Input 52 /* @@ -1367,12 +1404,13 @@ ops.OpSetParagraphStyle=function(){var k=this,l,n,c,b;this.init=function(h){l=h. @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpUpdateParagraphStyle=function(){function k(a,b){var c,e;for(c=0;cm?-n.countBackwardSteps(-m,c):0,l.move(c),f.emit(ops.OdtDocument.signalCursorMoved,l));f.getOdfCanvas().addAnnotation(d);return!0};this.spec=function(){return{optype:"AddAnnotation",memberid:h,timestamp:e,position:b, +length:g,name:a}}}; // Input 56 /* @@ -1522,24 +1563,63 @@ d.appendChild(f);d.appendChild(e);g.node=d;if(!g.node)return!1;if(b){d=a.getRoot @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpApplyDirectStyling");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertTable");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");runtime.loadClass("ops.OpUpdateParagraphStyle");runtime.loadClass("ops.OpAddParagraphStyle");runtime.loadClass("ops.OpRemoveParagraphStyle"); -runtime.loadClass("ops.OpAddAnnotation"); -ops.OperationFactory=function(){function k(k){return function(){return new k}}var l;this.register=function(k,c){l[k]=c};this.create=function(k){var c=null,b=l[k.optype];b&&(c=b(k),c.init(k));return c};l={AddCursor:k(ops.OpAddCursor),ApplyDirectStyling:k(ops.OpApplyDirectStyling),InsertTable:k(ops.OpInsertTable),InsertText:k(ops.OpInsertText),RemoveText:k(ops.OpRemoveText),SplitParagraph:k(ops.OpSplitParagraph),SetParagraphStyle:k(ops.OpSetParagraphStyle),UpdateParagraphStyle:k(ops.OpUpdateParagraphStyle),AddParagraphStyle:k(ops.OpAddParagraphStyle), -RemoveParagraphStyle:k(ops.OpRemoveParagraphStyle),MoveCursor:k(ops.OpMoveCursor),RemoveCursor:k(ops.OpRemoveCursor),AddAnnotation:k(ops.OpAddAnnotation)}}; +runtime.loadClass("odf.Namespaces");runtime.loadClass("core.DomUtils"); +ops.OpRemoveAnnotation=function(){var k,l,h,e,b;this.init=function(g){k=g.memberid;l=g.timestamp;h=parseInt(g.position,10);e=parseInt(g.length,10);b=new core.DomUtils};this.transform=function(b,a){return null};this.execute=function(e){for(var a=e.getIteratorAtPosition(h).container(),f,d=null,c=null;a.namespaceURI!==odf.Namespaces.officens||"annotation"!==a.localName;)a=a.parentNode;if(null===a)return!1;d=a;(f=d.getAttributeNS(odf.Namespaces.officens,"name"))&&(c=b.getElementsByTagNameNS(e.getRootNode(), +odf.Namespaces.officens,"annotation-end").filter(function(a){return f===a.getAttributeNS(odf.Namespaces.officens,"name")})[0]||null);e.getOdfCanvas().forgetAnnotations();for(a=b.getElementsByTagNameNS(d,odf.Namespaces.webodfns+":names:cursor","cursor");a.length;)d.parentNode.insertBefore(a.pop(),d);d.parentNode.removeChild(d);c&&c.parentNode.removeChild(c);e.fixCursorPositions();e.getOdfCanvas().refreshAnnotations();return!0};this.spec=function(){return{optype:"RemoveAnnotation",memberid:k,timestamp:l, +position:h,length:e}}}; // Input 57 -runtime.loadClass("core.Cursor");runtime.loadClass("core.PositionIterator");runtime.loadClass("core.PositionFilter");runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.OdfUtils"); -gui.SelectionMover=function(k,l){function n(){w.setUnfilteredPosition(k.getNode(),0);return w}function c(a,b,d){var c;d.setStart(a,b);c=d.getClientRects()[0];if(!c)if(c={},a.childNodes[b-1]){d.setStart(a,b-1);d.setEnd(a,b);b=d.getClientRects()[0];if(!b){for(d=b=0;a&&a.nodeType===Node.ELEMENT_NODE;)b+=a.offsetLeft-a.scrollLeft,d+=a.offsetTop-a.scrollTop,a=a.parentNode;b={top:d,left:b}}runtime.assert(b,"getRect: invalid containerOffset");c.top=b.top;c.left=b.right;c.bottom=b.bottom}else a.nodeType=== -Node.TEXT_NODE?(a.previousSibling&&(c=a.previousSibling.getClientRects()[0]),c||(d.setStart(a,0),d.setEnd(a,b),c=d.getClientRects()[0])):c=a.getClientRects()[0];runtime.assert(c,"getRect invalid rect");runtime.assert(void 0!==c.top,"getRect rect without top property");return{top:c.top,left:c.left,bottom:c.bottom}}function b(a,b,d){var e=a,f=n(),g,h=l.ownerDocument.createRange(),m=k.getSelectedRange()?k.getSelectedRange().cloneRange():l.ownerDocument.createRange(),q,r=runtime.getWindow();for(g=c(k.getNode(), -0,h);0a?-1:1;for(a=Math.abs(a);0m?k.previousPosition():k.nextPosition());)if(F.check(),h.acceptPosition(k)===v&&(r+=1,q=k.container(),y=c(q,k.unfilteredDomOffset(),P),y.top!==M)){if(y.top!==T&&T!==M)break;T=y.top;y=Math.abs($-y.left);if(null===s||ya?(d=h.previousPosition,e=-1):(d=h.nextPosition,e=1);for(f=c(h.container(),h.unfilteredDomOffset(),r);d.call(h);)if(b.acceptPosition(h)===v){if(q.getParagraphElement(h.getCurrentNode())!==k)break;g=c(h.container(),h.unfilteredDomOffset(),r);if(g.bottom!==f.bottom&&(f=g.top>=f.top&&g.bottomf.bottom,!f))break;m+=e;f=g}r.detach();return m}function m(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 r(a,b,d){runtime.assert(null!==a,"SelectionMover.countStepsToPosition called with element===null");var c=n(),e=c.container(),f=c.unfilteredDomOffset(),g=0,h=new core.LoopWatchDog(1E3);c.setUnfilteredPosition(a,b);a=c.container();runtime.assert(Boolean(a),"SelectionMover.countStepsToPosition: positionIterator.container() returned null");b=c.unfilteredDomOffset();c.setUnfilteredPosition(e,f);var e=a,f=b,k=c.container(),l=c.unfilteredDomOffset();if(e===k)e=l- -f;else{var q=e.compareDocumentPosition(k);2===q?q=-1:4===q?q=1:10===q?(f=m(e,k),q=fe)for(;c.nextPosition()&&(h.check(),d.acceptPosition(c)===v&&(g+=1),c.container()!==a||c.unfilteredDomOffset()!==b););else if(0 + + @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("ops.OpAddCursor");runtime.loadClass("ops.OpApplyDirectStyling");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertTable");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");runtime.loadClass("ops.OpUpdateParagraphStyle");runtime.loadClass("ops.OpAddParagraphStyle");runtime.loadClass("ops.OpRemoveParagraphStyle"); +runtime.loadClass("ops.OpAddAnnotation");runtime.loadClass("ops.OpRemoveAnnotation"); +ops.OperationFactory=function(){function k(h){return function(){return new h}}var l;this.register=function(h,e){l[h]=e};this.create=function(h){var e=null,b=l[h.optype];b&&(e=b(h),e.init(h));return e};l={AddCursor:k(ops.OpAddCursor),ApplyDirectStyling:k(ops.OpApplyDirectStyling),InsertTable:k(ops.OpInsertTable),InsertText:k(ops.OpInsertText),RemoveText:k(ops.OpRemoveText),SplitParagraph:k(ops.OpSplitParagraph),SetParagraphStyle:k(ops.OpSetParagraphStyle),UpdateParagraphStyle:k(ops.OpUpdateParagraphStyle), +AddParagraphStyle:k(ops.OpAddParagraphStyle),RemoveParagraphStyle:k(ops.OpRemoveParagraphStyle),MoveCursor:k(ops.OpMoveCursor),RemoveCursor:k(ops.OpRemoveCursor),AddAnnotation:k(ops.OpAddAnnotation),RemoveAnnotation:k(ops.OpRemoveAnnotation)}}; // Input 58 +runtime.loadClass("core.Cursor");runtime.loadClass("core.PositionIterator");runtime.loadClass("core.PositionFilter");runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.OdfUtils"); +gui.SelectionMover=function(k,l){function h(){u.setUnfilteredPosition(k.getNode(),0);return u}function e(a,b){var c,d=null;a&&(c=b?a[a.length-1]:a[0]);c&&(d={top:c.top,left:b?c.right:c.left,bottom:c.bottom});return d}function b(a,c,d,f){var g=a.nodeType;d.setStart(a,c);d.collapse(!f);f=e(d.getClientRects(),!0===f);!f&&0a?-1:1;for(a=Math.abs(a);0m?n.previousPosition():n.nextPosition());)if(K.check(),k.acceptPosition(n)===s&&(r+=1,p=n.container(),w=b(p,n.unfilteredDomOffset(),E),w.top!==Y)){if(w.top!==N&&N!==Y)break;N=w.top;w=Math.abs(T-w.left);if(null===q||wa?(d=k.previousPosition,f=-1):(d=k.nextPosition,f=1);for(e=b(k.container(),k.unfilteredDomOffset(),p);d.call(k);)if(c.acceptPosition(k)===s){if(w.getParagraphElement(k.getCurrentNode())!==m)break;g=b(k.container(),k.unfilteredDomOffset(),p);if(g.bottom!==e.bottom&&(e=g.top>=e.top&&g.bottome.bottom,!e))break;n+=f;e=g}p.detach();return n}function p(a,b){for(var c=0,d;a.parentNode!==b;)runtime.assert(null!==a.parentNode,"parent is null"), +a=a.parentNode;for(d=b.firstChild;d!==a;)c+=1,d=d.nextSibling;return c}function r(a,b,c){runtime.assert(null!==a,"SelectionMover.countStepsToPosition called with element===null");var d=h(),f=d.container(),e=d.unfilteredDomOffset(),g=0,k=new core.LoopWatchDog(1E3);d.setUnfilteredPosition(a,b);a=d.container();runtime.assert(Boolean(a),"SelectionMover.countStepsToPosition: positionIterator.container() returned null");b=d.unfilteredDomOffset();d.setUnfilteredPosition(f,e);var f=a,e=b,l=d.container(), +m=d.unfilteredDomOffset();if(f===l)f=m-e;else{var n=f.compareDocumentPosition(l);2===n?n=-1:4===n?n=1:10===n?(e=p(f,l),n=ef)for(;d.nextPosition()&&(k.check(),c.acceptPosition(d)===s&&(g+=1),d.container()!==a||d.unfilteredDomOffset()!==b););else if(0 @@ -1575,13 +1655,13 @@ a.collapse(!0);k.setSelectedRange(a)})()};gui.SelectionMover.createPositionItera @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertTable");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");runtime.loadClass("ops.OpAddParagraphStyle");runtime.loadClass("ops.OpUpdateParagraphStyle");runtime.loadClass("ops.OpRemoveParagraphStyle"); -ops.OperationTransformer=function(){function k(n,c){for(var b,h,a,g=[],e=[];0=b&&(g=-c.movePointBackward(-b,a));n.handleUpdate();return g};this.handleUpdate=function(){};this.getStepCounter=function(){return c.getStepCounter()};this.getMemberId=function(){return k};this.getNode=function(){return b.getNode()};this.getAnchorNode=function(){return b.getAnchorNode()};this.getSelectedRange=function(){return b.getSelectedRange()}; -this.getOdtDocument=function(){return l};b=new core.Cursor(l.getDOM(),k);c=new gui.SelectionMover(b,l.getRootNode())}; +ops.OperationTransformer=function(){function k(h,e){for(var b,g,a,f=[],d=[];0=b&&(f=-e.movePointBackward(-b,a));h.handleUpdate();return f};this.handleUpdate=function(){};this.getStepCounter=function(){return e.getStepCounter()};this.getMemberId=function(){return k};this.getNode=function(){return b.getNode()};this.getAnchorNode=function(){return b.getAnchorNode()};this.getSelectedRange=function(){return b.getSelectedRange()}; +this.getOdtDocument=function(){return l};b=new core.Cursor(l.getDOM(),k);e=new gui.SelectionMover(b,l.getRootNode())}; +// Input 61 /* Copyright (C) 2012 KO GmbH @@ -1616,22 +1696,20 @@ this.getOdtDocument=function(){return l};b=new core.Cursor(l.getDOM(),k);c=new g @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.EditInfo=function(k,l){function n(){var c=[],a;for(a in b)b.hasOwnProperty(a)&&c.push({memberid:a,time:b[a].time});c.sort(function(a,b){return a.time-b.time});return c}var c,b={};this.getNode=function(){return c};this.getOdtDocument=function(){return l};this.getEdits=function(){return b};this.getSortedEdits=function(){return n()};this.addEdit=function(c,a){b[c]={time:a}};this.clearEdits=function(){b={}};c=l.getDOM().createElementNS("urn:webodf:names:editinfo","editinfo");k.insertBefore(c,k.firstChild)}; -// Input 61 -gui.Avatar=function(k,l){var n=this,c,b,h;this.setColor=function(a){b.style.borderColor=a};this.setImageUrl=function(a){n.isVisible()?b.src=a:h=a};this.isVisible=function(){return"block"===c.style.display};this.show=function(){h&&(b.src=h,h=void 0);c.style.display="block"};this.hide=function(){c.style.display="none"};this.markAsFocussed=function(a){c.className=a?"active":""};(function(){var a=k.ownerDocument,g=a.documentElement.namespaceURI;c=a.createElementNS(g,"div");b=a.createElementNS(g,"img"); -b.width=64;b.height=64;c.appendChild(b);c.style.width="64px";c.style.height="70px";c.style.position="absolute";c.style.top="-80px";c.style.left="-34px";c.style.display=l?"block":"none";k.appendChild(c)})()}; +ops.EditInfo=function(k,l){function h(){var e=[],a;for(a in b)b.hasOwnProperty(a)&&e.push({memberid:a,time:b[a].time});e.sort(function(a,b){return a.time-b.time});return e}var e,b={};this.getNode=function(){return e};this.getOdtDocument=function(){return l};this.getEdits=function(){return b};this.getSortedEdits=function(){return h()};this.addEdit=function(e,a){b[e]={time:a}};this.clearEdits=function(){b={}};e=l.getDOM().createElementNS("urn:webodf:names:editinfo","editinfo");k.insertBefore(e,k.firstChild)}; // Input 62 -runtime.loadClass("gui.Avatar");runtime.loadClass("ops.OdtCursor"); -gui.Caret=function(k,l,n){function c(a){e&&g.parentNode&&(!d||a)&&(a&&void 0!==t&&runtime.clearTimeout(t),d=!0,h.style.opacity=a||"0"===h.style.opacity?"1":"0",t=runtime.setTimeout(function(){d=!1;c(!1)},500))}function b(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 h,a,g,e=!1,d=!1,t;this.refreshCursorBlinking=function(){n||k.getSelectedRange().collapsed?(e=!0,c(!0)): -(e=!1,h.style.opacity="0")};this.setFocus=function(){e=!0;a.markAsFocussed(!0);c(!0)};this.removeFocus=function(){e=!1;a.markAsFocussed(!1);h.style.opacity="0"};this.setAvatarImageUrl=function(b){a.setImageUrl(b)};this.setColor=function(b){h.style.borderColor=b;a.setColor(b)};this.getCursor=function(){return k};this.getFocusElement=function(){return h};this.toggleHandleVisibility=function(){a.isVisible()?a.hide():a.show()};this.showHandle=function(){a.show()};this.hideHandle=function(){a.hide()}; -this.ensureVisible=function(){var a,c,d,e,g,l,n,t=k.getOdtDocument().getOdfCanvas().getElement().parentNode;g=n=h;d=runtime.getWindow();runtime.assert(null!==d,"Expected to be run in an environment which has a global window, like a browser.");do{g=g.parentElement;if(!g)break;l=d.getComputedStyle(g,null)}while("block"!==l.display);l=g;g=e=0;if(l&&t){c=!1;do{d=l.offsetParent;for(a=l.parentNode;a!==d;){if(a===t){a=l;var v=t,p=0;c=0;var x=void 0,D=runtime.getWindow();for(runtime.assert(null!==D,"Expected to be run in an environment which has a global window, like a browser.");a&& -a!==v;)x=D.getComputedStyle(a,null),p+=b(x.marginLeft)+b(x.borderLeftWidth)+b(x.paddingLeft),c+=b(x.marginTop)+b(x.borderTopWidth)+b(x.paddingTop),a=a.parentElement;a=p;e+=a;g+=c;c=!0;break}a=a.parentNode}if(c)break;e+=b(l.offsetLeft);g+=b(l.offsetTop);l=d}while(l&&l!==t);d=e;e=g}else e=d=0;d+=n.offsetLeft;e+=n.offsetTop;g=d-5;l=e-5;d=d+n.scrollWidth-1+5;n=e+n.scrollHeight-1+5;lt.scrollTop+t.clientHeight-1&&(t.scrollTop=n-t.clientHeight+1);gt.scrollLeft+t.clientWidth-1&&(t.scrollLeft=d-t.clientWidth+1)};(function(){var b=k.getOdtDocument().getDOM();h=b.createElementNS(b.documentElement.namespaceURI,"span");g=k.getNode();g.appendChild(h);a=new gui.Avatar(g,l)})()}; +gui.Avatar=function(k,l){var h=this,e,b,g;this.setColor=function(a){b.style.borderColor=a};this.setImageUrl=function(a){h.isVisible()?b.src=a:g=a};this.isVisible=function(){return"block"===e.style.display};this.show=function(){g&&(b.src=g,g=void 0);e.style.display="block"};this.hide=function(){e.style.display="none"};this.markAsFocussed=function(a){e.className=a?"active":""};(function(){var a=k.ownerDocument,f=a.documentElement.namespaceURI;e=a.createElementNS(f,"div");b=a.createElementNS(f,"img"); +b.width=64;b.height=64;e.appendChild(b);e.style.width="64px";e.style.height="70px";e.style.position="absolute";e.style.top="-80px";e.style.left="-34px";e.style.display=l?"block":"none";k.appendChild(e)})()}; // Input 63 -runtime.loadClass("core.EventNotifier"); -gui.ClickHandler=function(){function k(){n=0;c=null}var l,n=0,c=null,b=new core.EventNotifier([gui.ClickHandler.signalSingleClick,gui.ClickHandler.signalDoubleClick,gui.ClickHandler.signalTripleClick]);this.subscribe=function(c,a){b.subscribe(c,a)};this.handleMouseUp=function(h){var a=runtime.getWindow();c&&c.x===h.screenX&&c.y===h.screenY?(n+=1,1===n?b.emit(gui.ClickHandler.signalSingleClick,h):2===n?b.emit(gui.ClickHandler.signalDoubleClick,void 0):3===n&&(a.clearTimeout(l),b.emit(gui.ClickHandler.signalTripleClick, -void 0),k())):(b.emit(gui.ClickHandler.signalSingleClick,h),n=1,c={x:h.screenX,y:h.screenY},a.clearTimeout(l),l=a.setTimeout(k,400))}};gui.ClickHandler.signalSingleClick="click";gui.ClickHandler.signalDoubleClick="doubleClick";gui.ClickHandler.signalTripleClick="tripleClick";(function(){return gui.ClickHandler})(); +runtime.loadClass("gui.Avatar");runtime.loadClass("ops.OdtCursor"); +gui.Caret=function(k,l,h){function e(g){f&&a.parentNode&&(!d||g)&&(g&&void 0!==c&&runtime.clearTimeout(c),d=!0,b.style.opacity=g||"0"===b.style.opacity?"1":"0",c=runtime.setTimeout(function(){d=!1;e(!1)},500))}var b,g,a,f=!1,d=!1,c;this.refreshCursorBlinking=function(){h||k.getSelectedRange().collapsed?(f=!0,e(!0)):(f=!1,b.style.opacity="0")};this.setFocus=function(){f=!0;g.markAsFocussed(!0);e(!0)};this.removeFocus=function(){f=!1;g.markAsFocussed(!1);b.style.opacity="0"};this.setAvatarImageUrl= +function(a){g.setImageUrl(a)};this.setColor=function(a){b.style.borderColor=a;g.setColor(a)};this.getCursor=function(){return k};this.getFocusElement=function(){return b};this.toggleHandleVisibility=function(){g.isVisible()?g.hide():g.show()};this.showHandle=function(){g.show()};this.hideHandle=function(){g.hide()};this.ensureVisible=function(){var a,c,d,f,e=k.getOdtDocument().getOdfCanvas().getElement().parentNode,g;d=e.offsetWidth-e.clientWidth+5;f=e.offsetHeight-e.clientHeight+5;g=b.getBoundingClientRect(); +a=g.left-d;c=g.top-f;d=g.right+d;f=g.bottom+f;g=e.getBoundingClientRect();cg.bottom&&(e.scrollTop+=f-g.bottom);ag.right&&(e.scrollLeft+=d-g.right)};(function(){var c=k.getOdtDocument().getDOM();b=c.createElementNS(c.documentElement.namespaceURI,"span");a=k.getNode();a.appendChild(b);g=new gui.Avatar(a,l)})()}; // Input 64 +runtime.loadClass("core.EventNotifier"); +gui.ClickHandler=function(){function k(){h=0;e=null}var l,h=0,e=null,b=new core.EventNotifier([gui.ClickHandler.signalSingleClick,gui.ClickHandler.signalDoubleClick,gui.ClickHandler.signalTripleClick]);this.subscribe=function(e,a){b.subscribe(e,a)};this.handleMouseUp=function(g){var a=runtime.getWindow();e&&e.x===g.screenX&&e.y===g.screenY?(h+=1,1===h?b.emit(gui.ClickHandler.signalSingleClick,g):2===h?b.emit(gui.ClickHandler.signalDoubleClick,void 0):3===h&&(a.clearTimeout(l),b.emit(gui.ClickHandler.signalTripleClick, +void 0),k())):(b.emit(gui.ClickHandler.signalSingleClick,g),h=1,e={x:g.screenX,y:g.screenY},a.clearTimeout(l),l=a.setTimeout(k,400))}};gui.ClickHandler.signalSingleClick="click";gui.ClickHandler.signalDoubleClick="doubleClick";gui.ClickHandler.signalTripleClick="tripleClick";(function(){return gui.ClickHandler})(); +// Input 65 /* Copyright (C) 2012-2013 KO GmbH @@ -1666,9 +1744,9 @@ void 0),k())):(b.emit(gui.ClickHandler.signalSingleClick,h),n=1,c={x:h.screenX,y @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -gui.KeyboardHandler=function(){function k(b,c){c||(c=l.None);return b+":"+c}var l=gui.KeyboardHandler.Modifier,n=null,c={};this.setDefault=function(b){n=b};this.bind=function(b,h,a){b=k(b,h);runtime.assert(!1===c.hasOwnProperty(b),"tried to overwrite the callback handler of key combo: "+b);c[b]=a};this.unbind=function(b,h){var a=k(b,h);delete c[a]};this.reset=function(){n=null;c={}};this.handleEvent=function(b){var h=b.keyCode,a=l.None;b.metaKey&&(a|=l.Meta);b.ctrlKey&&(a|=l.Ctrl);b.altKey&&(a|=l.Alt); -b.shiftKey&&(a|=l.Shift);h=k(h,a);h=c[h];a=!1;h?a=h():null!==n&&(a=n(b));a&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}};gui.KeyboardHandler.Modifier={None:0,Meta:1,Ctrl:2,Alt:4,Shift:8,MetaShift:9,CtrlShift:10,AltShift:12};gui.KeyboardHandler.KeyCode={Backspace:8,Tab:9,Clear:12,Enter:13,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Delete:46,A:65,B:66,I:73,U:85,Z:90};(function(){return gui.KeyboardHandler})(); -// Input 65 +gui.KeyboardHandler=function(){function k(b,e){e||(e=l.None);return b+":"+e}var l=gui.KeyboardHandler.Modifier,h=null,e={};this.setDefault=function(b){h=b};this.bind=function(b,g,a){b=k(b,g);runtime.assert(!1===e.hasOwnProperty(b),"tried to overwrite the callback handler of key combo: "+b);e[b]=a};this.unbind=function(b,g){var a=k(b,g);delete e[a]};this.reset=function(){h=null;e={}};this.handleEvent=function(b){var g=b.keyCode,a=l.None;b.metaKey&&(a|=l.Meta);b.ctrlKey&&(a|=l.Ctrl);b.altKey&&(a|=l.Alt); +b.shiftKey&&(a|=l.Shift);g=k(g,a);g=e[g];a=!1;g?a=g():null!==h&&(a=h(b));a&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}};gui.KeyboardHandler.Modifier={None:0,Meta:1,Ctrl:2,Alt:4,Shift:8,MetaShift:9,CtrlShift:10,AltShift:12};gui.KeyboardHandler.KeyCode={Backspace:8,Tab:9,Clear:12,Enter:13,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Delete:46,A:65,B:66,I:73,U:85,Z:90};(function(){return gui.KeyboardHandler})(); +// Input 66 /* Copyright (C) 2013 KO GmbH @@ -1704,35 +1782,38 @@ b.shiftKey&&(a|=l.Shift);h=k(h,a);h=c[h];a=!1;h?a=h():null!==n&&(a=n(b));a&&(b.p @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("odf.Namespaces");runtime.loadClass("xmldom.LSSerializer");runtime.loadClass("odf.OdfNodeFilter");runtime.loadClass("odf.TextSerializer"); -gui.Clipboard=function(){var k,l,n;this.setDataFromRange=function(c,b){var h=!0,a,g=c.clipboardData;a=runtime.getWindow();var e=b.startContainer.ownerDocument;!g&&a&&(g=a.clipboardData);g?(e=e.createElement("span"),e.appendChild(b.cloneContents()),a=g.setData("text/plain",l.writeToString(e)),h=h&&a,a=g.setData("text/html",k.writeToString(e,odf.Namespaces.namespaceMap)),h=h&&a,c.preventDefault()):h=!1;return h};k=new xmldom.LSSerializer;l=new odf.TextSerializer;n=new odf.OdfNodeFilter;k.filter=n;l.filter= -n}; -// Input 66 -runtime.loadClass("core.DomUtils");runtime.loadClass("odf.OdfUtils");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("gui.ClickHandler");runtime.loadClass("gui.Clipboard");runtime.loadClass("gui.KeyboardHandler");runtime.loadClass("gui.StyleHelper"); -gui.SessionController=function(){gui.SessionController=function(k,l){function n(a,b,c,d){var e="on"+b,f=!1;a.attachEvent&&(f=a.attachEvent(e,c));!f&&a.addEventListener&&(a.addEventListener(b,c,!1),f=!0);f&&!d||!a.hasOwnProperty(e)||(a[e]=c)}function c(a,b,c){var d="on"+b;a.detachEvent&&a.detachEvent(d,c);a.removeEventListener&&a.removeEventListener(b,c,!1);a[d]===c&&(a[d]=null)}function b(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function h(a,b){var c=new ops.OpMoveCursor;c.init({memberid:l, -position:a,length:b||0});return c}function a(a,b){var c=gui.SelectionMover.createPositionIterator(C.getRootNode()),d=C.getOdfCanvas().getElement(),e;e=a;if(!e)return null;for(;e!==d&&!("urn:webodf:names:cursor"===e.namespaceURI&&"cursor"===e.localName||"urn:webodf:names:editinfo"===e.namespaceURI&&"editinfo"===e.localName);)if(e=e.parentNode,!e)return null;e!==d&&a!==e&&(a=e.parentNode,b=Array.prototype.indexOf.call(a.childNodes,e));c.setUnfilteredPosition(a,b);return C.getDistanceFromCursor(l,c.container(), -c.unfilteredDomOffset())}function g(a){var b=C.getOdfCanvas().getElement(),c=C.getRootNode(),d=0;b.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_PRECEDING||(a=gui.SelectionMover.createPositionIterator(c),a.moveToEnd(),c=a.container(),d=a.unfilteredDomOffset());return{node:c,offset:d}}function e(b){runtime.setTimeout(function(){var c;a:{var d=C.getOdfCanvas().getElement(),e=W.getSelection(),f,m,n,q;if(null===e.anchorNode&&null===e.focusNode){c=b.clientX;f=b.clientY;m=C.getDOM();m.caretRangeFromPoint? -(c=m.caretRangeFromPoint(c,f),f={container:c.startContainer,offset:c.startOffset}):m.caretPositionFromPoint?(c=m.caretPositionFromPoint(c,f),f={container:c.offsetNode,offset:c.offset}):f=null;if(!f){c=null;break a}c=f.container;f=f.offset;m=c;e=f}else c=e.anchorNode,f=e.anchorOffset,m=e.focusNode,e=e.focusOffset;runtime.assert(null!==c&&null!==m,"anchorNode is null or focusNode is null");n=na.containsNode(d,c);q=na.containsNode(d,m);n||q?(n||(n=g(c),c=n.node,f=n.offset),q||(n=g(m),m=n.node,e=n.offset), -d.focus(),c={anchorNode:c,anchorOffset:f,focusNode:m,focusOffset:e}):c=null}null!==c&&(d=a(c.anchorNode,c.anchorOffset),f=c.focusNode===c.anchorNode&&c.focusOffset===c.anchorOffset?d:a(c.focusNode,c.focusOffset),null!==f&&0!==f||null!==d&&0!==d)&&(c=C.getCursorPosition(l),d=h(c+d,f-d),k.enqueue(d))},0)}function d(a){e(a)}function t(){var a=C.getOdfCanvas().getElement(),b=/[A-Za-z0-9]/,c=0,d=0,e,f,g,m;if(na.containsNode(a,W.getSelection().focusNode)){a=gui.SelectionMover.createPositionIterator(C.getRootNode()); -e=C.getCursor(l).getNode();a.setUnfilteredPosition(e,0);if(a.previousPosition()&&(f=a.getCurrentNode(),f.nodeType===Node.TEXT_NODE))for(g=f.data.length-1;0<=g;g-=1){m=f.data[g];if(!b.test(m))break;c-=1}a.setUnfilteredPosition(e,0);if(a.nextPosition()&&(f=a.getCurrentNode(),f.nodeType===Node.TEXT_NODE))for(g=0;ga.length&&(a.position+=a.length,a.length=-a.length);return a}function $(a){var b=new ops.OpRemoveText;b.init({memberid:l,position:a.position,length:a.length});return b}function T(){var a= -M(C.getCursorSelection(l)),b=null;0===a.length?0a.length&&(a.position+=a.length,a.length=-a.length);return a}function Y(a){var b=new ops.OpRemoveText;b.init({memberid:l,position:a.position,length:a.length});return b}function T(){var a= +Q(C.getCursorSelection(l)),b=null;0===a.length?0 @@ -1768,7 +1849,7 @@ b=null===a.which?String.fromCharCode(a.keyCode):0!==a.which&&0!==a.charCode?Stri @source: http://gitorious.org/webodf/webodf/ */ ops.MemberModel=function(){};ops.MemberModel.prototype.getMemberDetailsAndUpdates=function(k,l){};ops.MemberModel.prototype.unsubscribeMemberDetailsUpdates=function(k,l){}; -// Input 68 +// Input 69 /* Copyright (C) 2012-2013 KO GmbH @@ -1804,7 +1885,7 @@ ops.MemberModel=function(){};ops.MemberModel.prototype.getMemberDetailsAndUpdate @source: http://gitorious.org/webodf/webodf/ */ ops.TrivialMemberModel=function(){this.getMemberDetailsAndUpdates=function(k,l){l(k,null)};this.unsubscribeMemberDetailsUpdates=function(k,l){}}; -// Input 69 +// Input 70 /* Copyright (C) 2012-2013 KO GmbH @@ -1839,10 +1920,10 @@ ops.TrivialMemberModel=function(){this.getMemberDetailsAndUpdates=function(k,l){ @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.NowjsMemberModel=function(k){var l={},n={},c=k.getNowObject();this.getMemberDetailsAndUpdates=function(b,h){var a=b.split("___")[0],g=l[a],e=n[a]||[],d;n[a]=e;runtime.assert(void 0!==h,"missing callback");for(d=0;d @@ -1877,11 +1958,11 @@ function(b,c){var a=c?{userid:c.uid,fullname:c.fullname,imageurl:"/user/"+c.avat @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.PullBoxMemberModel=function(k,l){function n(){var a,c=Object.keys(h);runtime.log("member-list request for : "+c.join(","));l.call({command:"query_memberdata_list",args:{es_id:k,member_ids:c}},function(c){var e=runtime.fromJson(c),f;runtime.log("member-list reply: "+c);if(e.hasOwnProperty("memberdata_list"))for(c=e.memberdata_list,a=0;a @@ -1917,7 +1998,7 @@ c);delete h[c];delete b[c];a:{var f;if(a){for(f in h)if(h.hasOwnProperty(f))brea @source: http://gitorious.org/webodf/webodf/ */ ops.OperationRouter=function(){};ops.OperationRouter.prototype.setOperationFactory=function(k){};ops.OperationRouter.prototype.setPlaybackFunction=function(k){};ops.OperationRouter.prototype.push=function(k){}; -// Input 72 +// Input 73 /* Copyright (C) 2012 KO GmbH @@ -1952,12 +2033,12 @@ ops.OperationRouter=function(){};ops.OperationRouter.prototype.setOperationFacto @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.TrivialOperationRouter=function(){var k,l;this.setOperationFactory=function(l){k=l};this.setPlaybackFunction=function(k){l=k};this.push=function(n){n=n.spec();n.timestamp=(new Date).getTime();n=k.create(n);l(n)}}; -// Input 73 -ops.NowjsOperationRouter=function(k,l,n){function c(a){var c;c=b.create(a);runtime.log(" op in: "+runtime.toJson(a));if(null!==c)if(a=Number(a.server_seq),runtime.assert(!isNaN(a),"server seq is not a number"),a===g+1)for(h(c),g=a,d=0,c=g+1;e.hasOwnProperty(c);c+=1)h(e[c]),delete e[c],runtime.log("op with server seq "+a+" taken from hold (reordered)");else runtime.assert(a!==g+1,"received incorrect order from server"),runtime.assert(!e.hasOwnProperty(a),"reorder_queue has incoming op"),runtime.log("op with server seq "+ -a+" put on hold"),e[a]=c;else runtime.log("ignoring invalid incoming opspec: "+a)}var b,h,a=n.getNowObject(),g=-1,e={},d=0,t=1E3;this.setOperationFactory=function(a){b=a};this.setPlaybackFunction=function(a){h=a};a.ping=function(a){null!==l&&a(l)};a.receiveOp=function(a,b){a===k&&c(b)};this.push=function(b){b=b.spec();runtime.assert(null!==l,"Router sequence N/A without memberid");t+=1;b.client_nonce="C:"+l+":"+t;b.parent_op=g+"+"+d;d+=1;runtime.log("op out: "+runtime.toJson(b));a.deliverOp(k,b)}; -this.requestReplay=function(b){a.requestReplay(k,function(a){runtime.log("replaying: "+runtime.toJson(a));c(a)},function(a){runtime.log("replay done ("+a+" ops).");b&&b()})}}; +ops.TrivialOperationRouter=function(){var k,l;this.setOperationFactory=function(h){k=h};this.setPlaybackFunction=function(h){l=h};this.push=function(h){h=h.spec();h.timestamp=(new Date).getTime();h=k.create(h);l(h)}}; // Input 74 +ops.NowjsOperationRouter=function(k,l,h){function e(a){var e;e=b.create(a);runtime.log(" op in: "+runtime.toJson(a));if(null!==e)if(a=Number(a.server_seq),runtime.assert(!isNaN(a),"server seq is not a number"),a===f+1)for(g(e),f=a,c=0,e=f+1;d.hasOwnProperty(e);e+=1)g(d[e]),delete d[e],runtime.log("op with server seq "+a+" taken from hold (reordered)");else runtime.assert(a!==f+1,"received incorrect order from server"),runtime.assert(!d.hasOwnProperty(a),"reorder_queue has incoming op"),runtime.log("op with server seq "+ +a+" put on hold"),d[a]=e;else runtime.log("ignoring invalid incoming opspec: "+a)}var b,g,a=h.getNowObject(),f=-1,d={},c=0,t=1E3;this.setOperationFactory=function(a){b=a};this.setPlaybackFunction=function(a){g=a};a.ping=function(a){null!==l&&a(l)};a.receiveOp=function(a,b){a===k&&e(b)};this.push=function(b){b=b.spec();runtime.assert(null!==l,"Router sequence N/A without memberid");t+=1;b.client_nonce="C:"+l+":"+t;b.parent_op=f+"+"+c;c+=1;runtime.log("op out: "+runtime.toJson(b));a.deliverOp(k,b)}; +this.requestReplay=function(b){a.requestReplay(k,function(a){runtime.log("replaying: "+runtime.toJson(a));e(a)},function(a){runtime.log("replay done ("+a+" ops).");b&&b()})}}; +// Input 75 /* Copyright (C) 2013 KO GmbH @@ -1993,21 +2074,21 @@ this.requestReplay=function(b){a.requestReplay(k,function(a){runtime.log("replay @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("ops.OperationTransformer"); -ops.PullBoxOperationRouter=function(k,l,n){function c(a){var b,c,d,f=[];for(b=0;bf?(n(1,0),g=n(0.5,1E4-f),e=n(0.2,2E4-f)):1E4<=f&&2E4>f?(n(0.5,0),e=n(0.2,2E4-f)):n(0.2,0)};this.getEdits= -function(){return k.getEdits()};this.clearEdits=function(){k.clearEdits();h.setEdits([]);a.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&a.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return k};this.show=function(){a.style.display="block"};this.hide=function(){c.hideHandle();a.style.display="none"};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};(function(){var d=k.getOdtDocument().getDOM();a=d.createElementNS(d.documentElement.namespaceURI, -"div");a.setAttribute("class","editInfoMarker");a.onmouseover=function(){c.showHandle()};a.onmouseout=function(){c.hideHandle()};b=k.getNode();b.appendChild(a);h=new gui.EditInfoHandle(b);l||c.hide()})()}; +gui.EditInfoHandle=function(k){var l=[],h,e=k.ownerDocument,b=e.documentElement.namespaceURI;this.setEdits=function(g){l=g;var a,f,d,c;h.innerHTML="";for(g=0;gl?(h(1,0),f=h(0.5,1E4-l),d=h(0.2,2E4-l)):1E4<=l&&2E4>l?(h(0.5,0),d=h(0.2,2E4-l)):h(0.2,0)};this.getEdits= +function(){return k.getEdits()};this.clearEdits=function(){k.clearEdits();g.setEdits([]);a.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&a.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return k};this.show=function(){a.style.display="block"};this.hide=function(){e.hideHandle();a.style.display="none"};this.showHandle=function(){g.show()};this.hideHandle=function(){g.hide()};(function(){var c=k.getOdtDocument().getDOM();a=c.createElementNS(c.documentElement.namespaceURI, +"div");a.setAttribute("class","editInfoMarker");a.onmouseover=function(){e.showHandle()};a.onmouseout=function(){e.hideHandle()};b=k.getNode();b.appendChild(a);g=new gui.EditInfoHandle(b);l||e.hide()})()}; +// Input 78 /* Copyright (C) 2012-2013 KO GmbH @@ -2043,13 +2124,13 @@ function(){return k.getEdits()};this.clearEdits=function(){k.clearEdits();h.setE @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("gui.Caret");runtime.loadClass("ops.TrivialMemberModel");runtime.loadClass("ops.EditInfo");runtime.loadClass("gui.EditInfoMarker");gui.SessionViewOptions=function(){this.caretBlinksOnRangeSelect=this.caretAvatarsInitiallyVisible=this.editInfoMarkersInitiallyVisible=!0}; -gui.SessionView=function(){return function(k,l,n){function c(a,b,c){b=b.split("___")[0];return a+'[editinfo|memberid^="'+b+'"]'+c}function b(a,b,d){function e(b,d,f){d=c(b,a,f)+d;a:{var g=t.firstChild;for(b=c(b,a,f);g;){if(g.nodeType===Node.TEXT_NODE&&0===g.data.indexOf(b)){b=g;break a}g=g.nextSibling}b=null}b?b.data=d:t.appendChild(document.createTextNode(d))}e("div.editInfoMarker","{ background-color: "+d+"; }","");e("span.editInfoColor","{ background-color: "+d+"; }","");e("span.editInfoAuthor", -'{ content: "'+b+'"; }',":before");e("dc|creator",'{ content: "'+b+'"; display: none;}',":before");e("dc|creator","{ background-color: "+d+"; }","")}function h(a){var b,c;for(c in f)f.hasOwnProperty(c)&&(b=f[c],a?b.show():b.hide())}function a(a){n.getCarets().forEach(function(b){a?b.showHandle():b.hideHandle()})}function g(a,c){var d=n.getCaret(a);void 0===c?runtime.log('MemberModel sent undefined data for member "'+a+'".'):(null===c&&(c={memberid:a,fullname:"Unknown Identity",color:"black",imageurl:"avatar-joe.png"}), -d&&(d.setAvatarImageUrl(c.imageurl),d.setColor(c.color)),b(a,c.fullname,c.color))}function e(a){var b=a.getMemberId(),c=l.getMemberModel();n.registerCursor(a,m,r);g(b,null);c.getMemberDetailsAndUpdates(b,g);runtime.log("+++ View here +++ eagerly created an Caret for '"+b+"'! +++")}function d(a){var b=!1,c;for(c in f)if(f.hasOwnProperty(c)&&f[c].getEditInfo().getEdits().hasOwnProperty(a)){b=!0;break}b||l.getMemberModel().unsubscribeMemberDetailsUpdates(a,g)}var t,f={},s=void 0!==k.editInfoMarkersInitiallyVisible? -Boolean(k.editInfoMarkersInitiallyVisible):!0,m=void 0!==k.caretAvatarsInitiallyVisible?Boolean(k.caretAvatarsInitiallyVisible):!0,r=void 0!==k.caretBlinksOnRangeSelect?Boolean(k.caretBlinksOnRangeSelect):!0;this.showEditInfoMarkers=function(){s||(s=!0,h(s))};this.hideEditInfoMarkers=function(){s&&(s=!1,h(s))};this.showCaretAvatars=function(){m||(m=!0,a(m))};this.hideCaretAvatars=function(){m&&(m=!1,a(m))};this.getSession=function(){return l};this.getCaret=function(a){return n.getCaret(a)};(function(){var a= -l.getOdtDocument(),b=document.getElementsByTagName("head")[0];a.subscribe(ops.OdtDocument.signalCursorAdded,e);a.subscribe(ops.OdtDocument.signalCursorRemoved,d);a.subscribe(ops.OdtDocument.signalParagraphChanged,function(a){var b=a.paragraphElement,c=a.memberId;a=a.timeStamp;var d,e="",g=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0];g?(e=g.getAttributeNS("urn:webodf:names:editinfo","id"),d=f[e]):(e=Math.random().toString(),d=new ops.EditInfo(b,l.getOdtDocument()),d=new gui.EditInfoMarker(d, -s),g=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0],g.setAttributeNS("urn:webodf:names:editinfo","id",e),f[e]=d);d.addEdit(c,new Date(a))});t=document.createElementNS(b.namespaceURI,"style");t.type="text/css";t.media="screen, print, handheld, projection";t.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));t.appendChild(document.createTextNode("@namespace dc url(http://purl.org/dc/elements/1.1/);"));b.appendChild(t)})()}}(); -// Input 78 +gui.SessionView=function(){return function(k,l,h){function e(a,b,d){function e(b,d,f){d=b+'[editinfo|memberid^="'+a+'"]'+f+d;a:{var g=c.firstChild;for(b=b+'[editinfo|memberid^="'+a+'"]'+f;g;){if(g.nodeType===Node.TEXT_NODE&&0===g.data.indexOf(b)){b=g;break a}g=g.nextSibling}b=null}b?b.data=d:c.appendChild(document.createTextNode(d))}e("div.editInfoMarker","{ background-color: "+d+"; }","");e("span.editInfoColor","{ background-color: "+d+"; }","");e("span.editInfoAuthor",'{ content: "'+b+'"; }',":before"); +e("dc|creator",'{ content: "'+b+'"; display: none;}',":before");e("dc|creator","{ background-color: "+d+"; }","")}function b(a){var b,c;for(c in t)t.hasOwnProperty(c)&&(b=t[c],a?b.show():b.hide())}function g(a){h.getCarets().forEach(function(b){a?b.showHandle():b.hideHandle()})}function a(a,b){var c=h.getCaret(a);void 0===b?runtime.log('MemberModel sent undefined data for member "'+a+'".'):(null===b&&(b={memberid:a,fullname:"Unknown Identity",color:"black",imageurl:"avatar-joe.png"}),c&&(c.setAvatarImageUrl(b.imageurl), +c.setColor(b.color)),e(a,b.fullname,b.color))}function f(b){var c=b.getMemberId(),d=l.getMemberModel();h.registerCursor(b,q,n);a(c,null);d.getMemberDetailsAndUpdates(c,a);runtime.log("+++ View here +++ eagerly created an Caret for '"+c+"'! +++")}function d(b){var c=!1,d;for(d in t)if(t.hasOwnProperty(d)&&t[d].getEditInfo().getEdits().hasOwnProperty(b)){c=!0;break}c||l.getMemberModel().unsubscribeMemberDetailsUpdates(b,a)}var c,t={},m=void 0!==k.editInfoMarkersInitiallyVisible?Boolean(k.editInfoMarkersInitiallyVisible): +!0,q=void 0!==k.caretAvatarsInitiallyVisible?Boolean(k.caretAvatarsInitiallyVisible):!0,n=void 0!==k.caretBlinksOnRangeSelect?Boolean(k.caretBlinksOnRangeSelect):!0;this.showEditInfoMarkers=function(){m||(m=!0,b(m))};this.hideEditInfoMarkers=function(){m&&(m=!1,b(m))};this.showCaretAvatars=function(){q||(q=!0,g(q))};this.hideCaretAvatars=function(){q&&(q=!1,g(q))};this.getSession=function(){return l};this.getCaret=function(a){return h.getCaret(a)};(function(){var a=l.getOdtDocument(),b=document.getElementsByTagName("head")[0]; +a.subscribe(ops.OdtDocument.signalCursorAdded,f);a.subscribe(ops.OdtDocument.signalCursorRemoved,d);a.subscribe(ops.OdtDocument.signalParagraphChanged,function(a){var b=a.paragraphElement,c=a.memberId;a=a.timeStamp;var d,e="",f=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0];f?(e=f.getAttributeNS("urn:webodf:names:editinfo","id"),d=t[e]):(e=Math.random().toString(),d=new ops.EditInfo(b,l.getOdtDocument()),d=new gui.EditInfoMarker(d,m),f=b.getElementsByTagNameNS("urn:webodf:names:editinfo", +"editinfo")[0],f.setAttributeNS("urn:webodf:names:editinfo","id",e),t[e]=d);d.addEdit(c,new Date(a))});c=document.createElementNS(b.namespaceURI,"style");c.type="text/css";c.media="screen, print, handheld, projection";c.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));c.appendChild(document.createTextNode("@namespace dc url(http://purl.org/dc/elements/1.1/);"));b.appendChild(c)})()}}(); +// Input 79 /* Copyright (C) 2012-2013 KO GmbH @@ -2085,27 +2166,27 @@ s),g=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0],g.setAt @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("gui.Caret"); -gui.CaretManager=function(k){function l(a){return e.hasOwnProperty(a)?e[a]:null}function n(){return k.getSession().getOdtDocument().getOdfCanvas().getElement()}function c(a){a===k.getInputMemberId()&&n().removeAttribute("tabindex");delete e[a]}function b(a){a=a.getMemberId();a===k.getInputMemberId()&&(a=l(a))&&a.refreshCursorBlinking()}function h(a){a.memberId===k.getInputMemberId()&&(a=l(a.memberId))&&a.ensureVisible()}function a(){var a=l(k.getInputMemberId());a&&a.setFocus()}function g(){var a= -l(k.getInputMemberId());a&&a.removeFocus()}var e={};this.registerCursor=function(a,b,c){var g=a.getMemberId(),h=n();b=new gui.Caret(a,b,c);e[g]=b;g===k.getInputMemberId()&&(runtime.log("Starting to track input on new cursor of "+g),a.handleUpdate=b.ensureVisible,h.setAttribute("tabindex",0),h.focus());return b};this.getCaret=l;this.getCarets=function(){return Object.keys(e).map(function(a){return e[a]})};(function(){var d=k.getSession().getOdtDocument(),e=n();d.subscribe(ops.OdtDocument.signalParagraphChanged, -h);d.subscribe(ops.OdtDocument.signalCursorMoved,b);d.subscribe(ops.OdtDocument.signalCursorRemoved,c);e.onfocus=a;e.onblur=g})()}; -// Input 79 -runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.Namespaces"); -gui.PresenterUI=function(){var k=new xmldom.XPath,l=runtime.getWindow();return function(n){var c=this;c.setInitialSlideMode=function(){c.startSlideMode("single")};c.keyDownHandler=function(b){if(!b.target.isContentEditable&&"input"!==b.target.nodeName)switch(b.keyCode){case 84:c.toggleToolbar();break;case 37:case 8:c.prevSlide();break;case 39:case 32:c.nextSlide();break;case 36:c.firstSlide();break;case 35:c.lastSlide()}};c.root=function(){return c.odf_canvas.odfContainer().rootElement};c.firstSlide= -function(){c.slideChange(function(b,c){return 0})};c.lastSlide=function(){c.slideChange(function(b,c){return c-1})};c.nextSlide=function(){c.slideChange(function(b,c){return b+1b?-1:b-1})};c.slideChange=function(b){var h=c.getPages(c.odf_canvas.odfContainer().rootElement),a=-1,g=0;h.forEach(function(b){b=b[1];b.hasAttribute("slide_current")&&(a=g,b.removeAttribute("slide_current"));g+=1});b=b(a,h.length);-1===b&&(b=a);h[b][1].setAttribute("slide_current", -"1");document.getElementById("pagelist").selectedIndex=b;"cont"===c.slide_mode&&l.scrollBy(0,h[b][1].getBoundingClientRect().top-30)};c.selectSlide=function(b){c.slideChange(function(c,a){return b>=a||0>b?-1:b})};c.scrollIntoContView=function(b){var h=c.getPages(c.odf_canvas.odfContainer().rootElement);0!==h.length&&l.scrollBy(0,h[b][1].getBoundingClientRect().top-30)};c.getPages=function(b){b=b.getElementsByTagNameNS(odf.Namespaces.drawns,"page");var c=[],a;for(a=0;a=a.rangeCount||!r)||(a=a.getRangeAt(0),r.setPoint(a.startContainer,a.startOffset))}function h(){var a=k.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();r&&r.node()&&(b=r.node(),c=b.ownerDocument.createRange(), -c.setStart(b,r.position()),c.collapse(!0),a.addRange(c))}function a(a){var d=a.charCode||a.keyCode;if(r=null,r&&37===d)b(),r.stepBackward(),h();else if(16<=d&&20>=d||33<=d&&40>=d)return;c(a)}function g(a){c(a)}function e(a){for(var b=a.firstChild;b&&b!==a;)b.nodeType===Node.ELEMENT_NODE&&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,c.nodeType===Node.TEXT_NODE&&d.test(c.nodeValue)&&c.parentNode.removeChild(c)}function d(a,b){for(var c=a.firstChild,e,f,g;c&&c!==a;){if(c.nodeType===Node.ELEMENT_NODE)for(d(c,b),e=c.attributes,g=e.length-1;0<=g;g-=1)f=e.item(g),"http://www.w3.org/2000/xmlns/"!==f.namespaceURI||b[f.nodeValue]||(b[f.nodeValue]=f.localName);c=c.nextSibling||c.parentNode}}function t(){var a=k.ownerDocument.createElement("style"),b;b={};d(k,b); -var c={},e,g,h=0;for(e in b)if(b.hasOwnProperty(e)&&e){g=b[e];if(!g||c.hasOwnProperty(g)||"xmlns"===g){do g="ns"+h,h+=1;while(c.hasOwnProperty(g));b[e]=g}c[g]=!0}a.type="text/css";b="@namespace customns url(customns);\n"+f;a.appendChild(k.ownerDocument.createTextNode(b));l=l.parentNode.replaceChild(a,l)}var f,s,m,r=null;k.id||(k.id="xml"+String(Math.random()).substring(2));s="#"+k.id+" ";f=s+"*,"+s+":visited, "+s+":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"+ -s+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+s+":after {color: blue; content: '';}\n"+s+"{overflow: auto;}\n";(function(b){n(b,"click",g);n(b,"keydown",a);n(b,"drop",c);n(b,"dragend",c);n(b,"beforepaste",c);n(b,"paste",c)})(k);this.updateCSS=t;this.setXML=function(a){a=a.documentElement||a;m=a=k.ownerDocument.importNode(a,!0);for(e(a);k.lastChild;)k.removeChild(k.lastChild);k.appendChild(a);t();r=new core.PositionIterator(a)};this.getXML= -function(){return m}}; +runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.Namespaces"); +gui.PresenterUI=function(){var k=new xmldom.XPath,l=runtime.getWindow();return function(h){var e=this;e.setInitialSlideMode=function(){e.startSlideMode("single")};e.keyDownHandler=function(b){if(!b.target.isContentEditable&&"input"!==b.target.nodeName)switch(b.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(b,e){return 0})};e.lastSlide=function(){e.slideChange(function(b,e){return e-1})};e.nextSlide=function(){e.slideChange(function(b,e){return b+1b?-1:b-1})};e.slideChange=function(b){var g=e.getPages(e.odf_canvas.odfContainer().rootElement),a=-1,f=0;g.forEach(function(b){b=b[1];b.hasAttribute("slide_current")&&(a=f,b.removeAttribute("slide_current"));f+=1});b=b(a,g.length);-1===b&&(b=a);g[b][1].setAttribute("slide_current", +"1");document.getElementById("pagelist").selectedIndex=b;"cont"===e.slide_mode&&l.scrollBy(0,g[b][1].getBoundingClientRect().top-30)};e.selectSlide=function(b){e.slideChange(function(e,a){return b>=a||0>b?-1:b})};e.scrollIntoContView=function(b){var g=e.getPages(e.odf_canvas.odfContainer().rootElement);0!==g.length&&l.scrollBy(0,g[b][1].getBoundingClientRect().top-30)};e.getPages=function(b){b=b.getElementsByTagNameNS(odf.Namespaces.drawns,"page");var e=[],a;for(a=0;a=a.rangeCount||!p)||(a=a.getRangeAt(0),p.setPoint(a.startContainer,a.startOffset))}function g(){var a=k.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(a){var c=a.charCode||a.keyCode;if(p=null,p&&37===c)b(),p.stepBackward(),g();else if(16<=c&&20>=c||33<=c&&40>=c)return;e(a)}function f(a){e(a)}function d(a){for(var b=a.firstChild;b&&b!==a;)b.nodeType===Node.ELEMENT_NODE&&d(b),b=b.nextSibling||b.parentNode;var c,e,f,b=a.attributes;c="";for(f=b.length-1;0<=f;f-=1)e=b.item(f),c=c+" "+e.nodeName+'="'+e.nodeValue+'"';a.setAttribute("customns_name",a.nodeName);a.setAttribute("customns_atts", +c);b=a.firstChild;for(e=/^\s*$/;b&&b!==a;)c=b,b=b.nextSibling||b.parentNode,c.nodeType===Node.TEXT_NODE&&e.test(c.nodeValue)&&c.parentNode.removeChild(c)}function c(a,b){for(var d=a.firstChild,e,f,g;d&&d!==a;){if(d.nodeType===Node.ELEMENT_NODE)for(c(d,b),e=d.attributes,g=e.length-1;0<=g;g-=1)f=e.item(g),"http://www.w3.org/2000/xmlns/"!==f.namespaceURI||b[f.nodeValue]||(b[f.nodeValue]=f.localName);d=d.nextSibling||d.parentNode}}function t(){var a=k.ownerDocument.createElement("style"),b;b={};c(k,b); +var d={},e,f,g=0;for(e in b)if(b.hasOwnProperty(e)&&e){f=b[e];if(!f||d.hasOwnProperty(f)||"xmlns"===f){do f="ns"+g,g+=1;while(d.hasOwnProperty(f));b[e]=f}d[f]=!0}a.type="text/css";b="@namespace customns url(customns);\n"+m;a.appendChild(k.ownerDocument.createTextNode(b));l=l.parentNode.replaceChild(a,l)}var m,q,n,p=null;k.id||(k.id="xml"+String(Math.random()).substring(2));q="#"+k.id+" ";m=q+"*,"+q+":visited, "+q+":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"+ +q+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+q+":after {color: blue; content: '';}\n"+q+"{overflow: auto;}\n";(function(b){h(b,"click",f);h(b,"keydown",a);h(b,"drop",e);h(b,"dragend",e);h(b,"beforepaste",e);h(b,"paste",e)})(k);this.updateCSS=t;this.setXML=function(a){a=a.documentElement||a;n=a=k.ownerDocument.importNode(a,!0);for(d(a);k.lastChild;)k.removeChild(k.lastChild);k.appendChild(a);t();p=new core.PositionIterator(a)};this.getXML= +function(){return n}}; +// Input 82 /* Copyright (C) 2013 KO GmbH @@ -2142,7 +2223,7 @@ function(){return m}}; */ gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(k,l){};gui.UndoManager.prototype.unsubscribe=function(k,l){};gui.UndoManager.prototype.setOdtDocument=function(k){};gui.UndoManager.prototype.saveInitialState=function(){};gui.UndoManager.prototype.resetInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(k){};gui.UndoManager.prototype.hasUndoStates=function(){};gui.UndoManager.prototype.hasRedoStates=function(){}; gui.UndoManager.prototype.moveForward=function(k){};gui.UndoManager.prototype.moveBackward=function(k){};gui.UndoManager.prototype.onOperationExecuted=function(k){};gui.UndoManager.signalUndoStackChanged="undoStackChanged";gui.UndoManager.signalUndoStateCreated="undoStateCreated";gui.UndoManager.signalUndoStateModified="undoStateModified";(function(){return gui.UndoManager})(); -// Input 82 +// Input 83 /* Copyright (C) 2013 KO GmbH @@ -2177,9 +2258,9 @@ gui.UndoManager.prototype.moveForward=function(k){};gui.UndoManager.prototype.mo @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -gui.UndoStateRules=function(){function k(k){return k.spec().optype}function l(l){switch(k(l)){case "MoveCursor":case "AddCursor":case "RemoveCursor":return!1;default:return!0}}this.getOpType=k;this.isEditOperation=l;this.isPartOfOperationSet=function(n,c){if(l(n)){if(0===c.length)return!0;var b;if(b=l(c[c.length-1]))a:{b=c.filter(l);var h=k(n),a;b:switch(h){case "RemoveText":case "InsertText":a=!0;break b;default:a=!1}if(a&&h===k(b[0])){if(1===b.length){b=!0;break a}h=b[b.length-2].spec().position; -b=b[b.length-1].spec().position;a=n.spec().position;if(b===a-(b-h)){b=!0;break a}}b=!1}return b}return!0}}; -// Input 83 +gui.UndoStateRules=function(){function k(h){return h.spec().optype}function l(h){switch(k(h)){case "MoveCursor":case "AddCursor":case "RemoveCursor":return!1;default:return!0}}this.getOpType=k;this.isEditOperation=l;this.isPartOfOperationSet=function(h,e){if(l(h)){if(0===e.length)return!0;var b;if(b=l(e[e.length-1]))a:{b=e.filter(l);var g=k(h),a;b:switch(g){case "RemoveText":case "InsertText":a=!0;break b;default:a=!1}if(a&&g===k(b[0])){if(1===b.length){b=!0;break a}g=b[b.length-2].spec().position; +b=b[b.length-1].spec().position;a=h.spec().position;if(b===a-(b-g)){b=!0;break a}}b=!1}return b}return!0}}; +// Input 84 /* Copyright (C) 2013 KO GmbH @@ -2215,13 +2296,13 @@ b=b[b.length-1].spec().position;a=n.spec().position;if(b===a-(b-h)){b=!0;break a @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.DomUtils");runtime.loadClass("gui.UndoManager");runtime.loadClass("gui.UndoStateRules"); -gui.TrivialUndoManager=function(k){function l(){q.emit(gui.UndoManager.signalUndoStackChanged,{undoAvailable:a.hasUndoStates(),redoAvailable:a.hasRedoStates()})}function n(){s!==d&&s!==m[m.length-1]&&m.push(s)}function c(a){var b=a.previousSibling||a.nextSibling;a.parentNode.removeChild(a);g.normalizeTextNodes(b)}function b(a){return Object.keys(a).map(function(b){return a[b]})}function h(a){function c(a){var b=a.spec();if(g[b.memberid])switch(b.optype){case "AddCursor":d[b.memberid]||(d[b.memberid]= -a,delete g[b.memberid],h-=1);break;case "MoveCursor":e[b.memberid]||(e[b.memberid]=a)}}var d={},e={},g={},h,k=a.pop();f.getCursors().forEach(function(a){g[a.getMemberId()]=!0});for(h=Object.keys(g).length;k&&0 @@ -2257,22 +2338,22 @@ b.refreshCSS(),s=m[m.length-1]||d,l());return g}};gui.TrivialUndoManager.signalD @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.EventNotifier");runtime.loadClass("odf.OdfUtils");runtime.loadClass("gui.SelectionMover");runtime.loadClass("gui.StyleHelper");runtime.loadClass("core.PositionFilterChain"); -ops.OdtDocument=function(k){function l(){var a=k.odfContainer().getContentElement(),b=a&&a.localName;runtime.assert("text"===b,"Unsupported content element type '"+b+"'for OdtDocument");return a}function n(a){function b(a){for(;!(a.namespaceURI===odf.Namespaces.officens&&"text"===a.localName||a.namespaceURI===odf.Namespaces.officens&&"annotation"===a.localName);)a=a.parentNode;return a}this.acceptPosition=function(c){c=c.container();var d=e[a].getNode();return b(c)===b(d)?t:f}}function c(a){var b= -gui.SelectionMover.createPositionIterator(l());for(a+=1;0=e;e+=1){b=a.container();d=a.unfilteredDomOffset();if(b.nodeType===Node.TEXT_NODE&&" "===b.data[d]&&g.isSignificantWhitespace(b, -d)){runtime.assert(" "===b.data[d],"upgradeWhitespaceToElement: textNode.data[offset] should be a literal space");var f=b.ownerDocument.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:s");f.appendChild(b.ownerDocument.createTextNode(" "));b.deleteData(d,1);0= 0");1===s.acceptPosition(c)?(f=c.container(),f.nodeType===Node.TEXT_NODE&&(d=f,g=0)):a+=1;for(;0=d;d+=1){b=a.container();c=a.unfilteredDomOffset();if(b.nodeType===Node.TEXT_NODE&&" "===b.data[c]&&f.isSignificantWhitespace(b, +c)){runtime.assert(" "===b.data[c],"upgradeWhitespaceToElement: textNode.data[offset] should be a literal space");var g=b.ownerDocument.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:s");g.appendChild(b.ownerDocument.createTextNode(" "));b.deleteData(c,1);0= 0");1===q.acceptPosition(c)?(f=c.container(),f.nodeType===Node.TEXT_NODE&&(e=f,g=0)):a+=1;for(;0 @@ -2308,7 +2389,7 @@ ops.OdtDocument.signalStyleCreated="style/created";ops.OdtDocument.signalStyleDe @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("ops.TrivialMemberModel");runtime.loadClass("ops.TrivialOperationRouter");runtime.loadClass("ops.OperationFactory");runtime.loadClass("ops.OdtDocument"); -ops.Session=function(k){var l=new ops.OperationFactory,n=new ops.OdtDocument(k),c=new ops.TrivialMemberModel,b=null;this.setMemberModel=function(b){c=b};this.setOperationFactory=function(c){l=c;b&&b.setOperationFactory(l)};this.setOperationRouter=function(c){b=c;c.setPlaybackFunction(function(a){a.execute(n);n.emit(ops.OdtDocument.signalOperationExecuted,a)});c.setOperationFactory(l)};this.getMemberModel=function(){return c};this.getOperationFactory=function(){return l};this.getOdtDocument=function(){return n}; -this.enqueue=function(c){b.push(c)};this.setOperationRouter(new ops.TrivialOperationRouter)}; -// Input 86 -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@namespace annotation url(urn:webodf:names:annotation);\n@namespace dc url(http://purl.org/dc/elements/1.1/);\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 min-height: 1.3em; /* prevent empty paragraphs and headings from collapsing if they are empty */\n}\n*[runtimens|containsparagraphanchor] {\n position: relative;\n}\ntext|s {\n white-space: pre;\n}\ntext|tab {\n display: inline;\n white-space: pre;\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 text-align: left;\n overflow: visible;\n word-wrap: break-word;\n}\n\noffice|text::selection {\n /** Let's not draw selection highlight that overflows into the office|text\n * node when selecting content across several paragraphs\n */\n background: transparent;\n}\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}\n#shadowContent {\n display: inline-block;\n text-align: left;\n}\ndraw|page {\n display: block;\n position: relative;\n overflow: hidden;\n}\npresentation|notes, presentation|footer-decl, presentation|date-time-decl {\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 word-break: break-all; /* prevent long words from extending out the 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 z-index: 1;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n top: 5%; /* push down the caret; 0px can do the job, 5% looks better, 10% is a bit over */\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\n.annotationWrapper {\n display: inline;\n position: relative;\n}\n\n.annotationNote {\n width: 4cm;\n position: absolute;\n display: inline;\n z-index: 10;\n}\n.annotationNote > office|annotation {\n display: block;\n}\n\n.annotationConnector {\n position: absolute;\n display: inline;\n z-index: 10;\n border-top: 1px dashed brown;\n}\n.annotationConnector.angular {\n -moz-transform-origin: left top;\n -webkit-transform-origin: left top;\n -ms-transform-origin: left top;\n transform-origin: left top;\n}\n.annotationConnector.horizontal {\n left: 0;\n}\n.annotationConnector.horizontal:before {\n content: '';\n display: inline;\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: brown transparent transparent transparent;\n top: -1px;\n left: -5px;\n}\n\noffice|annotation {\n width: 100%;\n height: 100%;\n display: none;\n background: rgb(198, 238, 184);\n background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n box-shadow: 0 3px 4px -3px #ccc;\n}\n\noffice|annotation > dc|creator {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n color: white;\n background-color: brown;\n padding: 4px;\n}\noffice|annotation > dc|date {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n border: 4px solid transparent;\n}\noffice|annotation > text|list {\n display: block;\n padding: 5px;\n}\n\n/* This is very temporary CSS. This must go once\n * we start bundling webodf-default ODF styles for annotations.\n */\noffice|annotation text|p {\n font-size: 10pt;\n color: black;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n font-family: sans-serif;\n}\n\ndc|*::selection {\n background: transparent;\n}\ndc|*::-moz-selection {\n background: transparent;\n}\n\n#annotationsPane {\n background-color: #EAEAEA;\n width: 4cm;\n height: 100%;\n display: inline-block;\n position: absolute;\n outline: 1px solid #ccc;\n}\n\n.annotationHighlight {\n background-color: yellow;\n position: relative;\n}\n"; +ops.Session=function(k){var l=new ops.OperationFactory,h=new ops.OdtDocument(k),e=new ops.TrivialMemberModel,b=null;this.setMemberModel=function(b){e=b};this.setOperationFactory=function(e){l=e;b&&b.setOperationFactory(l)};this.setOperationRouter=function(e){b=e;e.setPlaybackFunction(function(a){a.execute(h);h.emit(ops.OdtDocument.signalOperationExecuted,a)});e.setOperationFactory(l)};this.getMemberModel=function(){return e};this.getOperationFactory=function(){return l};this.getOdtDocument=function(){return h}; +this.enqueue=function(e){b.push(e)};this.setOperationRouter(new ops.TrivialOperationRouter)}; +// Input 87 +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@namespace annotation url(urn:webodf:names:annotation);\n@namespace dc url(http://purl.org/dc/elements/1.1/);\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 min-height: 1.3em; /* prevent empty paragraphs and headings from collapsing if they are empty */\n}\n*[runtimens|containsparagraphanchor] {\n position: relative;\n}\ntext|s {\n white-space: pre;\n}\ntext|tab {\n display: inline;\n white-space: pre;\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 text-align: left;\n overflow: visible;\n word-wrap: break-word;\n}\n\noffice|text::selection {\n /** Let's not draw selection highlight that overflows into the office|text\n * node when selecting content across several paragraphs\n */\n background: transparent;\n}\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}\n#shadowContent {\n display: inline-block;\n text-align: left;\n}\ndraw|page {\n display: block;\n position: relative;\n overflow: hidden;\n}\npresentation|notes, presentation|footer-decl, presentation|date-time-decl {\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 word-break: break-all; /* prevent long words from extending out the 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 z-index: 1;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n top: 5%; /* push down the caret; 0px can do the job, 5% looks better, 10% is a bit over */\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\n.annotationWrapper {\n display: inline;\n position: relative;\n}\n\n.annotationRemoveButton:before {\n content: '\u00d7';\n color: white;\n padding: 5px;\n line-height: 1em;\n}\n\n.annotationRemoveButton {\n width: 20px;\n height: 20px;\n border-radius: 10px;\n background-color: black;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n position: absolute;\n top: -10px;\n left: -10px;\n z-index: 3;\n text-align: center;\n font-family: sans-serif;\n font-style: normal;\n font-weight: normal;\n text-decoration: none;\n font-size: 15px;\n}\n.annotationRemoveButton:hover {\n cursor: pointer;\n box-shadow: 0px 0px 5px rgba(0, 0, 0, 1);\n}\n\n.annotationNote {\n width: 4cm;\n position: absolute;\n display: inline;\n z-index: 10;\n}\n.annotationNote > office|annotation {\n display: block;\n}\n\n.annotationConnector {\n position: absolute;\n display: inline;\n z-index: 2;\n border-top: 1px dashed brown;\n}\n.annotationConnector.angular {\n -moz-transform-origin: left top;\n -webkit-transform-origin: left top;\n -ms-transform-origin: left top;\n transform-origin: left top;\n}\n.annotationConnector.horizontal {\n left: 0;\n}\n.annotationConnector.horizontal:before {\n content: '';\n display: inline;\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: brown transparent transparent transparent;\n top: -1px;\n left: -5px;\n}\n\noffice|annotation {\n width: 100%;\n height: 100%;\n display: none;\n background: rgb(198, 238, 184);\n background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n box-shadow: 0 3px 4px -3px #ccc;\n}\n\noffice|annotation > dc|creator {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n color: white;\n background-color: brown;\n padding: 4px;\n}\noffice|annotation > dc|date {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n border: 4px solid transparent;\n}\noffice|annotation > text|list {\n display: block;\n padding: 5px;\n}\n\n/* This is very temporary CSS. This must go once\n * we start bundling webodf-default ODF styles for annotations.\n */\noffice|annotation text|p {\n font-size: 10pt;\n color: black;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n font-family: sans-serif;\n}\n\ndc|*::selection {\n background: transparent;\n}\ndc|*::-moz-selection {\n background: transparent;\n}\n\n#annotationsPane {\n background-color: #EAEAEA;\n width: 4cm;\n height: 100%;\n display: inline-block;\n position: absolute;\n outline: 1px solid #ccc;\n}\n\n.annotationHighlight {\n background-color: yellow;\n position: relative;\n}\n";