LibreOffice Module xmerge (master)  1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
org.openoffice.xmerge.converter.xml.StyleCatalog Class Reference

A. More...

Collaboration diagram for org.openoffice.xmerge.converter.xml.StyleCatalog:
[legend]

Public Member Functions

 StyleCatalog (int initialEntries)
 Constructor. More...
 
void add (Node node, String families[], Class<?> classes[], Class<?> defaultClass, boolean alwaysCreateDefault)
 Parse the. More...
 
void add (Style s)
 Add a. More...
 
Style lookup (String name, String family, String parent, Class<?> styleClass)
 Return the first. More...
 
Style[] getMatching (Style s)
 Given a. More...
 
Element writeNode (org.w3c.dom.Document parentDoc, String name)
 Create a. More...
 

Private Member Functions

void callConstructor (Class<?> cls, Node node)
 Call the constructor of class. More...
 
String getFamilyName (Node node)
 Find the family attribute of a. More...
 

Private Attributes

final ArrayList< Stylestyles
 

Detailed Description

A.

holds a collection of

objects.

It is intended for use when parsing or building a DOM document.

Each entry in the

represents a

, and is an object which is a subclass of

.

See also
Style

Definition at line 40 of file StyleCatalog.java.

Constructor & Destructor Documentation

org.openoffice.xmerge.converter.xml.StyleCatalog.StyleCatalog ( int  initialEntries)
inline

Constructor.

Parameters
initialEntriesExpected number of entries to set for efficiency purposes.

Definition at line 50 of file StyleCatalog.java.

Member Function Documentation

void org.openoffice.xmerge.converter.xml.StyleCatalog.add ( Node  node,
String  families[],
Class<?>  classes[],
Class<?>  defaultClass,
boolean  alwaysCreateDefault 
)
inline

Parse the.

starting from

node

and working downward, and add all styles found, so long as their family name is listed in

families

.

For each family name in

families

there must be a corresponding element in

classes

, which specifies the class type to use for that family. All of these classes must be subclasses of

. There can be multiple classes specified for a particular family.

If

defaultClass

is non-null, then all styles that are found will be added. Any

whose family is not listed in

families

will be added using defaultClass, which, of course, must be a subclass of

. If

alwaysCreateDefault

is

true

, then a class of type

defaultClass

will always be created, regardless of whether there was also a match in

families

.

DJP ToDo: make it recursive so that

node

can be higher up in the

tree.

Parameters
nodeThe node to be searched for objects.
familiesAn array of families to add.
classesAn array of class types corresponding to the families array.
defaultClassAll objects that are found are added to this class.
alwaysCreateDefaultA class of type
defaultClass
will always be created, regardless of whether there is a match in the families array.

Definition at line 86 of file StyleCatalog.java.

References org.openoffice.xmerge.converter.xml.StyleCatalog.callConstructor(), equals(), org.openoffice.xmerge.util.Debug.ERROR, org.openoffice.xmerge.converter.xml.StyleCatalog.getFamilyName(), i, org.openoffice.xmerge.util.Debug.log(), name, and String.

Referenced by org.openoffice.xmerge.converter.xml.sxc.SxcDocumentSerializer.loadStyles(), org.openoffice.xmerge.converter.xml.sxc.SxcDocumentDeserializer.processCells(), and org.openoffice.xmerge.converter.xml.sxc.SxcDocumentDeserializer.processColumns().

void org.openoffice.xmerge.converter.xml.StyleCatalog.add ( Style  s)
inline

Add a.

to the catalog.

Parameters
sThe to add.

Definition at line 154 of file StyleCatalog.java.

void org.openoffice.xmerge.converter.xml.StyleCatalog.callConstructor ( Class<?>  cls,
Node  node 
)
inlineprivate

Call the constructor of class.

cls

with parameters

node

, and add the resulting

to the catalog.

Parameters
clsThe class whose constructor will be called.
nodeThe constructed class will be added to this node.

Definition at line 134 of file StyleCatalog.java.

References org.openoffice.xmerge.util.Debug.ERROR, Exception, getClass(), org.openoffice.xmerge.util.Debug.log(), Object, and p.

Referenced by org.openoffice.xmerge.converter.xml.StyleCatalog.add().

String org.openoffice.xmerge.converter.xml.StyleCatalog.getFamilyName ( Node  node)
inlineprivate

Find the family attribute of a.

.

Parameters
nodeThe to check.
Returns
The family attribute, or
null
if one does not exist.

Definition at line 271 of file StyleCatalog.java.

References i, and String.

Referenced by org.openoffice.xmerge.converter.xml.StyleCatalog.add().

Style [] org.openoffice.xmerge.converter.xml.StyleCatalog.getMatching ( Style  s)
inline
Style org.openoffice.xmerge.converter.xml.StyleCatalog.lookup ( String  name,
String  family,
String  parent,
Class<?>  styleClass 
)
inline

Return the first.

matching the specified names.

Parameters
nameName to match,
null
is considered always match.
familyFamily to match,
null
is considered always match.
parentParent to match,
null
is considered always match.
styleClassstyleClass to match,
null
is considered always match.
Returns
value if all parameters match,
null
otherwise.

Definition at line 173 of file StyleCatalog.java.

References org.openoffice.xmerge.converter.xml.Style.getFamily(), org.openoffice.xmerge.converter.xml.Style.getName(), org.openoffice.xmerge.converter.xml.Style.getParent(), and i.

Referenced by org.openoffice.xmerge.converter.xml.sxc.SxcDocumentSerializer.traverseCell(), org.openoffice.xmerge.converter.xml.sxc.SxcDocumentSerializer.traverseTableColumn(), and org.openoffice.xmerge.converter.xml.sxc.SxcDocumentSerializer.traverseTableRow().

Element org.openoffice.xmerge.converter.xml.StyleCatalog.writeNode ( org.w3c.dom.Document  parentDoc,
String  name 
)
inline

Create a.

named

in

Document parentDoc

, and write the entire

to it.

Note that the resulting node is returned, but is not connected into the document. Placing the output node in the document is left to the caller.

Parameters
parentDocThe to add the .
nameThe name of the to add.
Returns
The
Element
that was created.

Definition at line 237 of file StyleCatalog.java.

References org.openoffice.xmerge.converter.xml.Style.createNode(), org.openoffice.xmerge.converter.xml.Style.getFamily(), org.openoffice.xmerge.converter.xml.Style.getName(), and org.openoffice.xmerge.converter.xml.Style.getParent().

Referenced by org.openoffice.xmerge.converter.xml.sxc.SxcDocumentDeserializer.processCells().

Member Data Documentation

final ArrayList<Style> org.openoffice.xmerge.converter.xml.StyleCatalog.styles
private

Definition at line 42 of file StyleCatalog.java.


The documentation for this class was generated from the following file: