addEmbeddedObject
public void addEmbeddedObject(EmbeddedObject embObj)
Adds a new embedded object to the document.
embObj
- An instance of EmbeddedObject
.
getContentDOM
public Document getContentDOM()
Return a DOM Document
object of the content.xml
file. Note that a content DOM is not created when the constructor
is called. So, either the read
method or the
initContentDOM
method will need to be called ahead
on this object before calling this method.
getDocumentMimeType
protected String getDocumentMimeType()
Method to return the MIME type of the document.
- String The document's MIME type.
getEmbeddedObject
public EmbeddedObject getEmbeddedObject(String name)
Returns the embedded object corresponding to the name provided.
The name should be stripped of any preceding path characters, such as
'/', '.' or '#'.
name
- The name of the embedded object to retrieve.
- An
EmbeddedObject
instance representing the named
object.
getEmbeddedObjects
public Iterator getEmbeddedObjects()
Returns all the embedded objects (graphics, formulae, etc.) present in
this document.
- An
Iterator
of EmbeddedObject
objects.
getFileExtension
protected String getFileExtension()
Returns the file extension for this type of
Document
.
- The file extension of
Document
.
getFileName
public String getFileName()
Return the file name of the Document
, possibly
with the standard extension.
- getFileName in interface OutputFile
- The file name of
Document
.
getMetaDOM
public Document getMetaDOM()
Return a DOM Document
object of the meta.xml
file. Note that a content DOM is not created when the constructor
is called. So, either the read
method or the
initContentDOM
method will need to be called ahead
on this object before calling this method.
getName
public String getName()
Return the name of the Document
.
- getName in interface Document
getOfficeClassAttribute
protected String getOfficeClassAttribute()
Return the office:class attribute value.
getSettingsDOM
public Document getSettingsDOM()
Return a DOM Document
object of the settings.xml
file. Note that a content DOM is not created when the constructor
is called. So, either the read
method or the
initContentDOM
method will need to be called ahead
on this object before calling this method.
getStyleDOM
public Document getStyleDOM()
Return a DOM Document
object of the style.xml file.
Note that this may return null if there is no style DOM.
Note that a style DOM is not created when the constructor
is called. Depending on the InputStream
, a
read
method may or may not build a style DOM. When
creating a new style DOM, call the initStyleDOM
method
first.
initContentDOM
public final void initContentDOM()
throws IOException
Initializes a new DOM Document
with the content
containing minimum OpenOffice XML tags.
initSettingsDOM
public final void initSettingsDOM()
throws IOException
Initializes a new DOM Document
with the content
containing minimum OpenOffice XML tags.
initStyleDOM
public final void initStyleDOM()
throws IOException
Initializes a new DOM Document with styles
containing minimum OpenOffice XML tags.
isPackageFormat
public boolean isPackageFormat()
Package or flat format?
- true if the document is in package format, false if it's flat xml
read
public void read(InputStream is)
throws IOException
Read the Office Document
from the given
InputStream
.
FIX3 (HJ): Perform simple type detection to determine package or flat format
- read in interface Document
is
- Office document InputStream
.
read
public void read(InputStream is,
boolean isZip)
throws IOException
Read the Office Document
from the given
InputStream
.
is
- Office document InputStream
.isZip
- boolean
Identifies whether
a file is zipped or not
setContentDOM
public void setContentDOM(Node newDom)
Sets the content tree of the document.
newDom
- Node
containing the new content tree.
setMetaDOM
public void setMetaDOM(Node newDom)
Sets the meta tree of the document.
newDom
- Node
containing the new meta tree.
setSettingsDOM
public void setSettingsDOM(Node newDom)
Sets the settings tree of the document.
newDom
- Node
containing the new settings tree.
setStyleDOM
public void setStyleDOM(Node newDom)
Sets the style tree of the document.
newDom
- Node
containing the new style tree.
write
public void write(OutputStream os)
throws IOException
Write out Office ZIP file format.
- write in interface OutputFile
write
public void write(OutputStream os,
boolean isZip)
throws IOException
Write out Office ZIP file format.
os
- XML OutputStream
.isZip
- boolean