OpenOffice.org
XMerge API

org.openoffice.xmerge.converter.xml.sxw.pocketword
Class PocketWordDocument

java.lang.Object
  |
  +--org.openoffice.xmerge.converter.xml.sxw.pocketword.PocketWordDocument
All Implemented Interfaces:
Document, PocketWordConstants

public class PocketWordDocument
extends java.lang.Object
implements Document, PocketWordConstants

Class representing a Pocket Word Document.

PocketWordDocument is used to create new Pocket Word documents and to read existing data to allow for conversion to OpenOffice Writer format.

Version:
1.1

Fields inherited from interface org.openoffice.xmerge.converter.xml.sxw.pocketword.PocketWordConstants
AQUA, BLACK, BLUE, COLOUR_TAG, DEFAULT_STYLE, FILE_EXTENSION, FONT_SIZE_TAG, FONT_TAG, FONT_WEIGHT_BOLD, FONT_WEIGHT_FINE, FONT_WEIGHT_NORMAL, FONT_WEIGHT_TAG, FONT_WEIGHT_THICK, FORMATTING_TAG, FUCHSIA, GREEN, GREY, HIGHLIGHT_TAG, ITALIC_TAG, LIME, MAROON, NAVY, OLIVE, PARAGRAPH_STYLE_FAMILY, PURPLE, RED, SILVER, STRIKETHROUGH_TAG, TEAL, TEXT_STYLE_FAMILY, UNDERLINE_TAG, WHITE, YELLOW
 
Constructor Summary
PocketWordDocument(java.lang.String name)
          Constructs a new Pocket Word Document.
 
Method Summary
 void addParagraph(ParaStyle style, boolean listElement)
          This method adds a new paragraph element to the document.
 void addParagraphData(java.lang.String data, TextStyle style)
          This method adds text to the current paragraph.
 java.lang.String getFileName()
          Returns the Document name with file extension.
 java.lang.String getName()
          Returns the Document name with no file extension.
 java.util.Enumeration getParagraphEnumeration()
          Method to provide access to all of the Paragraph objects in the Document.
 void read(java.io.InputStream docData)
          This method reads byte data from the InputStream and extracts font and paragraph data from the file.
 void write(java.io.OutputStream os)
          Writes out the Document content to the specified OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PocketWordDocument

public PocketWordDocument(java.lang.String name)

Constructs a new Pocket Word Document.

This new document does notcontain any information. Document data must either be added using appropriate methods, or an existing file can be read from an InputStream.

Parameters:
name - The name of the PocketWordDocument.
Method Detail

addParagraph

public void addParagraph(ParaStyle style,
                         boolean listElement)

This method adds a new paragraph element to the document. No string data is added to the paragraph.

N.B. The newly added paragraph becomes the current paragraph and is used as the target for all subsequent calls to addParagraphData().

Parameters:
style - Paragraph Style object describing the formatting for the new paragraph. Can be null.
listElement - true if this paragraph is to be bulleted; false otherwise.

addParagraphData

public void addParagraphData(java.lang.String data,
                             TextStyle style)

This method adds text to the current paragraph.

If no paragraphs exist within the document, it creates one.

Parameters:
data - The string data for this segment.
style - Text Style object describing the formatting of this segment. Can be null.

getFileName

public java.lang.String getFileName()

Returns the Document name with file extension.

Specified by:
getFileName in interface Document
Returns:
The Document name with file extension.

getName

public java.lang.String getName()

Returns the Document name with no file extension.

Specified by:
getName in interface Document
Returns:
The Document name with no file extension.

getParagraphEnumeration

public java.util.Enumeration getParagraphEnumeration()

Method to provide access to all of the Paragraph objects in the Document.

Returns:
Enumeration over the paragraphs in the document.

read

public void read(java.io.InputStream docData)
          throws java.io.IOException

This method reads byte data from the InputStream and extracts font and paragraph data from the file.

Specified by:
read in interface Document
Parameters:
is - InputStream containing a Pocket Word data file.
Throws:
java.io.IOException - In case of any I/O errors.

write

public void write(java.io.OutputStream os)
           throws java.io.IOException

Writes out the Document content to the specified OutputStream.

This method may not be thread-safe. Implementations may or may not synchronize this method. User code (i.e. caller) must make sure that calls to this method are thread-safe.

Specified by:
write in interface Document
Parameters:
os - OutputStream to write out the Document content.
Throws:
java.io.IOException - If any I/O error occurs.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org