|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openoffice.xmerge.converter.xml.sxc.SxcDocumentDeserializer
General spreadsheet implementation of DocumentDeserializer
for the SxcPluginFactory
. Used with SXC Document
objects.
The deserialize
method uses a DocDecoder
to read the device spreadsheet format into a String
object, then it calls buildDocument
to create a
SxcDocument
object from it.
Constructor Summary | |
SxcDocumentDeserializer(ConvertData cd)
Constructor. |
Method Summary | |
protected void |
addEmptyCells(int numColsSkipped,
org.w3c.dom.Node row)
This method will add empty cells to the Document . |
protected void |
addEmptyRows(int numEmptyRows,
org.w3c.dom.Node root,
int numEmptyCells)
This method will add empty rows to the Document . |
abstract SpreadsheetDecoder |
createDecoder(java.lang.String workbook,
java.lang.String[] worksheetNames,
java.lang.String password)
This abstract method will be implemented by concrete subclasses and will return an application-specific Decoder. |
protected void |
decode()
Outer level method used to decode a WorkBook into a Document . |
Document |
deserialize()
Method to convert a set of "Device" Document objects into a SxcDocument
object and returns it as a Document . |
protected abstract java.lang.String |
getWorkbookName(ConvertData cd)
This method will return the name of the WorkBook from the ConvertData . |
protected abstract java.lang.String[] |
getWorksheetNames(ConvertData cd)
This method will return the name of the WorkSheet from the ConvertData . |
protected java.lang.String |
parseFormula(java.lang.String formula)
This method takes a formula and parses it into StarOffice XML formula format. |
protected void |
processCellData(org.w3c.dom.Element cellElement,
java.lang.String type,
java.lang.String contents)
This method process the data in a cell and sets the appropriate attributes on the cell Element . |
protected void |
processCells(org.w3c.dom.Node root)
This method process the cells in a Document
and generates a portion of the Document . |
protected void |
processTable(org.w3c.dom.Node root)
This method process a WorkSheet and generates a portion of the Document . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SxcDocumentDeserializer(ConvertData cd)
cd
- ConvertData
consisting of a
device content object.Method Detail |
protected void addEmptyCells(int numColsSkipped, org.w3c.dom.Node row)
Document
.
It is called when the conversion process encounters a row
that contains some cells without data.numColsSkipped
- The number of empty cells
that we need to add to the
current row.row
- The Node
of the
Document
we
are building that we will
append our empty cell
Node
objects.
This Node
should
be a TAG_TABLE_ROW tag.protected void addEmptyRows(int numEmptyRows, org.w3c.dom.Node root, int numEmptyCells)
Document
.
It is called when the conversion process encounters
a row (or rows) that do not contain any data in its cells.numEmptyRows
- The number of empty rows that we
need to add to the Document
.root
- The Node
of the
Document
we are building
that we will append our empty row
Node
objects. This
Node
should be a TAG_TABLE
tag.numEmptyCells
- The number of empty cells in the
empty row.public abstract SpreadsheetDecoder createDecoder(java.lang.String workbook, java.lang.String[] worksheetNames, java.lang.String password) throws java.io.IOException
workbook
- The WorkBook to read.password
- The WorkBook password.SpreadSheetDecoder
.java.io.IOException
- If any I/O error occurs.protected void decode() throws java.io.IOException
Document
.java.io.IOException
- If any I/O error occurs.public Document deserialize() throws ConvertException, java.io.IOException
Method to convert a set of "Device"
Document
objects into a SxcDocument
object and returns it as a Document
.
This method is not thread safe for performance reasons. This method should not be called from within two threads. It would be best to call this method only once per object instance.
deserialize
in interface DocumentDeserializer
SxcDocument
consisting
of the data converted from the input
stream.ConvertException
- If any conversion error occurs.java.io.IOException
- If any I/O error occurs.protected abstract java.lang.String getWorkbookName(ConvertData cd) throws java.io.IOException
This method will return the name of the WorkBook from the
ConvertData
. Allows for situations where the
WorkBook name differs from the Device Content name.
Implemented in the Deserializer as the Decoder's constructor requires a name.
cd
- The ConvertData
containing the Device
content.protected abstract java.lang.String[] getWorksheetNames(ConvertData cd) throws java.io.IOException
ConvertData
.cd
- The ConvertData
containing the Device
content.protected java.lang.String parseFormula(java.lang.String formula)
This method takes a formula and parses it into StarOffice XML formula format.
Many spreadsheets use ',' as a separator. StarOffice XML format uses ';' as a separator instead.
Many spreadsheets use '!' as a separator when refencing a cell in a different sheet.
Example: =sheet1!A1
StarOffice XML format uses '.' as a separator instead.
Example: =sheet1.A1
formula
- A formula string.protected void processCellData(org.w3c.dom.Element cellElement, java.lang.String type, java.lang.String contents)
Element
.cellElement
- A TAG_TABLE_CELL Element
that we will be adding attributes to
based on the type of data in the cell.type
- The type of data contained in the cell.contents
- The contents of the data contained in
the cell.protected void processCells(org.w3c.dom.Node root) throws java.io.IOException
This method process the cells in a Document
and generates a portion of the Document
.
This method assumes that records are sorted by row and then column.
root
- The Node
of the Document
we are building that we will append our cell
Node
objects. This Node
should be a TAG_TABLE tag.java.io.IOException
- If any I/O error occurs.protected void processTable(org.w3c.dom.Node root) throws java.io.IOException
Document
. A spreadsheet is represented
as a table Node in StarOffice XML format.root
- The root Node
of the
Document
we are building. This
Node
should be a TAG_OFFICE_BODY
tag.java.io.IOException
- If any I/O error occurs.
|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |