OpenOffice.org
XMerge API

org.openoffice.xmerge.converter.xml
Class Style

java.lang.Object
  |
  +--org.openoffice.xmerge.converter.xml.Style
Direct Known Subclasses:
ParaStyle, TextStyle

public class Style
extends java.lang.Object

An object of class Style represents a style in an OpenOffice document. In practice subclasses of this Style, such as TextStyle, ParaStyle are used.

See Also:
TextStyle, ParaStyle

Field Summary
protected  java.lang.String family
          Family of the Style.
protected  java.lang.String name
          Name of the Style.
protected  java.lang.String parent
          Parent of the Style.
protected  StyleCatalog sc
          A reference to the StyleCatalog to be used for looking up ancestor Style objects.
 
Constructor Summary
Style(org.w3c.dom.Node node, StyleCatalog sc)
          Constructor for use when going from DOM to client device format.
Style(java.lang.String name, java.lang.String family, java.lang.String parent, 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)
          Write a Node in parentDoc representing this Style.
 java.lang.String getFamily()
          Return the family of this Style.
 java.lang.String getName()
          Returns the name of this Style.
 java.lang.String getParent()
          Return the name of the parent of this Style.
 Style getResolved()
          Return a Style object corresponding to this one, but with all of the inherited information from parent Style objects filled in.
 boolean isSubset(Style style)
          Return true if Style is a subset of this one.
 void setCatalog(StyleCatalog sc)
          Set the StyleCatalog to be used when looking up the Style parent.
 void setName(java.lang.String newName)
          Sets the name of this Style.
 void writeAttributes(org.w3c.dom.Node node)
          Write this Style object's attributes to the given Node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

family

protected java.lang.String family
Family of the Style.

name

protected java.lang.String name
Name of the Style.

parent

protected java.lang.String parent
Parent of the Style.

sc

protected StyleCatalog sc
A reference to the StyleCatalog to be used for looking up ancestor Style objects.
Constructor Detail

Style

public Style(org.w3c.dom.Node node,
             StyleCatalog sc)
Constructor for use when going from DOM to client device format.
Parameters:
node - A style:style or style:default-style Node from the document being parsed. No checking of Node is done, so if it is not of the proper type the results will be unpredictable.
sc - The StyleCatalog, which is used for looking up ancestor Style objects.

Style

public Style(java.lang.String name,
             java.lang.String family,
             java.lang.String parent,
             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.
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)
Write a Node in parentDoc representing this Style. Note that the Node is returned unconnected.
Parameters:
parentDoc - Document to which new Node will belong.
name - Name to use for new Node.

getFamily

public java.lang.String getFamily()
Return the family of this Style.
Returns:
The family of this Style.

getName

public java.lang.String getName()
Returns the name of this Style.
Returns:
The name of this Style.

getParent

public java.lang.String getParent()
Return the name of the parent of this Style.
Returns:
The parent of this Style.

getResolved

public Style getResolved()
Return a Style object corresponding to this one, but with all of the inherited information from parent Style objects filled in. The object returned will be a new object, not a reference to this object, even if it does not need any information added.
Returns:
A resolved Style object in which to look up ancestors.

isSubset

public boolean isSubset(Style style)
Return true if Style is a subset of this one. Note that this will return true even if Style is less specific than this Style, so long as it does not contradict this Style in any way. This always returns true since only subclasses of Style contain any actual Style information.
Parameters:
style - The Style to check
Returns:
true if the Style is a subset, false otherwise.

setCatalog

public void setCatalog(StyleCatalog sc)
Set the StyleCatalog to be used when looking up the Style parent.
Parameters:
sc - The StyleCatalog, which is used for looking up ancestor Style objects.

setName

public void setName(java.lang.String newName)
Sets the name of this Style.
Parameters:
newName - The new name of this Style.

writeAttributes

public void writeAttributes(org.w3c.dom.Node node)
Write this Style object's attributes to the given Node. This may involve writing child Node objects as well. This is similar to the writeNode method, but the Node already exists, and this does not write the name, family, and parent attributes, which are assumed to already exist in the Node.
Parameters:
node - The Node to add style attributes.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org