writer2latex.latex
Class CharStyleConverter

java.lang.Object
  extended by writer2latex.latex.ConverterHelper
      extended by writer2latex.latex.StyleConverter
          extended by writer2latex.latex.CharStyleConverter

public class CharStyleConverter
extends StyleConverter

This class creates LaTeX code from OOo character formatting Character formatting in OOo includes font, font effects/decorations and color. In addition it includes color and language/country information, this is however handled by the classes writer2latex.latex.ColorConverter and writer2latex.latex.style.I18n


Field Summary
private  boolean bIgnoreAll
           
private  boolean bIgnoreFont
           
private  boolean bIgnoreFontsize
           
private  boolean bIgnoreHardFontsize
           
private  boolean bNeedSubscript
           
private  boolean bNeedUlem
           
private  boolean bUseUlem
           
private  java.util.Hashtable fontDecls
           
 
Fields inherited from class writer2latex.latex.StyleConverter
declarations, styleMap, styleNames
 
Fields inherited from class writer2latex.latex.ConverterHelper
config, ofr, palette
 
Constructor Summary
CharStyleConverter(OfficeReader ofr, Config config, ConverterPalette palette)
          Constructs a new CharStyleConverter.
 
Method Summary
 void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl)
           
private  void applyChangeCase(StyleWithProperties style, boolean bInherit, BeforeAfter ba)
          Apply change case.
