|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.infinityloop.upcast.treeprocess.SectionProcessorBase
public class SectionProcessorBase
Base class for a custom section processor.
Subclass and implement checkParagraph(org.w3c.dom.Element, de.infinityloop.upcast.UpcastStyle, de.infinityloop.upcast.UpcastStyle)
as required.
Field Summary | |
---|---|
protected static int |
HEADING_PAR
|
LoggerProxy |
logger
|
protected static int |
NO_SECTION_BREAK
|
protected static int |
SECTION_1_START
|
protected static int |
SECTION_2_START
|
protected static int |
SECTION_3_START
|
protected static int |
SECTION_4_START
|
protected static int |
SECTION_5_START
|
protected static int |
SECTION_6_START
|
protected static int |
SECTION_7_START
|
protected static int |
SECTION_8_START
|
protected static int |
SECTION_9_START
|
Fields inherited from interface de.infinityloop.upcast.treeprocess.SectionProcessor |
---|
kSectionLevelAttrName |
Constructor Summary | |
---|---|
SectionProcessorBase()
|
Method Summary | |
---|---|
protected int |
checkParagraph(org.w3c.dom.Element par,
UpcastStyle baseStyle,
UpcastStyle overrideStyle)
This is the only method you need to implement. |
protected UpcastStyle |
getBaseStyle(org.w3c.dom.Element elem)
retrieves the base style of an element of the internal document tree. |
protected UpcastStyle |
getOverrideStyle(org.w3c.dom.Element elem)
retrieves the override style of an element of the internal document tree. |
void |
initialize(de.infinityloop.upcast.Converter conv,
de.infinityloop.upcast.importfilters.ImportFilter filter)
Called at initialization time. |
protected UpcastStyle |
mergeStyles(UpcastStyle baseStyle,
UpcastStyle overrideStyle)
Merges the base style and the override style into one representing the actual valid combination of properties. |
void |
processDocument(org.w3c.dom.Document doc)
Entry point for processing the document. |
protected void |
setParagraphStyleName(org.w3c.dom.Element par,
java.lang.String name)
sets the name of the element's base style to the one specified. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int NO_SECTION_BREAK
protected static final int SECTION_1_START
protected static final int SECTION_2_START
protected static final int SECTION_3_START
protected static final int SECTION_4_START
protected static final int SECTION_5_START
protected static final int SECTION_6_START
protected static final int SECTION_7_START
protected static final int SECTION_8_START
protected static final int SECTION_9_START
protected static final int HEADING_PAR
public LoggerProxy logger
Constructor Detail |
---|
public SectionProcessorBase()
Method Detail |
---|
public final void initialize(de.infinityloop.upcast.Converter conv, de.infinityloop.upcast.importfilters.ImportFilter filter)
When you override this, make sure to call the implementation of the super class.
initialize
in interface de.infinityloop.upcast.treeprocess.SectionProcessor
public final void processDocument(org.w3c.dom.Document doc)
When you override this, make sure to call the implementation of the super class as last action to start processing.
processDocument
in interface de.infinityloop.upcast.treeprocess.SectionProcessor
protected UpcastStyle getBaseStyle(org.w3c.dom.Element elem)
This will be needed in checkParagraph()
if you need to look 'down' the
tree into the paragraph's children to determine wether it is a section heading or not.
elem
- the element from which to retrieve the valid base style
protected UpcastStyle getOverrideStyle(org.w3c.dom.Element elem)
This will be needed in checkParagraph()
if you need to look 'down' the
tree into the paragraph's children to determine wether it is a section heading or not.
elem
- the element from which to retrieve the valid override style
protected void setParagraphStyleName(org.w3c.dom.Element par, java.lang.String name)
Internally, this makes a copy of the current style of the element and adds a new style to the styletable with the new name.
If a style by that name already exists in the style table, the element is linked to the existing style without changing it. This may alter the par's visual appearance if the existing style has different properties.
par
- the element to set the new named style on. This must be a par element.name
- the new style nameprotected UpcastStyle mergeStyles(UpcastStyle baseStyle, UpcastStyle overrideStyle)
baseStyle
- the base styleoverrideStyle
- the override style which is merged onto base style, replacing any
existing properties that might already exist there with the same name
protected int checkParagraph(org.w3c.dom.Element par, UpcastStyle baseStyle, UpcastStyle overrideStyle)
If you want this paragraph to be placed into a new section of level X, return one of the constants SECTION_X_START, with X being the nesting level of the sections where you want this paragraph to be the first one in.
If you also want to make this paragraph a heading element in the output, add the constant HEADING_PAR to the result.
The paragraph is in the internal DOM tree, so if you need to check for properties on its children,
you may traverse them using standard DOM level 1 methods and retrieve the children's style info
using the getBaseStyle()
and getOverrideStyle()
methods.
par
- A DOM element for the paragraph to processbaseStyle
- the base style as originally assigned via the named stylesheet styleoverrideStyle
- all properties that have been manually and locally applied on top
of the base style
NO_SECTION_BREAK
(the default), if this paragraph does not
indicate a change in section nesting.
By default, this implementation returns NO_SECTION_BREAK
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |