writer2latex.xhtml
Class DrawConverter

java.lang.Object
  extended by writer2latex.xhtml.ConverterHelper
      extended by writer2latex.xhtml.DrawConverter

public class DrawConverter
extends ConverterHelper


Field Summary
static int ABSOLUTE
          Identifies objects that should be positioned absolute (using the css attribute postion:absolute)
private  boolean bCollectFrames
           
private  boolean bConvertToPx
           
private  boolean bKeepImageSize
           
static int CENTERED
          Identifies objects that should be placed centered
static int FLOATING
          Identifies objects that should be displayed as floats, either alone or with text wrap (using the css attribute float:left or float:right)
private  FormReader form
           
private  java.util.Vector frames
           
static int INLINE
          Identifies objects that should be displayed inline.
private  java.lang.String sScale
           
 
Fields inherited from class writer2latex.xhtml.ConverterHelper
config, converter, ofr
 
Constructor Summary
DrawConverter(OfficeReader ofr, Config config, Converter converter)
           
 
Method Summary
private  void addLink(org.w3c.dom.Element onode, org.w3c.dom.Element hnode)
           
private  void applyPlacement(org.w3c.dom.Element onode, org.w3c.dom.Element hnodeBlock, org.w3c.dom.Element hnodeInline, int nMode, org.w3c.dom.Element object, StyleInfo info)
           
private  void applyPosition(org.w3c.dom.Element node, CSVList props)
           
private  void applySize(org.w3c.dom.Element node, CSVList props, boolean bOnlyWidth)
           
 void convertDrawContent(org.w3c.dom.Element onode)
           
 org.w3c.dom.Element createForm()
          Create form, if there is a form in this document
private  org.w3c.dom.Element createInput(ControlReader control, java.lang.String sType)
           
private  org.w3c.dom.Element createInputButton(ControlReader control)
           
private  org.w3c.dom.Element createInputCheck(ControlReader control, boolean bRadio)
           
private  org.w3c.dom.Element createInputFile(ControlReader control)
           
private  org.w3c.dom.Element createInputText(ControlReader control, boolean bPassword)
           
private  org.w3c.dom.Element createLabel(ControlReader control)
           
private  org.w3c.dom.Element createSelect(ControlReader control)
           
private  org.w3c.dom.Element createTextarea(ControlReader control)
           
 void flushFrames(org.w3c.dom.Element hnode)
           
 org.w3c.dom.Element getDrawAnchor(org.w3c.dom.Element onode)
           A draw element with a hyperlink is represented as two elements, eg.
private  org.w3c.dom.Element getFrame(org.w3c.dom.Element onode)
           
 org.w3c.dom.Element getRealDrawElement(org.w3c.dom.Element onode)
           A draw element with a hyperlink is represented as two elements, eg.
private  void handleDrawControl(org.w3c.dom.Element onode, org.w3c.dom.Element hnodeBlock, org.w3c.dom.Element hnodeInline, int nMode)
           
 void handleDrawElement(org.w3c.dom.Element onode, org.w3c.dom.Element hnodeBlock, org.w3c.dom.Element hnodeInline, int nMode)
          Convert a draw element to xhtml.
private  void handleDrawGroup(org.w3c.dom.Element onode, org.w3c.dom.Element hnodeBlock, org.w3c.dom.Element hnodeInline, int nMode)
           
private  void handleDrawImage(org.w3c.dom.Element onode, org.w3c.dom.Element hnodeBlock, org.w3c.dom.Element hnodeInline, int nMode)
           
private  void handleDrawObject(org.w3c.dom.Element onode, org.w3c.dom.Element hnodeBlock, org.w3c.dom.Element hnodeInline, int nMode)
           
private  void handleDrawPage(org.w3c.dom.Element onode, org.w3c.dom.Element hnode)
           
private  void handleDrawTextBox(org.w3c.dom.Element onode, org.w3c.dom.Element hnodeBlock, org.w3c.dom.Element hnodeInline, int nMode)
           
private  boolean isCenter(java.lang.String sHPos)
           
private  boolean isFromLeft(java.lang.String sHPos)
           
private  boolean isLeft(java.lang.String sHPos)
           
private  boolean isRight(java.lang.String sHPos)
           
private  boolean mayWrapLeft(java.lang.String sWrap)
           
private  boolean mayWrapRight(java.lang.String sWrap)
           
private  java.lang.String scale(java.lang.String s)
           
private  void setChecked(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setCommonAttributes(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setDisabled(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setFor(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setId(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setMaxLength(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setMultiple(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setName(ControlReader control, org.w3c.dom.Element hnode, boolean bRequired)
           
private  void setReadonly(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setSize(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setTabIndex(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setTitle(ControlReader control, org.w3c.dom.Element hnode)
           
private  void setValue(ControlReader control, org.w3c.dom.Element hnode)
           
 
Methods inherited from class writer2latex.xhtml.ConverterHelper
applyStyle, getCellSc, getDrawCv, getFrameSc, getListSc, getMathCv, getPageSc, getParSc, getPresentationSc, getRowSc, getSectionSc, getStyleCv, getTableCv, getTableSc, getTextCv, getTextSc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INLINE

public static final int INLINE
Identifies objects that should be displayed inline.

See Also:
Constant Field Values

FLOATING

public static final int FLOATING
Identifies objects that should be displayed as floats, either alone or with text wrap (using the css attribute float:left or float:right)

See Also:
Constant Field Values

ABSOLUTE

public static final int ABSOLUTE
Identifies objects that should be positioned absolute (using the css attribute postion:absolute)

See Also:
Constant Field Values

CENTERED

public static final int CENTERED
Identifies objects that should be placed centered

See Also:
Constant Field Values

form

private FormReader form

sScale

private java.lang.String sScale

bConvertToPx

private boolean bConvertToPx

bKeepImageSize

private boolean bKeepImageSize

frames

private java.util.Vector frames

bCollectFrames

private boolean bCollectFrames
Constructor Detail

DrawConverter

public DrawConverter(OfficeReader ofr,
                     Config config,
                     Converter converter)
Method Detail

convertDrawContent

public void convertDrawContent(org.w3c.dom.Element onode)

handleDrawPage

private void handleDrawPage(org.w3c.dom.Element onode,
                            org.w3c.dom.Element hnode)

createForm

public org.w3c.dom.Element createForm()

Create form, if there is a form in this document

Returns:
the form element, or null if there are no forms in the document

getRealDrawElement

public org.w3c.dom.Element getRealDrawElement(org.w3c.dom.Element onode)

A draw element with a hyperlink is represented as two elements, eg. <draw:a><draw:image/></draw:a>. We thus need methods to switch between the two elements.

This method takes a draw-element. If this element is a hyperlink, the child element is returned. Otherwise the argument is returned unchanged.

Parameters:
onode - the draw:a element
Returns:
the corresponding element

getDrawAnchor

public org.w3c.dom.Element getDrawAnchor(org.w3c.dom.Element onode)

A draw element with a hyperlink is represented as two elements, eg. <draw:a><draw:image/></draw:a>. We thus need methods to switch between the two elements.

This method takes a draw-element. If this element is contained in a hyperlink, the hyperlink is returned. Otherwise null is returned.

Parameters:
onode - the draw:a element
Returns:
the hyperlink element, if any

getFrame

private org.w3c.dom.Element getFrame(org.w3c.dom.Element onode)

flushFrames

public void flushFrames(org.w3c.dom.Element hnode)

handleDrawElement

public void handleDrawElement(org.w3c.dom.Element onode,
                              org.w3c.dom.Element hnodeBlock,
                              org.w3c.dom.Element hnodeInline,
                              int nMode)

Convert a draw element to xhtml. The presentation depends on the parameter nMode:

Containers for block and inline elements should be supplied. The containers may be identical (flow container).

Note: A draw:text-box will be ignored in inline mode.

Parameters:
onode - the draw element
hnodeBlock - the xhtml element to attach the converted element to if it's a block element
hnodeInline - the xhtml element to attach the converted element to if it's an inline element
nMode - identifies how the element should be presented

handleDrawObject

private void handleDrawObject(org.w3c.dom.Element onode,
                              org.w3c.dom.Element hnodeBlock,
                              org.w3c.dom.Element hnodeInline,
                              int nMode)

handleDrawImage

private void handleDrawImage(org.w3c.dom.Element onode,
                             org.w3c.dom.Element hnodeBlock,
                             org.w3c.dom.Element hnodeInline,
                             int nMode)

handleDrawTextBox

private void handleDrawTextBox(org.w3c.dom.Element onode,
                               org.w3c.dom.Element hnodeBlock,
                               org.w3c.dom.Element hnodeInline,
                               int nMode)

handleDrawGroup

private void handleDrawGroup(org.w3c.dom.Element onode,
                             org.w3c.dom.Element hnodeBlock,
                             org.w3c.dom.Element hnodeInline,
                             int nMode)

handleDrawControl

private void handleDrawControl(org.w3c.dom.Element onode,
                               org.w3c.dom.Element hnodeBlock,
                               org.w3c.dom.Element hnodeInline,
                               int nMode)

createInput

private org.w3c.dom.Element createInput(ControlReader control,
                                        java.lang.String sType)

createInputFile

private org.w3c.dom.Element createInputFile(ControlReader control)

createInputText

private org.w3c.dom.Element createInputText(ControlReader control,
                                            boolean bPassword)

createInputCheck

private org.w3c.dom.Element createInputCheck(ControlReader control,
                                             boolean bRadio)

createInputButton

private org.w3c.dom.Element createInputButton(ControlReader control)

createLabel

private org.w3c.dom.Element createLabel(ControlReader control)

createTextarea

private org.w3c.dom.Element createTextarea(ControlReader control)

createSelect

private org.w3c.dom.Element createSelect(ControlReader control)

setCommonAttributes

private void setCommonAttributes(ControlReader control,
                                 org.w3c.dom.Element hnode)

setId

private void setId(ControlReader control,
                   org.w3c.dom.Element hnode)

setName

private void setName(ControlReader control,
                     org.w3c.dom.Element hnode,
                     boolean bRequired)

setValue

private void setValue(ControlReader control,
                      org.w3c.dom.Element hnode)

setTitle

private void setTitle(ControlReader control,
                      org.w3c.dom.Element hnode)

setTabIndex

private void setTabIndex(ControlReader control,
                         org.w3c.dom.Element hnode)

setMaxLength

private void setMaxLength(ControlReader control,
                          org.w3c.dom.Element hnode)

setSize

private void setSize(ControlReader control,
                     org.w3c.dom.Element hnode)

setChecked

private void setChecked(ControlReader control,
                        org.w3c.dom.Element hnode)

setMultiple

private void setMultiple(ControlReader control,
                         org.w3c.dom.Element hnode)

setDisabled

private void setDisabled(ControlReader control,
                         org.w3c.dom.Element hnode)

setReadonly

private void setReadonly(ControlReader control,
                         org.w3c.dom.Element hnode)

setFor

private void setFor(ControlReader control,
                    org.w3c.dom.Element hnode)

addLink

private void addLink(org.w3c.dom.Element onode,
                     org.w3c.dom.Element hnode)

applySize

private void applySize(org.w3c.dom.Element node,
                       CSVList props,
                       boolean bOnlyWidth)

applyPosition

private void applyPosition(org.w3c.dom.Element node,
                           CSVList props)

applyPlacement

private void applyPlacement(org.w3c.dom.Element onode,
                            org.w3c.dom.Element hnodeBlock,
                            org.w3c.dom.Element hnodeInline,
                            int nMode,
                            org.w3c.dom.Element object,
                            StyleInfo info)

isLeft

private boolean isLeft(java.lang.String sHPos)

isCenter

private boolean isCenter(java.lang.String sHPos)

isRight

private boolean isRight(java.lang.String sHPos)

isFromLeft

private boolean isFromLeft(java.lang.String sHPos)

mayWrapLeft

private boolean mayWrapLeft(java.lang.String sWrap)

mayWrapRight

private boolean mayWrapRight(java.lang.String sWrap)

scale

private java.lang.String scale(java.lang.String s)