|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openoffice.xmerge.converter.xml.StyleCatalog
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
.
Constructor Summary | |
StyleCatalog(int initialEntries)
Constructor |
Method Summary | |
void |
add(org.w3c.dom.Node node,
java.lang.String[] families,
java.lang.Class[] classes,
java.lang.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 . |
void |
add(Style s)
Add a Style to the catalog. |
void |
dumpCSV(boolean para)
Dump the Style table in Comma Separated Value (CSV)
format |
Style |
getBestMatch(Style s)
Given a Style s , return the
style that is the closest match. |
Style[] |
getMatching(Style s)
Given a Style s |
Style |
lookup(java.lang.String name,
java.lang.String family,
java.lang.String parent,
java.lang.Class styleClass)
Return the first Style matching the specified names. |
org.w3c.dom.Element |
writeNode(org.w3c.dom.Document parentDoc,
java.lang.String name)
Create a Node named name in
Document parentDoc , and write the
entire StyleCatalog to it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StyleCatalog(int initialEntries)
initialEntries
- Expected number of entries to set
for efficiency purposes.Method Detail |
public void add(org.w3c.dom.Node node, java.lang.String[] families, java.lang.Class[] classes, java.lang.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
. 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.public void add(Style s)
Style
to the catalog.s
- The Style
to add.public void dumpCSV(boolean para)
Style
table in Comma Separated Value (CSV)
formatpara
- If true, dump in paragraph Style
,
otherwise dump in text style.public Style getBestMatch(Style s)
Style
s
, return the
style
that is the closest match. Not currently
implemented.s
- Style
to match.Style
that most closely matches.public Style[] getMatching(Style s)
Style
s return all
Style
objects that match.
- Parameters:
s
- Style
to match.- Returns:
- An array of
Style
objects that match, an
empty array if none match.
public Style lookup(java.lang.String name, java.lang.String family, java.lang.String parent, java.lang.Class styleClass)
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 otherwisepublic org.w3c.dom.Element writeNode(org.w3c.dom.Document parentDoc, java.lang.String name)
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.
|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |