From 3e53edd42a969585ef91a08aeeec0a177d21376e Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Wed, 29 Jan 2020 11:40:29 +0100 Subject: [PATCH] Rearranged packages --- ...ConverterImpl.java => BatchConverter.java} | 4 +- .../java/writer2latex/xhtml/Converter.java | 49 ++++++++------- .../java/writer2latex/xhtml/PageSplitter.java | 2 +- src/main/java/writer2latex/xhtml/Parser.java | 60 ++++++++++++------- ...{DocumentSeparator.java => Separator.java} | 16 ++--- .../AlphabeticalIndexParser.java | 4 +- .../{ => content}/BibliographyParser.java | 4 +- .../xhtml/{ => content}/DrawParser.java | 7 ++- .../xhtml/{ => content}/EndnoteParser.java | 4 +- .../xhtml/{ => content}/FootnoteParser.java | 5 +- .../xhtml/{ => content}/IndexParser.java | 6 +- .../xhtml/{ => content}/LOFParser.java | 5 +- .../xhtml/{ => content}/LOTParser.java | 5 +- .../xhtml/{ => content}/MathParser.java | 6 +- .../xhtml/{ => content}/NoteParser.java | 6 +- .../xhtml/{ => content}/TOCParser.java | 4 +- .../xhtml/{ => content}/TableParser.java | 9 ++- .../xhtml/{ => content}/TextParser.java | 28 +++++---- .../XhtmlBibliographyGenerator.java | 3 +- .../xhtml/{ => style}/CellStyleParser.java | 5 +- .../xhtml/{ => style}/FrameStyleParser.java | 4 +- .../xhtml/{ => style}/HeadingStyleParser.java | 6 +- .../{ => style}/ListStyleFamilyParser.java | 6 +- .../xhtml/{ => style}/PageStyleParser.java | 5 +- .../xhtml/{ => style}/ParStyleParser.java | 4 +- .../{ => style}/PresentationStyleParser.java | 6 +- .../xhtml/{ => style}/RowStyleParser.java | 5 +- .../xhtml/{ => style}/SectionStyleParser.java | 5 +- .../xhtml/{ => style}/StyleFamilyParser.java | 11 +++- .../xhtml/{ => style}/StyleParser.java | 38 ++++++------ .../StyleWithPropertiesParser.java | 7 ++- .../xhtml/{ => style}/TableStyleParser.java | 5 +- .../xhtml/{ => style}/TextStyleParser.java | 6 +- 33 files changed, 227 insertions(+), 113 deletions(-) rename src/main/java/writer2latex/xhtml/{BatchConverterImpl.java => BatchConverter.java} (98%) rename src/main/java/writer2latex/xhtml/{DocumentSeparator.java => Separator.java} (95%) rename src/main/java/writer2latex/xhtml/{ => content}/AlphabeticalIndexParser.java (98%) rename src/main/java/writer2latex/xhtml/{ => content}/BibliographyParser.java (94%) rename src/main/java/writer2latex/xhtml/{ => content}/DrawParser.java (99%) rename src/main/java/writer2latex/xhtml/{ => content}/EndnoteParser.java (93%) rename src/main/java/writer2latex/xhtml/{ => content}/FootnoteParser.java (95%) rename src/main/java/writer2latex/xhtml/{ => content}/IndexParser.java (95%) rename src/main/java/writer2latex/xhtml/{ => content}/LOFParser.java (89%) rename src/main/java/writer2latex/xhtml/{ => content}/LOTParser.java (89%) rename src/main/java/writer2latex/xhtml/{ => content}/MathParser.java (98%) rename src/main/java/writer2latex/xhtml/{ => content}/NoteParser.java (97%) rename src/main/java/writer2latex/xhtml/{ => content}/TOCParser.java (99%) rename src/main/java/writer2latex/xhtml/{ => content}/TableParser.java (98%) rename src/main/java/writer2latex/xhtml/{ => content}/TextParser.java (98%) rename src/main/java/writer2latex/xhtml/{ => content}/XhtmlBibliographyGenerator.java (96%) rename src/main/java/writer2latex/xhtml/{ => style}/CellStyleParser.java (96%) rename src/main/java/writer2latex/xhtml/{ => style}/FrameStyleParser.java (99%) rename src/main/java/writer2latex/xhtml/{ => style}/HeadingStyleParser.java (97%) rename src/main/java/writer2latex/xhtml/{ => style}/ListStyleFamilyParser.java (98%) rename src/main/java/writer2latex/xhtml/{ => style}/PageStyleParser.java (98%) rename src/main/java/writer2latex/xhtml/{ => style}/ParStyleParser.java (98%) rename src/main/java/writer2latex/xhtml/{ => style}/PresentationStyleParser.java (97%) rename src/main/java/writer2latex/xhtml/{ => style}/RowStyleParser.java (95%) rename src/main/java/writer2latex/xhtml/{ => style}/SectionStyleParser.java (95%) rename src/main/java/writer2latex/xhtml/{ => style}/StyleFamilyParser.java (93%) rename src/main/java/writer2latex/xhtml/{ => style}/StyleParser.java (86%) rename src/main/java/writer2latex/xhtml/{ => style}/StyleWithPropertiesParser.java (96%) rename src/main/java/writer2latex/xhtml/{ => style}/TableStyleParser.java (96%) rename src/main/java/writer2latex/xhtml/{ => style}/TextStyleParser.java (99%) diff --git a/src/main/java/writer2latex/xhtml/BatchConverterImpl.java b/src/main/java/writer2latex/xhtml/BatchConverter.java similarity index 98% rename from src/main/java/writer2latex/xhtml/BatchConverterImpl.java rename to src/main/java/writer2latex/xhtml/BatchConverter.java index c8f951a..3089801 100644 --- a/src/main/java/writer2latex/xhtml/BatchConverterImpl.java +++ b/src/main/java/writer2latex/xhtml/BatchConverter.java @@ -42,7 +42,7 @@ import writer2latex.xhtml.l10n.L10n; * Implementation of writer2latex.api.BatchConverter for * xhtml 1.0 strict */ -public class BatchConverterImpl extends BatchConverterBase { +public class BatchConverter extends BatchConverterBase { private XhtmlConfig config; private XhtmlDocument template; @@ -51,7 +51,7 @@ public class BatchConverterImpl extends BatchConverterBase { private String sDefaultCountry; private L10n l10n; - public BatchConverterImpl() { + public BatchConverter() { super(); config = new XhtmlConfig(); template = null; diff --git a/src/main/java/writer2latex/xhtml/Converter.java b/src/main/java/writer2latex/xhtml/Converter.java index d5dbb74..c3d2730 100644 --- a/src/main/java/writer2latex/xhtml/Converter.java +++ b/src/main/java/writer2latex/xhtml/Converter.java @@ -56,7 +56,12 @@ import writer2latex.office.StyleWithProperties; import writer2latex.office.XMLString; import writer2latex.util.ExportNameCollection; import writer2latex.util.Misc; +import writer2latex.xhtml.content.DrawParser; +import writer2latex.xhtml.content.MathParser; +import writer2latex.xhtml.content.TableParser; +import writer2latex.xhtml.content.TextParser; import writer2latex.xhtml.l10n.L10n; +import writer2latex.xhtml.style.StyleParser; /** *

This class converts an OpenDocument file to an XHTML(+MathML) or EPUB document.

@@ -92,7 +97,7 @@ public class Converter extends BasicConverter { private Set resources = new HashSet(); // The xhtml output file(s) - protected int nType = XhtmlDocument.XHTML10; // the doctype + public int nType = XhtmlDocument.XHTML10; // the doctype private boolean bOPS = false; // Do we need to be OPS conforming? Vector outFiles; private int nOutFileIndex; @@ -164,43 +169,43 @@ public class Converter extends BasicConverter { readResource(new FileInputStream(file), sFileName, sMediaType); } - protected String getContentWidth() { + public String getContentWidth() { return contentWidth.peek(); } - protected String pushContentWidth(String sWidth) { + public String pushContentWidth(String sWidth) { return contentWidth.push(sWidth); } - protected void popContentWidth() { + public void popContentWidth() { contentWidth.pop(); } - protected boolean isTopLevel() { + public boolean isTopLevel() { return contentWidth.size()==1; } - protected StyleParser getStyleCv() { return styleCv; } + public StyleParser getStyleCv() { return styleCv; } - protected TextParser getTextCv() { return textCv; } + public TextParser getTextCv() { return textCv; } - protected TableParser getTableCv() { return tableCv; } + public TableParser getTableCv() { return tableCv; } - protected DrawParser getDrawCv() { return drawCv; } + public DrawParser getDrawCv() { return drawCv; } - protected MathParser getMathCv() { return mathCv; } + public MathParser getMathCv() { return mathCv; } - protected int getType() { return nType; } + public int getType() { return nType; } public boolean isHTML5() { return nType==XhtmlDocument.HTML5; } - protected int getOutFileIndex() { return nOutFileIndex; } + public int getOutFileIndex() { return nOutFileIndex; } - protected void addContentEntry(String sTitle, int nLevel, String sTarget) { + public void addContentEntry(String sTitle, int nLevel, String sTarget) { converterResult.addContentEntry(new ContentEntryImpl(sTitle,nLevel,htmlDoc,sTarget)); } - protected void setTocFile(String sTarget) { + public void setTocFile(String sTarget) { converterResult.setTocFile(new ContentEntryImpl(l10n.get(L10n.CONTENTS),1,htmlDoc,sTarget)); //nTocFileIndex = nOutFileIndex; } @@ -213,26 +218,26 @@ public class Converter extends BasicConverter { converterResult.setLotFile(new ContentEntryImpl("Tables",1,htmlDoc,sTarget)); } - protected void setIndexFile(String sTarget) { + public void setIndexFile(String sTarget) { converterResult.setIndexFile(new ContentEntryImpl(l10n.get(L10n.INDEX),1,htmlDoc,sTarget)); //nAlphabeticalIndex = nOutFileIndex; } - protected void setCoverFile(String sTarget) { + public void setCoverFile(String sTarget) { converterResult.setCoverFile(new ContentEntryImpl("Cover",0,htmlDoc,sTarget)); } - protected void setCoverImageFile(OutputFile file, String sTarget) { + public void setCoverImageFile(OutputFile file, String sTarget) { converterResult.setCoverImageFile(new ContentEntryImpl("Cover image",0,file,sTarget)); } - protected Element createElement(String s) { return htmlDOM.createElement(s); } + public Element createElement(String s) { return htmlDOM.createElement(s); } - protected Text createTextNode(String s) { return htmlDOM.createTextNode(s); } + public Text createTextNode(String s) { return htmlDOM.createTextNode(s); } - protected Node importNode(Node node, boolean bDeep) { return htmlDOM.importNode(node,bDeep); } + public Node importNode(Node node, boolean bDeep) { return htmlDOM.importNode(node,bDeep); } - protected L10n getL10n() { return l10n; } + public L10n getL10n() { return l10n; } public void setOPS(boolean b) { bOPS = true; } @@ -538,7 +543,7 @@ public class Converter extends BasicConverter { } /* get inline text, ignoring any draw objects, footnotes, formatting and hyperlinks */ - protected String getPlainInlineText(Node node) { + public String getPlainInlineText(Node node) { StringBuilder buf = new StringBuilder(); Node child = node.getFirstChild(); while (child!=null) { diff --git a/src/main/java/writer2latex/xhtml/PageSplitter.java b/src/main/java/writer2latex/xhtml/PageSplitter.java index 86df55e..6013429 100644 --- a/src/main/java/writer2latex/xhtml/PageSplitter.java +++ b/src/main/java/writer2latex/xhtml/PageSplitter.java @@ -14,7 +14,7 @@ public class PageSplitter { static Node truncatedListItemNodeContent = null; static OfficeReader officeReader = null; - protected static Node splitSoftPageBreak(Node onode,OfficeReader ofr){ + public static Node splitSoftPageBreak(Node onode,OfficeReader ofr){ //Find par node with soft page break inside and split it officeReader = ofr; Document document = onode.getOwnerDocument(); diff --git a/src/main/java/writer2latex/xhtml/Parser.java b/src/main/java/writer2latex/xhtml/Parser.java index 9e84a38..90f8c52 100644 --- a/src/main/java/writer2latex/xhtml/Parser.java +++ b/src/main/java/writer2latex/xhtml/Parser.java @@ -28,15 +28,31 @@ package writer2latex.xhtml; import org.w3c.dom.Element; import writer2latex.office.OfficeReader; +import writer2latex.xhtml.content.DrawParser; +import writer2latex.xhtml.content.MathParser; +import writer2latex.xhtml.content.TableParser; +import writer2latex.xhtml.content.TextParser; +import writer2latex.xhtml.style.CellStyleParser; +import writer2latex.xhtml.style.FrameStyleParser; +import writer2latex.xhtml.style.HeadingStyleParser; +import writer2latex.xhtml.style.ListStyleFamilyParser; +import writer2latex.xhtml.style.PageStyleParser; +import writer2latex.xhtml.style.ParStyleParser; +import writer2latex.xhtml.style.PresentationStyleParser; +import writer2latex.xhtml.style.RowStyleParser; +import writer2latex.xhtml.style.SectionStyleParser; +import writer2latex.xhtml.style.StyleParser; +import writer2latex.xhtml.style.TableStyleParser; +import writer2latex.xhtml.style.TextStyleParser; /** A ConverterHelper is responsible for conversion of some specific content into XHTML. */ -class Parser { +public class Parser { // Member variables providing our content (set in constructor) - OfficeReader ofr; - XhtmlConfig config; - Converter converter; + protected OfficeReader ofr; + protected XhtmlConfig config; + protected Converter converter; /** Construct a new converter helper based on a * @@ -44,7 +60,7 @@ class Parser { * @param config the configuration to use * @param converter the main converter to which the helper belongs */ - Parser(OfficeReader ofr, XhtmlConfig config, Converter converter) { + protected Parser(OfficeReader ofr, XhtmlConfig config, Converter converter) { this.ofr = ofr; this.config = config; this.converter = converter; @@ -52,44 +68,44 @@ class Parser { // Convenience accessor methods to other converter helpers (only needed to save some typing) - StyleParser getStyleCv() { return converter.getStyleCv(); } + protected StyleParser getStyleCv() { return converter.getStyleCv(); } - TextStyleParser getTextSc() { return converter.getStyleCv().getTextSc(); } + protected TextStyleParser getTextSc() { return converter.getStyleCv().getTextSc(); } - ParStyleParser getParSc() { return converter.getStyleCv().getParSc(); } + protected ParStyleParser getParSc() { return converter.getStyleCv().getParSc(); } - HeadingStyleParser getHeadingSc() { return converter.getStyleCv().getHeadingSc(); } + protected HeadingStyleParser getHeadingSc() { return converter.getStyleCv().getHeadingSc(); } - ListStyleFamilyParser getListSc() { return converter.getStyleCv().getListSc(); } + protected ListStyleFamilyParser getListSc() { return converter.getStyleCv().getListSc(); } - SectionStyleParser getSectionSc() { return converter.getStyleCv().getSectionSc(); } + protected SectionStyleParser getSectionSc() { return converter.getStyleCv().getSectionSc(); } - TableStyleParser getTableSc() { return converter.getStyleCv().getTableSc(); } + protected TableStyleParser getTableSc() { return converter.getStyleCv().getTableSc(); } - RowStyleParser getRowSc() { return converter.getStyleCv().getRowSc(); } + protected RowStyleParser getRowSc() { return converter.getStyleCv().getRowSc(); } - CellStyleParser getCellSc() { return converter.getStyleCv().getCellSc(); } + protected CellStyleParser getCellSc() { return converter.getStyleCv().getCellSc(); } - FrameStyleParser getFrameSc() { return converter.getStyleCv().getFrameSc(); } + protected FrameStyleParser getFrameSc() { return converter.getStyleCv().getFrameSc(); } - PresentationStyleParser getPresentationSc() { return converter.getStyleCv().getPresentationSc(); } + protected PresentationStyleParser getPresentationSc() { return converter.getStyleCv().getPresentationSc(); } - PageStyleParser getPageSc() { return converter.getStyleCv().getPageSc(); } + protected PageStyleParser getPageSc() { return converter.getStyleCv().getPageSc(); } - TextParser getTextCv() { return converter.getTextCv(); } + protected TextParser getTextCv() { return converter.getTextCv(); } - TableParser getTableCv() { return converter.getTableCv(); } + protected TableParser getTableCv() { return converter.getTableCv(); } - DrawParser getDrawCv() { return converter.getDrawCv(); } + protected DrawParser getDrawCv() { return converter.getDrawCv(); } - MathParser getMathCv() { return converter.getMathCv(); } + protected MathParser getMathCv() { return converter.getMathCv(); } /** Apply style information to an XHTML node * * @param info the style to apply * @param hnode the XHTML node */ - void applyStyle(StyleInfo info, Element hnode) { + public void applyStyle(StyleInfo info, Element hnode) { if (info.sClass!=null) { hnode.setAttribute("class",info.sClass); } diff --git a/src/main/java/writer2latex/xhtml/DocumentSeparator.java b/src/main/java/writer2latex/xhtml/Separator.java similarity index 95% rename from src/main/java/writer2latex/xhtml/DocumentSeparator.java rename to src/main/java/writer2latex/xhtml/Separator.java index 1268f0c..5febf3f 100644 --- a/src/main/java/writer2latex/xhtml/DocumentSeparator.java +++ b/src/main/java/writer2latex/xhtml/Separator.java @@ -15,7 +15,7 @@ import static writer2latex.util.Misc.*; //LinkedList stringList = new LinkedList(); -public class DocumentSeparator { +public class Separator { private static final String NONE = "none"; private static final String SECTIONS = "sections"; @@ -37,7 +37,7 @@ public class DocumentSeparator { private Node prevPageNode = null; private List pageContanerStyles = new ArrayList(Arrays.asList("")); - public DocumentSeparator(XhtmlConfig config,Converter converter) { + public Separator(XhtmlConfig config,Converter converter) { this.config = config; this.converter = converter; headingSeparation = config.getHeadingTags(); @@ -47,7 +47,7 @@ public class DocumentSeparator { breakStyle = config.getPageBreakStyle(); } - protected Node processOutlineLevel(Node currentNode, Node hnode, int pageNum) { + public Node processOutlineLevel(Node currentNode, Node hnode, int pageNum) { //Get outline level String sLevel = getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL); @@ -105,7 +105,7 @@ public class DocumentSeparator { return false; } - protected Node processPageBreak(Node currentNode, Node hnode, Integer pageNum){ + public Node processPageBreak(Node currentNode, Node hnode, Integer pageNum){ if (noPageSeparation()){ return hnode; } @@ -123,7 +123,7 @@ public class DocumentSeparator { /** * Opens main document section heading tag */ - protected Node startDocument(Node hnode, String title, int pageNum){ + public Node startDocument(Node hnode, String title, int pageNum){ if (noHeadingSeparation() && noPageSeparation()){ return hnode; } @@ -136,7 +136,7 @@ public class DocumentSeparator { return hnode; } //Method to close open tags at the end of the document - protected Node endDocument(Node hnode){ + public Node endDocument(Node hnode){ if (noHeadingSeparation() && noPageSeparation()){ return hnode; } @@ -294,7 +294,7 @@ public class DocumentSeparator { } } } - protected Node closePage(Node hnode){ + public Node closePage(Node hnode){ if (pageOpened == false) { return hnode; } @@ -313,7 +313,7 @@ public class DocumentSeparator { pageOpened = false; return hnode; } - protected Node openPage(Node hnode, Integer pageNum){ + public Node openPage(Node hnode, Integer pageNum){ if (pageOpened == true) { return hnode; } diff --git a/src/main/java/writer2latex/xhtml/AlphabeticalIndexParser.java b/src/main/java/writer2latex/xhtml/content/AlphabeticalIndexParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/AlphabeticalIndexParser.java rename to src/main/java/writer2latex/xhtml/content/AlphabeticalIndexParser.java index de4941a..45bc416 100644 --- a/src/main/java/writer2latex/xhtml/AlphabeticalIndexParser.java +++ b/src/main/java/writer2latex/xhtml/content/AlphabeticalIndexParser.java @@ -22,7 +22,7 @@ * Version 1.6 (2015-06-19) * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import java.util.ArrayList; import java.util.Collections; @@ -35,6 +35,8 @@ import writer2latex.office.OfficeReader; import writer2latex.office.XMLString; import writer2latex.util.Misc; import writer2latex.util.StringComparator; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; // Helper class (a struct) to contain information about an alphabetical index entry. final class AlphabeticalEntry { diff --git a/src/main/java/writer2latex/xhtml/BibliographyParser.java b/src/main/java/writer2latex/xhtml/content/BibliographyParser.java similarity index 94% rename from src/main/java/writer2latex/xhtml/BibliographyParser.java rename to src/main/java/writer2latex/xhtml/content/BibliographyParser.java index acb0f7d..eacaff2 100644 --- a/src/main/java/writer2latex/xhtml/BibliographyParser.java +++ b/src/main/java/writer2latex/xhtml/content/BibliographyParser.java @@ -22,7 +22,7 @@ * Version 1.6 (2015-06-16) * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -30,6 +30,8 @@ import org.w3c.dom.Node; import writer2latex.office.OfficeReader; import writer2latex.office.XMLString; import writer2latex.util.Misc; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; /** This class handles the export of the bibliography. Most of the work is delegated to the * {@link XhtmlBibliographyGenerator} diff --git a/src/main/java/writer2latex/xhtml/DrawParser.java b/src/main/java/writer2latex/xhtml/content/DrawParser.java similarity index 99% rename from src/main/java/writer2latex/xhtml/DrawParser.java rename to src/main/java/writer2latex/xhtml/content/DrawParser.java index f8ad351..5fc4034 100644 --- a/src/main/java/writer2latex/xhtml/DrawParser.java +++ b/src/main/java/writer2latex/xhtml/content/DrawParser.java @@ -37,7 +37,7 @@ * export notes (part of draw-page) * export list-style-image for image bullets! */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import java.util.HashMap; import java.util.Iterator; @@ -60,6 +60,11 @@ import writer2latex.util.Calc; import writer2latex.util.Misc; import writer2latex.util.CSVList; import writer2latex.util.SimpleXMLParser; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlDocument; import writer2latex.base.BinaryGraphicsDocument; import writer2latex.office.EmbeddedObject; import writer2latex.office.EmbeddedXMLObject; diff --git a/src/main/java/writer2latex/xhtml/EndnoteParser.java b/src/main/java/writer2latex/xhtml/content/EndnoteParser.java similarity index 93% rename from src/main/java/writer2latex/xhtml/EndnoteParser.java rename to src/main/java/writer2latex/xhtml/content/EndnoteParser.java index d3689ab..978c3bd 100644 --- a/src/main/java/writer2latex/xhtml/EndnoteParser.java +++ b/src/main/java/writer2latex/xhtml/content/EndnoteParser.java @@ -22,12 +22,14 @@ * Version 1.6 (2015-06-12) * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import org.w3c.dom.Element; import org.w3c.dom.Node; import writer2latex.office.OfficeReader; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; class EndnoteParser extends NoteParser { diff --git a/src/main/java/writer2latex/xhtml/FootnoteParser.java b/src/main/java/writer2latex/xhtml/content/FootnoteParser.java similarity index 95% rename from src/main/java/writer2latex/xhtml/FootnoteParser.java rename to src/main/java/writer2latex/xhtml/content/FootnoteParser.java index a5685f5..3ff734d 100644 --- a/src/main/java/writer2latex/xhtml/FootnoteParser.java +++ b/src/main/java/writer2latex/xhtml/content/FootnoteParser.java @@ -22,7 +22,7 @@ * Version 1.6 (2015-06-14) * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -30,6 +30,9 @@ import org.w3c.dom.Node; import writer2latex.office.OfficeReader; import writer2latex.office.PropertySet; import writer2latex.office.XMLString; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; class FootnoteParser extends NoteParser { diff --git a/src/main/java/writer2latex/xhtml/IndexParser.java b/src/main/java/writer2latex/xhtml/content/IndexParser.java similarity index 95% rename from src/main/java/writer2latex/xhtml/IndexParser.java rename to src/main/java/writer2latex/xhtml/content/IndexParser.java index 2d11ddd..608c98f 100644 --- a/src/main/java/writer2latex/xhtml/IndexParser.java +++ b/src/main/java/writer2latex/xhtml/content/IndexParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -31,6 +31,10 @@ import org.w3c.dom.Node; import writer2latex.office.OfficeReader; import writer2latex.office.XMLString; import writer2latex.util.Misc; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; /** This is a base class for conversion of indexes (table of contents, bibliography, alphabetical index, * list of tables, list of figures) diff --git a/src/main/java/writer2latex/xhtml/LOFParser.java b/src/main/java/writer2latex/xhtml/content/LOFParser.java similarity index 89% rename from src/main/java/writer2latex/xhtml/LOFParser.java rename to src/main/java/writer2latex/xhtml/content/LOFParser.java index d860a0d..27642b9 100644 --- a/src/main/java/writer2latex/xhtml/LOFParser.java +++ b/src/main/java/writer2latex/xhtml/content/LOFParser.java @@ -22,11 +22,14 @@ * Version 1.6 (2015-06-10) * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import org.w3c.dom.Node; import writer2latex.office.OfficeReader; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.XhtmlConfig; public class LOFParser extends Parser { diff --git a/src/main/java/writer2latex/xhtml/LOTParser.java b/src/main/java/writer2latex/xhtml/content/LOTParser.java similarity index 89% rename from src/main/java/writer2latex/xhtml/LOTParser.java rename to src/main/java/writer2latex/xhtml/content/LOTParser.java index 88b673c..ae3bbcf 100644 --- a/src/main/java/writer2latex/xhtml/LOTParser.java +++ b/src/main/java/writer2latex/xhtml/content/LOTParser.java @@ -22,11 +22,14 @@ * Version 1.6 (2015-06-10) * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import org.w3c.dom.Node; import writer2latex.office.OfficeReader; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.XhtmlConfig; public class LOTParser extends Parser { diff --git a/src/main/java/writer2latex/xhtml/MathParser.java b/src/main/java/writer2latex/xhtml/content/MathParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/MathParser.java rename to src/main/java/writer2latex/xhtml/content/MathParser.java index 5b14a01..e1a644b 100644 --- a/src/main/java/writer2latex/xhtml/MathParser.java +++ b/src/main/java/writer2latex/xhtml/content/MathParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -32,6 +32,10 @@ import org.w3c.dom.NamedNodeMap; import writer2latex.office.*; import writer2latex.util.Misc; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlDocument; import writer2latex.base.BinaryGraphicsDocument; //import writer2latex.latex.StarMathConverter; diff --git a/src/main/java/writer2latex/xhtml/NoteParser.java b/src/main/java/writer2latex/xhtml/content/NoteParser.java similarity index 97% rename from src/main/java/writer2latex/xhtml/NoteParser.java rename to src/main/java/writer2latex/xhtml/content/NoteParser.java index 0fb45ab..1109bd4 100644 --- a/src/main/java/writer2latex/xhtml/NoteParser.java +++ b/src/main/java/writer2latex/xhtml/content/NoteParser.java @@ -22,7 +22,7 @@ * Version 1.6 (2015-06-14) * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import java.util.ArrayList; import java.util.HashMap; @@ -37,6 +37,10 @@ import writer2latex.office.OfficeReader; import writer2latex.office.PropertySet; import writer2latex.office.XMLString; import writer2latex.util.Misc; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; /** This is a base class handles the conversion of footnotes and endnotes */ diff --git a/src/main/java/writer2latex/xhtml/TOCParser.java b/src/main/java/writer2latex/xhtml/content/TOCParser.java similarity index 99% rename from src/main/java/writer2latex/xhtml/TOCParser.java rename to src/main/java/writer2latex/xhtml/content/TOCParser.java index 5de8a9b..6f84d20 100644 --- a/src/main/java/writer2latex/xhtml/TOCParser.java +++ b/src/main/java/writer2latex/xhtml/content/TOCParser.java @@ -22,7 +22,7 @@ * Version 1.6 (2015-07-23) * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import java.util.ArrayList; import java.util.List; @@ -35,6 +35,8 @@ import writer2latex.office.OfficeReader; import writer2latex.office.TocReader; import writer2latex.office.XMLString; import writer2latex.util.Misc; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; import writer2latex.xhtml.l10n.L10n; //Helper class (a struct) to contain information about a toc entry (ie. a heading, other paragraph or toc-mark) diff --git a/src/main/java/writer2latex/xhtml/TableParser.java b/src/main/java/writer2latex/xhtml/content/TableParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/TableParser.java rename to src/main/java/writer2latex/xhtml/content/TableParser.java index 451f218..3b4facb 100644 --- a/src/main/java/writer2latex/xhtml/TableParser.java +++ b/src/main/java/writer2latex/xhtml/content/TableParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import java.util.Vector; @@ -34,6 +34,11 @@ import org.w3c.dom.Element; import writer2latex.util.Calc; import writer2latex.util.Misc; import writer2latex.util.SimpleInputBuffer; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlDocument; import writer2latex.office.XMLString; import writer2latex.office.StyleWithProperties; import writer2latex.office.OfficeReader; @@ -46,7 +51,7 @@ public class TableParser extends Parser { // The collection of all table names // TODO: Navigation should be handled here rather than in Converter.java - protected Vector sheetNames = new Vector(); + public Vector sheetNames = new Vector(); public TableParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter); diff --git a/src/main/java/writer2latex/xhtml/TextParser.java b/src/main/java/writer2latex/xhtml/content/TextParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/TextParser.java rename to src/main/java/writer2latex/xhtml/content/TextParser.java index f99c2d3..e44c541 100644 --- a/src/main/java/writer2latex/xhtml/TextParser.java +++ b/src/main/java/writer2latex/xhtml/content/TextParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import java.util.Hashtable; import java.util.Stack; @@ -32,13 +32,19 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Element; -import writer2latex.util.CSVList; import writer2latex.util.Misc; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Separator; +import writer2latex.xhtml.PageSplitter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMap; +import writer2latex.xhtml.XhtmlStyleMapItem; import writer2latex.office.FontDeclaration; import writer2latex.office.MasterPage; import writer2latex.office.OfficeStyle; import writer2latex.office.PageLayout; -import writer2latex.office.XMLString; import writer2latex.office.ListCounter; import writer2latex.office.ListStyle; import writer2latex.office.StyleWithProperties; @@ -64,7 +70,7 @@ public class TextParser extends Parser { private int nLastSplitLevel = 1; // The outline level at which the last split occurred private int nDontSplitLevel = 0; // if > 0 splitting is forbidden boolean bAfterHeading=false; // last element was a top level heading - protected Stack sections = new Stack(); // stack of nested sections + public Stack sections = new Stack(); // stack of nested sections Element[] currentHeading = new Element[7]; // Last headings (repeated when splitting) private int nCharacterCount = 0; // The number of text characters in the current document @@ -74,7 +80,7 @@ public class TextParser extends Parser { private String sCurrentListLabel = null; private ListStyle currentListStyle = null; private int nCurrentListLevel = 0; - DocumentSeparator docSep = null; + Separator docSep = null; // Mode used to handle floats (depends on source doc type and config) @@ -138,7 +144,7 @@ public class TextParser extends Parser { outlineNumbering = new ListCounter(ofr.getOutlineStyle()); bDisplayHiddenText = config.displayHiddenText(); - docSep = new DocumentSeparator(config, converter); + docSep = new Separator(config, converter); } /** Converts an office node as a complete text document @@ -233,9 +239,9 @@ public class TextParser extends Parser { return; } - protected int getTocIndex() { return tocCv.getFileIndex(); } + public int getTocIndex() { return tocCv.getFileIndex(); } - protected int getAlphabeticalIndex() { return indexCv.getFileIndex(); } + public int getAlphabeticalIndex() { return indexCv.getFileIndex(); } protected void setAsapNode(Element node) { asapNode = node; @@ -257,10 +263,10 @@ public class TextParser extends Parser { //////////////////////////////////////////////////////////////////////// public Node traverseBlockText(Node onode, Node hnode) { - return traverseText(onode,0,null,hnode); + return parseText(onode,0,null,hnode); } - private Node traverseText(Node onode, int nLevel, String styleName, Node hnode) { + private Node parseText(Node onode, int nLevel, String styleName, Node hnode) { if (!onode.hasChildNodes()) { return hnode; } bAfterHeading = false; NodeList nList = onode.getChildNodes(); @@ -1040,7 +1046,7 @@ public class TextParser extends Parser { } } // Still here? - traverse block text as usual! - traverseText(onode,nLevel,styleName,hnode); + parseText(onode,nLevel,styleName,hnode); } /////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/writer2latex/xhtml/XhtmlBibliographyGenerator.java b/src/main/java/writer2latex/xhtml/content/XhtmlBibliographyGenerator.java similarity index 96% rename from src/main/java/writer2latex/xhtml/XhtmlBibliographyGenerator.java rename to src/main/java/writer2latex/xhtml/content/XhtmlBibliographyGenerator.java index 61ac7f8..5ec0aaa 100644 --- a/src/main/java/writer2latex/xhtml/XhtmlBibliographyGenerator.java +++ b/src/main/java/writer2latex/xhtml/content/XhtmlBibliographyGenerator.java @@ -23,12 +23,13 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.content; import org.w3c.dom.Element; import writer2latex.base.BibliographyGenerator; import writer2latex.office.OfficeReader; +import writer2latex.xhtml.Converter; class XhtmlBibliographyGenerator extends BibliographyGenerator { diff --git a/src/main/java/writer2latex/xhtml/CellStyleParser.java b/src/main/java/writer2latex/xhtml/style/CellStyleParser.java similarity index 96% rename from src/main/java/writer2latex/xhtml/CellStyleParser.java rename to src/main/java/writer2latex/xhtml/style/CellStyleParser.java index 888b446..5417630 100644 --- a/src/main/java/writer2latex/xhtml/CellStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/CellStyleParser.java @@ -23,13 +23,16 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import writer2latex.office.OfficeReader; import writer2latex.office.OfficeStyleFamily; import writer2latex.office.StyleWithProperties; import writer2latex.office.XMLString; import writer2latex.util.CSVList; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMap; /** * This class converts OpenDocument cell styles to CSS2 styles. diff --git a/src/main/java/writer2latex/xhtml/FrameStyleParser.java b/src/main/java/writer2latex/xhtml/style/FrameStyleParser.java similarity index 99% rename from src/main/java/writer2latex/xhtml/FrameStyleParser.java rename to src/main/java/writer2latex/xhtml/style/FrameStyleParser.java index 9306f1a..58f1688 100644 --- a/src/main/java/writer2latex/xhtml/FrameStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/FrameStyleParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import java.util.Enumeration; @@ -35,6 +35,8 @@ import writer2latex.util.CSVList; import writer2latex.util.Calc; //import writer2latex.util.Misc; import writer2latex.util.SimpleInputBuffer; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; /** * This class converts OpenDocument graphic (frame) styles to CSS2 styles. diff --git a/src/main/java/writer2latex/xhtml/HeadingStyleParser.java b/src/main/java/writer2latex/xhtml/style/HeadingStyleParser.java similarity index 97% rename from src/main/java/writer2latex/xhtml/HeadingStyleParser.java rename to src/main/java/writer2latex/xhtml/style/HeadingStyleParser.java index 8c40b78..84d212e 100644 --- a/src/main/java/writer2latex/xhtml/HeadingStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/HeadingStyleParser.java @@ -22,7 +22,7 @@ * Version 1.6 (2015-06-10) * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import java.util.ArrayList; import java.util.HashSet; @@ -33,6 +33,10 @@ import writer2latex.office.OfficeReader; import writer2latex.office.OfficeStyleFamily; import writer2latex.office.StyleWithProperties; import writer2latex.util.CSVList; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMapItem; public class HeadingStyleParser extends StyleFamilyParser { diff --git a/src/main/java/writer2latex/xhtml/ListStyleFamilyParser.java b/src/main/java/writer2latex/xhtml/style/ListStyleFamilyParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/ListStyleFamilyParser.java rename to src/main/java/writer2latex/xhtml/style/ListStyleFamilyParser.java index 642b6e8..5da8ae3 100644 --- a/src/main/java/writer2latex/xhtml/ListStyleFamilyParser.java +++ b/src/main/java/writer2latex/xhtml/style/ListStyleFamilyParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import java.util.Enumeration; //import java.util.Hashtable; @@ -35,6 +35,10 @@ import writer2latex.office.OfficeStyleFamily; import writer2latex.office.StyleWithProperties; import writer2latex.office.XMLString; import writer2latex.util.CSVList; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMapItem; /** * This class converts OpenDocument list styles to diff --git a/src/main/java/writer2latex/xhtml/PageStyleParser.java b/src/main/java/writer2latex/xhtml/style/PageStyleParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/PageStyleParser.java rename to src/main/java/writer2latex/xhtml/style/PageStyleParser.java index 6ec039c..ab0a896 100644 --- a/src/main/java/writer2latex/xhtml/PageStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/PageStyleParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import java.util.Enumeration; @@ -35,6 +35,9 @@ import writer2latex.office.StyleWithProperties; import writer2latex.office.XMLString; import writer2latex.util.CSVList; import writer2latex.util.Calc; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; /** * This class converts OpenDocument page styles to CSS2 styles. diff --git a/src/main/java/writer2latex/xhtml/ParStyleParser.java b/src/main/java/writer2latex/xhtml/style/ParStyleParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/ParStyleParser.java rename to src/main/java/writer2latex/xhtml/style/ParStyleParser.java index 765f890..86c5680 100644 --- a/src/main/java/writer2latex/xhtml/ParStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/ParStyleParser.java @@ -23,13 +23,15 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import writer2latex.office.OfficeReader; import writer2latex.office.OfficeStyleFamily; import writer2latex.office.StyleWithProperties; import writer2latex.office.XMLString; import writer2latex.util.CSVList; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; /* TODO: drop caps (contained in a child of the style:properties element) diff --git a/src/main/java/writer2latex/xhtml/PresentationStyleParser.java b/src/main/java/writer2latex/xhtml/style/PresentationStyleParser.java similarity index 97% rename from src/main/java/writer2latex/xhtml/PresentationStyleParser.java rename to src/main/java/writer2latex/xhtml/style/PresentationStyleParser.java index ae055d6..f3d1824 100644 --- a/src/main/java/writer2latex/xhtml/PresentationStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/PresentationStyleParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import java.util.Enumeration; import java.util.Hashtable; @@ -34,6 +34,10 @@ import writer2latex.office.StyleWithProperties; //import writer2latex.office.XMLString; import writer2latex.util.CSVList; import writer2latex.util.ExportNameCollection; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMap; /** * This class converts OpenDocument presentation styles to CSS2 styles. diff --git a/src/main/java/writer2latex/xhtml/RowStyleParser.java b/src/main/java/writer2latex/xhtml/style/RowStyleParser.java similarity index 95% rename from src/main/java/writer2latex/xhtml/RowStyleParser.java rename to src/main/java/writer2latex/xhtml/style/RowStyleParser.java index b059134..a398968 100644 --- a/src/main/java/writer2latex/xhtml/RowStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/RowStyleParser.java @@ -23,13 +23,16 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import writer2latex.office.OfficeReader; import writer2latex.office.OfficeStyleFamily; import writer2latex.office.StyleWithProperties; //import writer2latex.office.XMLString; import writer2latex.util.CSVList; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMap; /** * This class converts OpenDocument row styles to CSS2 styles. diff --git a/src/main/java/writer2latex/xhtml/SectionStyleParser.java b/src/main/java/writer2latex/xhtml/style/SectionStyleParser.java similarity index 95% rename from src/main/java/writer2latex/xhtml/SectionStyleParser.java rename to src/main/java/writer2latex/xhtml/style/SectionStyleParser.java index 61419ae..8728150 100644 --- a/src/main/java/writer2latex/xhtml/SectionStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/SectionStyleParser.java @@ -23,13 +23,16 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import writer2latex.office.OfficeReader; import writer2latex.office.OfficeStyleFamily; import writer2latex.office.StyleWithProperties; //import writer2latex.office.XMLString; import writer2latex.util.CSVList; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMap; /** * This class converts OpenDocument section styles to CSS2 styles. diff --git a/src/main/java/writer2latex/xhtml/StyleFamilyParser.java b/src/main/java/writer2latex/xhtml/style/StyleFamilyParser.java similarity index 93% rename from src/main/java/writer2latex/xhtml/StyleFamilyParser.java rename to src/main/java/writer2latex/xhtml/style/StyleFamilyParser.java index 14f5dc0..4c131ba 100644 --- a/src/main/java/writer2latex/xhtml/StyleFamilyParser.java +++ b/src/main/java/writer2latex/xhtml/style/StyleFamilyParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import writer2latex.office.OfficeReader; import writer2latex.office.OfficeStyleFamily; @@ -31,6 +31,11 @@ import writer2latex.office.StyleWithProperties; import writer2latex.office.XMLString; import writer2latex.util.Calc; import writer2latex.util.ExportNameCollection; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMap; /** *

This is an abstract base class to convert an OpenDocument style family to @@ -70,7 +75,7 @@ public abstract class StyleFamilyParser extends Parser { bConvertToPx = config.xhtmlConvertToPx(); } - protected String scale(String s) { + public String scale(String s) { if (bConvertToPx) { return Calc.length2px(Calc.multiply(sScale,s)); } @@ -79,7 +84,7 @@ public abstract class StyleFamilyParser extends Parser { } } - protected String colScale(String s) { + public String colScale(String s) { return scale(Calc.multiply(sColScale,s)); } diff --git a/src/main/java/writer2latex/xhtml/StyleParser.java b/src/main/java/writer2latex/xhtml/style/StyleParser.java similarity index 86% rename from src/main/java/writer2latex/xhtml/StyleParser.java rename to src/main/java/writer2latex/xhtml/style/StyleParser.java index 00d903f..e1160b9 100644 --- a/src/main/java/writer2latex/xhtml/StyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/StyleParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -31,6 +31,10 @@ import org.w3c.dom.Node; import writer2latex.office.*; import writer2latex.util.*; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.Parser; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; /** This class converts OpenDocument styles to CSS2 styles. * Note that some elements in OpenDocument has attributes that also maps to CSS2 properties. @@ -38,7 +42,7 @@ import writer2latex.util.*; * Also note, that some OpenDocument style properties cannot be mapped to CSS2 without creating an additional inline element. * The class uses one helper class per OpenDocument style family (paragraph, frame etc.) */ -class StyleParser extends Parser { +public class StyleParser extends Parser { // Helpers for text styles private TextStyleParser textSc; @@ -66,7 +70,7 @@ class StyleParser extends Parser { * @param converter the main converter * @param nType the XHTML type */ - StyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public StyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter); // Create the helpers textSc = new TextStyleParser(ofr,config,converter,nType); @@ -84,33 +88,33 @@ class StyleParser extends Parser { // Accessor methods for helpers: We need to override the style helper accessors - TextStyleParser getTextSc() { return textSc; } + public TextStyleParser getTextSc() { return textSc; } - ParStyleParser getParSc() { return parSc; } + public ParStyleParser getParSc() { return parSc; } - HeadingStyleParser getHeadingSc() { return headingSc; } + public HeadingStyleParser getHeadingSc() { return headingSc; } - ListStyleFamilyParser getListSc() { return listSc; } + public ListStyleFamilyParser getListSc() { return listSc; } - SectionStyleParser getSectionSc() { return sectionSc; } + public SectionStyleParser getSectionSc() { return sectionSc; } - TableStyleParser getTableSc() { return tableSc; } + public TableStyleParser getTableSc() { return tableSc; } - RowStyleParser getRowSc() { return rowSc; } + public RowStyleParser getRowSc() { return rowSc; } - CellStyleParser getCellSc() { return cellSc; } + public CellStyleParser getCellSc() { return cellSc; } - FrameStyleParser getFrameSc() { return frameSc; } + public FrameStyleParser getFrameSc() { return frameSc; } - PresentationStyleParser getPresentationSc() { return presentationSc; } + public PresentationStyleParser getPresentationSc() { return presentationSc; } - PageStyleParser getPageSc() { return pageSc; } + public PageStyleParser getPageSc() { return pageSc; } /** Apply the default language of the source document on an XHTML element * * @param node the XHTML element */ - void applyDefaultLanguage(Element node) { + public void applyDefaultLanguage(Element node) { StyleWithProperties style = getDefaultStyle(); if (style!=null) { StyleInfo info = new StyleInfo(); @@ -124,7 +128,7 @@ class StyleParser extends Parser { * @param bIndent true if the CSS code should be indented * @return the CSS code */ - String exportStyles(boolean bIndent) { + public String exportStyles(boolean bIndent) { String sIndent = bIndent ? " " : ""; StringBuilder buf = new StringBuilder(); @@ -154,7 +158,7 @@ class StyleParser extends Parser { * @param htmlDOM the XHTML DOM to which the generated element belongs * @return the style element */ - Node exportStyles(Document htmlDOM) { + public Node exportStyles(Document htmlDOM) { String sStyles = exportStyles(config.prettyPrint()); // Create node diff --git a/src/main/java/writer2latex/xhtml/StyleWithPropertiesParser.java b/src/main/java/writer2latex/xhtml/style/StyleWithPropertiesParser.java similarity index 96% rename from src/main/java/writer2latex/xhtml/StyleWithPropertiesParser.java rename to src/main/java/writer2latex/xhtml/style/StyleWithPropertiesParser.java index a644b39..ee7f289 100644 --- a/src/main/java/writer2latex/xhtml/StyleWithPropertiesParser.java +++ b/src/main/java/writer2latex/xhtml/style/StyleWithPropertiesParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import java.util.Enumeration; //import java.util.Hashtable; @@ -32,7 +32,10 @@ import java.util.Enumeration; import writer2latex.office.OfficeReader; import writer2latex.office.StyleWithProperties; import writer2latex.util.CSVList; -//import writer2latex.util.ExportNameCollection; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMapItem; /** *

This is an abstract class to convert an OpenDocument style family diff --git a/src/main/java/writer2latex/xhtml/TableStyleParser.java b/src/main/java/writer2latex/xhtml/style/TableStyleParser.java similarity index 96% rename from src/main/java/writer2latex/xhtml/TableStyleParser.java rename to src/main/java/writer2latex/xhtml/style/TableStyleParser.java index 720a872..bcada7d 100644 --- a/src/main/java/writer2latex/xhtml/TableStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/TableStyleParser.java @@ -23,13 +23,16 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import writer2latex.office.OfficeReader; import writer2latex.office.OfficeStyleFamily; import writer2latex.office.StyleWithProperties; import writer2latex.office.XMLString; import writer2latex.util.CSVList; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMap; /** * This class converts OpenDocument table styles to CSS2 styles. diff --git a/src/main/java/writer2latex/xhtml/TextStyleParser.java b/src/main/java/writer2latex/xhtml/style/TextStyleParser.java similarity index 99% rename from src/main/java/writer2latex/xhtml/TextStyleParser.java rename to src/main/java/writer2latex/xhtml/style/TextStyleParser.java index 07933b9..7ebd9aa 100644 --- a/src/main/java/writer2latex/xhtml/TextStyleParser.java +++ b/src/main/java/writer2latex/xhtml/style/TextStyleParser.java @@ -23,7 +23,7 @@ * */ -package writer2latex.xhtml; +package writer2latex.xhtml.style; import java.util.Enumeration; import java.util.Hashtable; @@ -36,6 +36,10 @@ import writer2latex.office.XMLString; import writer2latex.util.CSVList; import writer2latex.util.Calc; import writer2latex.util.ExportNameCollection; +import writer2latex.xhtml.Converter; +import writer2latex.xhtml.StyleInfo; +import writer2latex.xhtml.XhtmlConfig; +import writer2latex.xhtml.XhtmlStyleMapItem; /** * This class converts OpenDocument text styles to CSS2 styles.