OpenOffice.org
XMerge API

org.openoffice.xmerge.converter.xml
Class ParaStyle

java.lang.Object
  |
  +--org.openoffice.xmerge.converter.xml.Style
        |
        +--org.openoffice.xmerge.converter.xml.ParaStyle
All Implemented Interfaces:
java.lang.Cloneable

public class ParaStyle
extends Style
implements java.lang.Cloneable

This class represents a paragraph Style.

Attribute Value
MARGIN_LEFT mm * 100
MARGIN_RIGHT mm * 100
MARGIN_TOP mm * 100 (space on top of paragraph)
MARGIN_BOTTOM mm * 100
TEXT_INDENT mm * 100 (first line indent)
LINE_HEIGHT mm * 100, unless or'ed with LH_PCT, in which case it is a percentage (e.g. 200% for double spacing) Can also be or'ed with LH_ATLEAST. Value is stored in bits indicated by LH_VALUEMASK.
TEXT_ALIGN ALIGN_RIGHT, ALIGN_CENTER, ALIGN_JUST, ALIGN_LEFT


Field Summary
protected  java.lang.Class[] algor
          Array of attribute structures for this paragraph Style.
static int ALIGN_CENTER
          Align center.
static int ALIGN_JUST
          Align justified.
static int ALIGN_LEFT
          Align left.
static int ALIGN_RIGHT
          Align right.
protected  java.lang.String[] attrName
          Array of attribute names for this paragraph Style.
protected  boolean[] isSet
          Array of flags indicating which attributes are set for this paragraph Style.
static int LH_ATLEAST
          Line height minimum value.
static int LH_PCT
          Line height percentage.
static int LH_VALUEMASK
          Line height mask.
static int LINE_HEIGHT
          Indent right property.
static int MARGIN_BOTTOM
          The bottom margin property.
static int MARGIN_LEFT
          The left margin property.
static int MARGIN_RIGHT
          The right margin property.
static int MARGIN_TOP
          The top margin property.
protected static int NR_PROPERTIES
          Total number of properties.
static int TEXT_ALIGN
          Align text property.
static int TEXT_INDENT
          Indent left property.
protected  int[] value
          Array of attribute values for this paragraph tyle.
 
Fields inherited from class org.openoffice.xmerge.converter.xml.Style
family, name, parent, sc
 
Constructor Summary
ParaStyle(org.w3c.dom.Node node, StyleCatalog sc)
          Constructor for use when going from DOM to client device format.
ParaStyle(java.lang.String name, java.lang.String familyName, java.lang.String parentName, int[] attribs, java.lang.String[] values, StyleCatalog lookup)
          Alternate constructor for use when going from client device format to DOM.
ParaStyle(java.lang.String name, java.lang.String familyName, java.lang.String parentName, java.lang.String[] attribs, java.lang.String[] values, StyleCatalog sc)
          Constructor for use when going from client device format to DOM.
 
Method Summary
 org.w3c.dom.Node createNode(org.w3c.dom.Document parentDoc, java.lang.String name)
          Create the Node with the specified elements.
 void dumpCSV()
          Dump this Style as a Comma Separated Value (CSV) line.
static void dumpHdr()
          Print a Comma Separated Value (CSV) header line for the spreadsheet dump.
 int getAttribute(int attrIndex)
          Get the value of an integer attribute.
 Style getResolved()
          Return the Style in use.
 boolean isAttributeSet(int attrIndex)
          Check whether an attribute is set in this Style.
 boolean isSubset(Style style)
          Return true if style is a subset of the Style.
 void setAttribute(int attr, java.lang.String value)
          Set an attribute for this paragraph Style.
 void setAttribute(java.lang.String attr, java.lang.String value)
          Set an attribute for this paragraph Style.
 void writeAttributes(org.w3c.dom.Element node)
          Add Style attributes to the given Node.
 
Methods inherited from class org.openoffice.xmerge.converter.xml.Style
getFamily, getName, getParent, setCatalog, setName, writeAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

algor

protected java.lang.Class[] algor
Array of attribute structures for this paragraph Style.

ALIGN_CENTER

public static final int ALIGN_CENTER
Align center.

ALIGN_JUST

public static final int ALIGN_JUST
Align justified.

ALIGN_LEFT

public static final int ALIGN_LEFT
Align left.

ALIGN_RIGHT

public static final int ALIGN_RIGHT
Align right.

attrName

protected java.lang.String[] attrName
Array of attribute names for this paragraph Style.

