19package org.openoffice.xmerge.converter.xml.sxc;
21import org.w3c.dom.Node;
22import org.w3c.dom.Element;
23import org.w3c.dom.NodeList;
71 org.w3c.dom.Document doc1 = sdoc1.getContentDOM();
72 org.w3c.dom.Document doc2 = sdoc2.getContentDOM();
74 Element elem1 = doc1.getDocumentElement();
75 Element elem2 = doc2.getDocumentElement();
78 NodeList workSheetList1 =
80 NodeList workSheetList2 =
83 int numOfWorkSheet = workSheetList1.getLength();
85 for (
int i=0;
i < numOfWorkSheet;
i++) {
86 Node workSheet = workSheetList1.item(
i);
89 Node matchingWorkSheet =
matchWorkSheet(workSheet, workSheetList2);
91 if (matchingWorkSheet !=
null) {
107 for (
int j = 0; j < diffResult.length; j++) {
120 numOfWorkSheet = workSheetList2.getLength();
126 NodeList officeBodyList =
129 Node officeBody = officeBodyList.item(0);
132 for (
int j=0; j < numOfWorkSheet; j++) {
133 Node workSheet= workSheetList2.item(j);
136 Node matchingWorkSheet =
matchWorkSheet(workSheet, workSheetList1);
139 if (matchingWorkSheet ==
null) {
141 officeBody.appendChild(cloneNode);
157 Node matchSheet =
null;
159 String orgTableName = ((Element)orgSheet).getAttribute(
162 if (orgTableName ==
null)
165 int numOfWorkSheet = modSheetList.getLength();
169 for (
int i=0;
i < numOfWorkSheet;
i++) {
170 modTableName = ((Element)modSheetList.item(
i)).getAttribute(
172 if (modTableName ==
null)
175 if (orgTableName.equals(modTableName)) {
176 matchSheet = modSheetList.item(
i);
This Exception is thrown by merge algorithms.
Generic small device implementation of DocumentMerger for the SxcPluginFactory.
DocumentMergerImpl(org.openoffice.xmerge.Document doc, ConverterCapabilities cc)
Constructor.
final org.openoffice.xmerge.Document orig
Node matchWorkSheet(Node orgSheet, NodeList modSheetList)
Try to find a WorkSheet from the modified WorkSheetList that has a matching table name from the origi...
void merge(Document modifiedDoc)
This method will find the changes that had happened in the modifiedDoc Document object given the desi...
final ConverterCapabilities cc_
This class is an implementation of OfficeDocument for the SXC format.
This is the Difference basic unit.
String debug()
Display debug information.
A very simple and direct difference algorithm for row Node objects in a spreadsheet.
This is an implementation of the Iterator interface and extends NodeIterator.
This is an implementation of the NodeMergeAlgorithm interface.
This class extends the DocumentMerge class.
This class is used for logging debug messages.
static final int INFO
Informational messages.
static boolean isFlagSet(int f)
Checks if flag is set.
static void log(int flag, String msg)
Log message based on the flag type.
Class containing static utility methods for handling XML trees.
static Node deepClone(Node oldNode, Node newNode)
Perform a deep clone of certain Node which will base on the document Node of the old Node.
A ConverterCapabilities object is used by DocumentMerger implementations.
A DocumentMerger can merge changes from a modified "Device" Document to the assigned original "Office...
A Document represents any Document to be converted and the resulting Document from any conversion.
This interface contains constants for StarOffice XML tags, attributes (StarCalc cell types,...
String TAG_TABLE
Element tag for table:table.
String TAG_OFFICE_BODY
Element tag for office:body.
String ATTRIBUTE_TABLE_NAME
Attribute tag for table:name of element table:table.
This is the difference algorithm interface.
Difference[] computeDiffs(Iterator orgSeq, Iterator modSeq)
Returns a Difference array.
This is an interface used by the DiffAlgorithm and MergeAlgorithm to access a Document.
This is the MergeAlgorithm interface.
void applyDifference(Iterator orgSeq, Iterator modSeq, Difference[] differences)
This method is to merge the difference to an Iterator.
This is an interface for a MergeAlgorithm to merge two Node objects.
Document and PluginFactory implementations for XML based formats.
Provides implementations for the Iterator interface and related support classes.
Provides implementations for the MergeAlgorithm interface, the NodeMergeAlgorithm interface,...
The DiffAlgorithm and MergeAlgorithm are used to provide the merge capabilities of this project.
Provides general purpose utilities.
Provides interfaces for converting between two Document formats, and supports a "merge" interface for...