LibreOffice Module xmerge (master) 1
|
A StyleCatalog
holds a collection of Style
objects.
More...
Public Member Functions | |
StyleCatalog (int initialEntries) | |
Constructor. More... | |
void | add (Node node, String families[], Class<?> classes[], Class<?> defaultClass, boolean alwaysCreateDefault) |
Parse the Document starting from node and working downward, and add all styles found, so long as their family name is listed in families . More... | |
void | add (Style s) |
Add a Style to the catalog. More... | |
Style | lookup (String name, String family, String parent, Class<?> styleClass) |
Return the first Style matching the specified names. More... | |
Style[] | getMatching (Style s) |
Given a Style s return all Style objects that match. More... | |
Element | writeNode (org.w3c.dom.Document parentDoc, String name) |
Create a Node named name in Document parentDoc , and write the entire StyleCatalog to it. More... | |
Private Member Functions | |
void | callConstructor (Class<?> cls, Node node) |
Call the constructor of class cls with parameters node , and add the resulting Style to the catalog. More... | |
String | getFamilyName (Node node) |
Find the family attribute of a Style Node . More... | |
Private Attributes | |
final ArrayList< Style > | styles |
A StyleCatalog
holds a collection of Style
objects.
It is intended for use when parsing or building a DOM document.
Each entry in the StyleCatalog
represents a Style
, and is an object which is a subclass of Style
.
Definition at line 40 of file StyleCatalog.java.
|
inline |
Constructor.
initialEntries | Expected number of entries to set for efficiency purposes. |
Definition at line 50 of file StyleCatalog.java.
References org.openoffice.xmerge.converter.xml.StyleCatalog.styles.
|
inline |
Parse the Document
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 Style
. 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 Style
whose family is not listed in families
will be added using defaultClass, which, of course, must be a subclass of Style
. 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 Document
tree.
node | The node to be searched for Style objects. |
families | An array of Style families to add. |
classes | An array of class types corresponding to the families array. |
defaultClass | All Style objects that are found are added to this class. |
alwaysCreateDefault | A 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(), Class, 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().
|
inline |
Add a Style
to the catalog.
s | The Style to add. |
Definition at line 154 of file StyleCatalog.java.
References org.openoffice.xmerge.converter.xml.StyleCatalog.styles.
|
inlineprivate |
Call the constructor of class cls
with parameters node
, and add the resulting Style
to the catalog.
cls | The class whose constructor will be called. |
node | The constructed class will be added to this node. |
Definition at line 134 of file StyleCatalog.java.
References Class, org.openoffice.xmerge.util.Debug.ERROR, Exception, getClass(), org.openoffice.xmerge.util.Debug.log(), Object, p, and org.openoffice.xmerge.converter.xml.StyleCatalog.styles.
Referenced by org.openoffice.xmerge.converter.xml.StyleCatalog.add().
|
inlineprivate |
Find the family attribute of a Style Node
.
node | The Node to check. |
null
if one does not exist. Definition at line 271 of file StyleCatalog.java.
Referenced by org.openoffice.xmerge.converter.xml.StyleCatalog.add().
Given a Style s
return all Style
objects that match.
s | Style to match. |
Style
objects that match, an empty array if none match. Definition at line 203 of file StyleCatalog.java.
References matchArray(), p, and org.openoffice.xmerge.converter.xml.StyleCatalog.styles.
Referenced by org.openoffice.xmerge.converter.xml.sxc.SxcDocumentDeserializer.processCells(), and org.openoffice.xmerge.converter.xml.sxc.SxcDocumentDeserializer.processColumns().
|
inline |
Return the first Style
matching the specified names.
name | Name to match, null is considered always match. |
family | Family to match, null is considered always match. |
parent | Parent to match, null is considered always match. |
styleClass | styleClass to match, null is considered always match. |
Style
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(), i, name, and org.openoffice.xmerge.converter.xml.StyleCatalog.styles.
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().
|
inline |
Create a Node
named name
in Document parentDoc
, and write the entire StyleCatalog
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.
parentDoc | The Document to add the Node . |
name | The name of the Node to add. |
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(), org.openoffice.xmerge.converter.xml.Style.getParent(), name, and org.openoffice.xmerge.converter.xml.StyleCatalog.styles.
Referenced by org.openoffice.xmerge.converter.xml.sxc.SxcDocumentDeserializer.processCells().
|
private |
Definition at line 42 of file StyleCatalog.java.
Referenced by org.openoffice.xmerge.converter.xml.StyleCatalog.add(), org.openoffice.xmerge.converter.xml.StyleCatalog.callConstructor(), org.openoffice.xmerge.converter.xml.StyleCatalog.getMatching(), org.openoffice.xmerge.converter.xml.StyleCatalog.lookup(), org.openoffice.xmerge.converter.xml.StyleCatalog.StyleCatalog(), and org.openoffice.xmerge.converter.xml.StyleCatalog.writeNode().