public class XHTMLWriter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected class |
XHTMLWriter.LevelStore
Level status keeper for stack
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
_openCharGroup |
protected CharacterProperties |
charProps |
protected java.util.Vector |
colorList |
protected JWordDocument |
document |
static java.lang.String |
EOL |
static int |
EQUATION_AS_EMBEDDED_SVG |
static int |
EQUATION_AS_EXTERNAL_SVG |
static int |
EQUATION_AS_MATH |
static int |
EQUATION_AS_PNG |
protected java.util.Vector |
fontList |
protected java.util.ArrayList<NumberedList> |
numberedLists |
protected java.util.Vector |
pictList |
protected java.util.Vector |
styleList |
static int |
SVG_AS_EMBEDDED_SVG |
static int |
SVG_AS_EXTERNAL_SVG |
static int |
SVG_AS_PNG |
static int |
WMF_AS_EMBEDDED_SVG |
static int |
WMF_AS_EXTERNAL_SVG |
static int |
WMF_AS_PNG |
Constructor and Description |
---|
XHTMLWriter(JWordDocument doc,
XHTMLObjectHandler objectHandler,
int svgOption,
int wmfOption,
int equationOption,
int dpi,
int imageDpi,
boolean useObjectTagForSvg)
Constructs new writer instance.
|
XHTMLWriter(JWordDocument doc,
XHTMLObjectHandler objectHandler,
int svgOption,
int wmfOption,
int equationOption,
int dpi,
int imageDpi,
boolean useObjectTagForSvg,
boolean singleFile,
java.lang.String linkTarget,
int HTMLversion)
Constructs new writer instance.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Double |
convertPixelsToTwips(java.lang.Double value)
Convert pixel measure into the twips.
|
protected java.lang.String |
createStyleTable(java.util.Vector styleList)
Creates text representation of the style table.
|
protected java.lang.String |
getAllCharDescription(CharacterProperties cp,
javax.swing.text.AttributeSet attr,
boolean isStyle)
get character attributes as a string from the given properties.
|
protected java.lang.String |
getBorder(Border brd)
get string representation of the given border
|
protected javax.swing.text.Element |
getDocumentTree()
Gets tree of the document's elements.
|
protected java.util.Vector |
getFontList(javax.swing.text.Element root,
java.util.Vector list)
Gets fonts which are used in subtree.
|
protected java.lang.String |
getListStyle(Numbering num,
int level) |
protected java.lang.String |
getParagraphDescription(javax.swing.text.AttributeSet attr,
boolean isStyle)
Get text representation of the paragraph.
|
protected java.util.Vector |
getStyleList()
gets style list from the document
|
protected boolean |
isInList(java.util.Vector list,
java.lang.Object fontName)
Checks whether object is in list.
|
void |
write(java.io.OutputStream out,
int pos,
int len,
boolean bodyOnly)
Performs writing to a writer.
|
void |
write(java.lang.String fileName)
Performs writing to a file.
|
protected void |
writeBorder(java.io.Writer out,
Border brd)
Write border attributes for a single border
|
protected void |
writeCell(javax.swing.text.Element cell,
int level,
Dimension width)
writes a cell
|
protected void |
writeCellContent(javax.swing.text.Element cell,
int level)
Writes content of the cell.
|
protected void |
writeCellDefinition(javax.swing.text.Element cell,
com.pilot.irun.PrintWriter out,
Dimension width)
write cell definition
|
protected void |
writeColumnDefinition(TableColumn col,
com.pilot.irun.PrintWriter out)
write table column definition
|
protected void |
writeContent(javax.swing.text.Element root,
int level,
int pos,
int len)
writes content of an element starting at pos and len amount
|
protected void |
writeEquation(javax.swing.text.Element leaf)
writes an equation
|
protected void |
writeField(javax.swing.text.Element leaf)
Writes the field element.
|
protected void |
writeFormField(javax.swing.text.Element leaf)
Writes the form field element.
|
protected void |
writeHeader(com.pilot.irun.PrintWriter pw)
print XML header for content
|
protected void |
writeIcon(javax.swing.text.AttributeSet attr,
PaintableIcon icon,
int objId,
boolean equation,
float align)
Writes an image.
|
protected void |
writeIcon(javax.swing.text.Element leaf)
writes an icon element
|
protected void |
writeLeaf(javax.swing.text.Element leaf,
int pos,
int len)
Writes the leaf element.
|
protected void |
writeParagraph(javax.swing.text.Element paragraph,
int level,
boolean lastInTable,
int pos,
int len,
boolean breakBefore)
Writes content of single paragraph.
|
protected void |
writeRow(javax.swing.text.Element row,
int level)
Writes row element.
|
protected void |
writeRowContent(javax.swing.text.Element row,
com.pilot.irun.PrintWriter out,
int level)
writes row content (cells)
|
protected void |
writeRowDefinition(javax.swing.text.Element row,
com.pilot.irun.PrintWriter out)
write row definition
|
protected void |
writeTable(javax.swing.text.Element table,
int level)
Writes table element.
|
protected void |
writeTableDefinition(javax.swing.text.Element table,
com.pilot.irun.PrintWriter out)
writes table definition (attributes) to the output writer.
|
protected JWordDocument document
protected java.util.Vector fontList
protected java.util.Vector colorList
protected java.util.Vector styleList
protected java.util.Vector pictList
protected java.util.ArrayList<NumberedList> numberedLists
public static java.lang.String EOL
protected CharacterProperties charProps
protected boolean _openCharGroup
public static final int SVG_AS_PNG
public static final int SVG_AS_EMBEDDED_SVG
public static final int SVG_AS_EXTERNAL_SVG
public static final int WMF_AS_PNG
public static final int WMF_AS_EMBEDDED_SVG
public static final int WMF_AS_EXTERNAL_SVG
public static final int EQUATION_AS_PNG
public static final int EQUATION_AS_EMBEDDED_SVG
public static final int EQUATION_AS_EXTERNAL_SVG
public static final int EQUATION_AS_MATH
public XHTMLWriter(JWordDocument doc, XHTMLObjectHandler objectHandler, int svgOption, int wmfOption, int equationOption, int dpi, int imageDpi, boolean useObjectTagForSvg)
doc
- document for writing.public XHTMLWriter(JWordDocument doc, XHTMLObjectHandler objectHandler, int svgOption, int wmfOption, int equationOption, int dpi, int imageDpi, boolean useObjectTagForSvg, boolean singleFile, java.lang.String linkTarget, int HTMLversion)
doc
- document for writing.public void write(java.lang.String fileName) throws java.io.IOException
fileName
- Name of filejava.io.IOException
- occurs when writing is failed.protected void writeHeader(com.pilot.irun.PrintWriter pw)
pw
- public void write(java.io.OutputStream out, int pos, int len, boolean bodyOnly) throws java.io.IOException
out
- writerjava.io.IOException
- occurs when writing is failed.protected void writeContent(javax.swing.text.Element root, int level, int pos, int len) throws java.io.IOException
root
- root elementlevel
- depth of element in tables (default 0)pos
- start offsetlen
- lengthjava.io.IOException
protected void writeParagraph(javax.swing.text.Element paragraph, int level, boolean lastInTable, int pos, int len, boolean breakBefore) throws java.io.IOException
paragraph
- level
- content level (default 0). If element in the table level is 1.
if it in the nested table level is 2 etc.lastInTable
- if true that means paragraph is last paragraph in the table
cell.pos
- start offsetlen
- lengthjava.io.IOException
- occurs when writing is failed.protected void writeEquation(javax.swing.text.Element leaf) throws java.io.IOException
leaf
- java.io.IOException
protected void writeLeaf(javax.swing.text.Element leaf, int pos, int len) throws java.io.IOException
leaf
- the leaf element to writepos
- start offsetlen
- lengthjava.io.IOException
- occurs when writing is failed.protected void writeFormField(javax.swing.text.Element leaf) throws java.io.IOException
leaf
- java.io.IOException
- occurs when writing is failed.protected void writeField(javax.swing.text.Element leaf) throws java.io.IOException
leaf
- java.io.IOException
- occurs when writing is failed.protected void writeIcon(javax.swing.text.Element leaf) throws java.io.IOException
leaf
- java.io.IOException
protected void writeIcon(javax.swing.text.AttributeSet attr, PaintableIcon icon, int objId, boolean equation, float align) throws java.io.IOException
attr
- attributesleaf
- leaf element containing imagejava.io.IOException
- occurs when writing is failed.protected void writeTableDefinition(javax.swing.text.Element table, com.pilot.irun.PrintWriter out)
table
- out
- protected void writeRowDefinition(javax.swing.text.Element row, com.pilot.irun.PrintWriter out)
row
- out
- protected void writeColumnDefinition(TableColumn col, com.pilot.irun.PrintWriter out)
col
- out
- protected void writeCellDefinition(javax.swing.text.Element cell, com.pilot.irun.PrintWriter out, Dimension width) throws java.io.IOException
cell
- out
- java.io.IOException
protected void writeTable(javax.swing.text.Element table, int level) throws java.io.IOException
table
- level
- content level (default 0). If element in the table level is 1.
if it in the nested table level is 2 etc.java.io.IOException
- occurs when writing is failed.protected void writeRowContent(javax.swing.text.Element row, com.pilot.irun.PrintWriter out, int level) throws java.io.IOException
row
- out
- level
- java.io.IOException
protected void writeRow(javax.swing.text.Element row, int level) throws java.io.IOException
row
- level
- content level (default 0). If element in the table level is 1.
if it in the nested table level is 2 etc.java.io.IOException
- occurs when writing is failed.protected void writeCellContent(javax.swing.text.Element cell, int level) throws java.io.IOException
cell
- level
- content level (default 0). If element in the table level is 1.
if it in the nested table level is 2 etc.java.io.IOException
- occurs when writing is failed.protected java.lang.String getBorder(Border brd)
brd
- protected void writeBorder(java.io.Writer out, Border brd) throws java.io.IOException
out
- brd
- java.io.IOException
protected void writeCell(javax.swing.text.Element cell, int level, Dimension width) throws java.io.IOException
cell
- level
- width
- java.io.IOException
protected javax.swing.text.Element getDocumentTree()
protected java.util.Vector getFontList(javax.swing.text.Element root, java.util.Vector list)
root
- root of subtree.list
- list of the fontsprotected java.util.Vector getStyleList()
protected boolean isInList(java.util.Vector list, java.lang.Object fontName)
list
- fontName
- protected java.lang.String createStyleTable(java.util.Vector styleList)
styleList
- list of the document's styles.protected java.lang.String getListStyle(Numbering num, int level)
protected java.lang.String getAllCharDescription(CharacterProperties cp, javax.swing.text.AttributeSet attr, boolean isStyle)
cp
- character propertiesattr
- full attribute setisStyle
- is this a style?protected java.lang.String getParagraphDescription(javax.swing.text.AttributeSet attr, boolean isStyle)
attr
- Paragraph attributes.isStyle
- is this a style?protected java.lang.Double convertPixelsToTwips(java.lang.Double value)
value
-