Package writer2latex.base

# Class ConverterBase

java.lang.Object
writer2latex.base.ConverterBase

All Implemented Interfaces:
  `Converter`

Direct Known Subclasses:
  `Converter`, `Converter`, `ConverterPalette`

public abstract class ConverterBase extends Object implements Converter

Abstract base implementation of `writer2latex.api.Converter`

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`ConverterBase.TexMathsStyle`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected ConverterResultImpl`
`converterResult`
`protected GraphicConverter`
`graphicConverter`
`protected ImageConverter`
`imageConverter`
`protected MetaData`
`metaData`
`protected OfficeDocument`
`odDoc`
`protected OfficeReader`
`ofr`
`protected String`
`sTargetFileName`

## Constructor Summary

Constructors
Constructor
Description
`ConverterBase()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addDocument(OutputFile doc)`
`ConverterResult`
`convert(File source, String sTargetFileName)`
Convert a document
`ConverterResult`
`convert(InputStream is, String sTargetFileName)`
Convert a document
`ConverterResult`
`convert(Document dom, String sTargetFileName, boolean bDestructive)`
Convert a document
`abstract void`
`convertInner()`
`EmbeddedObject`
`getEmbeddedObject(String sHref)`
`ImageConverter`
`getImageCv()`
`MetaData`
`getMetaData()`
`String`
`getTexMathsEquation(String s)`
`Element`
`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 element
`ConverterBase.TexMathsStyle`
`getTexMathsStyle(String s)`
`void`
`readResource(File file, String sFileName, String sMediaType)`
Read a style sheet to include with the converted document.
`void`
`readResource(InputStream is, String sFileName, String sMediaType)`
Read a resource to include with the converted document.
`void`
`readStyleSheet(File file)`
Read a style sheet to include with the converted document.
`void`
`readStyleSheet(InputStream is)`
Read a style sheet to include with the converted document.
`void`
`readTemplate(File file)`
Read a template to use as a base for the converted document.
`void`
`readTemplate(InputStream is)`
Read a template to use as a base for the converted document.
`void`
`setGraphicConverter(GraphicConverter graphicConverter)`
Define a `GraphicConverter` implementation to use for conversion of graphic files.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface writer2latex.api.Converter

`getConfig`

## Field Details

### graphicConverter

protected GraphicConverter graphicConverter

### odDoc

protected OfficeDocument odDoc

### ofr

protected OfficeReader ofr

### metaData

protected MetaData metaData

### imageConverter

protected ImageConverter imageConverter

### sTargetFileName

protected String sTargetFileName

### converterResult

protected ConverterResultImpl converterResult

## Constructor Details

### ConverterBase

public ConverterBase()

## Method Details

### setGraphicConverter

public void setGraphicConverter(GraphicConverter graphicConverter)
Description copied from interface: `Converter`
Define a `GraphicConverter` implementation to use for conversion of graphic files. If no converter is specified, graphic files will not be converted into other formats.

Specified by:
  `setGraphicConverter` in interface `Converter`
Parameters:
  `graphicConverter` - the `GraphicConverter` to use

### readTemplate

public void readTemplate(InputStream is) throws IOException
Description copied from interface: `Converter`
Read a template to use as a base for the converted document. The format of the template depends on the `Converter` implementation.

Specified by:
  `readTemplate` in interface `Converter`
Parameters:
  `is` - an `InputStream` from which to read the template
Throws:
  `IOException` - if some exception occurs while reading the template

### readTemplate

public void readTemplate(File file) throws IOException
Description copied from interface: `Converter`
Read a template to use as a base for the converted document. The format of the template depends on the `Converter` implementation.

Specified by:
  `readTemplate` in interface `Converter`
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

public void readStyleSheet(InputStream is) throws IOException
Description copied from interface: `Converter`
Read a style sheet to include with the converted document. The format of the style sheet depends on the `Converter` implementation.

Specified by:
  `readStyleSheet` in interface `Converter`
Parameters:
  `is` - an `InputStream` from which to read the style sheet
Throws:
  `IOException` - if some exception occurs while reading the style sheet

### readStyleSheet

public void readStyleSheet(File file) throws IOException
Description copied from interface: `Converter`
Read a style sheet to include with the converted document. The format of the style sheet depends on the `Converter` implementation.

Specified by:
  `readStyleSheet` in interface `Converter`
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

public void readResource(InputStream is, String sFileName, String sMediaType) throws IOException
Description copied from interface: `Converter`
Read 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:
  `readResource` in interface `Converter`
Parameters:
  `is` - an `InputStream` from which to read the resource
  `sFileName` - the file name to use for the resource
  `sMediaType` - 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

public void readResource(File file, String sFileName, String sMediaType) throws IOException
Description copied from interface: `Converter`
Read 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:
  `readResource` in interface `Converter`
Parameters:
  `file` - a file from which to read the style sheet
  `sFileName` - the file name to use for the resource
  `sMediaType` - 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: `Converter`
Convert a document

Specified by:
  `convert` in interface `Converter`
Parameters:
  `source` - a `File` from 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 `ConverterResult` containing the converted document
Throws:
  `FileNotFoundException` - if the file does not exist
  `IOException` - if some exception occurs while reading the document

### convert

public ConverterResult convert(InputStream is, String sTargetFileName) throws IOException
Description copied from interface: `Converter`
Convert a document

Specified by:
  `convert` in interface `Converter`
Parameters:
  `is` - an `InputStream` from 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 `ConverterResult` containing 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: `Converter`
Convert a document

Specified by:
  `convert` in interface `Converter`
Parameters:
  `dom` - a DOM tree representing the document as flat XML
  `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)
  `bDestructive` - set to true if the converter is allowed to remove contents from the DOM tree (to save memory)
Returns:
  a `ConverterResult` containing the converted document
Throws:
  `IOException` - if some exception occurs while reading the document

### convertInner

public abstract void convertInner() throws IOException

Throws:
  `IOException`

### getMetaData

public MetaData getMetaData()

### getImageCv

public ImageConverter getImageCv()

### addDocument

public void addDocument(OutputFile doc)

### getEmbeddedObject

public EmbeddedObject getEmbeddedObject(String sHref)

### getTexMathsEquation

public Element 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 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

public ConverterBase.TexMathsStyle getTexMathsStyle(String s)

### getTexMathsEquation

public String getTexMathsEquation(String s)