|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.odftoolkit.odfdom.doc.OdfDocument
public abstract class OdfDocument
| Nested Class Summary | |
|---|---|
static class |
OdfDocument.OdfMediaType
This enum contains all possible media types of OpenDocument documents. |
static class |
OdfDocument.OdfXMLFile
This enum contains all possible standardized XML ODF files of the OpenDocument document. |
protected static class |
OdfDocument.Resource
|
| Constructor Summary | |
|---|---|
OdfDocument()
|
|
| Method Summary | |
|---|---|
void |
embedDocument(String pkgPathToChildDocument,
OdfDocument newOdfDocument)
Add an OdfDocument as an embedded OdfDocument to the current OdfDocument |
String |
getBaseURI()
Get the URI, where this ODF document is stored. |
OdfFileDom |
getContentDom()
Return the ODF type-based content DOM of the current OdfDocument |
InputStream |
getContentStream()
Gets the ODF content.xml file as stream. |
String |
getDocumentPackagePath()
Get the relative path for an embedded ODF document. |
OdfStyles |
getDocumentStyles()
|
OdfDocument |
getEmbeddedDocument(String pathToObject)
Returns an embedded OdfDocument of the current OdfDocument matching to the internal package path given as an parameter. |
List<OdfDocument> |
getEmbeddedDocuments()
Method returns all embedded OdfDocuments, which match a valid OdfMediaType, of the current OdfDocument. |
List<OdfDocument> |
getEmbeddedDocuments(OdfDocument.OdfMediaType mediaType)
Method returns all embedded OdfDocuments of the current OdfDocument matching the according MediaType. |
String |
getMediaType()
Get the media type from document |
InputStream |
getMetaStream()
Gets the ODF metadata.xml file as stream. |
OdfBody |
getOfficeBody()
|
OdfMasterStyles |
getOfficeMasterStyles()
return the office:master-styles element of this document. |
OdfStyles |
getOrCreateDocumentStyles()
|
OdfPackage |
getPackage()
Retreives the OdfPackage for this OdfDocument. |
protected OdfDocument |
getRootDocument()
Retreives the root OdfDocument that determines the mediatype of the package. |
InputStream |
getSettingsStream()
Gets the ODF settings.xml file as stream. |
OdfFileDom |
getStylesDom()
Return the ODF type-based content DOM of the current OdfDocument |
InputStream |
getStylesStream()
Gets the ODF style.xml file as stream. |
protected String |
getXMLFilePath(OdfDocument.OdfXMLFile file)
Get the relative path for an embedded ODF document including its file name. |
XPath |
getXPath()
Create an XPath instance to select one or more nodes from an ODF document. |
static OdfDocument |
loadDocument(File file)
Creates an OdfDocument from the OpenDocument provided by a File. |
static OdfDocument |
loadDocument(InputStream inStream)
Creates an OdfDocument from the OpenDocument provided by a resource Stream. |
static OdfDocument |
loadDocument(OdfPackage odfPackage)
Creates an OdfDocument from the OpenDocument provided by an ODF package. |
static OdfDocument |
loadDocument(String path)
Loads an OdfDocument from the provided path. |
protected static OdfDocument |
loadTemplate(OdfDocument.Resource res)
Loads an OpenDocument from the given resource |
void |
save(File file)
Save the document to given file. |
void |
save(OutputStream out)
Save the document to an OutputStream. |
void |
save(String path)
Save the document to given path.Delegate to the root document and save possible embedded OdfDocuments. |
protected void |
setMediaType(OdfDocument.OdfMediaType odfMediaType)
Sets the media type of the OdfDocument |
protected void |
setPackage(OdfPackage pkg)
Sets the OdfPackage that contains this OdfDocument. |
protected void |
setRootDocument(OdfDocument root)
Sets the root OdfDocument that determines the mediatype of the package. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public OdfDocument()
| Method Detail |
|---|
protected static OdfDocument loadTemplate(OdfDocument.Resource res)
throws Exception
res - a resource containing the documentuseTempFile - a flag to indicate whether or not to use temporary files
Exception - - if the document could not be created.
public static OdfDocument loadDocument(String path)
throws Exception
path - - the path from where the document can be loaded
Exception - - if the document could not be created.
public static OdfDocument loadDocument(InputStream inStream)
throws Exception
inStream - - the InputStream of the ODF document.
Exception - - if the document could not be created.
public static OdfDocument loadDocument(File file)
throws Exception
file - - a file representing the ODF document.
Exception - - if the document could not be created.
public static OdfDocument loadDocument(OdfPackage odfPackage)
throws Exception
odfPackage - - the ODF package containing the ODF document.
Exception - - if the ODF document could not be created.protected void setRootDocument(OdfDocument root)
root - the OdfDocument that has its file on the root level of the packageprotected OdfDocument getRootDocument()
protected void setPackage(OdfPackage pkg)
pkg - the OdfPackage that contains this OdfDocumentpublic OdfPackage getPackage()
protected void setMediaType(OdfDocument.OdfMediaType odfMediaType)
odfMediaType - media type to be setpublic String getDocumentPackagePath()
protected String getXMLFilePath(OdfDocument.OdfXMLFile file)
file - represents one of the standardized XML ODF files.
public void embedDocument(String pkgPathToChildDocument,
OdfDocument newOdfDocument)
pkgPathToChildDocument - path to the directory of the embedded ODF document (always relative to ODF package root).newOdfDocument - the OdfDocument to be embedded
public InputStream getContentStream()
throws Exception
Exception - - if the stream can not be extracted
public InputStream getStylesStream()
throws Exception
Exception - - if the stream can not be extracted
public InputStream getSettingsStream()
throws Exception
Exception - - if the stream can not be extracted
public InputStream getMetaStream()
throws Exception
Exception - - if the stream can not be extractedpublic String getBaseURI()
public OdfDocument getEmbeddedDocument(String pathToObject)
pathToObject - path to the directory of the embedded ODF document (relative to ODF package root).
public List<OdfDocument> getEmbeddedDocuments(OdfDocument.OdfMediaType mediaType)
mediaType - media type which is used as a filter
public List<OdfDocument> getEmbeddedDocuments()
public OdfStyles getDocumentStyles()
public OdfStyles getOrCreateDocumentStyles()
public XPath getXPath()
public OdfFileDom getContentDom()
throws Exception
Exception - if content DOM could not be initialized
public OdfFileDom getStylesDom()
throws Exception
Exception - if styles DOM could not be initializedpublic String getMediaType()
public void save(String path)
throws Exception
path - - the path to the file
Exception - if the document could not be saved
public void save(File file)
throws Exception
file - - the file to save the document
Exception - if the document could not be saved
public void save(OutputStream out)
throws Exception
out - - the OutputStream to write the file to
Exception - if the document could not be savedpublic OdfBody getOfficeBody()
public OdfMasterStyles getOfficeMasterStyles()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||