Class FieldConverter
- java.lang.Object
-
- writer2latex.latex.ConverterHelper
-
- writer2latex.latex.FieldConverter
-
public class FieldConverter extends ConverterHelper
This class handles text fields and links in the document. Packages: lastpage, hyperref, titleref, oooref (all optional) TODO: Need proper treatment of "caption" and "text" for sequence references not to figures and tables (should be fairly rare, though)
-
-
Field Summary
-
Fields inherited from class writer2latex.latex.ConverterHelper
config, ofr, palette
-
-
Constructor Summary
Constructors Constructor Description FieldConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTarget(java.lang.String sName, java.lang.String sSuffix, LaTeXDocumentPortion ldp)Add a\\hypertargetvoidaddTarget(org.w3c.dom.Element node, java.lang.String sSuffix, LaTeXDocumentPortion ldp)Add a\\hypertargetvoidappendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl)Append declarations needed by theFieldConverterto the preamble.voidflushReferenceMarks(LaTeXDocumentPortion ldp, Context oc)Process pending reference marks and bookmarks (which may have been postponed within sections, captions or verbatim text.voidhandleAnchor(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a hyperlink (text:a tag)voidhandleBookmark(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a bookmark (text:bookmark tag)voidhandleBookmarkRef(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a bookmark reference (text:bookmark-ref tag).voidhandlePageCount(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a page count field (text:page-count tag)voidhandlePageNumber(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a page number field (text:page-number tag)voidhandleReferenceMark(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a reference mark (text:reference-mark or text:reference-mark-start tag)voidhandleReferenceMarkEnd(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a reference mark end (text:reference-mark-end tag)voidhandleReferenceRef(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a reference (text:reference-ref tag)voidhandleSequence(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a sequence field (text:sequence tag)voidhandleSequenceDecls(org.w3c.dom.Element node)Process sequence declarationsvoidhandleSequenceLabel(org.w3c.dom.Element node, LaTeXDocumentPortion ldp)Create label for a sequence field (text:sequence tag)voidhandleSequenceRef(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a sequence reference (text:sequence-ref tag)booleanhasPendingReferenceMarks(Context oc)Do we have any pending reference marks or bookmarks, that may be inserted in this context?
-
-
-
Constructor Detail
-
FieldConverter
public FieldConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette)
-
-
Method Detail
-
appendDeclarations
public void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl)
Append declarations needed by the
FieldConverterto the preamble.- Overrides:
appendDeclarationsin classConverterHelper- Parameters:
pack- theLaTeXDocumentPortionto which declarations of packages should be added (\\usepackage).decl- theLaTeXDocumentPortionto which other declarations should be added.
-
handleSequenceDecls
public void handleSequenceDecls(org.w3c.dom.Element node)
Process sequence declarations
- Parameters:
node- the text:sequence-decls node
-
handleSequence
public void handleSequence(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a sequence field (text:sequence tag)
- Parameters:
node- The element containing the sequence fieldldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
handleSequenceLabel
public void handleSequenceLabel(org.w3c.dom.Element node, LaTeXDocumentPortion ldp)Create label for a sequence field (text:sequence tag)
- Parameters:
node- The element containing the sequence fieldldp- theLaTeXDocumentPortionto which LaTeX code should be added
-
handleSequenceRef
public void handleSequenceRef(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a sequence reference (text:sequence-ref tag)
- Parameters:
node- The element containing the sequence referenceldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
handleReferenceMarkEnd
public void handleReferenceMarkEnd(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a reference mark end (text:reference-mark-end tag)
- Parameters:
node- The element containing the reference markldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
handleReferenceMark
public void handleReferenceMark(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a reference mark (text:reference-mark or text:reference-mark-start tag)
- Parameters:
node- The element containing the reference markldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
handleReferenceRef
public void handleReferenceRef(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a reference (text:reference-ref tag)
- Parameters:
node- The element containing the referenceldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
handleBookmark
public void handleBookmark(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a bookmark (text:bookmark tag)
A bookmark may be the target for either a hyperlink or a reference, so this will generate a
\\hyperrefand/or a\\label- Parameters:
node- The element containing the bookmarkldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
handleBookmarkRef
public void handleBookmarkRef(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a bookmark reference (text:bookmark-ref tag).
- Parameters:
node- The element containing the bookmark referenceldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
hasPendingReferenceMarks
public boolean hasPendingReferenceMarks(Context oc)
Do we have any pending reference marks or bookmarks, that may be inserted in this context?- Parameters:
oc- the context to verify against- Returns:
- true if there are pending marks
-
flushReferenceMarks
public void flushReferenceMarks(LaTeXDocumentPortion ldp, Context oc)
Process pending reference marks and bookmarks (which may have been postponed within sections, captions or verbatim text.
- Parameters:
ldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
handleAnchor
public void handleAnchor(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a hyperlink (text:a tag)
- Parameters:
node- The element containing the hyperlinkldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
addTarget
public void addTarget(org.w3c.dom.Element node, java.lang.String sSuffix, LaTeXDocumentPortion ldp)Add a
\\hypertarget- Parameters:
node- The element containing the name of the targetsSuffix- A suffix to be added to the target, e.g. "|table" for a reference to a table.ldp- theLaTeXDocumentPortionto which LaTeX code should be added
-
addTarget
public void addTarget(java.lang.String sName, java.lang.String sSuffix, LaTeXDocumentPortion ldp)Add a
\\hypertarget- Parameters:
sName- The name of the targetsSuffix- A suffix to be added to the target, e.g. "|table" for a reference to a table.ldp- theLaTeXDocumentPortionto which LaTeX code should be added
-
handlePageNumber
public void handlePageNumber(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a page number field (text:page-number tag)
- Parameters:
node- The element containing the page number fieldldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
handlePageCount
public void handlePageCount(org.w3c.dom.Element node, LaTeXDocumentPortion ldp, Context oc)Process a page count field (text:page-count tag)
- Parameters:
node- The element containing the page count fieldldp- theLaTeXDocumentPortionto which LaTeX code should be addedoc- the current context
-
-