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 SetConverterHelper
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.*;
//LinkedListThis 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.