fop 0.95

org.apache.fop.layoutmgr
Class AbstractBreaker

java.lang.Object
  extended by org.apache.fop.layoutmgr.AbstractBreaker
Direct Known Subclasses:
PageBreaker

public abstract class AbstractBreaker
extends java.lang.Object

Abstract base class for breakers (page breakers, static region handlers etc.).


Nested Class Summary
 class AbstractBreaker.BlockSequence
           
static class AbstractBreaker.PageBreakPosition
           
 
Field Summary
protected  int alignment
           
protected  MinOptMax footnoteSeparatorLength
           
protected static org.apache.commons.logging.Log log
          logging instance
 
Constructor Summary
AbstractBreaker()
           
 
Method Summary
protected  void addAreas(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int partCount, AbstractBreaker.BlockSequence originalList, AbstractBreaker.BlockSequence effectiveList)
          Phase 3 of Knuth algorithm: Adds the areas
protected  void addAreas(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int startPart, int partCount, AbstractBreaker.BlockSequence originalList, AbstractBreaker.BlockSequence effectiveList)
          Phase 3 of Knuth algorithm: Adds the areas
protected abstract  void addAreas(PositionIterator posIter, LayoutContext context)
           
protected  LayoutContext createLayoutContext()
          Creates the top-level LayoutContext for the breaker operation.
 void doLayout(int flowBPD)
          Starts the page breaking process.
 void doLayout(int flowBPD, boolean autoHeight)
          Starts the page breaking process.
protected abstract  void doPhase3(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, int partCount, AbstractBreaker.BlockSequence originalList, AbstractBreaker.BlockSequence effectiveList)
          Phase 3 of Knuth algorithm: Adds the areas
protected abstract  void finishPart(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg, AbstractBreaker.PageBreakPosition pbp)
           
protected abstract  LayoutManager getCurrentChildLM()
           
protected abstract  int getCurrentDisplayAlign()
           
protected  PageBreakingAlgorithm.PageBreakingLayoutListener getLayoutListener()
          Returns a PageBreakingLayoutListener for the PageBreakingAlgorithm to notify about layout problems.
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 abstract  java.util.LinkedList getNextKnuthElements(LayoutContext context, int alignment)
           
protected  PageProvider getPageProvider()
          Returns the PageProvider if any.
protected abstract  LayoutManager getTopLevelLM()
           
protected  void handleEmptyContent()
          This method is called when no content is available for a part.
protected  int handleSpanChange(LayoutContext childLC, int nextSequenceStartsOn)
          Handles span changes reported through the LayoutContext.
protected abstract  boolean hasMoreContent()
           
 boolean isEmpty()
           
protected  boolean isPartOverflowRecoveryActivated()
          Controls the behaviour of the algorithm in cases where the first element of a part overflows a line/page.
protected  boolean isSinglePartFavored()
           
protected  void observeElementList(java.util.List elementList)
          Used for debugging purposes.
protected  void startPart(AbstractBreaker.BlockSequence list, int breakClass)
           
protected  void updateLayoutContext(LayoutContext context)
          Used to update the LayoutContext in subclasses prior to starting a new element list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
logging instance


alignment

protected int alignment

footnoteSeparatorLength

protected MinOptMax footnoteSeparatorLength
Constructor Detail

AbstractBreaker

public AbstractBreaker()
Method Detail

getCurrentDisplayAlign

protected abstract int getCurrentDisplayAlign()

hasMoreContent

protected abstract boolean hasMoreContent()

addAreas

protected abstract void addAreas(PositionIterator posIter,
                                 LayoutContext context)

getTopLevelLM

protected abstract LayoutManager getTopLevelLM()

getCurrentChildLM

protected abstract LayoutManager getCurrentChildLM()

isPartOverflowRecoveryActivated

protected boolean isPartOverflowRecoveryActivated()
Controls the behaviour of the algorithm in cases where the first element of a part overflows a line/page.

Returns:
true if the algorithm should try to send the element to the next line/page.

isSinglePartFavored

protected boolean isSinglePartFavored()
Returns:
true if one a single part should be produced if possible (ex. for block-containers)

getPageProvider

protected PageProvider 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.

Returns:
the applicable PageProvider, or null if not applicable

getLayoutListener

protected PageBreakingAlgorithm.PageBreakingLayoutListener getLayoutListener()
Returns a PageBreakingLayoutListener for the PageBreakingAlgorithm to notify about layout problems.

Returns:
the listener instance or null if no notifications are needed

getNextKnuthElements

protected abstract java.util.LinkedList getNextKnuthElements(LayoutContext context,
                                                             int alignment)

isEmpty

public boolean isEmpty()
Returns:
true if there's no content that could be handled.

startPart

protected void startPart(AbstractBreaker.BlockSequence list,
                         int breakClass)

handleEmptyContent

protected void handleEmptyContent()
This method is called when no content is available for a part. Used to force empty pages.


finishPart

protected abstract void finishPart(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg,
                                   AbstractBreaker.PageBreakPosition pbp)

createLayoutContext

protected LayoutContext createLayoutContext()
Creates the top-level LayoutContext for the breaker operation.

Returns:
the top-level LayoutContext

updateLayoutContext

protected void updateLayoutContext(LayoutContext context)
Used to update the LayoutContext in subclasses prior to starting a new element list.

Parameters:
context - the LayoutContext to update

observeElementList

protected void observeElementList(java.util.List elementList)
Used for debugging purposes. Notifies all registered observers about the element list. Override to set different parameters.

Parameters:
elementList - the Knuth element list

doLayout

public void doLayout(int flowBPD)
Starts the page breaking process.

Parameters:
flowBPD - the constant available block-progression-dimension (used for every part)

doLayout

public void doLayout(int flowBPD,
                     boolean autoHeight)
Starts the page breaking process.

Parameters:
flowBPD - the constant available block-progression-dimension (used for every part)
autoHeight - true if warnings about overflows should be disabled because the the BPD is really undefined (for footnote-separators, for example)

doPhase3

protected abstract void doPhase3(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg,
                                 int partCount,
                                 AbstractBreaker.BlockSequence originalList,
                                 AbstractBreaker.BlockSequence effectiveList)
Phase 3 of Knuth algorithm: Adds the areas

Parameters:
alg - PageBreakingAlgorithm instance which determined the breaks
partCount - number of parts (pages) to be rendered
originalList - original Knuth element list
effectiveList - effective Knuth element list (after adjustments)

addAreas

protected void addAreas(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg,
                        int partCount,
                        AbstractBreaker.BlockSequence originalList,
                        AbstractBreaker.BlockSequence effectiveList)
Phase 3 of Knuth algorithm: Adds the areas

Parameters:
alg - PageBreakingAlgorithm instance which determined the breaks
partCount - number of parts (pages) to be rendered
originalList - original Knuth element list
effectiveList - effective Knuth element list (after adjustments)

addAreas

protected void addAreas(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg,
                        int startPart,
                        int partCount,
                        AbstractBreaker.BlockSequence originalList,
                        AbstractBreaker.BlockSequence effectiveList)
Phase 3 of Knuth algorithm: Adds the areas

Parameters:
alg - PageBreakingAlgorithm instance which determined the breaks
startPart - index of the first part (page) to be rendered
partCount - number of parts (pages) to be rendered
originalList - original Knuth element list
effectiveList - effective Knuth element list (after adjustments)

handleSpanChange

protected int handleSpanChange(LayoutContext childLC,
                               int nextSequenceStartsOn)
Handles span changes reported through the LayoutContext. Only used by the PSLM and called by getNextBlockList().

Parameters:
childLC - the LayoutContext
nextSequenceStartsOn - previous value for break handling
Returns:
effective value for break handling

getNextBlockList

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.

Parameters:
childLC - LayoutContext to use
nextSequenceStartsOn - indicates on what page the next sequence should start
Returns:
the page on which the next content should appear after a hard break

fop 0.95

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.