org.apache.fop.layoutmgr

## Interface LayoutManager

- All Superinterfaces:
    PercentBaseContext
  All Known Subinterfaces:
    BlockLevelLayoutManager, InlineLevelLayoutManager
  All Known Implementing Classes:
    AbstractBaseLayoutManager, AbstractGraphicsLayoutManager, AbstractLayoutManager, AbstractPageNumberCitationLayoutManager, AbstractPageSequenceLayoutManager, BasicLinkLayoutManager, BidiLayoutManager, BlockContainerLayoutManager, BlockLayoutManager, BlockStackingLayoutManager, CharacterLayoutManager, ContentLayoutManager, ExternalDocumentLayoutManager, ExternalGraphicLayoutManager, FloatContentLayoutManager, FloatLayoutManager, FlowLayoutManager, FootnoteBodyLayoutManager, FootnoteLayoutManager, InlineContainerLayoutManager, InlineLayoutManager, InlineStackingLayoutManager, InstreamForeignObjectLM, LeaderLayoutManager, LeafNodeLayoutManager, LineLayoutManager, ListBlockLayoutManager, ListItemContentLayoutManager, ListItemLayoutManager, MultiCaseLayoutManager, MultiSwitchLayoutManager, PageNumberCitationLastLayoutManager, PageNumberCitationLayoutManager, PageNumberLayoutManager, PageSequenceLayoutManager, RetrieveTableMarkerLayoutManager, SpacedBorderedPaddedBlockLayoutManager, StaticContentLayoutManager, TableAndCaptionLayoutManager, TableCaptionLayoutManager, TableCellLayoutManager, TableLayoutManager, TextLayoutManager, WrapperLayoutManager

      public interface LayoutManager
      extends PercentBaseContext

  The interface for all LayoutManagers.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAreas(PositionIterator posIter, LayoutContext context)` Tell the layout manager to add all the child areas implied by Position objects which will be returned by the Iterator.
    `void` | `addChildArea(Area childArea)` Add the area as a child of the current area.
    `void` | `addChildLM(LayoutManager lm)` Add the LM in the argument to the list of child LMs; set this LM as the parent; initialize the LM.
    `void` | `addChildLMs(List newLMs)` Add the LMs in the argument to the list of child LMs;
    `boolean` | `createNextChildLMs(int pos)` Create more child LMs of the parent, up to child LM index pos
    `int` | `getBaselineOffset()` Returns the position of the dominant-baseline of this FO's first descendant line-area.
    `List` | `getChangedKnuthElements(List oldList, int alignment)` Get a sequence of KnuthElements representing the content of the node assigned to the LM, after changes have been applied In the context of line breaking, this method is called after hyphenation has been performed, in order to receive the sequence of elements representing the text together with all possible hyphenation points.
    `List` | `getChildLMs()`
    `int` | `getContentAreaBPD()` Returns the BPD of the content area
    `int` | `getContentAreaIPD()` Returns the IPD of the content area
    `FObj` | `getFObj()` Returns the fo this layout manager is associated with.
    `boolean` | `getGeneratesBlockArea()` Returns an indication if the layout manager generates a block area.
    `boolean` | `getGeneratesLineArea()` Returns an indication if the layout manager generates a line area.
    `boolean` | `getGeneratesReferenceArea()` Returns an indication if the layout manager generates a reference area.
    `List` | `getNextKnuthElements(LayoutContext context, int alignment)` Get a sequence of KnuthElements representing the content of the node assigned to the LM.
    `List` | `getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, Position positionAtIPDChange, LayoutManager restartAtLM)` Returns an updated list of Knuth elements corresponding to this layout manager, after a change of IPD has been detected.
    `LayoutManager` | `getParent()` Get the parent layout manager.
    `Area` | `getParentArea(Area childArea)` Get the parent area for an area.
    `PageSequenceLayoutManager` | `getPSLM()` Get the active PageSequenceLayoutManager instance for this layout process.
    `boolean` | `hasLineAreaDescendant()` Whether the FO handled by this layout manager has a descendant (including itself) that will generate a line-area.
    `void` | `initialize()` initialize the layout manager.
    `boolean` | `isFinished()` Return a value indicating whether this LayoutManager has laid out all its content (or generated BreakPossibilities for all content.)
    `boolean` | `isRestartable()` Returns `true` if this layout manager is able to re-generate its Knuth elements after an IPD change.
    `Position` | `notifyPos(Position pos)` Adds a Position to the Position participating in the first|last determination by assigning it a unique position index.
    `void` | `reset()` Re-initializes this layout manager in order to re-generate its Knuth elements according to a new IPD value.
    `void` | `setFinished(boolean isFinished)` Set a flag indicating whether the LayoutManager has laid out all its content.
    `void` | `setParent(LayoutManager lm)` Set the parent layout manager.

    - ### Methods inherited from interface org.apache.fop.datatypes.PercentBaseContext

      `getBaseLength`

- - ### Method Detail

    - #### setParent

          void setParent(LayoutManager lm)

      Set the parent layout manager. The parent layout manager is required for adding areas.
      Parameters:
        `lm` - the parent layout manager

    - #### getParent

          LayoutManager getParent()

      Get the parent layout manager.
      Returns:
        the parent layout manager.

    - #### initialize

          void initialize()

      initialize the layout manager. Allows each layout manager to calculate often used values.

    - #### getPSLM

          PageSequenceLayoutManager getPSLM()

      Get the active PageSequenceLayoutManager instance for this layout process.
      Returns:
        the PageSequenceLayoutManager

    - #### isFinished

          boolean isFinished()

      Return a value indicating whether this LayoutManager has laid out all its content (or generated BreakPossibilities for all content.)
      Returns:
        true if this layout manager is finished

    - #### setFinished

          void setFinished(boolean isFinished)

      Set a flag indicating whether the LayoutManager has laid out all its content. This is generally called by the LM itself, but can be called by a parentLM when backtracking.
      Parameters:
        `isFinished` - the value to set the finished flag to

    - #### getParentArea

          Area getParentArea(Area childArea)

      Get the parent area for an area. This should get the parent depending on the class of the area passed in.
      Parameters:
        `childArea` - the child area to get the parent for
      Returns:
        the parent Area

    - #### addChildArea

          void addChildArea(Area childArea)

      Add the area as a child of the current area. This is called by child layout managers to add their areas as children of the current area.
      Parameters:
        `childArea` - the child area to add

    - #### addAreas

          void addAreas(PositionIterator posIter,
                        LayoutContext context)

      Tell the layout manager to add all the child areas implied by Position objects which will be returned by the Iterator.
      Parameters:
        `posIter` - the position iterator
        `context` - the context

    - #### createNextChildLMs

          boolean createNextChildLMs(int pos)

      Create more child LMs of the parent, up to child LM index pos
      Parameters:
        `pos` - index up to which child LMs are requested
      Returns:
        true if requested index does exist

    - #### getChildLMs

          List getChildLMs()

      Returns:
        the list of child LMs

    - #### addChildLM

          void addChildLM(LayoutManager lm)

      Add the LM in the argument to the list of child LMs; set this LM as the parent; initialize the LM.
      Parameters:
        `lm` - the LM to be added

    - #### addChildLMs

          void addChildLMs(List newLMs)

      Add the LMs in the argument to the list of child LMs;
      Parameters:
        `newLMs` - the list of LMs to be added

    - #### getNextKnuthElements

          List getNextKnuthElements(LayoutContext context,
                                    int alignment)

      Get a sequence of KnuthElements representing the content of the node assigned to the LM.
      Parameters:
        `context` - the LayoutContext used to store layout information
        `alignment` - the desired text alignment
      Returns:
        the list of KnuthElements

    - #### getChangedKnuthElements

          List getChangedKnuthElements(List oldList,
                                       int alignment)

      Get a sequence of KnuthElements representing the content of the node assigned to the LM, after changes have been applied In the context of line breaking, this method is called after hyphenation has been performed, in order to receive the sequence of elements representing the text together with all possible hyphenation points. For example, if the text "representation" originates a single box element when getNextKnuthElements() is called, it will be now split in syllables (rep-re-sen-ta-tion) each one originating a box and divided by additional elements allowing a line break. In the context of page breaking, this method is called only if the pages need to be "vertically justified" modifying (also) the quantity of lines created by the paragraphs, and after a first page breaking has been performed. According to the result of the first page breaking, each paragraph now knows how many lines it must create (among the existing layout possibilities) and has to create a sequence of elements representing this layout; in particular, each box, representing a line, will contain a LineBreakPositions that will be used in the addAreas() phase. LMs having children look at the old list of elements in order to know which ones they must get the new elements from, as break conditions of preserved linefeeds can divide children into smaller groups (page sequences or paragraphs). LMs having no children can simply return the old elements if they have nothing to change. Inline LMs need to know the text alignment because it affects the elements representing feasible breaks between syllables.
      Parameters:
        `oldList` - the elements to replace
        `alignment` - the desired text alignment
      Returns:
        the updated list of KnuthElements

    - #### hasLineAreaDescendant

          boolean hasLineAreaDescendant()

      Whether the FO handled by this layout manager has a descendant (including itself) that will generate a line-area.
      Returns:
        `true` if a descendant line-area will be generated, `false` otherwise

    - #### getBaselineOffset

          int getBaselineOffset()

      Returns the position of the dominant-baseline of this FO's first descendant line-area.

      The behavior of this method is undefined if this FO has no descendant line-area, and an exception may be thrown. See `hasLineAreaDescendant()`

      Returns:
        this FO's space-before plus the distance from the before-edge of its allocation-rectangle to the dominant-baseline of the first line-area descendant
      See Also:
        `hasLineAreaDescendant()`

    - #### getContentAreaIPD

          int getContentAreaIPD()

      Returns the IPD of the content area
      Returns:
        the IPD of the content area

    - #### getContentAreaBPD

          int getContentAreaBPD()

      Returns the BPD of the content area
      Returns:
        the BPD of the content area

    - #### getGeneratesReferenceArea

          boolean getGeneratesReferenceArea()

      Returns an indication if the layout manager generates a reference area.
      Returns:
        True if the layout manager generates a reference area

    - #### getGeneratesBlockArea

          boolean getGeneratesBlockArea()

      Returns an indication if the layout manager generates a block area.
      Returns:
        True if the layout manager generates a block area

    - #### getGeneratesLineArea

          boolean getGeneratesLineArea()

      Returns an indication if the layout manager generates a line area.
      Returns:
        True if the layout manager generates a line area

    - #### getFObj

          FObj getFObj()

      Returns the fo this layout manager is associated with.
      Returns:
        The fo for this layout manager or null.

    - #### notifyPos

          Position notifyPos(Position pos)

      Adds a Position to the Position participating in the first|last determination by assigning it a unique position index.
      Parameters:
        `pos` - the Position
      Returns:
        the same Position but with a position index

    - #### reset

          void reset()

      Re-initializes this layout manager in order to re-generate its Knuth elements according to a new IPD value.

    - #### isRestartable

          boolean isRestartable()

      Returns `true` if this layout manager is able to re-generate its Knuth elements after an IPD change.
      Returns:
        `true` if this layout manager can be restarted after an IPD change

    - #### getNextKnuthElements

          List getNextKnuthElements(LayoutContext context,
                                    int alignment,
                                    Stack lmStack,
                                    Position positionAtIPDChange,
                                    LayoutManager restartAtLM)

      Returns an updated list of Knuth elements corresponding to this layout manager, after a change of IPD has been detected.
      Parameters:
        `context` - the layout context
        `alignment` - the alignment
        `lmStack` - the stack of LMs that are active at the IPD change
        `positionAtIPDChange` - the position corresponding to the element finishing the page before the IPD change
        `restartAtLM` - if not null, the layout manager from which to restart. That is, the IPD change occurs between two block elements and not inside a paragraph
      Returns:
        an updated list of elements, taking the new IPD into account

Copyright © 2023 Apache Software Foundation. All rights reserved.