Oxygen XML Editor 11.2 Author API

ro.sync.ecss.extensions.api
Interface AuthorDocumentFilterBypass


public interface AuthorDocumentFilterBypass

Used as a way to circumvent calling back into the AuthorDocumentController to change the AuthorDocument.


Method Summary
 boolean delete(int startOffset, int endOffset, boolean withBackspace)
          Deletes a document fragment between the start and end offset.
 boolean deleteNode(AuthorNode node)
          Deletes the specified node from the document.
 void insertFragment(int offset, AuthorDocumentFragment frag)
          Insert an AuthorDocumentFragment at the given offset.
 void insertMultipleElements(AuthorElement parentElement, String[] elementNames, int[] offsets, String namespace)
          Insert multiple elements at the given offsets.
 boolean insertNode(int offset, AuthorNode node)
          Insert the specified node at the given offset.
 void insertText(int offset, String text)
          Inserts a text at the given offset.
 void multipleDelete(AuthorElement parentElement, int[] startOffsets, int[] endOffsets)
          Deletes the given intervals.
 void removeAttribute(String attributeName, AuthorElement element)
          Removes an attribute from the given element.
 void renameElement(AuthorElement element, String newName, Object infoProvider)
          Rename the given element.
 void setAttribute(String attributeName, AttrValue value, AuthorElement element)
          Sets the value of an attribute in the specified element.
 void setDoctype(AuthorDocumentType docType)
          Set a new internal document type to the Author content.
 boolean split(AuthorNode toSplit, int splitOffset)
          Splits the specified node at the given offset.
 void surroundInFragment(String xmlFragment, int startOffset, int endOffset)
          Surround the content between the given offsets with the xmlFragment.
 void surroundInText(String header, String footer, int startOffset, int endOffset)
          Surround the content between the given offsets with plain text fragments(without XML parsing).
 void surroundWithNode(AuthorNode node, int startOffset, int endOffset, boolean leftToRight)
          Surrounds the fragment between the specified offset with the specified node.
 

Method Detail

insertText

void insertText(int offset,
                String text)
Inserts a text at the given offset. After the operation the caret will be positioned at the end of the inserted text.

Parameters:
offset - The insert position, 0 based.
text - The text to be inserted.

insertFragment

void insertFragment(int offset,
                    AuthorDocumentFragment frag)
Insert an AuthorDocumentFragment at the given offset.

Parameters:
offset - The offset where the fragment will be inserted, 0 based.
frag - The AuthorDocumentFragment to be inserted.

insertNode

boolean insertNode(int offset,
                   AuthorNode node)
Insert the specified node at the given offset.

Parameters:
offset - The offset where the node will be inserted. 0 based.
node - The AuthorNode to insert.
Returns:
true if the operation was successful.

insertMultipleElements

void insertMultipleElements(AuthorElement parentElement,
                            String[] elementNames,
                            int[] offsets,
                            String namespace)
Insert multiple elements at the given offsets.
Note: The offsets and elements must be in document order.

Parameters:
parentElement - The parent element that contains all the new inserted elements.
elementNames - The element names to be inserted.
offsets - The absolute offsets where the elements will be inserted. 0 based.
namespace - The namespace of the new inserted elements.

delete

boolean delete(int startOffset,
               int endOffset,
               boolean withBackspace)
Deletes a document fragment between the start and end offset.

Parameters:
startOffset - Start offset, 0 based and inclusive.
endOffset - End offset, 0 based and inclusive.
withBackspace - true if BACKSPACE key was used when deleting the fragment.
Returns:
true if the delete operation was successful.

deleteNode

boolean deleteNode(AuthorNode node)
Deletes the specified node from the document.

Parameters:
node - The AuthorNode to delete.
Returns:
true if the delete node operation was successful.

multipleDelete

void multipleDelete(AuthorElement parentElement,
                    int[] startOffsets,
                    int[] endOffsets)
