Class Index | File Index

Classes


Class ops.OdtDocument


Defined in: OdtDocument.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ops.OdtDocument(odfCanvas)
A document that keeps all data related to the mapped document.
Field Summary
Field Attributes Field Name and Description
 
 
This function will return the Text node as well as the offset in that text node of the cursor.
<static>  
ops.OdtDocument.signalAnnotationAdded
<static>  
ops.OdtDocument.signalCommonStyleCreated
<static>  
ops.OdtDocument.signalCommonStyleDeleted
<static>  
ops.OdtDocument.signalMetadataUpdated
<static>  
ops.OdtDocument.signalOperationEnd
<static>  
ops.OdtDocument.signalOperationStart
<static>  
ops.OdtDocument.signalParagraphChanged
<static>  
<static>  
ops.OdtDocument.signalProcessingBatchEnd
<static>  
ops.OdtDocument.signalProcessingBatchStart
<static>  
ops.OdtDocument.signalStepsInserted
<static>  
ops.OdtDocument.signalStepsRemoved
<static>  
ops.OdtDocument.signalTableAdded
<static>  
ops.OdtDocument.signalUndoStackChanged
 
Upgrades any significant whitespace at the requested step, and one step right of the given position to space elements.
Method Summary
Method Attributes Method Name and Description
 
addCursor(cursor)
Adds the specified cursor to the ODT document.
 
addMember(member)
 
close(callback,)
 
Converts the requested step number from root into the equivalent DOM node & offset pair.
 
convertCursorToDomRange(position, length)
Convert a cursor range to a DOM range
 
convertDomPointToCursorStep(node, offset, roundDirection)
Converts a DOM node and offset pair to a cursor step.
 
<inner>  
 
createRootFilter(inputMemberId)
<inner>  
createStepIterator(container, offset, filters, subTree)
Create a new StepIterator instance set to the defined position
 
destroy(callback,)
<inner>  
downgradeWhitespaces(stepIterator)
Downgrades white space elements to normal spaces at the step iterators current step, and one step to the right.
 
Downgrades white space elements to normal spaces at the specified step, and one step to the right.
 
emit(eventid, args)
 
Iterates through all cursors and checks if they are in walkable positions; if not, move the cursor 1 filtered step backward which guarantees walkable state for all cursors, while keeping them inside the same root.
 
 
getCursor(memberid)
 
This function returns the position in ODF world of the cursor of the member.
 
This function returns the position and selection length in ODF world of the cursor of the member.
 
Return the office:document element of this document.
<inner>  
 
<inner>  
Returns a PositionIterator instance at the specified starting position
 
getMember(memberId)
 
 
 
<inner>  
getRoot(node)
<inner>  
Return the office:text element of this document.
<inner>  
getTextNodeAtStep(steps, memberid)
This function will iterate through positions allowed by the position iterator and count only the text positions.
<inner>  
Called after an operation is executed, this function will check if the operation is an 'edit', and in that case will update the document's metadata, such as dc:creator, meta:editing-cycles, and dc:creator.
 
hasCursor(memberid)
<inner>  
init()
<inner>  
isRoot(node)
<inner>  
maxOffset(node)
Returns the maximum available offset for the specified node.
 
moveCursor(memberid, position, length, selectionType)
Moves the cursor/selection of a given memberid to the given position+length combination and adopts the given selectionType.
<inner>  
paragraphOrRoot(container, offset, root)
Returns the closest parent paragraph or root to the supplied container and offset
 
removeCursor(memberid)
 
removeMember(memberId)
<inner>  
roundUp(step)
Rounds to the first step within the paragraph
 
setDocumentElement(documentElement)
 
subscribe(eventid, cb)
 
unsubscribe(eventid, cb)
<inner>  
<inner>  
upgradeWhitespaceToElement(textNode, offset)
Upgrades literal whitespaces (' ') to , when given a textNode containing the whitespace and an offset indicating the location of the whitespace in it.
Class Detail
ops.OdtDocument(odfCanvas)
A document that keeps all data related to the mapped document.
Parameters:
{!odf.OdfCanvas} odfCanvas
Field Detail
{!Element} getRootNode

{?{textNode: !Text|offset: !number}} getTextNodeAtStep
This function will return the Text node as well as the offset in that text node of the cursor.

<static> ops.OdtDocument.signalAnnotationAdded

<static> ops.OdtDocument.signalCommonStyleCreated

<static> ops.OdtDocument.signalCommonStyleDeleted

