Class PageBreaker


  • public class PageBreaker
    extends AbstractBreaker
    Handles the breaking of pages in an fo:flow
    • Constructor Detail

      • PageBreaker

        public PageBreaker​(PageSequenceLayoutManager pslm)
        Construct page breaker.
        Parameters:
        pslm - the page sequence layout manager
    • Method Detail

      • updateLayoutContext

        protected void updateLayoutContext​(LayoutContext context)
        Used to update the LayoutContext in subclasses prior to starting a new element list.
        Overrides:
        updateLayoutContext in class AbstractBreaker
        Parameters:
        context - the LayoutContext to update
      • 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.
        Overrides:
        getPageProvider in class AbstractBreaker
        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 class AbstractBreaker
        Returns:
        the listener instance or null if no notifications are needed
      • handleSpanChange

        protected int handleSpanChange​(LayoutContext childLC,
                                       int nextSequenceStartsOn)
        Handles span changes reported through the LayoutContext. Only used by the PSLM and called by getNextBlockList().
        Overrides:
        handleSpanChange in class AbstractBreaker
        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.
        Overrides:
        getNextBlockList in class AbstractBreaker
        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
      • getNextBlockList

        protected int getNextBlockList​(LayoutContext childLC,
                                       int nextSequenceStartsOn,
                                       Position positionAtIPDChange,
                                       LayoutManager restartLM,
                                       java.util.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 class AbstractBreaker
        Parameters:
        childLC - LayoutContext to use
        nextSequenceStartsOn - indicates on what page the next sequence should start
        positionAtIPDChange - last element on the part before an IPD change
        restartLM - the layout manager from which to restart, if IPD change occurs between two LMs
        firstElements - elements from non-restartable LMs on the new page
        Returns:
        the page on which the next content should appear after a hard break
      • getNextKnuthElements

        protected java.util.List getNextKnuthElements​(LayoutContext context,
                                                      int alignment)
        Get a sequence of KnuthElements representing the content of the node assigned to the LM
        Specified by:
        getNextKnuthElements in class AbstractBreaker
        Parameters:
        context - the LayoutContext used to store layout information
        alignment - the desired text alignment
        Returns:
        the list of KnuthElements
      • getNextKnuthElements

        protected java.util.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 class AbstractBreaker
        Parameters:
        context - the LayoutContext used to store layout information
        alignment - the desired text alignment
        positionAtIPDChange - last element on the part before an IPD change
        restartAtLM - the layout manager from which to restart, if IPD change occurs between two LMs
        Returns:
        the list of KnuthElements
      • hasMoreContent

        protected boolean hasMoreContent()
        Specified by:
        hasMoreContent in class AbstractBreaker
        Returns:
        whether or not this flow has more page break opportunities
      • 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 class AbstractBreaker
        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)
      • handleEmptyContent

        protected void handleEmptyContent()
        This method is called when no content is available for a part. Used to force empty pages.
        Overrides:
        handleEmptyContent in class AbstractBreaker
      • 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.
        Overrides:
        observeElementList in class AbstractBreaker
        Parameters:
        elementList - the Knuth element list
      • shouldRedoLayout

        protected boolean shouldRedoLayout​(int partCount)
      • 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()
      • holdFootnotes

        public void holdFootnotes​(java.util.List fl,
                                  java.util.List ll,
                                  int tfl,
                                  int ifl,
                                  boolean fp,
                                  boolean nf,
                                  int fnfi,
                                  int fli,
                                  int fei,
                                  MinOptMax fsl,
                                  int pfli,
                                  int pfei)
      • retrieveFootones

        public void retrieveFootones​(org.apache.fop.layoutmgr.PageBreakingAlgorithm alg)