From 6180585f9a6ea8def630d777ea15d9f6b0d482a1 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Wed, 29 Jan 2020 11:09:59 +0100 Subject: [PATCH] Renamed classes to resolve ambiguity --- ...ConverterBase.java => BasicConverter.java} | 4 +- ...rter.java => AlphabeticalIndexParser.java} | 4 +- ...Converter.java => BibliographyParser.java} | 4 +- ...yleConverter.java => CellStyleParser.java} | 4 +- .../java/writer2latex/xhtml/Converter.java | 34 ++++----- .../{DrawConverter.java => DrawParser.java} | 4 +- ...dnoteConverter.java => EndnoteParser.java} | 4 +- ...noteConverter.java => FootnoteParser.java} | 4 +- ...leConverter.java => FrameStyleParser.java} | 4 +- ...Converter.java => HeadingStyleParser.java} | 4 +- ...xConverterHelper.java => IndexParser.java} | 4 +- .../{LOFConverter.java => LOFParser.java} | 4 +- .../{LOTConverter.java => LOTParser.java} | 4 +- ...verter.java => ListStyleFamilyParser.java} | 4 +- .../{MathConverter.java => MathParser.java} | 4 +- .../{NoteConverter.java => NoteParser.java} | 4 +- ...yleConverter.java => PageStyleParser.java} | 4 +- ...tyleConverter.java => ParStyleParser.java} | 4 +- .../{ConverterHelper.java => Parser.java} | 36 +++++----- ...rter.java => PresentationStyleParser.java} | 4 +- ...tyleConverter.java => RowStyleParser.java} | 4 +- ...Converter.java => SectionStyleParser.java} | 4 +- ...rterHelper.java => StyleFamilyParser.java} | 4 +- .../{StyleConverter.java => StyleParser.java} | 72 +++++++++---------- ...er.java => StyleWithPropertiesParser.java} | 6 +- .../{TOCConverter.java => TOCParser.java} | 4 +- .../{TableConverter.java => TableParser.java} | 6 +- ...leConverter.java => TableStyleParser.java} | 4 +- .../{TextConverter.java => TextParser.java} | 57 +++++++-------- ...yleConverter.java => TextStyleParser.java} | 4 +- 30 files changed, 152 insertions(+), 155 deletions(-) rename src/main/java/writer2latex/base/{ConverterBase.java => BasicConverter.java} (98%) rename src/main/java/writer2latex/xhtml/{AlphabeticalIndexConverter.java => AlphabeticalIndexParser.java} (97%) rename src/main/java/writer2latex/xhtml/{BibliographyConverter.java => BibliographyParser.java} (93%) rename src/main/java/writer2latex/xhtml/{CellStyleConverter.java => CellStyleParser.java} (95%) rename src/main/java/writer2latex/xhtml/{DrawConverter.java => DrawParser.java} (99%) rename src/main/java/writer2latex/xhtml/{EndnoteConverter.java => EndnoteParser.java} (92%) rename src/main/java/writer2latex/xhtml/{FootnoteConverter.java => FootnoteParser.java} (95%) rename src/main/java/writer2latex/xhtml/{FrameStyleConverter.java => FrameStyleParser.java} (98%) rename src/main/java/writer2latex/xhtml/{HeadingStyleConverter.java => HeadingStyleParser.java} (97%) rename src/main/java/writer2latex/xhtml/{IndexConverterHelper.java => IndexParser.java} (96%) rename src/main/java/writer2latex/xhtml/{LOFConverter.java => LOFParser.java} (88%) rename src/main/java/writer2latex/xhtml/{LOTConverter.java => LOTParser.java} (88%) rename src/main/java/writer2latex/xhtml/{ListStyleConverter.java => ListStyleFamilyParser.java} (98%) rename src/main/java/writer2latex/xhtml/{MathConverter.java => MathParser.java} (99%) rename src/main/java/writer2latex/xhtml/{NoteConverter.java => NoteParser.java} (98%) rename src/main/java/writer2latex/xhtml/{PageStyleConverter.java => PageStyleParser.java} (98%) rename src/main/java/writer2latex/xhtml/{ParStyleConverter.java => ParStyleParser.java} (97%) rename src/main/java/writer2latex/xhtml/{ConverterHelper.java => Parser.java} (64%) rename src/main/java/writer2latex/xhtml/{PresentationStyleConverter.java => PresentationStyleParser.java} (97%) rename src/main/java/writer2latex/xhtml/{RowStyleConverter.java => RowStyleParser.java} (94%) rename src/main/java/writer2latex/xhtml/{SectionStyleConverter.java => SectionStyleParser.java} (94%) rename src/main/java/writer2latex/xhtml/{StyleConverterHelper.java => StyleFamilyParser.java} (95%) rename src/main/java/writer2latex/xhtml/{StyleConverter.java => StyleParser.java} (75%) rename src/main/java/writer2latex/xhtml/{StyleWithPropertiesConverterHelper.java => StyleWithPropertiesParser.java} (97%) rename src/main/java/writer2latex/xhtml/{TOCConverter.java => TOCParser.java} (99%) rename src/main/java/writer2latex/xhtml/{TableConverter.java => TableParser.java} (99%) rename src/main/java/writer2latex/xhtml/{TableStyleConverter.java => TableStyleParser.java} (96%) rename src/main/java/writer2latex/xhtml/{TextConverter.java => TextParser.java} (98%) rename src/main/java/writer2latex/xhtml/{TextStyleConverter.java => TextStyleParser.java} (99%) diff --git a/src/main/java/writer2latex/base/ConverterBase.java b/src/main/java/writer2latex/base/BasicConverter.java similarity index 98% rename from src/main/java/writer2latex/base/ConverterBase.java rename to src/main/java/writer2latex/base/BasicConverter.java index c73503f..46aff54 100644 --- a/src/main/java/writer2latex/base/ConverterBase.java +++ b/src/main/java/writer2latex/base/BasicConverter.java @@ -45,7 +45,7 @@ import writer2latex.util.Misc; /**

Abstract base implementation of writer2latex.api.Converter

*/ -public abstract class ConverterBase implements Converter { +public abstract class BasicConverter implements Converter { public enum TexMathsStyle {inline, display, latex}; @@ -63,7 +63,7 @@ public abstract class ConverterBase implements Converter { protected ConverterResultImpl converterResult; // Constructor - public ConverterBase() { + public BasicConverter() { graphicConverter = null; converterResult = new ConverterResultImpl(); } diff --git a/src/main/java/writer2latex/xhtml/AlphabeticalIndexConverter.java b/src/main/java/writer2latex/xhtml/AlphabeticalIndexParser.java similarity index 97% rename from src/main/java/writer2latex/xhtml/AlphabeticalIndexConverter.java rename to src/main/java/writer2latex/xhtml/AlphabeticalIndexParser.java index aed511a..de4941a 100644 --- a/src/main/java/writer2latex/xhtml/AlphabeticalIndexConverter.java +++ b/src/main/java/writer2latex/xhtml/AlphabeticalIndexParser.java @@ -44,13 +44,13 @@ final class AlphabeticalEntry { /** This class processes alphabetical index marks and the associated index table */ -class AlphabeticalIndexConverter extends IndexConverterHelper { +class AlphabeticalIndexParser extends IndexParser { private List index = new ArrayList(); // All words for the index private int nIndexIndex = -1; // Current index used for id's (of form idxN) private int nAlphabeticalIndex = -1; // File containing alphabetical index - AlphabeticalIndexConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + AlphabeticalIndexParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter,XMLString.TEXT_ALPHABETICAL_INDEX_SOURCE,"index"); } diff --git a/src/main/java/writer2latex/xhtml/BibliographyConverter.java b/src/main/java/writer2latex/xhtml/BibliographyParser.java similarity index 93% rename from src/main/java/writer2latex/xhtml/BibliographyConverter.java rename to src/main/java/writer2latex/xhtml/BibliographyParser.java index 2f56ba6..acb0f7d 100644 --- a/src/main/java/writer2latex/xhtml/BibliographyConverter.java +++ b/src/main/java/writer2latex/xhtml/BibliographyParser.java @@ -34,11 +34,11 @@ import writer2latex.util.Misc; /** This class handles the export of the bibliography. Most of the work is delegated to the * {@link XhtmlBibliographyGenerator} */ -class BibliographyConverter extends IndexConverterHelper { +class BibliographyParser extends IndexParser { private XhtmlBibliographyGenerator bibGenerator; - BibliographyConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + BibliographyParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter,XMLString.TEXT_BIBLIOGRAPHY_SOURCE,"bibliography"); bibGenerator = new XhtmlBibliographyGenerator(ofr,converter); } diff --git a/src/main/java/writer2latex/xhtml/CellStyleConverter.java b/src/main/java/writer2latex/xhtml/CellStyleParser.java similarity index 95% rename from src/main/java/writer2latex/xhtml/CellStyleConverter.java rename to src/main/java/writer2latex/xhtml/CellStyleParser.java index eef7a44..888b446 100644 --- a/src/main/java/writer2latex/xhtml/CellStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/CellStyleParser.java @@ -35,7 +35,7 @@ import writer2latex.util.CSVList; * This class converts OpenDocument cell styles to CSS2 styles. * Cells are formatted using box properties and alignment. */ -public class CellStyleConverter extends StyleWithPropertiesConverterHelper { +public class CellStyleParser extends StyleWithPropertiesParser { /** Create a new CellStyleConverter * @param ofr an OfficeReader to read style information from @@ -43,7 +43,7 @@ public class CellStyleConverter extends StyleWithPropertiesConverterHelper { * @param converter the main Converter class * @param nType the type of xhtml to use */ - public CellStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public CellStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); // Style maps for Cells are currently not supported. // (In OOo, cell styles are only supported by Calc) diff --git a/src/main/java/writer2latex/xhtml/Converter.java b/src/main/java/writer2latex/xhtml/Converter.java index d78bc1f..d5dbb74 100644 --- a/src/main/java/writer2latex/xhtml/Converter.java +++ b/src/main/java/writer2latex/xhtml/Converter.java @@ -49,7 +49,7 @@ import writer2latex.api.ContentEntry; import writer2latex.api.ConverterFactory; import writer2latex.api.OutputFile; import writer2latex.base.ContentEntryImpl; -import writer2latex.base.ConverterBase; +import writer2latex.base.BasicConverter; import writer2latex.office.MIMETypes; import writer2latex.office.OfficeReader; import writer2latex.office.StyleWithProperties; @@ -62,7 +62,7 @@ import writer2latex.xhtml.l10n.L10n; *

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

* */ -public class Converter extends ConverterBase { +public class Converter extends BasicConverter { private static final String EPUB_STYLES_FOLDER = "styles/"; private static final String EPUB_STYLESHEET = "styles/styles1.css"; private static final String EPUB_CUSTOM_STYLESHEET = "styles/styles.css"; @@ -78,11 +78,11 @@ public class Converter extends ConverterBase { private L10n l10n; // The helpers - private StyleConverter styleCv; - private TextConverter textCv; - private TableConverter tableCv; - private DrawConverter drawCv; - private MathConverter mathCv; + private StyleParser styleCv; + private TextParser textCv; + private TableParser tableCv; + private DrawParser drawCv; + private MathParser mathCv; // The template private XhtmlDocument template = null; @@ -180,15 +180,15 @@ public class Converter extends ConverterBase { return contentWidth.size()==1; } - protected StyleConverter getStyleCv() { return styleCv; } + protected StyleParser getStyleCv() { return styleCv; } - protected TextConverter getTextCv() { return textCv; } + protected TextParser getTextCv() { return textCv; } - protected TableConverter getTableCv() { return tableCv; } + protected TableParser getTableCv() { return tableCv; } - protected DrawConverter getDrawCv() { return drawCv; } + protected DrawParser getDrawCv() { return drawCv; } - protected MathConverter getMathCv() { return mathCv; } + protected MathParser getMathCv() { return mathCv; } protected int getType() { return nType; } @@ -267,11 +267,11 @@ public class Converter extends ConverterBase { imageConverter.setDefaultVectorFormat(MIMETypes.SVG); } - styleCv = new StyleConverter(ofr,config,this,nType); - textCv = new TextConverter(ofr,config,this); - tableCv = new TableConverter(ofr,config,this); - drawCv = new DrawConverter(ofr,config,this); - mathCv = new MathConverter(ofr,config,this,nType!=XhtmlDocument.XHTML10 && nType!=XhtmlDocument.XHTML11); + styleCv = new StyleParser(ofr,config,this,nType); + textCv = new TextParser(ofr,config,this); + tableCv = new TableParser(ofr,config,this); + drawCv = new DrawParser(ofr,config,this); + mathCv = new MathParser(ofr,config,this,nType!=XhtmlDocument.XHTML10 && nType!=XhtmlDocument.XHTML11); // Set locale to document language StyleWithProperties style = ofr.isSpreadsheet() ? ofr.getDefaultCellStyle() : ofr.getDefaultParStyle(); diff --git a/src/main/java/writer2latex/xhtml/DrawConverter.java b/src/main/java/writer2latex/xhtml/DrawParser.java similarity index 99% rename from src/main/java/writer2latex/xhtml/DrawConverter.java rename to src/main/java/writer2latex/xhtml/DrawParser.java index e6d33ad..f8ad351 100644 --- a/src/main/java/writer2latex/xhtml/DrawConverter.java +++ b/src/main/java/writer2latex/xhtml/DrawParser.java @@ -73,7 +73,7 @@ import writer2latex.office.ControlReader; import writer2latex.office.OfficeReader; //import writer2latex.xhtml.XhtmlStyleMap; -public class DrawConverter extends ConverterHelper { +public class DrawParser extends Parser { /** Identifies objects that should be displayed inline. */ @@ -118,7 +118,7 @@ public class DrawConverter extends ConverterHelper { // This flag determines whether to collect full screen images or insert them immediately private boolean bCollectFullscreenFrames = true; - public DrawConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + public DrawParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter); // We can only handle one form; pick an arbitrary one. // Also we cannot split a form over several files. diff --git a/src/main/java/writer2latex/xhtml/EndnoteConverter.java b/src/main/java/writer2latex/xhtml/EndnoteParser.java similarity index 92% rename from src/main/java/writer2latex/xhtml/EndnoteConverter.java rename to src/main/java/writer2latex/xhtml/EndnoteParser.java index 8509046..d3689ab 100644 --- a/src/main/java/writer2latex/xhtml/EndnoteConverter.java +++ b/src/main/java/writer2latex/xhtml/EndnoteParser.java @@ -29,9 +29,9 @@ import org.w3c.dom.Node; import writer2latex.office.OfficeReader; -class EndnoteConverter extends NoteConverter { +class EndnoteParser extends NoteParser { - EndnoteConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + EndnoteParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter,ofr.getEndnotesConfiguration()); } diff --git a/src/main/java/writer2latex/xhtml/FootnoteConverter.java b/src/main/java/writer2latex/xhtml/FootnoteParser.java similarity index 95% rename from src/main/java/writer2latex/xhtml/FootnoteConverter.java rename to src/main/java/writer2latex/xhtml/FootnoteParser.java index e981e4a..a5685f5 100644 --- a/src/main/java/writer2latex/xhtml/FootnoteConverter.java +++ b/src/main/java/writer2latex/xhtml/FootnoteParser.java @@ -31,12 +31,12 @@ import writer2latex.office.OfficeReader; import writer2latex.office.PropertySet; import writer2latex.office.XMLString; -class FootnoteConverter extends NoteConverter { +class FootnoteParser extends NoteParser { // Footnote position (can be page or document) private boolean bFootnotesAtPage = true; - FootnoteConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + FootnoteParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter,ofr.getFootnotesConfiguration()); PropertySet configuration=ofr.getFootnotesConfiguration(); if (configuration!=null) { diff --git a/src/main/java/writer2latex/xhtml/FrameStyleConverter.java b/src/main/java/writer2latex/xhtml/FrameStyleParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/FrameStyleConverter.java rename to src/main/java/writer2latex/xhtml/FrameStyleParser.java index 3f182a0..9306f1a 100644 --- a/src/main/java/writer2latex/xhtml/FrameStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/FrameStyleParser.java @@ -41,7 +41,7 @@ import writer2latex.util.SimpleInputBuffer; * This includes conversion of frame properties in other styles (paragraph, * cell, section, page and presentation styles). */ -public class FrameStyleConverter extends StyleWithPropertiesConverterHelper { +public class FrameStyleParser extends StyleWithPropertiesParser { /** Create a new FrameStyleConverter * @param ofr an OfficeReader to read style information from @@ -49,7 +49,7 @@ public class FrameStyleConverter extends StyleWithPropertiesConverterHelper { * @param converter the main Converter class * @param nType the type of xhtml to use */ - public FrameStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public FrameStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); this.styleMap = config.getXFrameStyleMap(); this.bConvertStyles = config.xhtmlFrameFormatting()==XhtmlConfig.CONVERT_ALL || config.xhtmlFrameFormatting()==XhtmlConfig.IGNORE_HARD; diff --git a/src/main/java/writer2latex/xhtml/HeadingStyleConverter.java b/src/main/java/writer2latex/xhtml/HeadingStyleParser.java similarity index 97% rename from src/main/java/writer2latex/xhtml/HeadingStyleConverter.java rename to src/main/java/writer2latex/xhtml/HeadingStyleParser.java index a82e8f7..8c40b78 100644 --- a/src/main/java/writer2latex/xhtml/HeadingStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/HeadingStyleParser.java @@ -34,12 +34,12 @@ import writer2latex.office.OfficeStyleFamily; import writer2latex.office.StyleWithProperties; import writer2latex.util.CSVList; -public class HeadingStyleConverter extends StyleConverterHelper { +public class HeadingStyleParser extends StyleFamilyParser { // Sets of additional styles (other than the main heading style for the level) private List> otherLevelStyles; - public HeadingStyleConverter(OfficeReader ofr, XhtmlConfig config, + public HeadingStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr, config, converter, nType); this.styleMap = config.getXHeadingStyleMap(); diff --git a/src/main/java/writer2latex/xhtml/IndexConverterHelper.java b/src/main/java/writer2latex/xhtml/IndexParser.java similarity index 96% rename from src/main/java/writer2latex/xhtml/IndexConverterHelper.java rename to src/main/java/writer2latex/xhtml/IndexParser.java index dd210b8..2d11ddd 100644 --- a/src/main/java/writer2latex/xhtml/IndexConverterHelper.java +++ b/src/main/java/writer2latex/xhtml/IndexParser.java @@ -35,7 +35,7 @@ import writer2latex.util.Misc; /** This is a base class for conversion of indexes (table of contents, bibliography, alphabetical index, * list of tables, list of figures) */ -abstract class IndexConverterHelper extends ConverterHelper { +abstract class IndexParser extends Parser { private String sEpubType; private String sSourceName; @@ -48,7 +48,7 @@ abstract class IndexConverterHelper extends ConverterHelper { * @param sSourceName the name of the source data element in the index * @param sEpubType the EPUB 3 semantic type of the index */ - IndexConverterHelper(OfficeReader ofr, XhtmlConfig config, Converter converter, + IndexParser(OfficeReader ofr, XhtmlConfig config, Converter converter, String sSourceName, String sEpubType) { super(ofr,config,converter); this.sSourceName = sSourceName; diff --git a/src/main/java/writer2latex/xhtml/LOFConverter.java b/src/main/java/writer2latex/xhtml/LOFParser.java similarity index 88% rename from src/main/java/writer2latex/xhtml/LOFConverter.java rename to src/main/java/writer2latex/xhtml/LOFParser.java index 1bf55a5..d860a0d 100644 --- a/src/main/java/writer2latex/xhtml/LOFConverter.java +++ b/src/main/java/writer2latex/xhtml/LOFParser.java @@ -28,9 +28,9 @@ import org.w3c.dom.Node; import writer2latex.office.OfficeReader; -public class LOFConverter extends ConverterHelper { +public class LOFParser extends Parser { - public LOFConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + public LOFParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter); } diff --git a/src/main/java/writer2latex/xhtml/LOTConverter.java b/src/main/java/writer2latex/xhtml/LOTParser.java similarity index 88% rename from src/main/java/writer2latex/xhtml/LOTConverter.java rename to src/main/java/writer2latex/xhtml/LOTParser.java index d443e1e..88b673c 100644 --- a/src/main/java/writer2latex/xhtml/LOTConverter.java +++ b/src/main/java/writer2latex/xhtml/LOTParser.java @@ -28,9 +28,9 @@ import org.w3c.dom.Node; import writer2latex.office.OfficeReader; -public class LOTConverter extends ConverterHelper { +public class LOTParser extends Parser { - public LOTConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + public LOTParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter); } diff --git a/src/main/java/writer2latex/xhtml/ListStyleConverter.java b/src/main/java/writer2latex/xhtml/ListStyleFamilyParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/ListStyleConverter.java rename to src/main/java/writer2latex/xhtml/ListStyleFamilyParser.java index 03921cb..642b6e8 100644 --- a/src/main/java/writer2latex/xhtml/ListStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/ListStyleFamilyParser.java @@ -40,7 +40,7 @@ import writer2latex.util.CSVList; * This class converts OpenDocument list styles to * CSS2 styles (currently, actually CSS1). */ -public class ListStyleConverter extends StyleConverterHelper { +public class ListStyleFamilyParser extends StyleFamilyParser { /** Create a new ListStyleConverter * @param ofr an OfficeReader to read style information from @@ -48,7 +48,7 @@ public class ListStyleConverter extends StyleConverterHelper { * @param converter the main Converter class * @param nType the type of xhtml to use */ - public ListStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public ListStyleFamilyParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); this.styleMap = config.getXListStyleMap(); this.bConvertStyles = config.xhtmlFormatting()==XhtmlConfig.CONVERT_ALL || config.xhtmlFormatting()==XhtmlConfig.IGNORE_HARD; diff --git a/src/main/java/writer2latex/xhtml/MathConverter.java b/src/main/java/writer2latex/xhtml/MathParser.java similarity index 99% rename from src/main/java/writer2latex/xhtml/MathConverter.java rename to src/main/java/writer2latex/xhtml/MathParser.java index 3c7834c..5b14a01 100644 --- a/src/main/java/writer2latex/xhtml/MathConverter.java +++ b/src/main/java/writer2latex/xhtml/MathParser.java @@ -37,7 +37,7 @@ import writer2latex.base.BinaryGraphicsDocument; /** This class converts formulas: Either as MathML, as an image or as plain text (StarMath or LaTeX format) */ -public class MathConverter extends ConverterHelper { +public class MathParser extends Parser { //private StarMathConverter smc = null; @@ -52,7 +52,7 @@ public class MathConverter extends ConverterHelper { * @param converter the converter instance * @param bSupportMathML true if the formula should be exported as MathML */ - public MathConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, + public MathParser(OfficeReader ofr, XhtmlConfig config, Converter converter, boolean bSupportMathML) { super(ofr,config,converter); diff --git a/src/main/java/writer2latex/xhtml/NoteConverter.java b/src/main/java/writer2latex/xhtml/NoteParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/NoteConverter.java rename to src/main/java/writer2latex/xhtml/NoteParser.java index 39bbb05..0fb45ab 100644 --- a/src/main/java/writer2latex/xhtml/NoteConverter.java +++ b/src/main/java/writer2latex/xhtml/NoteParser.java @@ -40,7 +40,7 @@ import writer2latex.util.Misc; /** This is a base class handles the conversion of footnotes and endnotes */ -class NoteConverter extends ConverterHelper { +class NoteParser extends Parser { // The notes configuration private PropertySet noteConfig; @@ -55,7 +55,7 @@ class NoteConverter extends ConverterHelper { * @param converter the converter * @param noteConfig the configuration of the notes */ - NoteConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, PropertySet noteConfig) { + NoteParser(OfficeReader ofr, XhtmlConfig config, Converter converter, PropertySet noteConfig) { super(ofr,config,converter); this.noteConfig = noteConfig; } diff --git a/src/main/java/writer2latex/xhtml/PageStyleConverter.java b/src/main/java/writer2latex/xhtml/PageStyleParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/PageStyleConverter.java rename to src/main/java/writer2latex/xhtml/PageStyleParser.java index 40d76a8..6ec039c 100644 --- a/src/main/java/writer2latex/xhtml/PageStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/PageStyleParser.java @@ -45,7 +45,7 @@ import writer2latex.util.Calc; * In a presentation document we export the full page style. * In a text document we export the writing direction, background color and footnote rule for the first master page only */ -public class PageStyleConverter extends StyleConverterHelper { +public class PageStyleParser extends StyleFamilyParser { private boolean bHasFootnoteRules = false; @@ -55,7 +55,7 @@ public class PageStyleConverter extends StyleConverterHelper { * @param converter the main Converter class * @param nType the type of xhtml to use */ - public PageStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public PageStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); this.bConvertStyles = config.xhtmlFormatting()==XhtmlConfig.CONVERT_ALL || config.xhtmlFormatting()==XhtmlConfig.IGNORE_HARD; } diff --git a/src/main/java/writer2latex/xhtml/ParStyleConverter.java b/src/main/java/writer2latex/xhtml/ParStyleParser.java similarity index 97% rename from src/main/java/writer2latex/xhtml/ParStyleConverter.java rename to src/main/java/writer2latex/xhtml/ParStyleParser.java index 7c4f5a5..765f890 100644 --- a/src/main/java/writer2latex/xhtml/ParStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/ParStyleParser.java @@ -43,7 +43,7 @@ import writer2latex.util.CSVList; * This also includes conversion of paragraph properties in other styles * (heading styles, cell styles). */ -public class ParStyleConverter extends StyleWithPropertiesConverterHelper { +public class ParStyleParser extends StyleWithPropertiesParser { /** Create a new ParStyleConverter * @param ofr an OfficeReader to read style information from @@ -51,7 +51,7 @@ public class ParStyleConverter extends StyleWithPropertiesConverterHelper { * @param converter the main Converter class * @param nType the type of XHTML to use */ - public ParStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public ParStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); this.styleMap = config.getXParStyleMap(); this.bConvertStyles = config.xhtmlFormatting()==XhtmlConfig.CONVERT_ALL || config.xhtmlFormatting()==XhtmlConfig.IGNORE_HARD; diff --git a/src/main/java/writer2latex/xhtml/ConverterHelper.java b/src/main/java/writer2latex/xhtml/Parser.java similarity index 64% rename from src/main/java/writer2latex/xhtml/ConverterHelper.java rename to src/main/java/writer2latex/xhtml/Parser.java index 66c6d29..9e84a38 100644 --- a/src/main/java/writer2latex/xhtml/ConverterHelper.java +++ b/src/main/java/writer2latex/xhtml/Parser.java @@ -31,7 +31,7 @@ import writer2latex.office.OfficeReader; /** A ConverterHelper is responsible for conversion of some specific content into XHTML. */ -class ConverterHelper { +class Parser { // Member variables providing our content (set in constructor) OfficeReader ofr; @@ -44,7 +44,7 @@ class ConverterHelper { * @param config the configuration to use * @param converter the main converter to which the helper belongs */ - ConverterHelper(OfficeReader ofr, XhtmlConfig config, Converter converter) { + Parser(OfficeReader ofr, XhtmlConfig config, Converter converter) { this.ofr = ofr; this.config = config; this.converter = converter; @@ -52,37 +52,37 @@ class ConverterHelper { // Convenience accessor methods to other converter helpers (only needed to save some typing) - StyleConverter getStyleCv() { return converter.getStyleCv(); } + StyleParser getStyleCv() { return converter.getStyleCv(); } - TextStyleConverter getTextSc() { return converter.getStyleCv().getTextSc(); } + TextStyleParser getTextSc() { return converter.getStyleCv().getTextSc(); } - ParStyleConverter getParSc() { return converter.getStyleCv().getParSc(); } + ParStyleParser getParSc() { return converter.getStyleCv().getParSc(); } - HeadingStyleConverter getHeadingSc() { return converter.getStyleCv().getHeadingSc(); } + HeadingStyleParser getHeadingSc() { return converter.getStyleCv().getHeadingSc(); } - ListStyleConverter getListSc() { return converter.getStyleCv().getListSc(); } + ListStyleFamilyParser getListSc() { return converter.getStyleCv().getListSc(); } - SectionStyleConverter getSectionSc() { return converter.getStyleCv().getSectionSc(); } + SectionStyleParser getSectionSc() { return converter.getStyleCv().getSectionSc(); } - TableStyleConverter getTableSc() { return converter.getStyleCv().getTableSc(); } + TableStyleParser getTableSc() { return converter.getStyleCv().getTableSc(); } - RowStyleConverter getRowSc() { return converter.getStyleCv().getRowSc(); } + RowStyleParser getRowSc() { return converter.getStyleCv().getRowSc(); } - CellStyleConverter getCellSc() { return converter.getStyleCv().getCellSc(); } + CellStyleParser getCellSc() { return converter.getStyleCv().getCellSc(); } - FrameStyleConverter getFrameSc() { return converter.getStyleCv().getFrameSc(); } + FrameStyleParser getFrameSc() { return converter.getStyleCv().getFrameSc(); } - PresentationStyleConverter getPresentationSc() { return converter.getStyleCv().getPresentationSc(); } + PresentationStyleParser getPresentationSc() { return converter.getStyleCv().getPresentationSc(); } - PageStyleConverter getPageSc() { return converter.getStyleCv().getPageSc(); } + PageStyleParser getPageSc() { return converter.getStyleCv().getPageSc(); } - TextConverter getTextCv() { return converter.getTextCv(); } + TextParser getTextCv() { return converter.getTextCv(); } - TableConverter getTableCv() { return converter.getTableCv(); } + TableParser getTableCv() { return converter.getTableCv(); } - DrawConverter getDrawCv() { return converter.getDrawCv(); } + DrawParser getDrawCv() { return converter.getDrawCv(); } - MathConverter getMathCv() { return converter.getMathCv(); } + MathParser getMathCv() { return converter.getMathCv(); } /** Apply style information to an XHTML node * diff --git a/src/main/java/writer2latex/xhtml/PresentationStyleConverter.java b/src/main/java/writer2latex/xhtml/PresentationStyleParser.java similarity index 97% rename from src/main/java/writer2latex/xhtml/PresentationStyleConverter.java rename to src/main/java/writer2latex/xhtml/PresentationStyleParser.java index 054466b..ae055d6 100644 --- a/src/main/java/writer2latex/xhtml/PresentationStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/PresentationStyleParser.java @@ -40,7 +40,7 @@ import writer2latex.util.ExportNameCollection; * Presentation styles are special frame styles, used to style the standard * elements in a presentation (title, subtitle and textbox) */ -public class PresentationStyleConverter extends FrameStyleConverter { +public class PresentationStyleParser extends FrameStyleParser { // Data about outline styles String sCurrentOutlineStyle = null; @@ -53,7 +53,7 @@ public class PresentationStyleConverter extends FrameStyleConverter { * @param converter the main Converter class * @param nType the type of xhtml to use */ - public PresentationStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public PresentationStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); // style maps for presentations are currently not supported: this.styleMap = new XhtmlStyleMap(); diff --git a/src/main/java/writer2latex/xhtml/RowStyleConverter.java b/src/main/java/writer2latex/xhtml/RowStyleParser.java similarity index 94% rename from src/main/java/writer2latex/xhtml/RowStyleConverter.java rename to src/main/java/writer2latex/xhtml/RowStyleParser.java index dff8829..b059134 100644 --- a/src/main/java/writer2latex/xhtml/RowStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/RowStyleParser.java @@ -36,7 +36,7 @@ import writer2latex.util.CSVList; * Rows formatting includes background, and also height, * which is considered elsewhere. */ -public class RowStyleConverter extends StyleWithPropertiesConverterHelper { +public class RowStyleParser extends StyleWithPropertiesParser { /** Create a new RowStyleConverter * @param ofr an OfficeReader to read style information from @@ -44,7 +44,7 @@ public class RowStyleConverter extends StyleWithPropertiesConverterHelper { * @param converter the main Converter class * @param nType the type of xhtml to use */ - public RowStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public RowStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); // Style maps for rows are currently not supported. this.styleMap = new XhtmlStyleMap(); diff --git a/src/main/java/writer2latex/xhtml/SectionStyleConverter.java b/src/main/java/writer2latex/xhtml/SectionStyleParser.java similarity index 94% rename from src/main/java/writer2latex/xhtml/SectionStyleConverter.java rename to src/main/java/writer2latex/xhtml/SectionStyleParser.java index 575c31b..61419ae 100644 --- a/src/main/java/writer2latex/xhtml/SectionStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/SectionStyleParser.java @@ -36,7 +36,7 @@ import writer2latex.util.CSVList; * Sections are formatted using (a subset of) box properties and with columns. * The latter would require css3 to be converted (column-count property) */ -public class SectionStyleConverter extends StyleWithPropertiesConverterHelper { +public class SectionStyleParser extends StyleWithPropertiesParser { /** Create a new SectionStyleConverter * @param ofr an OfficeReader to read style information from @@ -44,7 +44,7 @@ public class SectionStyleConverter extends StyleWithPropertiesConverterHelper { * @param converter the main Converter class * @param nType the type of xhtml to use */ - public SectionStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public SectionStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); // Style maps for sections are currently not supported. // (Section styles are not supported by OOo yet) diff --git a/src/main/java/writer2latex/xhtml/StyleConverterHelper.java b/src/main/java/writer2latex/xhtml/StyleFamilyParser.java similarity index 95% rename from src/main/java/writer2latex/xhtml/StyleConverterHelper.java rename to src/main/java/writer2latex/xhtml/StyleFamilyParser.java index 94470c4..14f5dc0 100644 --- a/src/main/java/writer2latex/xhtml/StyleConverterHelper.java +++ b/src/main/java/writer2latex/xhtml/StyleFamilyParser.java @@ -36,7 +36,7 @@ import writer2latex.util.ExportNameCollection; *

This is an abstract base class to convert an OpenDocument style family to * CSS2 styles.

*/ -public abstract class StyleConverterHelper extends ConverterHelper { +public abstract class StyleFamilyParser extends Parser { // Translation of OpenDocument style names to CSS class names protected ExportNameCollection styleNames = new ExportNameCollection(true); @@ -62,7 +62,7 @@ public abstract class StyleConverterHelper extends ConverterHelper { * @param converter the main Converter class * @param nType the type of xhtml to use */ - public StyleConverterHelper(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public StyleFamilyParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter); this.nType = nType; sScale = config.getXhtmlScaling(); diff --git a/src/main/java/writer2latex/xhtml/StyleConverter.java b/src/main/java/writer2latex/xhtml/StyleParser.java similarity index 75% rename from src/main/java/writer2latex/xhtml/StyleConverter.java rename to src/main/java/writer2latex/xhtml/StyleParser.java index 86f43cc..00d903f 100644 --- a/src/main/java/writer2latex/xhtml/StyleConverter.java +++ b/src/main/java/writer2latex/xhtml/StyleParser.java @@ -38,26 +38,26 @@ 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 StyleConverter extends ConverterHelper { +class StyleParser extends Parser { // Helpers for text styles - private TextStyleConverter textSc; - private ParStyleConverter parSc; - private HeadingStyleConverter headingSc; - private ListStyleConverter listSc; - private SectionStyleConverter sectionSc; + private TextStyleParser textSc; + private ParStyleParser parSc; + private HeadingStyleParser headingSc; + private ListStyleFamilyParser listSc; + private SectionStyleParser sectionSc; // Helpers for table styles - private TableStyleConverter tableSc; - private RowStyleConverter rowSc; - private CellStyleConverter cellSc; + private TableStyleParser tableSc; + private RowStyleParser rowSc; + private CellStyleParser cellSc; // Helpers for drawing styles - private FrameStyleConverter frameSc; - private PresentationStyleConverter presentationSc; + private FrameStyleParser frameSc; + private PresentationStyleParser presentationSc; // Helper for page styles - private PageStyleConverter pageSc; + private PageStyleParser pageSc; /** Create a new StyleConverter * @@ -66,45 +66,45 @@ class StyleConverter extends ConverterHelper { * @param converter the main converter * @param nType the XHTML type */ - StyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + StyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter); // Create the helpers - textSc = new TextStyleConverter(ofr,config,converter,nType); - parSc = new ParStyleConverter(ofr,config,converter,nType); - headingSc = new HeadingStyleConverter(ofr,config,converter,nType); - listSc = new ListStyleConverter(ofr,config,converter,nType); - sectionSc = new SectionStyleConverter(ofr,config,converter,nType); - tableSc = new TableStyleConverter(ofr,config,converter,nType); - rowSc = new RowStyleConverter(ofr,config,converter,nType); - cellSc = new CellStyleConverter(ofr,config,converter,nType); - frameSc = new FrameStyleConverter(ofr,config,converter,nType); - presentationSc = new PresentationStyleConverter(ofr,config,converter,nType); - pageSc = new PageStyleConverter(ofr,config,converter,nType); + textSc = new TextStyleParser(ofr,config,converter,nType); + parSc = new ParStyleParser(ofr,config,converter,nType); + headingSc = new HeadingStyleParser(ofr,config,converter,nType); + listSc = new ListStyleFamilyParser(ofr,config,converter,nType); + sectionSc = new SectionStyleParser(ofr,config,converter,nType); + tableSc = new TableStyleParser(ofr,config,converter,nType); + rowSc = new RowStyleParser(ofr,config,converter,nType); + cellSc = new CellStyleParser(ofr,config,converter,nType); + frameSc = new FrameStyleParser(ofr,config,converter,nType); + presentationSc = new PresentationStyleParser(ofr,config,converter,nType); + pageSc = new PageStyleParser(ofr,config,converter,nType); } // Accessor methods for helpers: We need to override the style helper accessors - TextStyleConverter getTextSc() { return textSc; } + TextStyleParser getTextSc() { return textSc; } - ParStyleConverter getParSc() { return parSc; } + ParStyleParser getParSc() { return parSc; } - HeadingStyleConverter getHeadingSc() { return headingSc; } + HeadingStyleParser getHeadingSc() { return headingSc; } - ListStyleConverter getListSc() { return listSc; } + ListStyleFamilyParser getListSc() { return listSc; } - SectionStyleConverter getSectionSc() { return sectionSc; } + SectionStyleParser getSectionSc() { return sectionSc; } - TableStyleConverter getTableSc() { return tableSc; } + TableStyleParser getTableSc() { return tableSc; } - RowStyleConverter getRowSc() { return rowSc; } + RowStyleParser getRowSc() { return rowSc; } - CellStyleConverter getCellSc() { return cellSc; } + CellStyleParser getCellSc() { return cellSc; } - FrameStyleConverter getFrameSc() { return frameSc; } + FrameStyleParser getFrameSc() { return frameSc; } - PresentationStyleConverter getPresentationSc() { return presentationSc; } + PresentationStyleParser getPresentationSc() { return presentationSc; } - PageStyleConverter getPageSc() { return pageSc; } + PageStyleParser getPageSc() { return pageSc; } /** Apply the default language of the source document on an XHTML element * @@ -114,7 +114,7 @@ class StyleConverter extends ConverterHelper { StyleWithProperties style = getDefaultStyle(); if (style!=null) { StyleInfo info = new StyleInfo(); - StyleConverterHelper.applyLang(style,info); + StyleFamilyParser.applyLang(style,info); applyStyle(info,node); } } diff --git a/src/main/java/writer2latex/xhtml/StyleWithPropertiesConverterHelper.java b/src/main/java/writer2latex/xhtml/StyleWithPropertiesParser.java similarity index 97% rename from src/main/java/writer2latex/xhtml/StyleWithPropertiesConverterHelper.java rename to src/main/java/writer2latex/xhtml/StyleWithPropertiesParser.java index cdff33a..a644b39 100644 --- a/src/main/java/writer2latex/xhtml/StyleWithPropertiesConverterHelper.java +++ b/src/main/java/writer2latex/xhtml/StyleWithPropertiesParser.java @@ -38,8 +38,8 @@ import writer2latex.util.CSVList; *

This is an abstract class to convert an OpenDocument style family * represented by StyleWithProperties to CSS2 styles.

*/ -public abstract class StyleWithPropertiesConverterHelper - extends StyleConverterHelper { +public abstract class StyleWithPropertiesParser + extends StyleFamilyParser { /** Create a new StyleWithPropertiesConverterHelper * @param ofr an OfficeReader to read style information from @@ -47,7 +47,7 @@ public abstract class StyleWithPropertiesConverterHelper * @param converter the main Converter class * @param nType the type of xhtml to use */ - public StyleWithPropertiesConverterHelper(OfficeReader ofr, XhtmlConfig config, + public StyleWithPropertiesParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); } diff --git a/src/main/java/writer2latex/xhtml/TOCConverter.java b/src/main/java/writer2latex/xhtml/TOCParser.java similarity index 99% rename from src/main/java/writer2latex/xhtml/TOCConverter.java rename to src/main/java/writer2latex/xhtml/TOCParser.java index 8ba3b39..5de8a9b 100644 --- a/src/main/java/writer2latex/xhtml/TOCConverter.java +++ b/src/main/java/writer2latex/xhtml/TOCParser.java @@ -58,7 +58,7 @@ final class IndexData { /** This class processes table of content index marks and the associated table of content */ -class TOCConverter extends IndexConverterHelper { +class TOCParser extends IndexParser { private static final String TOC_LINK_PREFIX = "toc"; @@ -71,7 +71,7 @@ class TOCConverter extends IndexConverterHelper { private int nExternalTocDepth = 1; // The number of levels to include in the "external" table of contents - TOCConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + TOCParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter,XMLString.TEXT_TABLE_OF_CONTENT_SOURCE,"toc"); nExternalTocDepth = config.externalTocDepth(); if (nExternalTocDepth==0) { // A value of zero means auto (i.e. determine from split level) diff --git a/src/main/java/writer2latex/xhtml/TableConverter.java b/src/main/java/writer2latex/xhtml/TableParser.java similarity index 99% rename from src/main/java/writer2latex/xhtml/TableConverter.java rename to src/main/java/writer2latex/xhtml/TableParser.java index 030d083..451f218 100644 --- a/src/main/java/writer2latex/xhtml/TableConverter.java +++ b/src/main/java/writer2latex/xhtml/TableParser.java @@ -42,13 +42,13 @@ import writer2latex.office.TableRange; import writer2latex.office.TableReader; import writer2latex.office.TableView; -public class TableConverter extends ConverterHelper { +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 TableConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + public TableParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter); } @@ -96,7 +96,7 @@ public class TableConverter extends ConverterHelper { while (shape!=null) { if (OfficeReader.isDrawElement(shape)) { // Actually only the first parameter is used - getDrawCv().handleDrawElement((Element)shape,div,null,DrawConverter.CENTERED); + getDrawCv().handleDrawElement((Element)shape,div,null,DrawParser.CENTERED); } shape = shape.getNextSibling(); } diff --git a/src/main/java/writer2latex/xhtml/TableStyleConverter.java b/src/main/java/writer2latex/xhtml/TableStyleParser.java similarity index 96% rename from src/main/java/writer2latex/xhtml/TableStyleConverter.java rename to src/main/java/writer2latex/xhtml/TableStyleParser.java index 4a499e3..720a872 100644 --- a/src/main/java/writer2latex/xhtml/TableStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/TableStyleParser.java @@ -36,7 +36,7 @@ import writer2latex.util.CSVList; * Table formatting includes background, alignment, * margins, and also width, which is considered elsewhere. */ -public class TableStyleConverter extends StyleWithPropertiesConverterHelper { +public class TableStyleParser extends StyleWithPropertiesParser { /** Create a new TableStyleConverter * @param ofr an OfficeReader to read style information from @@ -44,7 +44,7 @@ public class TableStyleConverter extends StyleWithPropertiesConverterHelper { * @param converter the main Converter class * @param nType the type of xhtml to use */ - public TableStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public TableStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); // Style maps for tables are currently not supported. this.styleMap = new XhtmlStyleMap(); diff --git a/src/main/java/writer2latex/xhtml/TextConverter.java b/src/main/java/writer2latex/xhtml/TextParser.java similarity index 98% rename from src/main/java/writer2latex/xhtml/TextConverter.java rename to src/main/java/writer2latex/xhtml/TextParser.java index 8910589..f99c2d3 100644 --- a/src/main/java/writer2latex/xhtml/TextConverter.java +++ b/src/main/java/writer2latex/xhtml/TextParser.java @@ -48,7 +48,7 @@ import static writer2latex.office.XMLString.*; /** This class handles text content */ -public class TextConverter extends ConverterHelper { +public class TextParser extends Parser { // Data used to handle splitting over several files // TODO: Accessor methods for sections @@ -81,15 +81,15 @@ public class TextConverter extends ConverterHelper { private int nFloatMode; // Converter helpers used to handle all sorts of indexes - private TOCConverter tocCv; - private LOFConverter lofCv; - private LOTConverter lotCv; - private AlphabeticalIndexConverter indexCv; - private BibliographyConverter bibCv; + private TOCParser tocCv; + private LOFParser lofCv; + private LOTParser lotCv; + private AlphabeticalIndexParser indexCv; + private BibliographyParser bibCv; // Converter helpers used to handle footnotes and endnotes - private FootnoteConverter footCv; - private EndnoteConverter endCv; + private FootnoteParser footCv; + private EndnoteParser endCv; // Sometimes we have to create an inlinenode in a block context // (labels for footnotes and endnotes) @@ -120,21 +120,21 @@ public class TextConverter extends ConverterHelper { private String endnotesContext = null; private String footnotesContext = null; - public TextConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { + public TextParser(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter); - tocCv = new TOCConverter(ofr, config, converter); - lofCv = new LOFConverter(ofr, config, converter); - lotCv = new LOTConverter(ofr, config, converter); - bibCv = new BibliographyConverter(ofr, config, converter); - indexCv = new AlphabeticalIndexConverter(ofr, config, converter); - footCv = new FootnoteConverter(ofr, config, converter); - endCv = new EndnoteConverter(ofr, config, converter); + tocCv = new TOCParser(ofr, config, converter); + lofCv = new LOFParser(ofr, config, converter); + lotCv = new LOTParser(ofr, config, converter); + bibCv = new BibliographyParser(ofr, config, converter); + indexCv = new AlphabeticalIndexParser(ofr, config, converter); + footCv = new FootnoteParser(ofr, config, converter); + endCv = new EndnoteParser(ofr, config, converter); nSplitAfter = 1000*config.splitAfter(); nPageBreakSplit = config.pageBreakSplit(); nSplit = config.getXhtmlSplitLevel(); nRepeatLevels = converter.isOPS() ? 0 : config.getXhtmlRepeatLevels(); // never repeat headings in EPUB nFloatMode = ofr.isText() && config.xhtmlFloatObjects() ? - DrawConverter.FLOATING : DrawConverter.ABSOLUTE; + DrawParser.FLOATING : DrawParser.ABSOLUTE; outlineNumbering = new ListCounter(ofr.getOutlineStyle()); bDisplayHiddenText = config.displayHiddenText(); @@ -167,11 +167,8 @@ public class TextConverter extends ConverterHelper { if (!pageSeparator.equals("none")) { onode = (Element) PageSplitter.splitSoftPageBreak(onode,ofr); } - hnode = (Element)traverseBlockText(onode,hnode); - - // Add footnotes and endnotes insertFootnotes(hnode,true); @@ -260,10 +257,10 @@ public class TextConverter extends ConverterHelper { //////////////////////////////////////////////////////////////////////// public Node traverseBlockText(Node onode, Node hnode) { - return traverseBlockText(onode,0,null,hnode); + return traverseText(onode,0,null,hnode); } - private Node traverseBlockText(Node onode, int nLevel, String styleName, Node hnode) { + private Node traverseText(Node onode, int nLevel, String styleName, Node hnode) { if (!onode.hasChildNodes()) { return hnode; } bAfterHeading = false; NodeList nList = onode.getChildNodes(); @@ -732,8 +729,8 @@ public class TextConverter extends ConverterHelper { private void handleParagraph(Node onode, Node hnode) { boolean bIsEmpty = OfficeReader.isWhitespaceContent(onode); if (config.ignoreEmptyParagraphs() && bIsEmpty) { return; } - String sStyleName = Misc.getAttribute(onode,TEXT_STYLE_NAME); - StyleWithProperties style = ofr.getParStyle(sStyleName); + String styleName = Misc.getAttribute(onode,TEXT_STYLE_NAME); + StyleWithProperties style = ofr.getParStyle(styleName); if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(TEXT_DISPLAY))) { return; } Element par; @@ -743,7 +740,7 @@ public class TextConverter extends ConverterHelper { else { // Hack because createParagraph doesn't work the way we need here :-( Element temp = converter.createElement("temp"); - par = createParagraph(temp, sStyleName); + par = createParagraph(temp, styleName); prependAsapNode(par); traverseFloats(onode,hnode,par); hnode.appendChild(temp.getFirstChild()); @@ -753,7 +750,7 @@ public class TextConverter extends ConverterHelper { tocCv.handleParagraph((Element)onode, par, sCurrentListLabel); if (!bIsEmpty) { - par = createTextBackground(par, sStyleName); + par = createTextBackground(par, styleName); if (config.listFormatting()==XhtmlConfig.HARD_LABELS) { insertListLabel(currentListStyle, nCurrentListLevel, "ItemNumber", null, sCurrentListLabel, par); } @@ -773,7 +770,7 @@ public class TextConverter extends ConverterHelper { } else { // Otherwise, add before/after text if required - addBeforeAfter(par,ofr.getParStyle(getParSc().getRealParStyleName(sStyleName)),config.getXParStyleMap()); + addBeforeAfter(par,ofr.getParStyle(getParSc().getRealParStyleName(styleName)),config.getXParStyleMap()); } } @@ -1043,7 +1040,7 @@ public class TextConverter extends ConverterHelper { } } // Still here? - traverse block text as usual! - traverseBlockText(onode,nLevel,styleName,hnode); + traverseText(onode,nLevel,styleName,hnode); } /////////////////////////////////////////////////////////////////////////// @@ -1198,7 +1195,7 @@ public class TextConverter extends ConverterHelper { } else if (DRAW_TEXT_BOX.equals(sTag)) { getDrawCv().handleDrawElement(elm,(Element)hnodeBlock, - (Element)hnodeInline,DrawConverter.INLINE); + (Element)hnodeInline,DrawParser.INLINE); } } } @@ -1243,7 +1240,7 @@ public class TextConverter extends ConverterHelper { if (elm!=null) { String sAnchor = (elm.getAttribute(TEXT_ANCHOR_TYPE)); if ("as-char".equals(sAnchor)) { - getDrawCv().handleDrawElement(elm,null,(Element)hnode,DrawConverter.INLINE); + getDrawCv().handleDrawElement(elm,null,(Element)hnode,DrawParser.INLINE); } } } diff --git a/src/main/java/writer2latex/xhtml/TextStyleConverter.java b/src/main/java/writer2latex/xhtml/TextStyleParser.java similarity index 99% rename from src/main/java/writer2latex/xhtml/TextStyleConverter.java rename to src/main/java/writer2latex/xhtml/TextStyleParser.java index 8764048..07933b9 100644 --- a/src/main/java/writer2latex/xhtml/TextStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/TextStyleParser.java @@ -48,7 +48,7 @@ import writer2latex.util.ExportNameCollection; *
  • TODO: Support text:display and text:condition
  • */ -public class TextStyleConverter extends StyleWithPropertiesConverterHelper { +public class TextStyleParser extends StyleWithPropertiesParser { // OpenDocument does *not* define the style for links without style name, // but OOo uses these styles, and so do we if they are available @@ -80,7 +80,7 @@ public class TextStyleConverter extends StyleWithPropertiesConverterHelper { * @param converter the main Converter class * @param nType the type of XHTML to use */ - public TextStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { + public TextStyleParser(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) { super(ofr,config,converter,nType); this.styleMap = config.getXTextStyleMap(); this.bConvertStyles = config.xhtmlFormatting()==XhtmlConfig.CONVERT_ALL || config.xhtmlFormatting()==XhtmlConfig.IGNORE_HARD;