<static> ops.OdtDocument.signalMetadataUpdated

<static> ops.OdtDocument.signalOperationEnd

<static> ops.OdtDocument.signalOperationStart

<static> ops.OdtDocument.signalParagraphChanged

<static> ops.OdtDocument.signalParagraphStyleModified

<static> ops.OdtDocument.signalProcessingBatchEnd

<static> ops.OdtDocument.signalProcessingBatchStart

<static> ops.OdtDocument.signalStepsInserted

<static> ops.OdtDocument.signalStepsRemoved

<static> ops.OdtDocument.signalTableAdded

<static> ops.OdtDocument.signalUndoStackChanged

{undefined} upgradeWhitespacesAtPosition
Upgrades any significant whitespace at the requested step, and one step right of the given position to space elements.
Method Detail
{undefined} addCursor(cursor)
Adds the specified cursor to the ODT document. The cursor will be collapsed to the first available cursor position in the document.
Parameters:
{!ops.OdtCursor} cursor
Returns:
{undefined}

{undefined} addMember(member)
Parameters:
{!ops.Member} member
Returns:
{undefined}

{undefined} close(callback,)
Parameters:
{!function(!Object=)} callback,
passing an error object in case of error
Returns:
{undefined}

{!{node: !Node|offset: !number}} convertCursorStepToDomPoint(step)
Converts the requested step number from root into the equivalent DOM node & offset pair. If the step is outside the bounds of the document, a RangeError will be thrown.
Parameters:
{!number} step
Returns:
{!{node: !Node|offset: !number}}

{!Range} convertCursorToDomRange(position, length)
Convert a cursor range to a DOM range
Parameters:
{!number} position
{!number} length
Returns:
{!Range}

{!number} convertDomPointToCursorStep(node, offset, roundDirection)
Converts a DOM node and offset pair to a cursor step. If a rounding direction is not supplied then the default is to round down to the previous step.
Parameters:
{!Node} node
{!number} offset
{core.StepDirection=} roundDirection
Whether to round down to the previous step or round up to the next step. The default value if unspecified is core.StepDirection.PREVIOUS
Returns:
{!number}

{!{position: !number|length: number}} convertDomToCursorRange(selection)
Parameters:
{!{anchorNode: !Node|anchorOffset: !number|focusNode: !Node|focusOffset: !number}} selection
Returns:
{!{position: !number|length: number}}

<inner> {!core.PositionIterator} createPositionIterator(rootNode)
Parameters:
{!Node} rootNode
Returns:
{!core.PositionIterator}

{!RootFilter} createRootFilter(inputMemberId)
Parameters:
{string|!Node} inputMemberId
Returns:
{!RootFilter}

<inner> {!core.StepIterator} createStepIterator(container, offset, filters, subTree)
Create a new StepIterator instance set to the defined position
Parameters:
{!Node} container
{!number} offset
{!Array.} filters
Filter to apply to the iterator positions. If multiple iterators are provided, they will be combined in order using a PositionFilterChain.
{!Node} subTree
Subtree to search for step within. Generally a paragraph or document root. Choosing a smaller subtree allows iteration to end quickly if there are no walkable steps remaining in a particular direction. This can vastly improve performance.
Returns:
{!core.StepIterator}

{undefined} destroy(callback,)
Parameters:
{!function(!Error=)} callback,
passing an error object in case of error
Returns:
{undefined}

<inner> {undefined} downgradeWhitespaces(stepIterator)
Downgrades white space elements to normal spaces at the step iterators current step, and one step to the right.
Parameters:
{!core.StepIterator} stepIterator
Returns:
{undefined}

{undefined} downgradeWhitespacesAtPosition(step)
Downgrades white space elements to normal spaces at the specified step, and one step to the right.
Parameters:
{!number} step
Returns:
{undefined}

{undefined} emit(eventid, args)
Parameters:
{!string} eventid
{*} args
Returns:
{undefined}

fixCursorPositions()
Iterates through all cursors and checks if they are in walkable positions; if not, move the cursor 1 filtered step backward which guarantees walkable state for all cursors, while keeping them inside the same root. An event will be raised for this cursor if it is moved

{!ops.Canvas} getCanvas()
Returns:
{!ops.Canvas}

{ops.OdtCursor} getCursor(memberid)
Parameters:
{!string} memberid
Returns:
{ops.OdtCursor}