isSet

protected boolean[] isSet
Array of flags indicating which attributes are set for this paragraph Style.

LH_ATLEAST

public static final int LH_ATLEAST
Line height minimum value.

LH_PCT

public static final int LH_PCT
Line height percentage.

LH_VALUEMASK

public static final int LH_VALUEMASK
Line height mask.

LINE_HEIGHT

public static final int LINE_HEIGHT
Indent right property.

MARGIN_BOTTOM

public static final int MARGIN_BOTTOM
The bottom margin property.

MARGIN_LEFT

public static final int MARGIN_LEFT
The left margin property.

MARGIN_RIGHT

public static final int MARGIN_RIGHT
The right margin property.

MARGIN_TOP

public static final int MARGIN_TOP
The top margin property.

NR_PROPERTIES

protected static final int NR_PROPERTIES
Total number of properties.

TEXT_ALIGN

public static final int TEXT_ALIGN
Align text property.

TEXT_INDENT

public static final int TEXT_INDENT
Indent left property.

value

protected int[] value
Array of attribute values for this paragraph tyle.
Constructor Detail

ParaStyle

public ParaStyle(org.w3c.dom.Node node,
                 StyleCatalog sc)
Constructor for use when going from DOM to client device format.
Parameters:
node - A style:style Node which, which is assumed to have family attribute of paragraph.
sc - The StyleCatalog, which is used for looking up ancestor Style objects.

ParaStyle

public ParaStyle(java.lang.String name,
                 java.lang.String familyName,
                 java.lang.String parentName,
                 int[] attribs,
                 java.lang.String[] values,
                 StyleCatalog lookup)
Alternate constructor for use when going from client device format to DOM.
Parameters:
name - Name of the Style. Can be null.
family - Family of the Style - usually paragraph, text, etc. Can be null.
parent - Name of the parent Style, or null if none.
attribs - Array of attributes indices to set.
values - Array of values to set.
sc - The StyleCatalog, which is used for looking up ancestor Style objects.

ParaStyle

public ParaStyle(java.lang.String name,
                 java.lang.String familyName,
                 java.lang.String parentName,
                 java.lang.String[] attribs,
                 java.lang.String[] values,
                 StyleCatalog sc)
Constructor for use when going from client device format to DOM.
Parameters:
name - Name of the Style. Can be null.
family - Family of the Style - usually paragraph, text, etc. Can be null.
parent - Name of the parent Style, or null if none.
attribs - Array of attributes to set.
values - Array of values to set.
sc - The StyleCatalog, which is used for looking up ancestor Style objects.
Method Detail

createNode

public org.w3c.dom.Node createNode(org.w3c.dom.Document parentDoc,
                                   java.lang.String name)
Create the Node with the specified elements.
Overrides:
createNode in class Style
Parameters:
name - Name of the Node.
Returns:
The created Node.

dumpCSV

public void dumpCSV()
Dump this Style as a Comma Separated Value (CSV) line.

dumpHdr

public static void dumpHdr()
Print a Comma Separated Value (CSV) header line for the spreadsheet dump.

getAttribute

public int getAttribute(int attrIndex)
Get the value of an integer attribute.
Parameters:
attrIndex - Index of the attribute.
Returns:
Value of the attribute, 0 if not set.

getResolved

public Style getResolved()
Return the Style in use.
Overrides:
getResolved in class Style
Returns:
The fully-resolved copy of the Style in use.

isAttributeSet

public boolean isAttributeSet(int attrIndex)
Check whether an attribute is set in this Style.
Parameters:
attrIndex - The attribute index to check.
Returns:
true if the attribute at specified index is set, false otherwise.

isSubset

public boolean isSubset(Style style)
Return true if style is a subset of the Style.
Overrides:
isSubset in class Style
Parameters:
style - Style to check.
Returns:
true if style is a subset, false otherwise.

setAttribute

public void setAttribute(int attr,
                         java.lang.String value)
Set an attribute for this paragraph Style.
Parameters:
attr - The attribute index to set.

setAttribute

public void setAttribute(java.lang.String attr,
                         java.lang.String value)
Set an attribute for this paragraph Style.
Parameters:
attr - The attribute to set.
value - The attribute value to set.

writeAttributes

public void writeAttributes(org.w3c.dom.Element node)
Add Style attributes to the given Node. This may involve writing child Node objects as well.
Parameters:
node - The Node to add Style attributes.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org