Package org.apache.fop.accessibility.fo
Class FO2StructureTreeConverter
- java.lang.Object
-
- org.apache.fop.fo.FOEventHandler
-
- org.apache.fop.fo.DelegatingFOEventHandler
-
- org.apache.fop.accessibility.fo.FO2StructureTreeConverter
-
public class FO2StructureTreeConverter extends DelegatingFOEventHandler
Allows to create the structure tree of an FO document, by converting FO events into appropriate structure tree events.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classFO2StructureTreeConverter.State
-
Field Summary
Fields Modifier and Type Field Description protected FOEventHandlerconverterThe top of theconvertersstack.private java.util.Stack<FOEventHandler>convertersprivate EventcurrentNodeprivate FOEventHandlereventSwallowerThe descendants of some elements like fo:leader must be ignored.private Eventrootprivate java.util.Map<AbstractRetrieveMarker,FO2StructureTreeConverter.State>statesprivate StructureTreeEventTriggerstructureTreeEventTrigger-
Fields inherited from class org.apache.fop.fo.FOEventHandler
fontInfo, foUserAgent
-
-
Constructor Summary
Constructors Constructor Description FO2StructureTreeConverter(StructureTreeEventHandler structureTreeEventHandler, FOEventHandler delegate)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacter(Character c)Process a Character.voidcharacters(FOText foText)Process character data.private voidcontent(Event event, boolean hasContent)voidendBlock(Block bl)voidendBlockContainer(BlockContainer blc)voidendBody(TableBody body)voidendCell(TableCell tc)voidendColumn(TableColumn tc)private voidendContent(Event event)voidendDocument()This method is called to indicate the end of a document run.voidendExternalDocument(ExternalDocument document)Process the end of the external-document extension.voidendFlow(Flow fl)voidendFooter(TableFooter footer)voidendFootnote(Footnote footnote)Process the ending of a footnote.voidendFootnoteBody(FootnoteBody body)Process the ending of a footnote body.voidendHeader(TableHeader header)voidendInline(Inline inl)voidendInstreamForeignObject(InstreamForeignObject ifo)Process the end of an InstreamForeignObject.voidendLeader(Leader l)Process the end of a Leader.voidendLink(BasicLink basicLink)Process end of a Link.voidendList(ListBlock lb)voidendListBody(ListItemBody listItemBody)Process end of a ListBody.voidendListItem(ListItem li)voidendListLabel(ListItemLabel listItemLabel)Process end of a ListLabel.voidendMarkup()Process end of a Markup.voidendPageNumber(PageNumber pagenum)voidendPageNumberCitation(PageNumberCitation pageCite)voidendPageNumberCitationLast(PageNumberCitationLast pageLast)voidendPageSequence(PageSequence pageSeq)voidendRetrieveMarker(RetrieveMarker retrieveMarker)Process the ending of a retrieve-marker.voidendRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker)Process the ending of a retrieve-table-marker.voidendRoot(Root root)Called upon end of root element.voidendRow(TableRow tr)voidendStatic(StaticContent staticContent)Process end of a Static.voidendTable(Table tbl)voidendWrapper(Wrapper wrapper)Process the ending of a wrapper.private voidhandleEndArtifact(CommonAccessibilityHolder fobj)private voidhandleStartArtifact(CommonAccessibilityHolder fobj)voidimage(ExternalGraphic eg)Process an ExternalGraphic.private booleanisArtifact(CommonAccessibilityHolder fobj)voidpageRef()Process a pageRef.private voidrestoreRetrieveMarkerState(AbstractRetrieveMarker retrieveMarker)voidrestoreState(RetrieveMarker retrieveMarker)Restore the state of this event handler as it was when the given fo:retrieve-marker element was processed.voidrestoreState(RetrieveTableMarker retrieveTableMarker)private voidsaveState(AbstractRetrieveMarker retrieveMarker)voidstartBlock(Block bl)voidstartBlockContainer(BlockContainer blc)voidstartBody(TableBody body)voidstartCell(TableCell tc)voidstartColumn(TableColumn tc)private voidstartContent(Event event, boolean hasContent)voidstartDocument()This method is called to indicate the start of a new document run.voidstartExternalDocument(ExternalDocument document)Process the start of the external-document extension.voidstartFlow(Flow fl)This method is called to indicate the start of a new fo:flow or fo:static-content.voidstartFooter(TableFooter footer)voidstartFootnote(Footnote footnote)Process the start of a footnote.voidstartFootnoteBody(FootnoteBody body)Process the start of a footnote body.voidstartHeader(TableHeader header)voidstartInline(Inline inl)voidstartInstreamForeignObject(InstreamForeignObject ifo)Process the start of an InstreamForeignObject.voidstartLeader(Leader l)Process the start of a Leader.voidstartLink(BasicLink basicLink)Process start of a Link.voidstartList(ListBlock lb)voidstartListBody(ListItemBody listItemBody)Process start of a ListBody.voidstartListItem(ListItem li)voidstartListLabel(ListItemLabel listItemLabel)Process start of a ListLabel.voidstartMarkup()Process start of a Markup.voidstartPageNumber(PageNumber pagenum)voidstartPageNumberCitation(PageNumberCitation pageCite)voidstartPageNumberCitationLast(PageNumberCitationLast pageLast)voidstartPageSequence(PageSequence pageSeq)voidstartRetrieveMarker(RetrieveMarker retrieveMarker)Process the start of a retrieve-marker.voidstartRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker)Process the start of a retrieve-table-marker.voidstartRoot(Root root)Called upon start of root element.voidstartRow(TableRow tr)voidstartStatic(StaticContent staticContent)Process start of a Static.voidstartTable(Table tbl)voidstartWrapper(Wrapper wrapper)Process the start of a wrapper.-
Methods inherited from class org.apache.fop.fo.DelegatingFOEventHandler
getFontInfo, getResults, getUserAgent
-
-
-
-
Field Detail
-
converter
protected FOEventHandler converter
The top of theconvertersstack.
-
converters
private java.util.Stack<FOEventHandler> converters
-
structureTreeEventTrigger
private final StructureTreeEventTrigger structureTreeEventTrigger
-
eventSwallower
private final FOEventHandler eventSwallower
The descendants of some elements like fo:leader must be ignored.
-
states
private final java.util.Map<AbstractRetrieveMarker,FO2StructureTreeConverter.State> states
-
root
private Event root
-
currentNode
private Event currentNode
-
-
Constructor Detail
-
FO2StructureTreeConverter
public FO2StructureTreeConverter(StructureTreeEventHandler structureTreeEventHandler, FOEventHandler delegate)
Creates a new instance.- Parameters:
structureTreeEventHandler- the object that will hold the structure treedelegate- the FO event handler that must be wrapped by this instance
-
-
Method Detail
-
startContent
private void startContent(Event event, boolean hasContent)
-
content
private void content(Event event, boolean hasContent)
-
endContent
private void endContent(Event event)
-
startDocument
public void startDocument() throws org.xml.sax.SAXExceptionDescription copied from class:FOEventHandlerThis method is called to indicate the start of a new document run.- Overrides:
startDocumentin classDelegatingFOEventHandler- Throws:
org.xml.sax.SAXException- In case of a problem
-
endDocument
public void endDocument() throws org.xml.sax.SAXExceptionDescription copied from class:FOEventHandlerThis method is called to indicate the end of a document run.- Overrides:
endDocumentin classDelegatingFOEventHandler- Throws:
org.xml.sax.SAXException- In case of a problem
-
startRoot
public void startRoot(Root root)
Description copied from class:FOEventHandlerCalled upon start of root element.- Overrides:
startRootin classDelegatingFOEventHandler- Parameters:
root- element
-
endRoot
public void endRoot(Root root)
Description copied from class:FOEventHandlerCalled upon end of root element.- Overrides:
endRootin classDelegatingFOEventHandler- Parameters:
root- element
-
startPageSequence
public void startPageSequence(PageSequence pageSeq)
- Overrides:
startPageSequencein classDelegatingFOEventHandler- Parameters:
pageSeq- PageSequence that is starting.
-
endPageSequence
public void endPageSequence(PageSequence pageSeq)
- Overrides:
endPageSequencein classDelegatingFOEventHandler- Parameters:
pageSeq- PageSequence that is ending.
-
startPageNumber
public void startPageNumber(PageNumber pagenum)
- Overrides:
startPageNumberin classDelegatingFOEventHandler- Parameters:
pagenum- PageNumber that is starting.
-
endPageNumber
public void endPageNumber(PageNumber pagenum)
- Overrides:
endPageNumberin classDelegatingFOEventHandler- Parameters:
pagenum- PageNumber that is ending.
-
startPageNumberCitation
public void startPageNumberCitation(PageNumberCitation pageCite)
- Overrides:
startPageNumberCitationin classDelegatingFOEventHandler- Parameters:
pageCite- PageNumberCitation that is starting.
-
endPageNumberCitation
public void endPageNumberCitation(PageNumberCitation pageCite)
- Overrides:
endPageNumberCitationin classDelegatingFOEventHandler- Parameters:
pageCite- PageNumberCitation that is ending.
-
startPageNumberCitationLast
public void startPageNumberCitationLast(PageNumberCitationLast pageLast)
- Overrides:
startPageNumberCitationLastin classDelegatingFOEventHandler- Parameters:
pageLast- PageNumberCitationLast that is starting.
-
endPageNumberCitationLast
public void endPageNumberCitationLast(PageNumberCitationLast pageLast)
- Overrides:
endPageNumberCitationLastin classDelegatingFOEventHandler- Parameters:
pageLast- PageNumberCitationLast that is ending.
-
startStatic
public void startStatic(StaticContent staticContent)
Description copied from class:FOEventHandlerProcess start of a Static.- Overrides:
startStaticin classDelegatingFOEventHandler- Parameters:
staticContent- StaticContent that is starting
-
endStatic
public void endStatic(StaticContent staticContent)
Description copied from class:FOEventHandlerProcess end of a Static.- Overrides:
endStaticin classDelegatingFOEventHandler- Parameters:
staticContent- StaticContent that is ending
-
startFlow
public void startFlow(Flow fl)
Description copied from class:FOEventHandlerThis method is called to indicate the start of a new fo:flow or fo:static-content. This method also handles fo:static-content tags, because the StaticContent class is derived from the Flow class.- Overrides:
startFlowin classDelegatingFOEventHandler- Parameters:
fl- Flow that is starting.
-
endFlow
public void endFlow(Flow fl)
- Overrides:
endFlowin classDelegatingFOEventHandler- Parameters:
fl- Flow that is ending.
-
startBlock
public void startBlock(Block bl)
- Overrides:
startBlockin classDelegatingFOEventHandler- Parameters:
bl- Block that is starting.
-
endBlock
public void endBlock(Block bl)
- Overrides:
endBlockin classDelegatingFOEventHandler- Parameters:
bl- Block that is ending.
-
startBlockContainer
public void startBlockContainer(BlockContainer blc)
- Overrides:
startBlockContainerin classDelegatingFOEventHandler- Parameters:
blc- BlockContainer that is starting.
-
endBlockContainer
public void endBlockContainer(BlockContainer blc)
- Overrides:
endBlockContainerin classDelegatingFOEventHandler- Parameters:
blc- BlockContainer that is ending.
-
startInline
public void startInline(Inline inl)
- Overrides:
startInlinein classDelegatingFOEventHandler- Parameters:
inl- Inline that is starting.
-
endInline
public void endInline(Inline inl)
- Overrides:
endInlinein classDelegatingFOEventHandler- Parameters:
inl- Inline that is ending.
-
startTable
public void startTable(Table tbl)
- Overrides:
startTablein classDelegatingFOEventHandler- Parameters:
tbl- Table that is starting.
-
endTable
public void endTable(Table tbl)
- Overrides:
endTablein classDelegatingFOEventHandler- Parameters:
tbl- Table that is ending.
-
startColumn
public void startColumn(TableColumn tc)
- Overrides:
startColumnin classDelegatingFOEventHandler- Parameters:
tc- TableColumn that is starting;
-
endColumn
public void endColumn(TableColumn tc)
- Overrides:
endColumnin classDelegatingFOEventHandler- Parameters:
tc- TableColumn that is ending;
-
startHeader
public void startHeader(TableHeader header)
- Overrides:
startHeaderin classDelegatingFOEventHandler- Parameters:
header- TableHeader that is starting;
-
endHeader
public void endHeader(TableHeader header)
- Overrides:
endHeaderin classDelegatingFOEventHandler- Parameters:
header- TableHeader that is ending.
-
startFooter
public void startFooter(TableFooter footer)
- Overrides:
startFooterin classDelegatingFOEventHandler- Parameters:
footer- TableFooter that is starting.
-
endFooter
public void endFooter(TableFooter footer)
- Overrides:
endFooterin classDelegatingFOEventHandler- Parameters:
footer- TableFooter that is ending.
-
startBody
public void startBody(TableBody body)
- Overrides:
startBodyin classDelegatingFOEventHandler- Parameters:
body- TableBody that is starting.
-
endBody
public void endBody(TableBody body)
- Overrides:
endBodyin classDelegatingFOEventHandler- Parameters:
body- TableBody that is ending.
-
startRow
public void startRow(TableRow tr)
- Overrides:
startRowin classDelegatingFOEventHandler- Parameters:
tr- TableRow that is starting.
-
endRow
public void endRow(TableRow tr)
- Overrides:
endRowin classDelegatingFOEventHandler- Parameters:
tr- TableRow that is ending.
-
startCell
public void startCell(TableCell tc)
- Overrides:
startCellin classDelegatingFOEventHandler- Parameters:
tc- TableCell that is starting.
-
endCell
public void endCell(TableCell tc)
- Overrides:
endCellin classDelegatingFOEventHandler- Parameters:
tc- TableCell that is ending.
-
startList
public void startList(ListBlock lb)
- Overrides:
startListin classDelegatingFOEventHandler- Parameters:
lb- ListBlock that is starting.
-
endList
public void endList(ListBlock lb)
- Overrides:
endListin classDelegatingFOEventHandler- Parameters:
lb- ListBlock that is ending.
-
startListItem
public void startListItem(ListItem li)
- Overrides:
startListItemin classDelegatingFOEventHandler- Parameters:
li- ListItem that is starting.
-
endListItem
public void endListItem(ListItem li)
- Overrides:
endListItemin classDelegatingFOEventHandler- Parameters:
li- ListItem that is ending.
-
startListLabel
public void startListLabel(ListItemLabel listItemLabel)
Description copied from class:FOEventHandlerProcess start of a ListLabel.- Overrides:
startListLabelin classDelegatingFOEventHandler- Parameters:
listItemLabel- ListItemLabel that is starting
-
endListLabel
public void endListLabel(ListItemLabel listItemLabel)
Description copied from class:FOEventHandlerProcess end of a ListLabel.- Overrides:
endListLabelin classDelegatingFOEventHandler- Parameters:
listItemLabel- ListItemLabel that is ending
-
startListBody
public void startListBody(ListItemBody listItemBody)
Description copied from class:FOEventHandlerProcess start of a ListBody.- Overrides:
startListBodyin classDelegatingFOEventHandler- Parameters:
listItemBody- ListItemBody that is starting
-
endListBody
public void endListBody(ListItemBody listItemBody)
Description copied from class:FOEventHandlerProcess end of a ListBody.- Overrides:
endListBodyin classDelegatingFOEventHandler- Parameters:
listItemBody- ListItemBody that is ending
-
startMarkup
public void startMarkup()
Description copied from class:FOEventHandlerProcess start of a Markup.- Overrides:
startMarkupin classDelegatingFOEventHandler
-
endMarkup
public void endMarkup()
Description copied from class:FOEventHandlerProcess end of a Markup.- Overrides:
endMarkupin classDelegatingFOEventHandler
-
startLink
public void startLink(BasicLink basicLink)
Description copied from class:FOEventHandlerProcess start of a Link.- Overrides:
startLinkin classDelegatingFOEventHandler- Parameters:
basicLink- BasicLink that is starting
-
endLink
public void endLink(BasicLink basicLink)
Description copied from class:FOEventHandlerProcess end of a Link.- Overrides:
endLinkin classDelegatingFOEventHandler- Parameters:
basicLink- BasicLink that is ending
-
image
public void image(ExternalGraphic eg)
Description copied from class:FOEventHandlerProcess an ExternalGraphic.- Overrides:
imagein classDelegatingFOEventHandler- Parameters:
eg- ExternalGraphic to process.
-
pageRef
public void pageRef()
Description copied from class:FOEventHandlerProcess a pageRef.- Overrides:
pageRefin classDelegatingFOEventHandler
-
startInstreamForeignObject
public void startInstreamForeignObject(InstreamForeignObject ifo)
Description copied from class:FOEventHandlerProcess the start of an InstreamForeignObject.- Overrides:
startInstreamForeignObjectin classDelegatingFOEventHandler- Parameters:
ifo- InstreamForeignObject that is starting
-
endInstreamForeignObject
public void endInstreamForeignObject(InstreamForeignObject ifo)
Description copied from class:FOEventHandlerProcess the end of an InstreamForeignObject.- Overrides:
endInstreamForeignObjectin classDelegatingFOEventHandler- Parameters:
ifo- InstreamForeignObject that is ending
-
startFootnote
public void startFootnote(Footnote footnote)
Description copied from class:FOEventHandlerProcess the start of a footnote.- Overrides:
startFootnotein classDelegatingFOEventHandler- Parameters:
footnote- Footnote that is starting
-
endFootnote
public void endFootnote(Footnote footnote)
Description copied from class:FOEventHandlerProcess the ending of a footnote.- Overrides:
endFootnotein classDelegatingFOEventHandler- Parameters:
footnote- Footnote that is ending
-
startFootnoteBody
public void startFootnoteBody(FootnoteBody body)
Description copied from class:FOEventHandlerProcess the start of a footnote body.- Overrides:
startFootnoteBodyin classDelegatingFOEventHandler- Parameters:
body- FootnoteBody that is starting
-
endFootnoteBody
public void endFootnoteBody(FootnoteBody body)
Description copied from class:FOEventHandlerProcess the ending of a footnote body.- Overrides:
endFootnoteBodyin classDelegatingFOEventHandler- Parameters:
body- FootnoteBody that is ending
-
startLeader
public void startLeader(Leader l)
Description copied from class:FOEventHandlerProcess the start of a Leader.- Overrides:
startLeaderin classDelegatingFOEventHandler- Parameters:
l- Leader that is starting
-
endLeader
public void endLeader(Leader l)
Description copied from class:FOEventHandlerProcess the end of a Leader.- Overrides:
endLeaderin classDelegatingFOEventHandler- Parameters:
l- Leader that is ending
-
startWrapper
public void startWrapper(Wrapper wrapper)
Description copied from class:FOEventHandlerProcess the start of a wrapper.- Overrides:
startWrapperin classDelegatingFOEventHandler- Parameters:
wrapper- wrapper that is starting
-
endWrapper
public void endWrapper(Wrapper wrapper)
Description copied from class:FOEventHandlerProcess the ending of a wrapper.- Overrides:
endWrapperin classDelegatingFOEventHandler- Parameters:
wrapper- wrapper that is ending
-
startRetrieveMarker
public void startRetrieveMarker(RetrieveMarker retrieveMarker)
Description copied from class:FOEventHandlerProcess the start of a retrieve-marker.- Overrides:
startRetrieveMarkerin classDelegatingFOEventHandler- Parameters:
retrieveMarker- the retrieve-marker that is starting
-
saveState
private void saveState(AbstractRetrieveMarker retrieveMarker)
-
endRetrieveMarker
public void endRetrieveMarker(RetrieveMarker retrieveMarker)
Description copied from class:FOEventHandlerProcess the ending of a retrieve-marker.- Overrides:
endRetrieveMarkerin classDelegatingFOEventHandler- Parameters:
retrieveMarker- the retrieve-marker that is ending
-
restoreState
public void restoreState(RetrieveMarker retrieveMarker)
Description copied from class:FOEventHandlerRestore the state of this event handler as it was when the given fo:retrieve-marker element was processed. This method is called at marker retrieval time, so that events for the marker descendants are fired within the proper context.The default implementation of this method does nothing.
- Overrides:
restoreStatein classDelegatingFOEventHandler- Parameters:
retrieveMarker- the fo:retrieve-marker element that is retrieving markers
-
restoreRetrieveMarkerState
private void restoreRetrieveMarkerState(AbstractRetrieveMarker retrieveMarker)
-
startRetrieveTableMarker
public void startRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker)
Description copied from class:FOEventHandlerProcess the start of a retrieve-table-marker.- Overrides:
startRetrieveTableMarkerin classDelegatingFOEventHandler- Parameters:
retrieveTableMarker- the retrieve-table-marker that is starting
-
endRetrieveTableMarker
public void endRetrieveTableMarker(RetrieveTableMarker retrieveTableMarker)
Description copied from class:FOEventHandlerProcess the ending of a retrieve-table-marker.- Overrides:
endRetrieveTableMarkerin classDelegatingFOEventHandler- Parameters:
retrieveTableMarker- the retrieve-table-marker that is ending
-
restoreState
public void restoreState(RetrieveTableMarker retrieveTableMarker)
Description copied from class:FOEventHandler- Overrides:
restoreStatein classDelegatingFOEventHandler
-
character
public void character(Character c)
Description copied from class:FOEventHandlerProcess a Character.- Overrides:
characterin classDelegatingFOEventHandler- Parameters:
c- Character to process.
-
characters
public void characters(FOText foText)
Description copied from class:FOEventHandlerProcess character data.- Overrides:
charactersin classDelegatingFOEventHandler- Parameters:
foText- text to process
-
startExternalDocument
public void startExternalDocument(ExternalDocument document)
Description copied from class:FOEventHandlerProcess the start of the external-document extension.- Overrides:
startExternalDocumentin classDelegatingFOEventHandler- Parameters:
document- the external-document node
-
endExternalDocument
public void endExternalDocument(ExternalDocument document)
Description copied from class:FOEventHandlerProcess the end of the external-document extension.- Overrides:
endExternalDocumentin classDelegatingFOEventHandler- Parameters:
document- the external-document node
-
handleStartArtifact
private void handleStartArtifact(CommonAccessibilityHolder fobj)
-
handleEndArtifact
private void handleEndArtifact(CommonAccessibilityHolder fobj)
-
isArtifact
private boolean isArtifact(CommonAccessibilityHolder fobj)
-
-