OpenOffice.org
XMerge API

org.openoffice.xmerge.converter.xml
Class OfficeDocument

java.lang.Object
  |
  +--org.openoffice.xmerge.converter.xml.OfficeDocument
All Implemented Interfaces:
Document, OfficeConstants
Direct Known Subclasses:
GenericOfficeDocument, SxcDocument, SxwDocument

public abstract class OfficeDocument
extends java.lang.Object
implements Document, OfficeConstants

An implementation of Document for StarOffice documents.


Fields inherited from interface org.openoffice.xmerge.converter.xml.OfficeConstants
ATTRIBUTE_FO_FONT_FAMILY, ATTRIBUTE_OFFICE_CLASS, ATTRIBUTE_SPACE_COUNT, ATTRIBUTE_STYLE_FONT_PITCH, ATTRIBUTE_STYLE_NAME, ATTRIBUTE_TABLE_BOOLEAN_VALUE, ATTRIBUTE_TABLE_CURRENCY, ATTRIBUTE_TABLE_DATE_VALUE, ATTRIBUTE_TABLE_FORMULA, ATTRIBUTE_TABLE_NAME, ATTRIBUTE_TABLE_NUM_COLUMNS_REPEATED, ATTRIBUTE_TABLE_NUM_ROWS_REPEATED, ATTRIBUTE_TABLE_STRING_VALUE, ATTRIBUTE_TABLE_STYLE_NAME, ATTRIBUTE_TABLE_TIME_VALUE, ATTRIBUTE_TABLE_VALUE, ATTRIBUTE_TABLE_VALUE_TYPE, ATTRIBUTE_TEXT_STYLE_NAME, CELLTYPE_BOOLEAN, CELLTYPE_CURRENCY, CELLTYPE_DATE, CELLTYPE_FLOAT, CELLTYPE_PERCENT, CELLTYPE_STRING, CELLTYPE_TIME, SXC_FILE_EXTENSION, SXC_TYPE, SXW_FILE_EXTENSION, SXW_TYPE, TAG_BOOKMARK, TAG_BOOKMARK_START, TAG_HEADING, TAG_HYPERLINK, TAG_LINE_BREAK, TAG_LIST_HEADER, TAG_LIST_ITEM, TAG_OFFICE_AUTOMATIC_STYLES, TAG_OFFICE_BODY, TAG_OFFICE_DOCUMENT, TAG_OFFICE_DOCUMENT_CONTENT, TAG_OFFICE_DOCUMENT_STYLES, TAG_OFFICE_FONT_DECLS, TAG_OFFICE_MASTER_STYLES, TAG_OFFICE_STYLES, TAG_ORDERED_LIST, TAG_PARAGRAPH, TAG_SPACE, TAG_SPAN, TAG_STYLE_FONT_DECL, TAG_TAB_STOP, TAG_TABLE, TAG_TABLE_CELL, TAG_TABLE_COLUMN, TAG_TABLE_ROW, TAG_TABLE_SCENARIO, TAG_UNORDERED_LIST
 
Constructor Summary
OfficeDocument(java.lang.String name)
          Default constructor.
OfficeDocument(java.lang.String name, boolean namespaceAware, boolean validating)
          Constructor with arguments to set namespaceAware and validating flags.
 
Method Summary
 org.w3c.dom.Document getContentDOM()
          Return a DOM Document object of the content.xml file.
protected abstract  java.lang.String getFileExtension()
          Returns the file extension for this type of Document.
 java.lang.String getFileName()
          Return the file name of the Document, possibly with the standard extension.
 java.lang.String getName()
          Return the name of the Document.
protected abstract  java.lang.String getOfficeClassAttribute()
          Return the office:class attribute value.
 org.w3c.dom.Document getStyleDOM()
          Return a DOM Document object of the style.xml file.
 void initContentDOM()
          Initializes a new DOM Document with the content containing minimum OpenOffice XML tags.
 void initStyleDOM()
          Initializes a new DOM Document with styles containing minimum OpenOffice XML tags.
 void read(java.io.InputStream is)
          Read the Office Document from the given InputStream.
 void read(java.io.InputStream is, boolean isZip)
          Read the Office Document from the given InputStream.
 void setContentDOM(org.w3c.dom.Node newDom)
           
 void write(java.io.OutputStream os)
          Write out Office ZIP file format.
 void write(java.io.OutputStream os, boolean isZip)
          Write out Office ZIP file format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OfficeDocument

public OfficeDocument(java.lang.String name)
Default constructor.
Parameters:
name - Document name.

OfficeDocument

public OfficeDocument(java.lang.String name,
                      boolean namespaceAware,
                      boolean validating)
Constructor with arguments to set namespaceAware and validating flags.
Parameters:
name - Document name (may or may not contain extension).
namespaceAware - Value for namespaceAware flag.
validating - Value for validating flag.
Method Detail

getContentDOM

public org.w3c.dom.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.
Returns:
DOM Document object.

getFileExtension

protected abstract java.lang.String getFileExtension()
Returns the file extension for this type of Document.
Returns:
The file extension of Document.

getFileName

public java.lang.String getFileName()
Return the file name of the Document, possibly with the standard extension.
Specified by:
getFileName in interface Document
Returns:
The file name of Document.

getName

public java.lang.String getName()
Return the name of the Document.
Specified by:
getName in interface Document
Returns:
The name of Document.

getOfficeClassAttribute

protected abstract java.lang.String getOfficeClassAttribute()
Return the office:class attribute value.
Returns:
The attribute value.

getStyleDOM

public org.w3c.dom.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.
Returns:
DOM Document object.

initContentDOM

public final void initContentDOM()
                          throws java.io.IOException
Initializes a new DOM Document with the content containing minimum OpenOffice XML tags.
Throws:
java.io.IOException - If any I/O error occurs.

initStyleDOM

public final void initStyleDOM()
                        throws java.io.IOException
Initializes a new DOM Document with styles containing minimum OpenOffice XML tags.
Throws:
java.io.IOException - If any I/O error occurs.

read

public void read(java.io.InputStream is)
          throws java.io.IOException
Read the Office Document from the given InputStream.
Specified by:
read in interface Document
Parameters:
is - Office document InputStream.
Throws:
java.io.IOException - If any I/O error occurs.

read

public void read(java.io.InputStream is,
                 boolean isZip)
          throws java.io.IOException
Read the Office Document from the given InputStream.
Parameters:
is - Office document InputStream.
isZip - boolean Identifies whether a file is zipped or not
Throws:
java.io.IOException - If any I/O error occurs.

setContentDOM

public void setContentDOM(org.w3c.dom.Node newDom)

write

public void write(java.io.OutputStream os)
           throws java.io.IOException
Write out Office ZIP file format.
Specified by:
write in interface Document
Parameters:
os - XML OutputStream.
Throws:
java.io.IOException - If any I/O error occurs.

write

public void write(java.io.OutputStream os,
                  boolean isZip)
           throws java.io.IOException
Write out Office ZIP file format.
Parameters:
os - XML OutputStream.
isZip - boolean
Throws:
java.io.IOException - If any I/O error occurs.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org