Package writer2latex.base
Class ConverterBase
java.lang.Object
writer2latex.base.ConverterBase
- All Implemented Interfaces:
Converter
- Direct Known Subclasses:
Converter,Converter,ConverterPalette
Abstract base implementation of writer2latex.api.Converter
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConverterResultImplprotected GraphicConverterprotected ImageConverterprotected MetaDataprotected OfficeDocumentprotected OfficeReaderprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocument(OutputFile doc) Convert a documentconvert(InputStream is, String sTargetFileName) Convert a documentConvert a documentabstract voidgetEmbeddedObject(String sHref) getTexMathsEquation(Element node) Get a TexMaths equation from a draw:frame (PNG formula) or draw:g element (SVG) Such an element is a TexMaths equation if it contains an svg:title element with content "TexMaths" The actual formula is the content of an svg:desc elementvoidreadResource(File file, String sFileName, String sMediaType) Read a style sheet to include with the converted document.voidreadResource(InputStream is, String sFileName, String sMediaType) Read a resource to include with the converted document.voidreadStyleSheet(File file) Read a style sheet to include with the converted document.voidRead a style sheet to include with the converted document.voidreadTemplate(File file) Read a template to use as a base for the converted document.voidRead a template to use as a base for the converted document.voidsetGraphicConverter(GraphicConverter graphicConverter) Define aGraphicConverterimplementation to use for conversion of graphic files.
-
Field Details
-
graphicConverter
-
odDoc
-
ofr
-
metaData
-
imageConverter
-
sTargetFileName
-
converterResult
-
-
Constructor Details
-
ConverterBase
public ConverterBase()
-
-
Method Details
-
setGraphicConverter
Description copied from interface:ConverterDefine aGraphicConverterimplementation to use for conversion of graphic files. If no converter is specified, graphic files will not be converted into other formats.- Specified by:
setGraphicConverterin interfaceConverter- Parameters:
graphicConverter- theGraphicConverterto use
-
readTemplate
Description copied from interface:ConverterRead a template to use as a base for the converted document. The format of the template depends on theConverterimplementation.- Specified by:
readTemplatein interfaceConverter- Parameters:
is- anInputStreamfrom which to read the template- Throws:
IOException- if some exception occurs while reading the template
-
readTemplate
Description copied from interface:ConverterRead a template to use as a base for the converted document. The format of the template depends on theConverterimplementation.- Specified by:
readTemplatein interfaceConverter- Parameters:
file- a file from which to read the template- Throws:
IOException- if the file does not exist or some exception occurs while reading the template
-
readStyleSheet
Description copied from interface:ConverterRead a style sheet to include with the converted document. The format of the style sheet depends on theConverterimplementation.- Specified by:
readStyleSheetin interfaceConverter- Parameters:
is- anInputStreamfrom which to read the style sheet- Throws:
IOException- if some exception occurs while reading the style sheet
-
readStyleSheet
Description copied from interface:ConverterRead a style sheet to include with the converted document. The format of the style sheet depends on theConverterimplementation.- Specified by:
readStyleSheetin interfaceConverter- Parameters:
file- a file from which to read the style sheet- Throws:
IOException- if the file does not exist or some exception occurs while reading the style sheet
-
readResource
Description copied from interface:ConverterRead a resource to include with the converted document. A resource can be any (binary) file and will be placed in the same directory as the style sheet- Specified by:
readResourcein interfaceConverter- Parameters:
is- anInputStreamfrom which to read the resourcesFileName- the file name to use for the resourcesMediaType- the media type of the resource, if null the media type will be guessed from the file name- Throws:
IOException- if some exception occurs while reading the resource
-
readResource
Description copied from interface:ConverterRead a style sheet to include with the converted document. A resource can be any (binary) file and will be placed in the same directory as the style sheet- Specified by:
readResourcein interfaceConverter- Parameters:
file- a file from which to read the style sheetsFileName- the file name to use for the resourcesMediaType- the media type of the resource, if null the media type will be guessed from the file name- Throws:
IOException- if the file does not exist or some exception occurs while reading the resource
-
convert
public ConverterResult convert(File source, String sTargetFileName) throws FileNotFoundException, IOException Description copied from interface:ConverterConvert a document- Specified by:
convertin interfaceConverter- Parameters:
source- aFilefrom which to read the source document.sTargetFileName- the file name to use for the converted document (if the converted document is a compound document consisting consisting of several files, this name will be used for the master document)- Returns:
- a
ConverterResultcontaining the converted document - Throws:
FileNotFoundException- if the file does not existIOException- if some exception occurs while reading the document
-
convert
Description copied from interface:ConverterConvert a document- Specified by:
convertin interfaceConverter- Parameters:
is- anInputStreamfrom which to read the source document.sTargetFileName- the file name to use for the converted document (if the converted document is a compound document consisting consisting of several files, this name will be used for the master document)- Returns:
- a
ConverterResultcontaining the converted document - Throws:
IOException- if some exception occurs while reading the document
-
convert
public ConverterResult convert(Document dom, String sTargetFileName, boolean bDestructive) throws IOException Description copied from interface:ConverterConvert a document- Specified by:
convertin interfaceConverter- Parameters:
dom- a DOM tree representing the document as flat XMLsTargetFileName- the file name to use for the converted document (if the converted document is a compound document consisting consisting of several files, this name will be used for the master document)bDestructive- set to true if the converter is allowed to remove contents from the DOM tree (to save memory)- Returns:
- a
ConverterResultcontaining the converted document - Throws:
IOException- if some exception occurs while reading the document
-
convertInner
- Throws:
IOException
-
getMetaData
-
getImageCv
-
addDocument
-
getEmbeddedObject
-
getTexMathsEquation
Get a TexMaths equation from a draw:frame (PNG formula) or draw:g element (SVG) Such an element is a TexMaths equation if it contains an svg:title element with content "TexMaths" The actual formula is the content of an svg:desc element- Parameters:
node- the draw:frame or draw:g element to check- Returns:
- the TexMaths equation, or null if this is not a TexMaths equation
-
getTexMathsStyle
-
getTexMathsEquation
-