writer2latex.latex.i18n

Class ClassicI18n


public class ClassicI18n
extends I18n

This class (and the helpers in the same package) takes care of i18n in Writer2LaTeX. In classic LaTeX, i18n is a mixture of inputencodings, fontencodings and babel languages. The class ClassicI18n thus manages these, and in particular implements a Unicode->LaTeX translation that can handle different inputencodings and fontencodings. The translation is table driven, using symbols.xml (embedded in the jar) Various sections of symbols.xml handles different cases: The class uses the packages inputenc, fontenc, babel, tipa, bbding, ifsym, pifont, eurosym, amsmath, wasysym, amssymb, amsfonts and textcomp in various combinations depending on the configuration.

Field Summary

static int
ASCII
static int
CP1250
static int
CP1251
static int
ISO_8859_7
static int
KOI8_R
static int
LATIN1
static int
LATIN2
static int
UTF8

Fields inherited from class writer2latex.latex.i18n.I18n

bAlwaysUseDefaultLang, bGreekMath, config, languages, sDefaultLanguage, stringReplace

Constructor Summary

ClassicI18n(LaTeXConfig config)
Construct a new I18n for general use
ClassicI18n(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette)
Construct a new ClassicI18n as ConverterHelper

Method Summary

void
appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl)
Add declarations to the preamble to load the required packages
void
applyLanguage(StyleWithProperties style, boolean bDecl, boolean bInherit, BeforeAfter ba)
Apply a language language
String
convert(String s, boolean bMathMode, String sLang)
Convert a string of characters into LaTeX
int
getCharCount()
Get the number of characters defined in the current table (for informational purposes only)
void
popSpecialTable()
Pop a font from the font stack
void
pushSpecialTable(String sName)
Push a font to the font stack
static int
readFontencs(String sFontencs)
static int
readInputenc(String sInputenc)
static String
writeInputenc(int nInputenc)
static String
writeJavaEncoding(int nInputenc)

Methods inherited from class writer2latex.latex.i18n.I18n

appendDeclarations, applyLanguage, convert, popSpecialTable, pushSpecialTable

Field Details

ASCII

public static final int ASCII
Field Value:
0

CP1250

public static final int CP1250
Field Value:
4

CP1251

public static final int CP1251
Field Value:
5

ISO_8859_7

public static final int ISO_8859_7
Field Value:
3

KOI8_R

public static final int KOI8_R
Field Value:
6

LATIN1

public static final int LATIN1
Field Value:
1

LATIN2

public static final int LATIN2
Field Value:
2

UTF8

public static final int UTF8
Field Value:
7

Constructor Details

ClassicI18n

public ClassicI18n(LaTeXConfig config)
Construct a new I18n for general use
Parameters:
config - the configuration which determines the symbols to use

ClassicI18n

public ClassicI18n(OfficeReader ofr,
                   LaTeXConfig config,
                   ConverterPalette palette)
Construct a new ClassicI18n as ConverterHelper
Parameters:
ofr - the OfficeReader to get language information from
config - the configuration which determines the symbols to use
palette - the ConverterPalette (unused)

Method Details

appendDeclarations

public void appendDeclarations(LaTeXDocumentPortion pack,
                               LaTeXDocumentPortion decl)
Add declarations to the preamble to load the required packages
Overrides:
appendDeclarations in interface I18n
Parameters:
pack - usepackage declarations
decl - other declarations

applyLanguage

public void applyLanguage(StyleWithProperties style,
                          boolean bDecl,
                          boolean bInherit,
                          BeforeAfter ba)
Apply a language language
Overrides:
applyLanguage in interface I18n
Parameters:
style - the OOo style to read attributesfrom
bDecl - true if declaration form is required
bInherit - true if inherited properties should be used
ba - the BeforeAfter to add LaTeX code to.

convert

public String convert(String s,
                      boolean bMathMode,
                      String sLang)
Convert a string of characters into LaTeX
Overrides:
convert in interface I18n
Parameters:
s - the source string
bMathMode - true if the string should be rendered in math mode
sLang - the iso language of the string
Returns:
the LaTeX string

getCharCount

public int getCharCount()
Get the number of characters defined in the current table (for informational purposes only)
Returns:
the number of characters

popSpecialTable

public void popSpecialTable()
Pop a font from the font stack
Overrides:
popSpecialTable in interface I18n

pushSpecialTable

public void pushSpecialTable(String sName)
Push a font to the font stack
Overrides:
pushSpecialTable in interface I18n
Parameters:
sName - the name of the font

readFontencs

public static final int readFontencs(String sFontencs)

readInputenc

public static final int readInputenc(String sInputenc)

writeInputenc

public static final String writeInputenc(int nInputenc)

writeJavaEncoding

public static final String writeJavaEncoding(int nInputenc)