writer2latex.xmerge
Class EmbeddedXMLObject

java.lang.Object
  extended by writer2latex.xmerge.EmbeddedObject
      extended by writer2latex.xmerge.EmbeddedXMLObject

public class EmbeddedXMLObject
extends EmbeddedObject

This class represents those embedded objects in an OpenOffice.org document that have an XML representation. Currently, according to the OpenOffice.org File Format 1.0 document, there are 6 such objects: Formulae created with Math (application/vnd.sun.xml.math) Charts created with Chart (application/vnd.sun.xml.chart) Spreadsheets created with Calc (application/vnd.sun.xml.calc) Text created with Writer (application/vnd.sun.xml.writer) Drawings created with Draw (application/vnd.sun.xml.draw) Presentations created with Impress (application/vnd.sun.xml.impress) These object types are stored using a combination of content, settings and styles XML files.


Field Summary
private  javax.xml.parsers.DocumentBuilder builder
           
protected  org.w3c.dom.Document contentDOM
           
protected  org.w3c.dom.Document settingsDOM
           
protected  org.w3c.dom.Document stylesDOM
           
 
Fields inherited from class writer2latex.xmerge.EmbeddedObject
hasChanged, objName, objType, zipFile
 
Constructor Summary
EmbeddedXMLObject(java.lang.String name, java.lang.String type)
          Constructor for an embedded object stored using an XML representation.
EmbeddedXMLObject(java.lang.String name, java.lang.String type, OfficeZip source)
          Package private constructor for use when reading an object from a compressed SX?
 
Method Summary
 org.w3c.dom.Document getContentDOM()
          Returns the content data for this embedded object.
private  org.w3c.dom.Document getNamedDOM(java.lang.String name)
          This method extracts the data for the given XML file from the SX?
 org.w3c.dom.Document getSettingsDOM()
          Returns the settings data for this embedded object.
 org.w3c.dom.Document getStylesDOM()
          Returns the style data for this embedded object.
 void setContentDOM(org.w3c.dom.Document content)
          Sets the content data for the embedded object.
 void setSettingsDOM(org.w3c.dom.Document settings)
          Sets the settings data for the embedded object.
 void setStylesDOM(org.w3c.dom.Document styles)
          Sets the styles data for the embedded object.
(package private)  void write(OfficeZip zip)
          Package private method for writing the data of the EmbeddedObject to a SX?
(package private)  void writeManifestData(org.w3c.dom.Document manifestDoc)
          Package private method that constructs the manifest.xml entries for this embedded object.
 
Methods inherited from class writer2latex.xmerge.EmbeddedObject
getName, getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentDOM

protected org.w3c.dom.Document contentDOM

settingsDOM

protected org.w3c.dom.Document settingsDOM

stylesDOM

protected org.w3c.dom.Document stylesDOM

builder

private javax.xml.parsers.DocumentBuilder builder
Constructor Detail

EmbeddedXMLObject

public EmbeddedXMLObject(java.lang.String name,
                         java.lang.String type)
Constructor for an embedded object stored using an XML representation.

Parameters:
name - The name of the object.
type - The mime-type of the object. See the class summary.

EmbeddedXMLObject

EmbeddedXMLObject(java.lang.String name,
                  java.lang.String type,
                  OfficeZip source)
Package private constructor for use when reading an object from a compressed SX? file.

Parameters:
name - The name of the object.
type - The mime-type of the object. See the class summary.
source - The OfficeZip representation of the SX? file that stores the object.
Method Detail

getContentDOM

public org.w3c.dom.Document getContentDOM()
                                   throws org.xml.sax.SAXException,
                                          java.io.IOException
Returns the content data for this embedded object.

Returns:
DOM represenation of "content.xml"
Throws:
org.xml.sax.SAXException - If any parser error occurs
java.io.IOException - If any IO error occurs

setContentDOM

public void setContentDOM(org.w3c.dom.Document content)
Sets the content data for the embedded object.

Parameters:
content - DOM representation of the object's content.

getSettingsDOM

public org.w3c.dom.Document getSettingsDOM()
                                    throws org.xml.sax.SAXException,
                                           java.io.IOException
Returns the settings data for this embedded object.

Returns:
DOM represenation of "settings.xml"
Throws:
org.xml.sax.SAXException - If any parser error occurs
java.io.IOException - If any IO error occurs

setSettingsDOM

public void setSettingsDOM(org.w3c.dom.Document settings)
Sets the settings data for the embedded object.

Parameters:
styles - DOM representation of the object's styles.

getStylesDOM

public org.w3c.dom.Document getStylesDOM()
                                  throws org.xml.sax.SAXException,
                                         java.io.IOException
Returns the style data for this embedded object.

Returns:
DOM represenation of "styles.xml"
Throws:
org.xml.sax.SAXException - If any parser error occurs
java.io.IOException - If any IO error occurs

setStylesDOM

public void setStylesDOM(org.w3c.dom.Document styles)
Sets the styles data for the embedded object.

Parameters:
styles - DOM representation of the object's styles.

getNamedDOM

private org.w3c.dom.Document getNamedDOM(java.lang.String name)
                                  throws org.xml.sax.SAXException,
                                         java.io.IOException
This method extracts the data for the given XML file from the SX? file and creates a DOM representation of it.

Parameters:
name - The name of the XML file to retrieve. It is paired with the object name to access the SX? file.
Returns:
DOM representation of the named XML file.
Throws:
org.xml.sax.SAXException - If any parser error occurs
java.io.IOException - If any IO error occurs

write

void write(OfficeZip zip)
     throws java.io.IOException
Package private method for writing the data of the EmbeddedObject to a SX? file.

Specified by:
write in class EmbeddedObject
Parameters:
zip - An OfficeZip instance representing the file the data is to be written to.
Throws:
java.io.IOException

writeManifestData

void writeManifestData(org.w3c.dom.Document manifestDoc)
                 throws org.w3c.dom.DOMException
Package private method that constructs the manifest.xml entries for this embedded object.

Specified by:
writeManifestData in class EmbeddedObject
Parameters:
manifestDoc - Document containing the manifest entries.
Throws:
org.w3c.dom.DOMException