This class reads and collects global information about an OOo document.
This includes styles, forms, information about indexes and references etc.
addFigureSequenceName
public void addFigureSequenceName(String sName)
Add a sequence name for figure captions.
OpenDocument has a very weak notion of figure captions: A caption is a
paragraph containing a text:sequence element. Moreover, the only source
to identify which sequence number to use is the list(s) of figures.
If there's no list of figures, captions cannot be identified.
Thus this method lets the user add a sequence name to identify the
figure captions.
addTableSequenceName
public void addTableSequenceName(String sName)
Add a sequence name for table captions.
OpenDocument has a very weak notion of table captions: A caption is a
paragraph containing a text:sequence element. Moreover, the only source
to identify which sequence number to use is the list(s) of tables.
If there's no list of tables, captions cannot be identified.
Thus this method lets the user add a sequence name to identify the
table captions.
getCharacterCount
public static int getCharacterCount(Node node)
Counts the number of characters (text nodes) in this element
excluding footnotes etc.
node
- the node to count in
getContent
public Element getContent()
Get the content element
In the old file format this means the
office:body
element
In the OpenDocument format this means a
office:text
,
office:spreadsheet
or
office:presentation
element.
getEndnotesConfiguration
public PropertySet getEndnotesConfiguration()
getFirstMasterPage
public MasterPage getFirstMasterPage()
Returns the first master page used in the document. If no master
page is used explicitly, the first master page found in the styles is
returned. Returns null if no master pages exists.
- a
MasterPage
object representing the master page
getFontDeclaration
public FontDeclaration getFontDeclaration(String sName)
Get a specific font declaration
sName
- the name of the font declaration
- a
FontDeclaration
representing the font
getFontDeclarations
public OfficeStyleFamily getFontDeclarations()
Get the collection of all font declarations.
- the
OfficeStyleFamily
of font declarations
getFootnotesConfiguration
public PropertySet getFootnotesConfiguration()
getForms
public FormsReader getForms()
Get the forms belonging to this document.
- a
FormsReader
representing the forms
getHeadingStyle
public StyleWithProperties getHeadingStyle(int nLevel)
Returns the paragraph style associated with headings of a specific
level. Returns
null
if no such style is known.
In principle, different styles can be used for each heading, in
practice the same (soft) style is used for all headings of a specific
level.
nLevel
- the level of the heading
- a
StyleWithProperties
object representing the style
getListStyle
public ListStyle getListStyle(String sName)
getMasterPage
public MasterPage getMasterPage(String sName)
getOutlineStyle
public ListStyle getOutlineStyle()
getPageLayout
public PageLayout getPageLayout(String sName)
getSequenceFromRef
public String getSequenceFromRef(String sRefName)
Get the sequence name associated with a reference name
sRefName
- the reference name to use
- the sequence name or null
getSequenceName
public String getSequenceName(Element par)
Get the sequence name associated with a paragraph
par
- the paragraph to look up
- the sequence name or null
getTableReader
public TableReader getTableReader(Element node)
Read a table from a table:table node
node
- the table:table Element node
- a
TableReader
object representing the table
getTextContent
public String getTextContent(Node node)
getTocReader
public TocReader getTocReader(Element onode)
Returns a reader for a specific toc
onode
- the text:table-of-content-node
hasBookmarkRefTo
public boolean hasBookmarkRefTo(String sName)
Is there a reference to this bookmark?
sName
- the name of the bookmark
- true if there is a reference
hasEndnoteRefTo
public boolean hasEndnoteRefTo(String sId)
Is there a reference to this endnote?
sId
- the id of the endnote
- true if there is a reference
hasFootnoteRefTo
public boolean hasFootnoteRefTo(String sId)
Is there a reference to this footnote id?
sId
- the id of the footnote
- true if there is a reference
hasLinkTo
public boolean hasLinkTo(String sName)
Is there a link to this sequence anchor name?
sName
- the name of the anchor
hasReferenceRefTo
public boolean hasReferenceRefTo(String sName)
Is there a reference to this reference mark?
- true if there is a reference
hasSequenceRefTo
public boolean hasSequenceRefTo(String sId)
Is there a reference to this sequence field?
sId
- the id of the sequence field
- true if there is a reference
isDrawElement
public static boolean isDrawElement(Node node)
Checks, if a node is an element in the draw namespace
- true if this is a draw element
isFigureSequenceName
public boolean isFigureSequenceName(String sName)
Does this sequence name belong to a lof?
sName
- the name of the sequence
- true if it belongs to an index
isInPackage
public boolean isInPackage(String sUrl)
Checks whether this url is internal to the package
- true if the url is internal to the package
isIndexSourceStyle
public boolean isIndexSourceStyle(String sStyleName)
Is this style used in some toc as an index source style?
sStyleName
- the name of the style
- true if this is an index source style
isNoteElement
public static boolean isNoteElement(Node node)
Checks, if a node is an element representing a note (footnote/endnote)
- true if this is a note element
isOpenDocument
public boolean isOpenDocument()
Is this an OASIS OpenDocument or an OOo 1.0 document?
- true if it's an OASIS OpenDocument
isPackageFormat
public boolean isPackageFormat()
Checks whether or not this document is in package format
- true if it's in package format
isPresentation
public boolean isPresentation()
Is this a presentation document?
- true if it's a presentation document
isSingleParagraph
public static boolean isSingleParagraph(Node node)
Checks, if this node contains at most one element, and that this is a
paragraph.
- true if the node contains a single paragraph or nothing
isSpreadsheet
public boolean isSpreadsheet()
Is this a spreadsheet document?
- true if it's a spreadsheet document
isTableElement
public static boolean isTableElement(Node node)
Checks, if a node is an element in the table namespace
- true if this is a table element
isTableSequenceName
public boolean isTableSequenceName(String sName)
Does this sequence name belong to a lot?
sName
- the name of the sequence
- true if it belongs to an index
isText
public boolean isText()
Is this an text document?
- true if it's a text document
isTextElement
public static boolean isTextElement(Node node)
Checks, if a node is an element in the text namespace
- true if this is a text element
isWhitespace
public static boolean isWhitespace(String s)
Checks, if this text is whitespace
- true if the String contains whitespace only
isWhitespaceContent
public static boolean isWhitespaceContent(Node node)
Checks, if the only text content of this node is whitespace
node
- the node to check (should be a paragraph node or a child
of a paragraph node)
- true if the node contains whitespace only