org.odftoolkit.simple.style
Class DefaultStyleHandler

java.lang.Object
  extended by org.odftoolkit.simple.style.DefaultStyleHandler
Direct Known Subclasses:
CellStyleHandler, FrameStyleHandler, ParagraphStyleHandler

public class DefaultStyleHandler
extends Object

This class is the default style handler. It provides methods to get the readable style element and the writable style element. It also provides method to get all kinds of style properties elements.

Since:
0.5

Field Summary
protected  boolean isUseDefaultStyle
          Whether the default style is used.
protected  Document mDocument
          The document
protected static HashMap<OdfStyleFamily,EnumSet<OdfStylePropertiesSet>> mFamilyProperties
          This HashMap contains the relationship between OdfStyleFamily and OdfStylePropertiesSet.
protected  GraphicProperties mGraphicProperties
          The readable graphics properties element.
protected  OdfStylableElement mOdfElement
          The odf element
protected  ParagraphProperties mParagraphProperties
          The readable paragraph properties element.
protected  OdfStyleBase mStyleElement
          The style element that will be processed.
protected  TableCellProperties mTableCellProperties
          The readable table cell properties element.
protected  TextProperties mTextProperties
          The readable text properties element.
protected  GraphicProperties mWritableGraphicProperties
          The writable graphics properties element.
protected  ParagraphProperties mWritableParagraphProperties
          The writable paragraph properties element.
protected  OdfStyle mWritableStyleElement
          The writable style element that will be processed.
protected  TableCellProperties mWritableTableCellProperties
          The writable table cell properties element.
protected  TextProperties mWritableTextProperties
          The writable text properties element.
 
Constructor Summary
DefaultStyleHandler(OdfStylableElement element)
          Constructor of DefaultStyleHandler
 
Method Summary
 GraphicProperties getGraphicPropertiesForRead()
          Return the graphic style properties definition for this component, only for read function.
 GraphicProperties getGraphicPropertiesForWrite()
          Return the text style properties definition for this component, for read and write function.
 ParagraphProperties getParagraphPropertiesForRead()
          Return the paragraph style properties definition for this component, only for read function.
 ParagraphProperties getParagraphPropertiesForWrite()
          Return the paragraph style properties definition for this component, for read and write function.
protected  OdfStyleBase getReadableStyleElementByName(String styleName)
          Return a readable style element by style name.
 OdfStyleBase getStyleElementForRead()
          Return the style element for this component, only for read function.
 OdfStyle getStyleElementForWrite()
          Return the style element for this component, for read and write functions.
 TableCellProperties getTableCellPropertiesForRead()
          Return the cell style properties definition for this component, only for read function.
 TableCellProperties getTableCellPropertiesForWrite()
          Return the cell style properties definition for this component, for read and write function.
 TextProperties getTextPropertiesForRead()
          Return the text style properties definition for this component, only for read function.
 TextProperties getTextPropertiesForWrite()
          Return the text style properties definition for this component, for read and write function.
protected  String getUsedStyleName()
          Return the used style name of this component.
protected  OdfStyle getWritableStyleElementByName(String styleName, boolean isShared)
          Return a writable style element by style name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mStyleElement

protected OdfStyleBase mStyleElement
The style element that will be processed.


mWritableStyleElement

protected OdfStyle mWritableStyleElement
The writable style element that will be processed.


isUseDefaultStyle

protected boolean isUseDefaultStyle
Whether the default style is used.


mOdfElement

protected OdfStylableElement mOdfElement
The odf element


mDocument

protected Document mDocument
The document


mTextProperties

protected TextProperties mTextProperties
The readable text properties element.


mWritableTextProperties

protected TextProperties mWritableTextProperties
The writable text properties element.


mTableCellProperties

protected TableCellProperties mTableCellProperties
The readable table cell properties element.


mWritableTableCellProperties

protected TableCellProperties mWritableTableCellProperties
The writable table cell properties element.


mParagraphProperties

protected ParagraphProperties mParagraphProperties
The readable paragraph properties element.


mWritableParagraphProperties

protected ParagraphProperties mWritableParagraphProperties
The writable paragraph properties element.


mGraphicProperties

protected GraphicProperties mGraphicProperties
The readable graphics properties element.


mWritableGraphicProperties

protected GraphicProperties mWritableGraphicProperties
The writable graphics properties element.


mFamilyProperties

protected static HashMap<OdfStyleFamily,EnumSet<OdfStylePropertiesSet>> mFamilyProperties
This HashMap contains the relationship between OdfStyleFamily and OdfStylePropertiesSet.

Constructor Detail

DefaultStyleHandler

public DefaultStyleHandler(OdfStylableElement element)
Constructor of DefaultStyleHandler

Parameters:
element - - the instance of structure component in an ODF document
Method Detail

getTextPropertiesForRead

public TextProperties getTextPropertiesForRead()
Return the text style properties definition for this component, only for read function.

Null will be returned if there is no style definition.

Null will be returned if there is no explicit text style properties definition for this component.

Note if you try to write style properties to the returned object, errors will be met with.

Returns:
the text style properties definition for this component, only for read function

getTextPropertiesForWrite

public TextProperties getTextPropertiesForWrite()
Return the text style properties definition for this component, for read and write function.

An empty style definition will be created if there is no style definition.

An empty text style properties definition will be created if there is no explicit text style properties definition.

Returns:
the text style properties definition for this component, for read and write function

getTableCellPropertiesForRead

public TableCellProperties getTableCellPropertiesForRead()
Return the cell style properties definition for this component, only for read function.

Null will be returned if there is no style definition.

Null will be returned if there is no explicit cell style properties definition for this component.

Note if you try to write style properties to the returned object, errors will be met with.

Returns:
the cell style properties definition for this component, only for read function

getTableCellPropertiesForWrite

public TableCellProperties getTableCellPropertiesForWrite()
Return the cell style properties definition for this component, for read and write function.

An empty style definition will be created if there is no style definition.

An empty cell style properties definition will be created if there is no explicit cell style properties definition.

Returns:
the cell style properties definition for this component, for read and write function

getParagraphPropertiesForRead

public ParagraphProperties getParagraphPropertiesForRead()
Return the paragraph style properties definition for this component, only for read function.

Null will be returned if there is no style definition.

Null will be returned if there is no explicit paragraph style properties definition for this component.

Note if you try to write style properties to the returned object, errors will be met with.

Returns:
the paragraph style properties definition for this component, only for read function

getParagraphPropertiesForWrite

public ParagraphProperties getParagraphPropertiesForWrite()
Return the paragraph style properties definition for this component, for read and write function.

An empty style definition will be created if there is no style definition.

An empty paragraph style properties definition will be created if there is no explicit paragraph style properties definition.

Returns:
the paragraph style properties definition for this component, for read and write function

getGraphicPropertiesForRead

public GraphicProperties getGraphicPropertiesForRead()
Return the graphic style properties definition for this component, only for read function.

Null will be returned if there is no style definition.

Null will be returned if there is no explicit graphic style properties definition for this component.

Note if you try to write style properties to the returned object, errors will be met with.

Returns:
the graphic style properties definition for this component, only for read function

getGraphicPropertiesForWrite

public GraphicProperties getGraphicPropertiesForWrite()
Return the text style properties definition for this component, for read and write function.

An empty style definition will be created if there is no style definition.

An empty text style properties definition will be created if there is no explicit text style properties definition.

Returns:
the text style properties definition for this component, for read and write function

getUsedStyleName

protected String getUsedStyleName()
Return the used style name of this component.

This method can be override by sub classes.

Please note the return of this method might not be same with the getStyleName() of component. If the style name is shared by multiple elements, getStyleElementForWrite() will return a copied style element, which is not same with the return of this method.

Returns:
- the used style name of this component

getReadableStyleElementByName

protected OdfStyleBase getReadableStyleElementByName(String styleName)
Return a readable style element by style name.

If the style name is null, the default style will be returned.

Parameters:
styleName - - the style name
Returns:
a readable style element

getWritableStyleElementByName

protected OdfStyle getWritableStyleElementByName(String styleName,
                                                 boolean isShared)
Return a writable style element by style name.

If the style is shared, a copied style element would be returned.

If the style name is null, the default style will be copied.

Parameters:
styleName - - the style name
Returns:
a writable style element

getStyleElementForRead

public OdfStyleBase getStyleElementForRead()
Return the style element for this component, only for read function. This method will invode getusedStyleName to get the style name, and then find the readable style element by name.

Null will be returned if there is no style definition.

Note if you try to write style properties to the returned object, errors will be met with.

Returns:
the style element
See Also:
getUsedStyleName()

getStyleElementForWrite

public OdfStyle getStyleElementForWrite()
Return the style element for this component, for read and write functions. This method will invode getusedStyleName to get the style name, and then find the writable style element by name.

An empty style definition will be created if there is no style definition.

Returns:
the style element
See Also:
getUsedStyleName()


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.