writer2latex.latex
Class ListStyleConverter

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

public class ListStyleConverter
extends StyleConverter


Field Summary
(package private)  boolean bNeedSaveEnumCounter
           
private  java.util.Hashtable listStyleLevelNames
           
 
Fields inherited from class writer2latex.latex.StyleConverter
declarations, styleMap, styleNames
 
Fields inherited from class writer2latex.latex.ConverterHelper
config, ofr, palette
 
Constructor Summary
ListStyleConverter(OfficeReader ofr, Config config, ConverterPalette palette)
          Constructs a new ListStyleConverter.
 
Method Summary
 void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl)
           
 void applyListItemStyle(java.lang.String sStyleName, int nLevel, boolean bHeader, boolean bRestart, int nStartValue, BeforeAfter ba)
          Apply a list style to a list item.
 void applyListStyle(java.lang.String sStyleName, int nLevel, boolean bOrdered, boolean bContinue, BeforeAfter ba)
          Apply a list style to an ordered or unordered list.
private  void createLabels(ListStyle style, java.lang.String[] sName, int nMaxLevel, boolean bDeclareCounters, boolean bRenewLabels, boolean bUseTextStyle, LaTeXDocumentPortion ldp)
          Create LaTeX list labels from an OOo list style.
private  void createListStyle(java.lang.String sStyleName)
          Create "Writer style" lists based on a List Style.
private  void createListStyleLabels(java.lang.String sStyleName)
          Create labels for default lists (enumerate/itemize) based on a List Style
private  java.lang.String getDisplayName(java.lang.String sName)
           
private  java.lang.String getLength(ListStyle style, int nLevel, java.lang.String sProperty)
           
static java.lang.String numFormat(java.lang.String sFormat)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bNeedSaveEnumCounter

boolean bNeedSaveEnumCounter

listStyleLevelNames

private java.util.Hashtable listStyleLevelNames
Constructor Detail

ListStyleConverter

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

Constructs a new ListStyleConverter.

Method Detail

appendDeclarations

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

applyListStyle

public void applyListStyle(java.lang.String sStyleName,
                           int nLevel,
                           boolean bOrdered,
                           boolean bContinue,
                           BeforeAfter ba)

Apply a list style to an ordered or unordered list.


applyListItemStyle

public void applyListItemStyle(java.lang.String sStyleName,
                               int nLevel,
                               boolean bHeader,
                               boolean bRestart,
                               int nStartValue,
                               BeforeAfter ba)

Apply a list style to a list item.


createListStyleLabels

private void createListStyleLabels(java.lang.String sStyleName)

Create labels for default lists (enumerate/itemize) based on a List Style


createListStyle

private void createListStyle(java.lang.String sStyleName)

Create "Writer style" lists based on a List Style.

A list in writer is really a sequence of numbered paragraphs, so this is also how we implement it in LaTeX. The enivronment + redefined \item defines three hooks: \writerlistleftskip, \writerlistparindent, \writerlistlabel which are used by exported paragraph styles to apply numbering.


createLabels

private void createLabels(ListStyle style,
                          java.lang.String[] sName,
                          int nMaxLevel,
                          boolean bDeclareCounters,
                          boolean bRenewLabels,
                          boolean bUseTextStyle,
                          LaTeXDocumentPortion ldp)

Create LaTeX list labels from an OOo list style. Examples:

Bullets:

\newcommand\labelliststylei{\textbullet}
  \newcommand\labelliststyleii{*}
  \newcommand\labelliststyleiii{\textstylebullet{>}}

Numbering:

\newcounter{liststylei}
  \newcounter{liststyleii}[liststylei]
  \newcounter{liststyleiii}[liststyleii]
  \renewcommand\theliststylei{\Roman{liststylei}}
  \renewcommand\theliststyleii{\Roman{liststylei}.\arabic{liststyleii}}
  \renewcommand\theliststyleiii{\alph{liststyleiii}}
  \newcommand\labelliststylei{\textstylelabel{\theliststylei .}}
  \newcommand\labelliststyleii{\textstylelabel{\theliststyleii .}}
  \newcommand\labelliststyleiii{\textstylelabel{\theliststyleiii )}}

Parameters:
style - the OOo list style to use
sName - an array of label basenames to use
nMaxLevel - the highest level in this numbering
bDeclareCounters - true if counters should be declared (they may exist already, eg. "section", "subsection"... or "enumi", "enumii"...
bRenewLabels - true if labels should be defined with \renewcommand
bUseTextStyle - true if labels should be formatted with the associated text style (rather than \newcommand).
ldp - the LaTeXDocumentPortion to add LaTeX code to.

getLength

private java.lang.String getLength(ListStyle style,
                                   int nLevel,
                                   java.lang.String sProperty)

getDisplayName

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

numFormat

public static final java.lang.String numFormat(java.lang.String sFormat)