LibreOffice Module xmerge (master) 1
CellNodeIterator.java
Go to the documentation of this file.
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18
19package org.openoffice.xmerge.merger.diff;
20
21import org.w3c.dom.Node;
22import org.w3c.dom.Element;
23
26
39public final class CellNodeIterator extends NodeIterator {
40
41 // can be expanded to an array in the future, not necessary right now
43
51 super(cc, node);
52 }
53
64 @Override
65 protected boolean nodeSupported(Node node) {
66
67 // can use an array later to check all possible tags for
68 // future expansion
69 return node.getNodeType() == Node.ELEMENT_NODE &&
70 node.getNodeName().equals(SUPPORTED_TAG1);
71 }
72
73 @Override
74 protected boolean childrenEqual(Node node1, Node node2) {
75
76 boolean equal = false;
77
78 if (node1.hasChildNodes() && node2.hasChildNodes()) {
79 Element cell1 = (Element)node1;
80 Element cell2 = (Element)node2;
81
82 // only need compare the first <text:p> children node, don't want
83 // to compare any non-supported features
84 // TODO: need to confirm whether all the text string is the
85 // first <text:p>, though I checked with the openoffice 619 build
86 Node paraNode1 = cell1.getElementsByTagName(
88 Node paraNode2 = cell2.getElementsByTagName(
90
91 equal = super.compareNode(paraNode1, paraNode2);
92 }
93
94 return equal;
95 }
96}
This is an implementations of the Iterator interface.
boolean childrenEqual(Node node1, Node node2)
Compare the children of two Node objects.
CellNodeIterator(ConverterCapabilities cc, Node node)
The standard constructor.
boolean nodeSupported(Node node)
Overwrite the parent nodeSupported method.
This is an implementation of the Iterator interface.
A ConverterCapabilities object is used by DocumentMerger implementations.
This interface contains constants for StarOffice XML tags, attributes (StarCalc cell types,...
String TAG_TABLE_CELL
Element tag for table:table-cell.
bool equal(T const &rfValA, T const &rfValB)
Document and PluginFactory implementations for XML based formats.
Provides interfaces for converting between two Document formats, and supports a "merge" interface for...
Definition: Convert.java:19