Deletes the given intervals.
Note: The offsets must be in document order and the intervals must not intersect with each other.

Parameters:
parentElement - The element that contains all the deleted intervals.
startOffsets - The start offset for each interval. Must be in document order. 0 based and inclusive.
endOffsets - The end offset for each interval. Must be in document order. 0 based and inclusive.

renameElement

void renameElement(AuthorElement element,
                   String newName,
                   Object infoProvider)
Rename the given element. Any compound must be handled externally.

Parameters:
element - The AuthorElement that is renamed.
newName - The new name for the element.
infoProvider - Information provider used for internal processing.

setAttribute

void setAttribute(String attributeName,
                  AttrValue value,
                  AuthorElement element)
Sets the value of an attribute in the specified element. Attributes set in this manner (as opposed to calling AuthorElement.setAttribute(String, AttrValue) directly) will be subject to undo/redo.

Parameters:
attributeName - Name of the attribute being changed.
value - New AttrValue for the attribute. If null, the attribute is removed from the element.
element - The AuthorElement whose attribute is changing.

removeAttribute

void removeAttribute(String attributeName,
                     AuthorElement element)
Removes an attribute from the given element. Attributes removed in this manner (as opposed to calling AuthorElement.setAttribute(String, AttrValue) directly) will be subject to undo/redo.

Parameters:
attributeName - Name of the attribute to remove.
element - The AuthorElement whose attribute will be removed.

split

boolean split(AuthorNode toSplit,
              int splitOffset)
Splits the specified node at the given offset. The attributes of the splitted node will also be copied excepting the unique ones. The unique attributes are identified by the UniqueAttributesRecognizer.

Parameters:
toSplit - The AuthorNode to split.
splitOffset - The split offset. The offset must be greater or equal to 1 and less than the current document length.
Returns:
true if the node was split.

surroundWithNode

void surroundWithNode(AuthorNode node,
                      int startOffset,
                      int endOffset,
                      boolean leftToRight)
Surrounds the fragment between the specified offset with the specified node. The fragment between the start and end offsets will become the node actual content.

Parameters:
node - The AuthorNode that will surround the fragment.
startOffset - Start offset of the surrounded fragment. 0 based and inclusive.
endOffset - End offset of the surrounded fragment. 0 based and inclusive.
leftToRight - true if after the operation the selection in the author page is done from the left to the right.

surroundInFragment

void surroundInFragment(String xmlFragment,
                        int startOffset,
                        int endOffset)
                        throws AuthorOperationException
Surround the content between the given offsets with the xmlFragment. If endOffset < startOffset the xmlFragment will be inserted at startOffset.

Parameters:
xmlFragment - The XML fragment which will surround the given interval. The first leaf node of the XML fragment will be the parent of the surrounded content.
startOffset - The start offset of the content to be surrounded, 0 based and inclusive.
endOffset - The end offset of the content to be surrounded, 0 based and inclusive.
Throws:
AuthorOperationException - If the content between start and end offset could not be surrounded.

surroundInText

void surroundInText(String header,
                    String footer,
                    int startOffset,
                    int endOffset)
                    throws AuthorOperationException
Surround the content between the given offsets with plain text fragments(without XML parsing). The method inserts the header at startOffset and the footer at endOffset.

Parameters:
header - The header to be inserted before the surrounded text.
footer - The footer to be inserted after the surrounded text.
startOffset - The start offset of the text to be surrounded, 0 based and inclusive.
endOffset - The end offset of the text to be surrounded, 0 based and inclusive.
Throws:
AuthorOperationException - If the operation failed.

setDoctype

void setDoctype(AuthorDocumentType docType)
Set a new internal document type to the Author content. This is a good method to add new entities (regular or unparsed) to the internal document type of the document. WARNING: if these modifications affect regular entities already inserted and expanded, they will not be re-parsed and their old content will remain rendered as such.

Parameters:
docType - The document type information.

Oxygen XML Editor 11.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.