Skip to content

Commit

Permalink
rename new base class to OdfContentOrStylesDomBase
Browse files Browse the repository at this point in the history
  • Loading branch information
mistmist authored and svanteschubert committed Dec 19, 2022
1 parent 25e4e0b commit fb98b75
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.odftoolkit.odfdom.doc.OdfDocument.OdfMediaType;
import org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument;
import org.odftoolkit.odfdom.dom.OdfContentDom;
import org.odftoolkit.odfdom.dom.OdfContentDomBase;
import org.odftoolkit.odfdom.dom.OdfContentOrStylesDomBase;
import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
import org.odftoolkit.odfdom.dom.OdfSchemaDocument;
import org.odftoolkit.odfdom.dom.OdfStylesDom;
Expand Down Expand Up @@ -111,7 +111,7 @@ private OdfTable(TableTableElement table) {
*/
public static OdfTable getInstance(TableTableElement odfElement) {
IdentityHashMap<TableTableElement, OdfTable> tableRepository =
((OdfContentDomBase) odfElement.getOwnerDocument()).getTableRepository();
((OdfContentOrStylesDomBase) odfElement.getOwnerDocument()).getTableRepository();
if (tableRepository.containsKey(odfElement)) {
return tableRepository.get(odfElement);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import org.odftoolkit.odfdom.doc.OdfDocument;
import org.odftoolkit.odfdom.dom.OdfContentDomBase;
import org.odftoolkit.odfdom.dom.OdfContentOrStylesDomBase;
import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
import org.odftoolkit.odfdom.dom.element.table.TableCoveredTableCellElement;
import org.odftoolkit.odfdom.dom.element.table.TableTableCellElement;
Expand Down Expand Up @@ -341,7 +341,7 @@ public OdfTableRow getPreviousRow() {
} else if (aPrevNode instanceof TableTableRowsElement
|| aPrevNode instanceof TableTableHeaderRowsElement
|| aPrevNode instanceof TableTableRowGroupElement) {
XPath xpath = ((OdfContentDomBase) aPrevNode.getOwnerDocument()).getXPath();
XPath xpath = ((OdfContentOrStylesDomBase) aPrevNode.getOwnerDocument()).getXPath();
synchronized (mDocument) {
lastRow =
(TableTableRowElement)
Expand Down Expand Up @@ -400,7 +400,7 @@ public OdfTableRow getNextRow() {
} else if (aNextNode instanceof TableTableRowsElement
|| aNextNode instanceof TableTableHeaderRowsElement
|| aNextNode instanceof TableTableRowGroupElement) {
XPath xpath = ((OdfContentDomBase) aNextNode.getOwnerDocument()).getXPath();
XPath xpath = ((OdfContentOrStylesDomBase) aNextNode.getOwnerDocument()).getXPath();
synchronized (mDocument) {
firstRow =
(TableTableRowElement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import org.xml.sax.SAXException;

/** The DOM representation of the ODF content.xml file of an ODF document. */
public class OdfContentDom extends OdfContentDomBase {
public class OdfContentDom extends OdfContentOrStylesDomBase {

private static final long serialVersionUID = 766167617530147883L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
import org.odftoolkit.odfdom.pkg.OdfPackageDocument;

/** Base class for an XML stream that contains document content, i.e., styles.xml or content.xml. */
public class OdfContentDomBase extends OdfFileDom {
public class OdfContentOrStylesDomBase extends OdfFileDom {

private static final long serialVersionUID = 6823264460360047745L;

IdentityHashMap<TableTableElement, OdfTable> mTableRepository =
new IdentityHashMap<TableTableElement, OdfTable>();

public OdfContentDomBase(OdfPackageDocument packageDocument, String packagePath) {
public OdfContentOrStylesDomBase(OdfPackageDocument packageDocument, String packagePath) {
super(packageDocument, packagePath);
}

public OdfContentDomBase(OdfPackage pkg, String packagePath) {
public OdfContentOrStylesDomBase(OdfPackage pkg, String packagePath) {
super(pkg, packagePath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import org.xml.sax.SAXException;

/** The DOM representation of the ODF styles.xml file of an ODF document. */
public class OdfStylesDom extends OdfContentDomBase {
public class OdfStylesDom extends OdfContentOrStylesDomBase {

private static final long serialVersionUID = 766167617530147886L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.odftoolkit.odfdom.doc.OdfDocument;
import org.odftoolkit.odfdom.doc.table.OdfTable;
import org.odftoolkit.odfdom.doc.table.OdfTableRow;
import org.odftoolkit.odfdom.dom.OdfContentDomBase;
import org.odftoolkit.odfdom.dom.OdfContentOrStylesDomBase;
import org.odftoolkit.odfdom.dom.OdfMetaDom;
import org.odftoolkit.odfdom.dom.OdfStylesDom;
import org.odftoolkit.odfdom.dom.element.draw.DrawObjectElement;
Expand Down Expand Up @@ -100,7 +100,7 @@ public static OdfEditableTextExtractor newOdfEditableTextExtractor(OdfElement el
public void visit(DrawObjectElement element) {
String embedDocPath = element.getXlinkHrefAttribute();
OdfDocument embedDoc =
((OdfDocument) (((OdfContentDomBase) element.getOwnerDocument()).getDocument()))
((OdfDocument) (((OdfContentOrStylesDomBase) element.getOwnerDocument()).getDocument()))
.loadSubDocument(embedDocPath);
if (embedDoc != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.junit.runner.RunWith;
import org.odftoolkit.junit.AlphabeticalOrderedRunner;
import org.odftoolkit.odfdom.dom.OdfContentDom;
import org.odftoolkit.odfdom.dom.OdfContentDomBase;
import org.odftoolkit.odfdom.dom.OdfContentOrStylesDomBase;
import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
import org.odftoolkit.odfdom.dom.attribute.text.TextAnchorTypeAttribute;
import org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement;
Expand Down Expand Up @@ -513,7 +513,8 @@ public void _8_testWritingCorrectMimetype() {
}
}

private void addImageToDocument(OdfContentDomBase dom, TextPElement para) throws Exception {
private void addImageToDocument(OdfContentOrStylesDomBase dom, TextPElement para)
throws Exception {
OdfDrawFrame drawFrame = new OdfDrawFrame(dom);
drawFrame.setDrawNameAttribute("graphics1");
drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
Expand All @@ -527,7 +528,7 @@ private void addImageToDocument(OdfContentDomBase dom, TextPElement para) throws
image.newImage(ResourceUtilities.getURI("test-input" + File.separatorChar + TEST_PIC));
}

private void addFrameForEmbeddedDoc(OdfContentDomBase dom, TextPElement para, String path)
private void addFrameForEmbeddedDoc(OdfContentOrStylesDomBase dom, TextPElement para, String path)
throws Exception {
OdfDrawFrame drawFrame = new OdfDrawFrame(dom);
drawFrame.setDrawNameAttribute(path);
Expand Down

0 comments on commit fb98b75

Please sign in to comment.