org.apache.fop.layoutmgr

## Class AbstractBaseLayoutManager

- java.lang.Object
- - org.apache.fop.layoutmgr.AbstractBaseLayoutManager

- All Implemented Interfaces:
    PercentBaseContext, LayoutManager
  Direct Known Subclasses:
    AbstractLayoutManager, ContentLayoutManager

      public abstract class AbstractBaseLayoutManager
      extends Object
      implements LayoutManager, PercentBaseContext

  The base class for nearly all LayoutManagers. Provides the functionality for merging the `LayoutManager` and the `PercentBaseContext` interfaces into a common base class for all higher LayoutManagers.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected FObj` | `fobj` The formatting object for this LM.
    `protected boolean` | `generatesBlockArea` Indicator if this LM generates block areas.
    `protected boolean` | `generatesReferenceArea` Indicator if this LM generates reference areas.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractBaseLayoutManager()` Abstract base layout manager.
    `AbstractBaseLayoutManager(FObj fo)` Abstract base layout manager.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `getAncestorBlockAreaBPD()` Find the first ancestor area that is a block area and returns its BPD.
    `protected int` | `getAncestorBlockAreaIPD()` Find the first ancestor area that is a block area and returns its IPD.
    `int` | `getBaseLength(int lengthBase, FObj fobjx)` Returns the base length for the given length base.
    `List<ChangeBar>` | `getChangeBarList()` Returns the active change bar list.
    `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<ListElement>` | `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.
    `protected int` | `getParentAreaBPD()` Find the parent area and returns its BPD.
    `protected int` | `getParentAreaIPD()` Find the parent area and returns its IPD.
    `protected int` | `getReferenceAreaBPD()` Find the first ancestor area that is a reference area and returns its BPD.
    `int` | `getReferenceAreaIPD()` Find the first ancestor area that is a reference area and returns its IPD.
    `boolean` | `isFromFootnote()`
    `boolean` | `isRestartable()` Returns `true` if this layout manager is able to re-generate its Knuth elements after an IPD change.
    `void` | `preserveChildrenAtEndOfLayout()`
    `void` | `recreateChildrenLMs()`
    `void` | `reset()` Re-initializes this layout manager in order to re-generate its Knuth elements according to a new IPD value.
    `void` | `setFromFootnote(boolean fromFootnote)`
    `protected void` | `setGeneratesBlockArea(boolean generatesBlockArea)` Lets implementing LM set the flag indicating if they generate block areas.
    `protected void` | `setGeneratesReferenceArea(boolean generatesReferenceArea)` Lets implementing LM set the flag indicating if they generate reference areas.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.fop.layoutmgr.LayoutManager

      `addAreas, addChildArea, addChildLM, addChildLMs, createNextChildLMs, getBaselineOffset, getChangedKnuthElements, getChildLMs, getNextKnuthElements, getParent, getParentArea, getPSLM, hasLineAreaDescendant, initialize, isFinished, notifyPos, setFinished, setParent`

- - ### Field Detail

    - #### generatesReferenceArea

          protected boolean generatesReferenceArea

      Indicator if this LM generates reference areas.

    - #### generatesBlockArea

          protected boolean generatesBlockArea

      Indicator if this LM generates block areas.

    - #### fobj

          protected final FObj fobj

      The formatting object for this LM.

  - ### Constructor Detail

    - #### AbstractBaseLayoutManager

          public AbstractBaseLayoutManager()

      Abstract base layout manager.

    - #### AbstractBaseLayoutManager

          public AbstractBaseLayoutManager(FObj fo)

      Abstract base layout manager.
      Parameters:
        `fo` - the formatting object for this layout manager

  - ### Method Detail

    - #### getBaseLength

          public int getBaseLength(int lengthBase,
                                   FObj fobjx)

      Returns the base length for the given length base. Length base should be one of the constants defined in `LengthBase`.
      Specified by:
        `getBaseLength` in interface `PercentBaseContext`
      Parameters:
        `lengthBase` - Indicates which type of the base length value is to be returned
        `fobjx` - The FO object against which the percentage should be evaluated
      Returns:
        The base length value of the given kind

    - #### getAncestorBlockAreaIPD

          protected int getAncestorBlockAreaIPD()

      Find the first ancestor area that is a block area and returns its IPD.
      Returns:
        the ipd of the ancestor block area

    - #### getAncestorBlockAreaBPD

          protected int getAncestorBlockAreaBPD()

      Find the first ancestor area that is a block area and returns its BPD.
      Returns:
        the bpd of the ancestor block area

    - #### getParentAreaIPD

          protected int getParentAreaIPD()

      Find the parent area and returns its IPD.
      Returns:
        the ipd of the parent area

    - #### getParentAreaBPD

          protected int getParentAreaBPD()

      Find the parent area and returns its BPD.
      Returns:
        the bpd of the parent area

    - #### getReferenceAreaIPD

          public int getReferenceAreaIPD()

      Find the first ancestor area that is a reference area and returns its IPD.
      Returns:
        the ipd of the ancestor reference area

    - #### getReferenceAreaBPD

          protected int getReferenceAreaBPD()

      Find the first ancestor area that is a reference area and returns its BPD.
      Returns:
        the bpd of the ancestor reference area

    - #### getContentAreaIPD

          public int getContentAreaIPD()

      Returns the IPD of the content area NOTE: Should be overridden by subclasses. Default implementation throws an `UnsupportedOperationException`.
      Specified by:
        `getContentAreaIPD` in interface `LayoutManager`
      Returns:
        the IPD of the content area

    - #### getContentAreaBPD

          public int getContentAreaBPD()

      Description copied from interface: `LayoutManager`
      Returns the BPD of the content area
      Specified by:
        `getContentAreaBPD` in interface `LayoutManager`
      Returns:
        the BPD of the content area

    - #### getGeneratesReferenceArea

          public boolean getGeneratesReferenceArea()

      Returns an indication if the layout manager generates a reference area.
      Specified by:
        `getGeneratesReferenceArea` in interface `LayoutManager`
      Returns:
        True if the layout manager generates a reference area

    - #### setGeneratesReferenceArea

          protected void setGeneratesReferenceArea(boolean generatesReferenceArea)

      Lets implementing LM set the flag indicating if they generate reference areas.
      Parameters:
        `generatesReferenceArea` - if true the areas generates by this LM are reference areas.

    - #### getGeneratesBlockArea

          public boolean getGeneratesBlockArea()

      Returns an indication if the layout manager generates a block area.
      Specified by:
        `getGeneratesBlockArea` in interface `LayoutManager`
      Returns:
        True if the layout manager generates a block area

    - #### setGeneratesBlockArea

          protected void setGeneratesBlockArea(boolean generatesBlockArea)

      Lets implementing LM set the flag indicating if they generate block areas.
      Parameters:
        `generatesBlockArea` - if true the areas generates by this LM are block areas.

    - #### getGeneratesLineArea

          public boolean getGeneratesLineArea()

      Returns an indication if the layout manager generates a line area.
      Specified by:
        `getGeneratesLineArea` in interface `LayoutManager`
      Returns:
        True if the layout manager generates a line area

    - #### getFObj

          public FObj getFObj()

      Returns the fo this layout manager is associated with.
      Specified by:
        `getFObj` in interface `LayoutManager`
      Returns:
        The fo for this layout manager or null.

    - #### getChangeBarList

          public List<ChangeBar> getChangeBarList()

      Returns the active change bar list.
      Returns:
        The active change bar list

    - #### reset

          public void reset()

      Re-initializes this layout manager in order to re-generate its Knuth elements according to a new IPD value.
      Specified by:
        `reset` in interface `LayoutManager`

    - #### isRestartable

          public boolean isRestartable()

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

    - #### getNextKnuthElements

          public List<ListElement> 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.
      Specified by:
        `getNextKnuthElements` in interface `LayoutManager`
      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

    - #### preserveChildrenAtEndOfLayout

          public void preserveChildrenAtEndOfLayout()

    - #### recreateChildrenLMs

          public void recreateChildrenLMs()

    - #### isFromFootnote

          public boolean isFromFootnote()

      Specified by:
        `isFromFootnote` in interface `LayoutManager`

    - #### setFromFootnote

          public void setFromFootnote(boolean fromFootnote)

      Specified by:
        `setFromFootnote` in interface `LayoutManager`

Copyright © 2025 Apache Software Foundation. All rights reserved.