Package org.apache.fop.layoutmgr
Class PageBreaker
java.lang.Object
org.apache.fop.layoutmgr.AbstractBreaker
org.apache.fop.layoutmgr.PageBreaker
Handles the breaking of pages in an fo:flow
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.fop.layoutmgr.AbstractBreaker
AbstractBreaker.BlockSequence, AbstractBreaker.FloatPosition, AbstractBreaker.PageBreakPosition
-
Field Summary
Fields inherited from class org.apache.fop.layoutmgr.AbstractBreaker
alignment, blockListIndex, blockLists, firstElementsForRestart, footnoteSeparatorLength, log, originalRestartAtLM, positionAtBreak, pslm
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAreas
(PositionIterator posIter, LayoutContext context) Adds an area to the flow layout managerprotected void
addAreasForFloats
(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int startPart, int partCount, AbstractBreaker.BlockSequence originalList, AbstractBreaker.BlockSequence effectiveList, LayoutContext childLC, int lastBreak, int startElementIndex, int endElementIndex) protected org.apache.fop.layoutmgr.PageBreakingAlgorithm.PageBreakingLayoutListener
Creates and returns a PageBreakingLayoutListener for the PageBreakingAlgorithm to notify about layout problems.protected void
doPhase3
(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int partCount, AbstractBreaker.BlockSequence originalList, AbstractBreaker.BlockSequence effectiveList) Phase 3 of Knuth algorithm: Adds the areasprotected void
finishPart
(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, AbstractBreaker.PageBreakPosition pbp) Finish part.protected FlowLayoutManager
protected int
protected int
protected int
static List<List<KnuthElement>>
getFootnoteKnuthElements
(FlowLayoutManager flowLM, LayoutContext context, List<FootnoteBodyLayoutManager> footnoteBodyLMs) protected int
getNextBlockList
(LayoutContext childLC, int nextSequenceStartsOn) Gets the next block list (sequence) and adds it to a list of block lists if it's not empty.protected int
getNextBlockList
(LayoutContext childLC, int nextSequenceStartsOn, Position positionAtIPDChange, LayoutManager restartLM, List firstElements) Gets the next block list (sequence) and adds it to a list of block lists if it's not empty.protected List
getNextKnuthElements
(LayoutContext context, int alignment) Get a sequence of KnuthElements representing the content of the node assigned to the LMprotected List
getNextKnuthElements
(LayoutContext context, int alignment, Position positionAtIPDChange, LayoutManager restartAtLM) Get a sequence of KnuthElements representing the content of the node assigned to the LMint
protected PageProvider
Returns the PageProvider if any.protected LayoutManager
protected void
This method is called when no content is available for a part.protected void
handleEndOfFloat
(int fHeight) protected int
handleFloatLayout
(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int optimalPageCount, AbstractBreaker.BlockSequence blockList, LayoutContext childLC) protected int
handleSpanChange
(LayoutContext childLC, int nextSequenceStartsOn) Handles span changes reported through theLayoutContext
.protected void
handleStartOfFloat
(int fHeight, int fYOffset) protected boolean
protected boolean
protected boolean
protected boolean
void
holdFootnotes
(List fl, List ll, int tfl, int ifl, boolean fp, boolean nf, int fnfi, int fli, int fei, MinOptMax fsl, int pfli, int pfei) protected boolean
lastPageHasIPDChange
(int optimalPageCount) protected void
observeElementList
(List elementList) Used for debugging purposes.protected void
prepareToRedoLayout
(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int partCount, AbstractBreaker.BlockSequence originalList, AbstractBreaker.BlockSequence effectiveList) void
retrieveFootones
(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg) protected boolean
protected boolean
shouldRedoLayout
(int partCount) protected void
startPart
(AbstractBreaker.BlockSequence list, int breakClass, boolean emptyContent) Start part.protected void
updateLayoutContext
(LayoutContext context) Used to update the LayoutContext in subclasses prior to starting a new element list.protected boolean
Methods inherited from class org.apache.fop.layoutmgr.AbstractBreaker
addAreas, addAreas, addAreas, containsNonRestartableLM, createLayoutContext, doLayout, isEmpty, isPartOverflowRecoveryActivated, isSinglePartFavored
-
Constructor Details
-
PageBreaker
Construct page breaker.- Parameters:
pslm
- the page sequence layout manager
-
-
Method Details
-
updateLayoutContext
Used to update the LayoutContext in subclasses prior to starting a new element list.- Overrides:
updateLayoutContext
in classAbstractBreaker
- Parameters:
context
- the LayoutContext to update
-
getTopLevelLM
- Specified by:
getTopLevelLM
in classAbstractBreaker
- Returns:
- top level layout manager
-
getPageProvider
Returns the PageProvider if any. PageBreaker overrides this method because each page may have a different available BPD which needs to be accessible to the breaking algorithm.- Overrides:
getPageProvider
in classAbstractBreaker
- Returns:
- the applicable PageProvider, or null if not applicable
-
createLayoutListener
protected org.apache.fop.layoutmgr.PageBreakingAlgorithm.PageBreakingLayoutListener createLayoutListener()Creates and returns a PageBreakingLayoutListener for the PageBreakingAlgorithm to notify about layout problems.- Overrides:
createLayoutListener
in classAbstractBreaker
- Returns:
- the listener instance or null if no notifications are needed
-
handleSpanChange
Handles span changes reported through theLayoutContext
. Only used by the PSLM and called bygetNextBlockList()
.- Overrides:
handleSpanChange
in classAbstractBreaker
- Parameters:
childLC
- the LayoutContextnextSequenceStartsOn
- previous value for break handling- Returns:
- effective value for break handling
-
getNextBlockList
Gets the next block list (sequence) and adds it to a list of block lists if it's not empty.- Overrides:
getNextBlockList
in classAbstractBreaker
- Parameters:
childLC
- LayoutContext to usenextSequenceStartsOn
- indicates on what page the next sequence should start- Returns:
- the page on which the next content should appear after a hard break
-
getNextBlockList
protected int getNextBlockList(LayoutContext childLC, int nextSequenceStartsOn, Position positionAtIPDChange, LayoutManager restartLM, List firstElements) Gets the next block list (sequence) and adds it to a list of block lists if it's not empty.- Overrides:
getNextBlockList
in classAbstractBreaker
- Parameters:
childLC
- LayoutContext to usenextSequenceStartsOn
- indicates on what page the next sequence should startpositionAtIPDChange
- last element on the part before an IPD changerestartLM
- the layout manager from which to restart, if IPD change occurs between two LMsfirstElements
- elements from non-restartable LMs on the new page- Returns:
- the page on which the next content should appear after a hard break
-
getFootnoteKnuthElements
public static List<List<KnuthElement>> getFootnoteKnuthElements(FlowLayoutManager flowLM, LayoutContext context, List<FootnoteBodyLayoutManager> footnoteBodyLMs) -
getNextKnuthElements
Get a sequence of KnuthElements representing the content of the node assigned to the LM- Specified by:
getNextKnuthElements
in classAbstractBreaker
- Parameters:
context
- the LayoutContext used to store layout informationalignment
- the desired text alignment- Returns:
- the list of KnuthElements
-
getNextKnuthElements
protected List getNextKnuthElements(LayoutContext context, int alignment, Position positionAtIPDChange, LayoutManager restartAtLM) Get a sequence of KnuthElements representing the content of the node assigned to the LM- Overrides:
getNextKnuthElements
in classAbstractBreaker
- Parameters:
context
- the LayoutContext used to store layout informationalignment
- the desired text alignmentpositionAtIPDChange
- last element on the part before an IPD changerestartAtLM
- the layout manager from which to restart, if IPD change occurs between two LMs- Returns:
- the list of KnuthElements
-
getCurrentDisplayAlign
protected int getCurrentDisplayAlign()- Specified by:
getCurrentDisplayAlign
in classAbstractBreaker
- Returns:
- current display alignment
-
hasMoreContent
protected boolean hasMoreContent()- Specified by:
hasMoreContent
in classAbstractBreaker
- Returns:
- whether or not this flow has more page break opportunities
-
addAreas
Adds an area to the flow layout manager- Specified by:
addAreas
in classAbstractBreaker
- Parameters:
posIter
- the position iteratorcontext
- the layout context
-
doPhase3
protected void doPhase3(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int partCount, AbstractBreaker.BlockSequence originalList, AbstractBreaker.BlockSequence effectiveList) Phase 3 of Knuth algorithm: Adds the areas This implementation checks whether to trigger column-balancing, or whether to take into account a 'last-page' condition.- Specified by:
doPhase3
in classAbstractBreaker
- Parameters:
alg
- PageBreakingAlgorithm instance which determined the breakspartCount
- number of parts (pages) to be renderedoriginalList
- original Knuth element listeffectiveList
- effective Knuth element list (after adjustments)
-
prepareToRedoLayout
protected void prepareToRedoLayout(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int partCount, AbstractBreaker.BlockSequence originalList, AbstractBreaker.BlockSequence effectiveList) - Overrides:
prepareToRedoLayout
in classAbstractBreaker
-
startPart
Start part.- Overrides:
startPart
in classAbstractBreaker
- Parameters:
list
- a block sequencebreakClass
- a break class
-
handleEmptyContent
protected void handleEmptyContent()This method is called when no content is available for a part. Used to force empty pages.- Overrides:
handleEmptyContent
in classAbstractBreaker
-
finishPart
protected void finishPart(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, AbstractBreaker.PageBreakPosition pbp) Finish part.- Specified by:
finishPart
in classAbstractBreaker
- Parameters:
alg
- a page breaking algorithmpbp
- a page break posittion
-
getCurrentChildLM
- Specified by:
getCurrentChildLM
in classAbstractBreaker
- Returns:
- current child layout manager
-
observeElementList
Used for debugging purposes. Notifies all registered observers about the element list. Override to set different parameters.- Overrides:
observeElementList
in classAbstractBreaker
- Parameters:
elementList
- the Knuth element list
-
shouldRedoLayout
protected boolean shouldRedoLayout()- Overrides:
shouldRedoLayout
in classAbstractBreaker
-
shouldRedoLayout
protected boolean shouldRedoLayout(int partCount) -
wasLayoutRedone
protected boolean wasLayoutRedone()- Overrides:
wasLayoutRedone
in classAbstractBreaker
-
lastPageHasIPDChange
protected boolean lastPageHasIPDChange(int optimalPageCount) - Overrides:
lastPageHasIPDChange
in classAbstractBreaker
-
handlingStartOfFloat
protected boolean handlingStartOfFloat() -
handleStartOfFloat
protected void handleStartOfFloat(int fHeight, int fYOffset) -
getFloatHeight
protected int getFloatHeight() -
getFloatYOffset
protected int getFloatYOffset() -
handlingEndOfFloat
protected boolean handlingEndOfFloat() -
handleEndOfFloat
protected void handleEndOfFloat(int fHeight) -
handlingFloat
protected boolean handlingFloat() -
getOffsetDueToFloat
public int getOffsetDueToFloat() -
handleFloatLayout
protected int handleFloatLayout(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int optimalPageCount, AbstractBreaker.BlockSequence blockList, LayoutContext childLC) - Overrides:
handleFloatLayout
in classAbstractBreaker
-
addAreasForFloats
protected void addAreasForFloats(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int startPart, int partCount, AbstractBreaker.BlockSequence originalList, AbstractBreaker.BlockSequence effectiveList, LayoutContext childLC, int lastBreak, int startElementIndex, int endElementIndex) - Overrides:
addAreasForFloats
in classAbstractBreaker
-
holdFootnotes
-
retrieveFootones
public void retrieveFootones(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg)
-