private  void applyCrossout(StyleWithProperties style, boolean bInherit, BeforeAfter ba)
          Apply text crossout.
 void applyDefaultFont(StyleWithProperties style, LaTeXDocumentPortion ldp)
          Apply default font attributes (family, series, shape, size and color).
 void applyFont(StyleWithProperties style, boolean bDecl, boolean bInherit, BeforeAfter ba, Context context)
          Apply all font attributes (family, series, shape, size and color).
 void applyFontEffects(StyleWithProperties style, boolean bInherit, BeforeAfter ba)
          Apply font effects (position, underline, crossout, change case.
 void applyHardCharFormatting(StyleWithProperties style, BeforeAfter ba)
          Apply hard character formatting (no inheritance).
private  void applyNfssFamily(StyleWithProperties style, boolean bDecl, boolean bInherit, BeforeAfter ba, Context context)
          Apply font family.
private  void applyNfssSeries(StyleWithProperties style, boolean bDecl, boolean bInherit, BeforeAfter ba, Context context)
          Apply font series.
private  void applyNfssShape(StyleWithProperties style, boolean bDecl, boolean bInherit, BeforeAfter ba, Context context)
          Apply font shape.
private  void applyNfssSize(StyleWithProperties style, boolean bDecl, boolean bInherit, BeforeAfter ba, Context context)
          Apply font size.
 void applyNormalFont(BeforeAfter ba)
          Reset to normal font, size and color.
private  void applyTextPosition(StyleWithProperties style, boolean bInherit, BeforeAfter ba)
          Apply text position.
 void applyTextStyle(java.lang.String sName, BeforeAfter ba, Context context)
          Use a text style in LaTeX.
private  void applyUnderline(StyleWithProperties style, boolean bInherit, BeforeAfter ba)
          Apply text underline.
private static java.lang.String changeCase(java.lang.String sTextTransform)
           
private  java.lang.String convertFontDeclaration(java.lang.String sName)
          Convert font declarations to LaTeX.
private static java.lang.String crossout(java.lang.String sCrossout)
           
 java.lang.String getFontName(java.lang.String sStyleName)
           
 java.lang.String getFontName(StyleWithProperties style)
           
private static java.lang.String nfssFamily(java.lang.String sFontFamily, java.lang.String sFontFamilyGeneric, java.lang.String sFontPitch)
           
private static java.lang.String nfssSeries(java.lang.String sFontWeight)
           
private static java.lang.String nfssShape(java.lang.String sFontVariant, java.lang.String sFontStyle)
           
private static java.lang.String nfssSize(java.lang.String sFontSize)
           
private  java.lang.String textPosition(java.lang.String sTextPosition)
           
private static java.lang.String underline(java.lang.String sUnderline)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fontDecls

private java.util.Hashtable fontDecls

bIgnoreHardFontsize

private boolean bIgnoreHardFontsize

bIgnoreFontsize

private boolean bIgnoreFontsize

bIgnoreFont

private boolean bIgnoreFont

bIgnoreAll

private boolean bIgnoreAll

bUseUlem

private boolean bUseUlem

bNeedUlem

private boolean bNeedUlem

bNeedSubscript

private boolean bNeedSubscript
Constructor Detail

CharStyleConverter

public CharStyleConverter(OfficeReader ofr,
                          Config config,
                          ConverterPalette palette)

Constructs a new CharStyleConverter.

Method Detail

appendDeclarations

public void appendDeclarations(LaTeXDocumentPortion pack,
                               LaTeXDocumentPortion decl)
Overrides:
appendDeclarations in class StyleConverter

applyTextStyle

public void applyTextStyle(java.lang.String sName,
                           BeforeAfter ba,
                           Context context)

Use a text style in LaTeX.

Parameters:
sName - the name of the text style
ba - a BeforeAfter to put code into

getFontName

public java.lang.String getFontName(StyleWithProperties style)

getFontName

public java.lang.String getFontName(java.lang.String sStyleName)

applyHardCharFormatting

public void applyHardCharFormatting(StyleWithProperties style,
                                    BeforeAfter ba)

Apply hard character formatting (no inheritance).

This is used in sections and {foot|end}notes

Parameters:
style - the style to use
ba - the BeforeAfter to add LaTeX code to

applyFont

public void applyFont(StyleWithProperties style,
                      boolean bDecl,
                      boolean bInherit,
                      BeforeAfter ba,
                      Context context)

Apply all font attributes (family, series, shape, size and color).

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.

applyNormalFont

public void applyNormalFont(BeforeAfter ba)

Reset to normal font, size and color.

Parameters:
ba - the BeforeAfter to add LaTeX code to.

applyDefaultFont

public void applyDefaultFont(StyleWithProperties style,
                             LaTeXDocumentPortion ldp)

Apply default font attributes (family, series, shape, size and color).

Parameters:
style - the OOo style to read attributesfrom
ldp - the LaTeXDocumentPortion to add LaTeX code to.

applyFontEffects

public void applyFontEffects(StyleWithProperties style,
                             boolean bInherit,
                             BeforeAfter ba)

Apply font effects (position, underline, crossout, change case.

Parameters:
style - the OOo style to read attributesfrom
bInherit - true if inherited properties should be used
ba - the BeforeAfter to add LaTeX code to.

applyNfssFamily

private void applyNfssFamily(StyleWithProperties style,
                             boolean bDecl,
                             boolean bInherit,
                             BeforeAfter ba,
                             Context context)

Apply font family.

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.

applyNfssSeries

private void applyNfssSeries(StyleWithProperties style,
                             boolean bDecl,
                             boolean bInherit,
                             BeforeAfter ba,
                             Context context)

Apply font series.

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.

applyNfssShape

private void applyNfssShape(StyleWithProperties style,
                            boolean bDecl,
                            boolean bInherit,
                            BeforeAfter ba,
                            Context context)

Apply font shape.

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.

applyNfssSize

private void applyNfssSize(StyleWithProperties style,
                           boolean bDecl,
                           boolean bInherit,
                           BeforeAfter ba,
                           Context context)

Apply font size.

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.

applyTextPosition

private void applyTextPosition(StyleWithProperties style,
                               boolean bInherit,
                               BeforeAfter ba)

Apply text position.

Parameters:
style - the OOo style to read attributesfrom
bInherit - true if inherited properties should be used
ba - the BeforeAfter to add LaTeX code to.

applyUnderline

private void applyUnderline(StyleWithProperties style,
                            boolean bInherit,
                            BeforeAfter ba)

Apply text underline.

Parameters:
style - the OOo style to read attributesfrom
bInherit - true if inherited properties should be used
ba - the BeforeAfter to add LaTeX code to.

applyCrossout

private void applyCrossout(StyleWithProperties style,
                           boolean bInherit,
                           BeforeAfter ba)

Apply text crossout.

Parameters:
style - the OOo style to read attributesfrom
bInherit - true if inherited properties should be used
ba - the BeforeAfter to add LaTeX code to.

applyChangeCase

private void applyChangeCase(StyleWithProperties style,
                             boolean bInherit,
                             BeforeAfter ba)

Apply change case.

Parameters:
style - the OOo style to read attributesfrom
bInherit - true if inherited properties should be used
ba - the BeforeAfter to add LaTeX code to.

convertFontDeclaration

private java.lang.String convertFontDeclaration(java.lang.String sName)

Convert font declarations to LaTeX.

It returns a generic LaTeX font family (rm, tt, sf).

It returns null if the font declaration doesn't exist.

Parameters:
sName - the name of the font declaration
Returns:
String with a LaTeX generic fontfamily

nfssFamily

private static final java.lang.String nfssFamily(java.lang.String sFontFamily,
                                                 java.lang.String sFontFamilyGeneric,
                                                 java.lang.String sFontPitch)

nfssSeries

private static final java.lang.String nfssSeries(java.lang.String sFontWeight)

nfssShape

private static final java.lang.String nfssShape(java.lang.String sFontVariant,
                                                java.lang.String sFontStyle)

nfssSize

private static final java.lang.String nfssSize(java.lang.String sFontSize)

textPosition

private final java.lang.String textPosition(java.lang.String sTextPosition)

underline

private static final java.lang.String underline(java.lang.String sUnderline)

crossout

private static final java.lang.String crossout(java.lang.String sCrossout)

changeCase

private static final java.lang.String changeCase(java.lang.String sTextTransform)