{!number} getCursorPosition(memberid)
This function returns the position in ODF world of the cursor of the member.
Parameters:
{!string} memberid
Returns:
{!number}

{{position: !number|length: !number}} getCursorSelection(memberid)
This function returns the position and selection length in ODF world of the cursor of the member. position is always the number of steps from root node to the anchor node length is the number of steps from anchor node to focus node !IMPORTANT! length is a vector, and may be negative if the cursor selection is reversed (i.e., user clicked and dragged the cursor backwards)
Parameters:
{!string} memberid
Returns:
{{position: !number|length: !number}}

{!Element} getDocumentElement()
Return the office:document element of this document.
Returns:
{!Element}

<inner> {!Document} getDOMDocument()
Returns:
{!Document}

{!odf.Formatting} getFormatting()
Returns:
{!odf.Formatting}

<inner> {!core.PositionIterator} getIteratorAtPosition(position)
Returns a PositionIterator instance at the specified starting position
Parameters:
{!number} position
Returns:
{!core.PositionIterator}

{?ops.Member} getMember(memberId)
Parameters:
{!string} memberId
Returns:
{?ops.Member}

{!Array.} getMemberIds()
Returns:
{!Array.}

{!odf.OdfCanvas} getOdfCanvas()
Returns:
{!odf.OdfCanvas}

{!core.PositionFilter} getPositionFilter()
Returns:
{!core.PositionFilter}

<inner> {!Node} getRoot(node)
Parameters:
{!Node} node
Returns:
{!Node}

<inner> {!Element} getRootNode()
Return the office:text element of this document.
Returns:
{!Element}

<inner> {?{textNode: !Text|offset: !number}} getTextNodeAtStep(steps, memberid)
This function will iterate through positions allowed by the position iterator and count only the text positions. When the amount defined by offset has been counted, the Text node that that position is returned as well as the offset in that text node. Optionally takes a memberid of a cursor, to specifically return the text node positioned just behind that cursor.
Parameters:
{!number} steps
{!string=} memberid
Returns:
{?{textNode: !Text|offset: !number}}

<inner> handleOperationExecuted(op)
Called after an operation is executed, this function will check if the operation is an 'edit', and in that case will update the document's metadata, such as dc:creator, meta:editing-cycles, and dc:creator.
Parameters:
{!ops.Operation} op

{!boolean} hasCursor(memberid)
Parameters:
{!string} memberid
Returns:
{!boolean}

<inner> {undefined} init()
Returns:
{undefined}

<inner> {!boolean} isRoot(node)
Parameters:
{!Node} node
Returns:
{!boolean}

<inner> {!number} maxOffset(node)
Returns the maximum available offset for the specified node.
Parameters:
{!Node} node
Returns:
{!number}

{undefined} moveCursor(memberid, position, length, selectionType)
Moves the cursor/selection of a given memberid to the given position+length combination and adopts the given selectionType. It is the caller's responsibility to decide if and when to subsequently fire signalCursorMoved.
Parameters:
{!string} memberid
{!number} position
{!number} length
{!string=} selectionType
Returns:
{undefined}

<inner> {!Node} paragraphOrRoot(container, offset, root)
Returns the closest parent paragraph or root to the supplied container and offset
Parameters:
{!Node} container
{!number} offset
{!Node} root
Returns:
{!Node}

{!boolean} removeCursor(memberid)
Parameters:
{!string} memberid
Returns:
{!boolean}

{undefined} removeMember(memberId)
Parameters:
{!string} memberId
Returns:
{undefined}

<inner> {!boolean} roundUp(step)
Rounds to the first step within the paragraph
Parameters:
{!core.StepDirection} step
Returns:
{!boolean}

setDocumentElement(documentElement)
Parameters:
{!Element} documentElement

{undefined} subscribe(eventid, cb)
Parameters:
{!string} eventid
{!Function} cb
Returns:
{undefined}

{undefined} unsubscribe(eventid, cb)
Parameters:
{!string} eventid
{!Function} cb
Returns:
{undefined}

<inner> {undefined} upgradeWhitespacesAtPosition(step)
Parameters:
{!number} step
Returns:
{undefined}

<inner> {!Element} upgradeWhitespaceToElement(textNode, offset)
Upgrades literal whitespaces (' ') to , when given a textNode containing the whitespace and an offset indicating the location of the whitespace in it.
Parameters:
{!Text} textNode
{!number} offset
Returns:
{!Element}

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Aug 06 2015 04:10:41 GMT+0200 (MESZ)