Package org.apache.fop.area
Class AreaTreeHandler
java.lang.Object
org.apache.fop.fo.FOEventHandler
org.apache.fop.area.AreaTreeHandler
Area tree handler for formatting objects.
Concepts: The area tree is to be as small as possible. With minimal classes
and data to fully represent an area tree for formatting objects. The area
tree needs to be simple to render and follow the spec closely. This area tree
has the concept of page sequences. Wherever possible information is discarded
or optimized to keep memory use low. The data is also organized to make it
possible for renderers to minimize their output. A page can be saved if not
fully resolved and once rendered a page contains only size and id reference
information. The area tree pages are organized in a model that depends on the
type of renderer.
-
Field Summary
FieldsFields inherited from class org.apache.fop.fo.FOEventHandler
fontInfo, foUserAgent
-
Constructor Summary
ConstructorsConstructorDescriptionAreaTreeHandler
(FOUserAgent userAgent, String outputFormat, OutputStream stream) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addUnresolvedIDRef
(String idref, Resolvable res) Deprecated.use getIDTracker().addUnresolvedIDRef(idref, res) insteadboolean
Deprecated.use getIDTracker().alreadyResolvedID(id) insteadvoid
Deprecated.use getIDTracker().associateIDWithPageViewport(id, pv) insteadvoid
End the document.void
endExternalDocument
(ExternalDocument document) Process the end of the external-document extension.void
endPageSequence
(PageSequence pageSequence) End the PageSequence.Generates and returns a unique key for a page viewport.Get the area tree model for this area tree.Get the IDTracker for this area tree.Get the LayoutManager maker for this area tree.Deprecated.use getIDTracker().getPageViewportsContainingID(id) insteadGet information about the rendered output, like number of pages created.boolean
Check whether complex script features are enabled.void
notifyPageSequenceFinished
(AbstractPageSequence pageSequence, int pageCount) Called by the PageSequenceLayoutManager when it is finished with a page-sequence.protected void
setupModel
(FOUserAgent userAgent, String outputFormat, OutputStream stream) Sets up the AreaTreeModel instance for use by the AreaTreeHandler.void
Deprecated.use getIDTracker().signalIDProcessed(id) insteadvoid
Deprecated.use getIDTracker().signalPendingID(id) insteadvoid
Prepare AreaTreeHandler for document processing This is called from FOTreeBuilder.startDocument()void
startExternalDocument
(ExternalDocument document) Process the start of the external-document extension.void
startPageSequence
(PageSequence pageSequence) void
Called upon start of root element.void
Deprecated.use getIDTracker().tryIDResolution(pv) insteadMethods inherited from class org.apache.fop.fo.FOEventHandler
character, characters, endBlock, endBlockContainer, endBody, endCell, endColumn, endFlow, endFooter, endFootnote, endFootnoteBody, endHeader, endInline, endInstreamForeignObject, endLeader, endLink, endList, endListBody, endListItem, endListLabel, endMarkup, endPageNumber, endPageNumberCitation, endPageNumberCitationLast, endRetrieveMarker, endRetrieveTableMarker, endRoot, endRow, endStatic, endTable, endWrapper, getFontInfo, getUserAgent, image, pageRef, restoreState, restoreState, startBlock, startBlockContainer, startBody, startCell, startColumn, startFlow, startFooter, startFootnote, startFootnoteBody, startHeader, startInline, startInstreamForeignObject, startLeader, startLink, startList, startListBody, startListItem, startListLabel, startMarkup, startPageNumber, startPageNumberCitation, startPageNumberCitationLast, startRetrieveMarker, startRetrieveTableMarker, startRow, startStatic, startTable, startWrapper
-
Field Details
-
model
The AreaTreeModel in use
-
-
Constructor Details
-
AreaTreeHandler
public AreaTreeHandler(FOUserAgent userAgent, String outputFormat, OutputStream stream) throws FOPException Constructor.- Parameters:
userAgent
- FOUserAgent object for processoutputFormat
- the MIME type of the output format to use (ex. "application/pdf").stream
- OutputStream- Throws:
FOPException
- if the RenderPagesModel cannot be created
-
-
Method Details
-
setupModel
protected void setupModel(FOUserAgent userAgent, String outputFormat, OutputStream stream) throws FOPException Sets up the AreaTreeModel instance for use by the AreaTreeHandler.- Parameters:
userAgent
- FOUserAgent object for processoutputFormat
- the MIME type of the output format to use (ex. "application/pdf").stream
- OutputStream- Throws:
FOPException
- if the RenderPagesModel cannot be created
-
getAreaTreeModel
Get the area tree model for this area tree.- Returns:
- AreaTreeModel the model being used for this area tree
-
getLayoutManagerMaker
Get the LayoutManager maker for this area tree.- Returns:
- LayoutManagerMaker the LayoutManager maker being used for this area tree
-
getIDTracker
Get the IDTracker for this area tree.- Returns:
- IDTracker used to track reference ids for items in this area tree
-
getResults
Get information about the rendered output, like number of pages created.- Overrides:
getResults
in classFOEventHandler
- Returns:
- the results structure
-
isComplexScriptFeaturesEnabled
public boolean isComplexScriptFeaturesEnabled()Check whether complex script features are enabled.- Returns:
- true if using complex script features
-
startDocument
Prepare AreaTreeHandler for document processing This is called from FOTreeBuilder.startDocument()- Overrides:
startDocument
in classFOEventHandler
- Throws:
SAXException
- if there is an error
-
startRoot
Description copied from class:FOEventHandler
Called upon start of root element.- Overrides:
startRoot
in classFOEventHandler
- Parameters:
root
- element
-
startPageSequence
- Overrides:
startPageSequence
in classFOEventHandler
- Parameters:
pageSequence
- PageSequence that is starting.
-
endPageSequence
End the PageSequence. The PageSequence formats Pages and adds them to the AreaTree. The area tree then handles what happens with the pages.- Overrides:
endPageSequence
in classFOEventHandler
- Parameters:
pageSequence
- the page sequence ending
-
startExternalDocument
Process the start of the external-document extension.- Overrides:
startExternalDocument
in classFOEventHandler
- Parameters:
document
- the external-document node
-
endExternalDocument
Process the end of the external-document extension.- Overrides:
endExternalDocument
in classFOEventHandler
- Parameters:
document
- the external-document node
-
notifyPageSequenceFinished
Called by the PageSequenceLayoutManager when it is finished with a page-sequence.- Parameters:
pageSequence
- the page-sequence just finishedpageCount
- The number of pages generated for the page-sequence
-
endDocument
End the document.- Overrides:
endDocument
in classFOEventHandler
- Throws:
SAXException
- if there is some error
-
generatePageViewportKey
Generates and returns a unique key for a page viewport.- Returns:
- the generated key.
-
associateIDWithPageViewport
Deprecated.use getIDTracker().associateIDWithPageViewport(id, pv) insteadTie a PageViewport with an ID found on a child area of the PV. Note that an area with a given ID may be on more than one PV, hence an ID may have more than one PV associated with it.- Parameters:
id
- the property ID of the areapv
- a page viewport that contains the area with this ID
-
signalPendingID
Deprecated.use getIDTracker().signalPendingID(id) insteadThis method tie an ID to the areaTreeHandler until this one is ready to be processed. This is used in page-number-citation-last processing so we know when an id can be resolved.- Parameters:
id
- the id of the object being processed
-
signalIDProcessed
Deprecated.use getIDTracker().signalIDProcessed(id) insteadSignals that all areas for the formatting object with the given ID have been generated. This is used to determine when page-number-citation-last ref-ids can be resolved.- Parameters:
id
- the id of the formatting object which was just finished
-
alreadyResolvedID
Deprecated.use getIDTracker().alreadyResolvedID(id) insteadCheck if an ID has already been resolved- Parameters:
id
- the id to check- Returns:
- true if the ID has been resolved
-
tryIDResolution
Deprecated.use getIDTracker().tryIDResolution(pv) insteadTries to resolve all unresolved ID references on the given page.- Parameters:
pv
- page viewport whose ID refs to resolve
-
getPageViewportsContainingID
Deprecated.use getIDTracker().getPageViewportsContainingID(id) insteadGet the set of page viewports that have an area with a given id.- Parameters:
id
- the id to lookup- Returns:
- the list of PageViewports
-
addUnresolvedIDRef
Deprecated.use getIDTracker().addUnresolvedIDRef(idref, res) insteadAdd an Resolvable object with an unresolved idref- Parameters:
idref
- the idref whose target id has not yet been locatedres
- the Resolvable object needing the idref to be resolved
-