Package org.odftoolkit.odfdom.pkg
Class OdfElement
java.lang.Object
org.apache.xerces.dom.NodeImpl
org.apache.xerces.dom.ChildNode
org.apache.xerces.dom.ParentNode
org.apache.xerces.dom.ElementImpl
org.apache.xerces.dom.ElementNSImpl
org.odftoolkit.odfdom.pkg.OdfElement
- All Implemented Interfaces:
Serializable
,Cloneable
,Element
,ElementTraversal
,EventTarget
,Node
,NodeList
,TypeInfo
- Direct Known Subclasses:
AlgorithmElement
,AnimAnimateColorElement
,AnimAnimateElement
,AnimAnimateMotionElement
,AnimAnimateTransformElement
,AnimAudioElement
,AnimCommandElement
,AnimIterateElement
,AnimParamElement
,AnimParElement
,AnimSeqElement
,AnimSetElement
,AnimTransitionFilterElement
,ChartCategoriesElement
,ChartDataLabelElement
,ChartDomainElement
,ChartEquationElement
,ChartLabelSeparatorElement
,ChartSymbolImageElement
,ConfigConfigItemElement
,ConfigConfigItemMapEntryElement
,ConfigConfigItemMapIndexedElement
,ConfigConfigItemMapNamedElement
,ConfigConfigItemSetElement
,DataStyleElement
,DbApplicationConnectionSettingsElement
,DbAutoIncrementElement
,DbCharacterSetElement
,DbColumnDefinitionElement
,DbColumnDefinitionsElement
,DbColumnElement
,DbColumnsElement
,DbComponentCollectionElement
,DbComponentElement
,DbConnectionDataElement
,DbConnectionResourceElement
,DbDatabaseDescriptionElement
,DbDataSourceElement
,DbDataSourceSettingElement
,DbDataSourceSettingsElement
,DbDataSourceSettingValueElement
,DbDelimiterElement
,DbDriverSettingsElement
,DbFileBasedDatabaseElement
,DbFilterStatementElement
,DbFormsElement
,DbIndexColumnElement
,DbIndexColumnsElement
,DbIndexElement
,DbIndicesElement
,DbKeyColumnElement
,DbKeyColumnsElement
,DbKeyElement
,DbKeysElement
,DbLoginElement
,DbOrderStatementElement
,DbQueriesElement
,DbQueryCollectionElement
,DbQueryElement
,DbReportsElement
,DbSchemaDefinitionElement
,DbServerDatabaseElement
,DbTableDefinitionElement
,DbTableDefinitionsElement
,DbTableExcludeFilterElement
,DbTableFilterElement
,DbTableFilterPatternElement
,DbTableIncludeFilterElement
,DbTableRepresentationElement
,DbTableRepresentationsElement
,DbTableSettingElement
,DbTableSettingsElement
,DbTableTypeElement
,DbTableTypeFilterElement
,DbUpdateTableElement
,DcCreatorElement
,DcDateElement
,DcDescriptionElement
,DcLanguageElement
,DcSubjectElement
,DcTitleElement
,DocumentSignaturesElement
,Dr3dLightElement
,DrawAElement
,DrawAppletElement
,DrawAreaCircleElement
,DrawAreaPolygonElement
,DrawAreaRectangleElement
,DrawContourPathElement
,DrawContourPolygonElement
,DrawEnhancedGeometryElement
,DrawEquationElement
,DrawFillImageElement
,DrawFloatingFrameElement
,DrawGluePointElement
,DrawGradientElement
,DrawHandleElement
,DrawHatchElement
,DrawImageElement
,DrawImageMapElement
,DrawLayerElement
,DrawLayerSetElement
,DrawMarkerElement
,DrawObjectElement
,DrawObjectOleElement
,DrawOpacityElement
,DrawParamElement
,DrawPluginElement
,DrawStrokeDashElement
,DrawTextBoxElement
,EncryptionDataElement
,FileEntryElement
,FormButtonElement
,FormCheckboxElement
,FormColumnElement
,FormComboboxElement
,FormConnectionResourceElement
,FormDateElement
,FormFileElement
,FormFixedTextElement
,FormFormattedTextElement
,FormFormElement
,FormFrameElement
,FormGenericControlElement
,FormGridElement
,FormHiddenElement
,FormImageElement
,FormImageFrameElement
,FormItemElement
,FormListboxElement
,FormListPropertyElement
,FormListValueElement
,FormNumberElement
,FormOptionElement
,FormPasswordElement
,FormPropertiesElement
,FormPropertyElement
,FormRadioElement
,FormTextareaElement
,FormTextElement
,FormTimeElement
,FormValueRangeElement
,KeyDerivationElement
,ManifestElement
,MathMathElement
,MetaAutoReloadElement
,MetaCreationDateElement
,MetaDateStringElement
,MetaDocumentStatisticElement
,MetaEditingCyclesElement
,MetaEditingDurationElement
,MetaGeneratorElement
,MetaHyperlinkBehaviourElement
,MetaInitialCreatorElement
,MetaKeywordElement
,MetaPrintDateElement
,MetaPrintedByElement
,MetaTemplateElement
,MetaUserDefinedElement
,NumberAmPmElement
,NumberBooleanElement
,NumberCurrencySymbolElement
,NumberDayElement
,NumberDayOfWeekElement
,NumberEmbeddedTextElement
,NumberEraElement
,NumberFractionElement
,NumberHoursElement
,NumberMinutesElement
,NumberMonthElement
,NumberNumberElement
,NumberQuarterElement
,NumberScientificNumberElement
,NumberSecondsElement
,NumberTextContentElement
,NumberTextElement
,NumberWeekOfYearElement
,NumberYearElement
,OdfAlienElement
,OdfContainerElementBase
,OdfStylableElement
,OdfStylePropertiesBase
,OfficeAnnotationEndElement
,OfficeBinaryDataElement
,OfficeBodyElement
,OfficeChangeInfoElement
,OfficeChartElement
,OfficeDatabaseElement
,OfficeDdeSourceElement
,OfficeDocumentContentElement
,OfficeDocumentElement
,OfficeDocumentMetaElement
,OfficeDocumentSettingsElement
,OfficeDocumentStylesElement
,OfficeDrawingElement
,OfficeEventListenersElement
,OfficeFontFaceDeclsElement
,OfficeFormsElement
,OfficeImageElement
,OfficeMetaElement
,OfficePresentationElement
,OfficeScriptElement
,OfficeScriptsElement
,OfficeSettingsElement
,OfficeSpreadsheetElement
,OfficeTextElement
,PresentationAnimationGroupElement
,PresentationAnimationsElement
,PresentationDateTimeDeclElement
,PresentationDateTimeElement
,PresentationDimElement
,PresentationEventListenerElement
,PresentationFooterDeclElement
,PresentationFooterElement
,PresentationHeaderDeclElement
,PresentationHeaderElement
,PresentationHideShapeElement
,PresentationHideTextElement
,PresentationPlaceholderElement
,PresentationPlayElement
,PresentationSettingsElement
,PresentationShowElement
,PresentationShowShapeElement
,PresentationShowTextElement
,PresentationSoundElement
,ScriptEventListenerElement
,SignatureElement
,StartKeyGenerationElement
,StyleBackgroundImageElement
,StyleColumnElement
,StyleColumnsElement
,StyleColumnSepElement
,StyleDefaultPageLayoutElement
,StyleFontFaceElement
,StyleFooterElement
,StyleFooterLeftElement
,StyleFooterStyleElement
,StyleFootnoteSepElement
,StyleHeaderElement
,StyleHeaderLeftElement
,StyleHeaderStyleElement
,StyleListLevelLabelAlignmentElement
,StyleMapElement
,StylePresentationPageLayoutElement
,StyleRegionCenterElement
,StyleRegionLeftElement
,StyleRegionRightElement
,StyleTabStopElement
,StyleTabStopsElement
,SvgDefinitionSrcElement
,SvgDescElement
,SvgFontFaceFormatElement
,SvgFontFaceNameElement
,SvgFontFaceSrcElement
,SvgFontFaceUriElement
,SvgLinearGradientElement
,SvgRadialGradientElement
,SvgStopElement
,SvgTitleElement
,TableBackgroundElement
,TableCalculationSettingsElement
,TableCellAddressElement
,TableCellContentChangeElement
,TableCellContentDeletionElement
,TableCellRangeSourceElement
,TableChangeDeletionElement
,TableChangeTrackTableCellElement
,TableConsolidationElement
,TableContentValidationElement
,TableContentValidationsElement
,TableCutOffsElement
,TableDatabaseRangeElement
,TableDatabaseRangesElement
,TableDatabaseSourceQueryElement
,TableDatabaseSourceSqlElement
,TableDatabaseSourceTableElement
,TableDataPilotDisplayInfoElement
,TableDataPilotFieldElement
,TableDataPilotFieldReferenceElement
,TableDataPilotGroupElement
,TableDataPilotGroupMemberElement
,TableDataPilotGroupsElement
,TableDataPilotLayoutInfoElement
,TableDataPilotLevelElement
,TableDataPilotMemberElement
,TableDataPilotMembersElement
,TableDataPilotSortInfoElement
,TableDataPilotSubtotalElement
,TableDataPilotSubtotalsElement
,TableDataPilotTableElement
,TableDataPilotTablesElement
,TableDdeLinkElement
,TableDdeLinksElement
,TableDeletionElement
,TableDeletionsElement
,TableDependenciesElement
,TableDependencyElement
,TableDescElement
,TableDetectiveElement
,TableErrorMacroElement
,TableErrorMessageElement
,TableFilterAndElement
,TableFilterConditionElement
,TableFilterElement
,TableFilterOrElement
,TableFilterSetItemElement
,TableHelpMessageElement
,TableHighlightedRangeElement
,TableInsertionCutOffElement
,TableInsertionElement
,TableIterationElement
,TableLabelRangeElement
,TableLabelRangesElement
,TableMovementCutOffElement
,TableMovementElement
,TableNamedExpressionElement
,TableNamedExpressionsElement
,TableNamedRangeElement
,TableNullDateElement
,TableOperationElement
,TablePreviousElement
,TableScenarioElement
,TableShapesElement
,TableSortByElement
,TableSortElement
,TableSortGroupsElement
,TableSourceCellRangeElement
,TableSourceRangeAddressElement
,TableSourceServiceElement
,TableSubtotalFieldElement
,TableSubtotalRuleElement
,TableSubtotalRulesElement
,TableTableColumnGroupElement
,TableTableColumnsElement
,TableTableHeaderColumnsElement
,TableTableHeaderRowsElement
,TableTableRowGroupElement
,TableTableRowsElement
,TableTableSourceElement
,TableTableTemplateElement
,TableTargetRangeAddressElement
,TableTitleElement
,TableTrackedChangesElement
,TextAlphabeticalIndexAutoMarkFileElement
,TextAlphabeticalIndexMarkElement
,TextAlphabeticalIndexMarkEndElement
,TextAlphabeticalIndexMarkStartElement
,TextAlphabeticalIndexSourceElement
,TextAuthorInitialsElement
,TextAuthorNameElement
,TextBibliographyConfigurationElement
,TextBibliographyMarkElement
,TextBibliographySourceElement
,TextBookmarkElement
,TextBookmarkEndElement
,TextBookmarkRefElement
,TextBookmarkStartElement
,TextChangedRegionElement
,TextChangeElement
,TextChangeEndElement
,TextChangeStartElement
,TextChapterElement
,TextCharacterCountElement
,TextConditionalTextElement
,TextCreationDateElement
,TextCreationTimeElement
,TextCreatorElement
,TextDatabaseDisplayElement
,TextDatabaseNameElement
,TextDatabaseNextElement
,TextDatabaseRowNumberElement
,TextDatabaseRowSelectElement
,TextDateElement
,TextDdeConnectionDeclElement
,TextDdeConnectionDeclsElement
,TextDdeConnectionElement
,TextDeletionElement
,TextDescriptionElement
,TextEditingCyclesElement
,TextEditingDurationElement
,TextExecuteMacroElement
,TextExpressionElement
,TextFileNameElement
,TextFormatChangeElement
,TextHiddenParagraphElement
,TextHiddenTextElement
,TextIllustrationIndexSourceElement
,TextImageCountElement
,TextIndexBodyElement
,TextIndexSourceStylesElement
,TextInitialCreatorElement
,TextInsertionElement
,TextKeywordsElement
,TextLineBreakElement
,TextLinenumberingSeparatorElement
,TextListElement
,TextListHeaderElement
,TextListItemElement
,TextMeasureElement
,TextMetaElement
,TextMetaFieldElement
,TextModificationDateElement
,TextModificationTimeElement
,TextNoteBodyElement
,TextNoteCitationElement
,TextNoteContinuationNoticeBackwardElement
,TextNoteContinuationNoticeForwardElement
,TextNoteElement
,TextNoteRefElement
,TextNotesConfigurationElement
,TextNumberElement
,TextObjectCountElement
,TextObjectIndexSourceElement
,TextOutlineStyleElement
,TextPageContinuationElement
,TextPageCountElement
,TextPageElement
,TextPageNumberElement
,TextPageSequenceElement
,TextPageVariableGetElement
,TextPageVariableSetElement
,TextParagraphCountElement
,TextPlaceholderElement
,TextPrintDateElement
,TextPrintedByElement
,TextPrintTimeElement
,TextReferenceMarkElement
,TextReferenceMarkEndElement
,TextReferenceMarkStartElement
,TextReferenceRefElement
,TextRubyBaseElement
,TextScriptElement
,TextSectionSourceElement
,TextSElement
,TextSenderCityElement
,TextSenderCompanyElement
,TextSenderCountryElement
,TextSenderEmailElement
,TextSenderFaxElement
,TextSenderFirstnameElement
,TextSenderInitialsElement
,TextSenderLastnameElement
,TextSenderPhonePrivateElement
,TextSenderPhoneWorkElement
,TextSenderPositionElement
,TextSenderPostalCodeElement
,TextSenderStateOrProvinceElement
,TextSenderStreetElement
,TextSenderTitleElement
,TextSequenceDeclElement
,TextSequenceDeclsElement
,TextSequenceElement
,TextSequenceRefElement
,TextSheetNameElement
,TextSoftPageBreakElement
,TextSortKeyElement
,TextSubjectElement
,TextTabElement
,TextTableCountElement
,TextTableFormulaElement
,TextTableIndexSourceElement
,TextTableOfContentSourceElement
,TextTemplateNameElement
,TextTextInputElement
,TextTimeElement
,TextTitleElement
,TextTocMarkElement
,TextTocMarkEndElement
,TextTocMarkStartElement
,TextTrackedChangesElement
,TextUserDefinedElement
,TextUserFieldDeclElement
,TextUserFieldDeclsElement
,TextUserFieldGetElement
,TextUserFieldInputElement
,TextUserIndexMarkElement
,TextUserIndexMarkEndElement
,TextUserIndexMarkStartElement
,TextUserIndexSourceElement
,TextVariableDeclElement
,TextVariableDeclsElement
,TextVariableGetElement
,TextVariableInputElement
,TextVariableSetElement
,TextWordCountElement
,XformsModelElement
- See Also:
-
Field Summary
Fields inherited from class org.apache.xerces.dom.ElementNSImpl
localName, namespaceURI
Fields inherited from class org.apache.xerces.dom.ElementImpl
attributes, name
Fields inherited from class org.apache.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocument
Fields inherited from class org.apache.xerces.dom.ChildNode
nextSibling, previousSibling
Fields inherited from class org.apache.xerces.dom.NodeImpl
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, ID, IGNORABLEWS, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
Fields inherited from interface org.w3c.dom.TypeInfo
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION
-
Constructor Summary
ConstructorsConstructorDescriptionOdfElement
(OdfFileDom ownerDocument, String namespaceURI, String qualifiedName) Creates a new instance of OdfElementOdfElement
(OdfFileDom ownerDocument, OdfName aName) Creates a new instance of OdfElement -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(ElementVisitor visitor) Accept an visitor instance to allow the visitor to do some operations.appendChild
(Node node) protected static void
appendUsingWhitespaceHandling
(Node precedingNode, OdfElement parent, Node followingNode, String newString) If the string is inserted into a text:p/text:h element and it will be inserted in the start/end all spaces are replaced by <text:s/> element(s). tabulator and linefeeds are being removed.Clones this complete element with all descendants.cloneNode
(boolean deep) cloneNode
(int depth) static OdfElement
cloneNode
(OdfElement source, OdfElement target, boolean deep) Clones the content of the source element including attributes even xml:id to the target element.protected OdfElement
Overwritten by AlienElement class, which represents XML elements of various namesint
Recursive traverse the text container and count the size of the contentstatic void
copyAttributes
(OdfElement from, OdfElement to) Copy attributes from one element to another, existing attributes will be overwrittenint
countChildComponents
(Boolean hasTextComponents) Counts the number of child componentsint
Counts the number of descendant componentsint
void
delete
(int textPosStart, int textPosEnd) Deletes text from this paragraph element.boolean
indicates if some other object is equal to this one.static <T extends OdfElement>
TfindFirstChildNode
(Class<T> clazz, Node parentNode) returns the first child node that implements the given class.static <T extends OdfElement>
TfindNextChildNode
(Class<T> clazz, Node refNode) returns the first sibling after the given reference node that implements the given class.static <T extends OdfElement>
TfindPreviousChildNode
(Class<T> clazz, Node refNode) returns the first previous sibling before the given reference node that implements the given class.protected <T extends OdfElement>
TgetAncestorAs
(Class<T> clazz) getChildElement
(String uri, String localName) getChildElement
(String uri, String localName, int position) Returns the component referencestatic OdfElement
getNextSiblingElement
(Node node) getOdfAttribute
(String localname) Retrieves an ODF attribute by local name.getOdfAttribute
(NamespaceName namespace, String localname) Retrieves an ODF attribute byNamespaceName
, and local name.getOdfAttribute
(OdfName name) Retrieves an ODF attribute byOdfName
.getOdfAttributeValue
(OdfName name) Retrieves a value of an ODF attribute byOdfName
.abstract OdfName
protected <T extends OdfElement>
TgetParentAs
(Class<T> clazz) static OdfElement
int
boolean
hasAncestor
(Node potentialParent) boolean
hasOdfAttribute
(OdfName name) Determines if an ODF attribute exists.void
ignoredComponent
(boolean isIngoredComponent) void
Insert text to a certain position.void
insertBefore
(Node newChild, Node refChild) boolean
static boolean
isIgnoredElement
(String uri, String localName) ToDo: Move away to parser, as it is application logic not ODF relevant!static boolean
isIgnoredElement
(Element element) boolean
void
markAsComponentRoot
(boolean isRoot) void
markText
(int textPosStart, int textPosEnd, org.json.JSONObject formatChanges) void
moveChildrenTo
(Element newParent) protected void
protected void
onInsertNode
(Node node) protected void
protected void
onRemoveNode
(Node node) receiveNode
(int textPosStart) Receives node from this text container element.receiveNode
(int textPosStart, int textPosEnd) Receives node from this text container element.removeChild
(Node oldChild) void
Removes all the content from the elementstatic Element
removeSingleElement
(Element oldElement) replaceChild
(Node newChild, Node oldChild) boolean
void
setComponent
(Component component) void
setOdfAttribute
(String name, String value) Set an ODF attribute to this elementvoid
setOdfAttribute
(OdfAttribute attribute) Set an ODF attribute to this elementvoid
setOdfAttributeValue
(OdfName name, String value) Set the value of an ODF attribute byOdfName
.void
setRepetition
(int repetition) split
(int posStart) Splitting the element at the given position into two halvestoString()
Methods inherited from class org.apache.xerces.dom.ElementNSImpl
getLocalName, getNamespaceURI, getPrefix, getTypeName, getTypeNamespace, getXMLBaseAttribute, isDerivedFrom, setPrefix, setType
Methods inherited from class org.apache.xerces.dom.ElementImpl
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getBaseURI, getChildElementCount, getDefaultAttributes, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getLastElementChild, getNextElementSibling, getNodeName, getNodeType, getPreviousElementSibling, getSchemaTypeInfo, getTagName, getXercesAttribute, hasAttribute, hasAttributeNS, hasAttributes, isEqualNode, normalize, reconcileDefaultAttributes, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setOwnerDocument, setReadOnly, setupDefaultAttributes, setXercesAttributeNode, synchronizeData
Methods inherited from class org.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, hasChildNodes, item, setTextContent, synchronizeChildren
Methods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
Methods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, changed, changes, compareDocumentPosition, compareTreePosition, dispatchEvent, getContainer, getFeature, getNodeNumber, getNodeValue, getReadOnly, getUserData, getUserData, getUserDataRecord, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setUserData, setUserData
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.w3c.dom.Node
compareDocumentPosition, getChildNodes, getFeature, getFirstChild, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, getUserData, hasChildNodes, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, setNodeValue, setTextContent, setUserData
-
Constructor Details
-
OdfElement
public OdfElement(OdfFileDom ownerDocument, String namespaceURI, String qualifiedName) throws DOMException Creates a new instance of OdfElement- Throws:
DOMException
-
OdfElement
Creates a new instance of OdfElement- Throws:
DOMException
-
-
Method Details
-
getOdfName
-
getParentAs
-
getAncestorAs
-
hasAncestor
-
toString
-
setOdfAttributeValue
Set the value of an ODF attribute byOdfName
.- Parameters:
name
- The qualified name of the ODF attribute.value
- The value to be set inString
form
-
setOdfAttribute
Set an ODF attribute to this element- Parameters:
attribute
- the attribute to be set
-
setOdfAttribute
Set an ODF attribute to this element- Parameters:
name
- name of the attribute to be setvalue
-
-
getOdfAttributeValue
Retrieves a value of an ODF attribute byOdfName
.- Parameters:
name
- The qualified name of the ODF attribute.- Returns:
- The value of the attribute as
String
ornull
if the attribute does not exist.
-
getOdfAttribute
Retrieves an ODF attribute byOdfName
.- Parameters:
name
- The qualified name of the ODF attribute.- Returns:
- The
OdfAttribute
ornull
if the attribute does not exist.
-
getOdfAttribute
Retrieves an ODF attribute byNamespaceName
, and local name.- Parameters:
namespace
- The namespace of the ODF attribute.localname
- The local name of the ODF attribute.- Returns:
- The
OdfAttribute
ornull
if the attribute does not exist.
-
getOdfAttribute
Retrieves an ODF attribute by local name.- Parameters:
localname
- The local name of the ODF attribute.- Returns:
- The
OdfAttribute
ornull
if the attribute does not exist.
-
hasOdfAttribute
Determines if an ODF attribute exists.- Parameters:
name
- The qualified name of the ODF attribute.- Returns:
- True if the attribute exists.
-
findFirstChildNode
returns the first child node that implements the given class.- Type Parameters:
T
- The type of the ODF element to be found.- Parameters:
clazz
- is a class that extends OdfElement.parentNode
- is the parent O of the children to be found.- Returns:
- the first child node of the given parentNode that is a clazz or null if none is found.
-
findNextChildNode
returns the first sibling after the given reference node that implements the given class.- Type Parameters:
T
- The type of the ODF element to be found.- Parameters:
clazz
- is a class that extends OdfElement.refNode
- the reference node of the siblings to be found.- Returns:
- the first sibling of the given reference node that is a class or null if none is found.
-
findPreviousChildNode
returns the first previous sibling before the given reference node that implements the given class.- Parameters:
clazz
- is a class that extends OdfElement.refNode
- the reference node which siblings are to be searched.- Returns:
- the first previous sibling of the given reference node that is a class or null if none is found.
-
cloneElement
Clones this complete element with all descendants.- Returns:
- the cloned element
-
cloneOdfElement
Overwritten by AlienElement class, which represents XML elements of various names -
cloneNode
- Specified by:
cloneNode
in interfaceNode
- Overrides:
cloneNode
in classElementImpl
-
cloneNode
- Parameters:
depth
- how many levels of children should be considered- Returns:
- the cloned node (element)
-
cloneNode
Clones the content of the source element including attributes even xml:id to the target element. Helpful when changing a <text:h> to a <text:p> and vice versa, when outline attribute changes.- Parameters:
source
- the element to copy the content & attributes from.target
- the element to copy the content & attributes into.deep
- if a deep copy should happen. If false only the source element attributes will be copied, otherwise all descendants.- Returns:
- the target element with all new nodes
-
appendChild
- Specified by:
appendChild
in interfaceNode
- Overrides:
appendChild
in classNodeImpl
-
componentSize
public int componentSize()Recursive traverse the text container and count the size of the content -
equals
indicates if some other object is equal to this one. -
onRemoveNode
-
onInsertNode
-
onRemoveNode
protected void onRemoveNode() -
onInsertNode
protected void onInsertNode() -
insertBefore
- Specified by:
insertBefore
in interfaceNode
- Overrides:
insertBefore
in classParentNode
- Throws:
DOMException
-
removeSingleElement
- Throws:
DOMException
-
removeChild
- Specified by:
removeChild
in interfaceNode
- Overrides:
removeChild
in classParentNode
- Throws:
DOMException
-
isRepeatable
public boolean isRepeatable()- Returns:
- true if the element does represent multiple instances. (only applicable for some elements as cell or row).
-
getRepetition
public int getRepetition()- Returns:
- the repetition the element represents, by default it is 1
-
removeContent
public void removeContent()Removes all the content from the element -
replaceChild
- Specified by:
replaceChild
in interfaceNode
- Overrides:
replaceChild
in classParentNode
- Throws:
DOMException
-
accept
Accept an visitor instance to allow the visitor to do some operations. Refer to visitor design pattern to get a better understanding.- Parameters:
visitor
- an instance of DefaultElementVisitor
-
getComponentRoot
Returns the component reference -
markAsComponentRoot
public void markAsComponentRoot(boolean isRoot) -
getComponent
-
setComponent
-
isComponentRoot
public boolean isComponentRoot() -
selfAndDescendantTextIgnoredAsComponent
public boolean selfAndDescendantTextIgnoredAsComponent()- Returns:
- true if the text should not count as for component path nor the element root itself. This might occur for nested paragraphs or ignored text element (e.g. text:note-citation).
-
ignoredComponent
public void ignoredComponent(boolean isIngoredComponent) - Parameters:
isIngoredComponent
- true if the text should not count as for component path nor the element root itself. This might occur for nested paragraphs or ignored text element (e.g. text:note-citation). For instance called by a SAX Component parser, * * * * * * * seeorg.odftoolkit.odfdom.component.OdfFileSaxHandler
-
appendUsingWhitespaceHandling
protected static void appendUsingWhitespaceHandling(Node precedingNode, OdfElement parent, Node followingNode, String newString) If the string is inserted into a text:p/text:h element and it will be inserted in the start/end all spaces are replaced by <text:s/> element(s). tabulator and linefeeds are being removed.If both the previous text node ends with a space and newString starts with a space, we would need to encode the single leading space as an element, otherwise it would be stripped. Same occurs for the next text node and an ending space. For Example: text <text:s c="7"/> text2 <== SAVE when starting ending a span as well with space element independent of preceding
-
split
Splitting the element at the given position into two halves- Parameters:
posStart
- The logical position of the first character (or other paragraph child component) that will be moved to the beginning of the new paragraph. Counting starts with 0.- Returns:
- the new created second text container
-
receiveNode
Receives node from this text container element.- Parameters:
textPosStart
- The start delimiter for the child- Returns:
- the child node might be text or element
-
receiveNode
Receives node from this text container element.- Parameters:
textPosStart
- The start delimiter for the child- Returns:
- the child node might be text or element
-
markText
public void markText(int textPosStart, int textPosEnd, org.json.JSONObject formatChanges) - Parameters:
textPosStart
- the first text level component to be marked, start counting with 0textPosEnd
- the last text level component to be marked, start counting with 0formatChanges
- the changes to be applied to the text
-
countDescendantComponents
public int countDescendantComponents()Counts the number of descendant components -
countChildComponents
Counts the number of child components -
moveChildrenTo
-
insert
Insert text to a certain position. The text will be appended to the previous position text, so the span of the previous character will be expanded- Parameters:
newString
- string to be insertedtextPosStart
- text index of the new string
-
insert
-
delete
public void delete(int textPosStart, int textPosEnd) Deletes text from this paragraph element.- Parameters:
textPosStart
- Counting starts with 0, which is the first character of the paragraph.textPosEnd
- The end delimiter for the deletion. To delete text to the end of the paragraph, as represent for the end of the paragraph Integer.MAX_VALUE can be used.
-
copyAttributes
Copy attributes from one element to another, existing attributes will be overwritten -
getChildElement
- Returns:
- the first child element of a given parent
-
getChildElement
- Returns:
- the child element of a given parent from a given position (starting with 0)
-
isIgnoredElement
-
isIgnoredElement
ToDo: Move away to parser, as it is application logic not ODF relevant! Elements that blocks the creation of operations due to implementation issues -
getNextSiblingElement
-
getPreviousSiblingElement
-
getFirstChildElement
-
getLastChildElement
-
countPrecedingSiblingElements
public int countPrecedingSiblingElements() -
setRepetition
public void setRepetition(int repetition) -
getTextContent
- Specified by:
getTextContent
in interfaceNode
- Overrides:
getTextContent
in classParentNode
- Returns:
- the concatenated text contained by itself and all descendants (subtree). Does not take into account indented XML, as ODF whitespace handling require to neglect preceeding text content
-