Class InlineStackingLayoutManager

All Implemented Interfaces:
PercentBaseContext, Constants, BreakOpportunity, InlineLevelLayoutManager, LayoutManager
Direct Known Subclasses:
FloatLayoutManager, FootnoteLayoutManager, InlineLayoutManager, LineLayoutManager

public abstract class InlineStackingLayoutManager extends AbstractLayoutManager implements InlineLevelLayoutManager, BreakOpportunity
Class modelling the commonalities of layoutmanagers for objects which stack children in the inline direction, such as Inline or Line. It should not be instantiated directly.
  • Field Details

    • extraBPD

      protected MinOptMax extraBPD
      Size of border and padding in BPD (ie, before and after).
    • childLC

      protected LayoutContext childLC
      The child layout context
  • Constructor Details

    • InlineStackingLayoutManager

      protected InlineStackingLayoutManager(FObj node)
      Create an inline stacking layout manager. This is used for fo's that create areas that contain inline areas.
      Parameters:
      node - the formatting object that creates the area
  • Method Details

    • setLMiter

      public void setLMiter(ListIterator iter)
      Set the iterator.
      Parameters:
      iter - the iterator for this LM
    • getExtraIPD

      protected MinOptMax getExtraIPD(boolean bNotFirst, boolean bNotLast)
      Returns the extra IPD needed for any leading or trailing fences for the current area.
      Parameters:
      bNotFirst - true if not the first area for this layout manager
      bNotLast - true if not the last area for this layout manager
      Returns:
      the extra IPD as a MinOptMax spec
    • hasLeadingFence

      protected boolean hasLeadingFence(boolean bNotFirst)
      Indication if the current area has a leading fence.
      Parameters:
      bNotFirst - true if not the first area for this layout manager
      Returns:
      the leading fence flag
    • hasTrailingFence

      protected boolean hasTrailingFence(boolean bNotLast)
      Indication if the current area has a trailing fence.
      Parameters:
      bNotLast - true if not the last area for this layout manager
      Returns:
      the trailing fence flag
    • getSpaceStart

      protected SpaceProperty getSpaceStart()
      Get the space at the start of the inline area.
      Returns:
      the space property describing the space
    • getSpaceEnd

      protected SpaceProperty getSpaceEnd()
      Get the space at the end of the inline area.
      Returns:
      the space property describing the space
    • getCurrentArea

      protected Area getCurrentArea()
      Returns the current area.
      Returns:
      the current area
    • setCurrentArea

      protected void setCurrentArea(Area area)
      Set the current area.
      Parameters:
      area - the current area
    • setTraits

      protected void setTraits(boolean bNotFirst, boolean bNotLast)
      Trait setter to be overridden by subclasses.
      Parameters:
      bNotFirst - true if this is not the first child area added
      bNotLast - true if this is not the last child area added
    • setChildContext

      protected void setChildContext(LayoutContext lc)
      Set the current child layout context
      Parameters:
      lc - the child layout context
    • getContext

      protected LayoutContext getContext()
      Current child layout context
      Returns:
      the current child layout context
    • addSpace

      protected void addSpace(Area parentArea, MinOptMax spaceRange, double spaceAdjust)
      Adds a space to the area.
      Parameters:
      parentArea - the area to which to add the space
      spaceRange - the space range specifier
      spaceAdjust - the factor by which to stretch or shrink the space
    • addALetterSpaceTo

      public List addALetterSpaceTo(List oldList)
      Tell the LM to modify its data, adding a letter space to the word fragment represented by the given elements, and returning the corrected elements
      Specified by:
      addALetterSpaceTo in interface InlineLevelLayoutManager
      Parameters:
      oldList - the elements which must be given one more letter space
      Returns:
      the new elements replacing the old ones
    • addALetterSpaceTo

      public List addALetterSpaceTo(List oldList, int thisDepth)
      Tell the LM to modify its data, adding a letter space to the word fragment represented by the given elements, and returning the corrected elements
      Specified by:
      addALetterSpaceTo in interface InlineLevelLayoutManager
      Parameters:
      oldList - the elements which must be given one more letter space
      thisDepth - the depth at which the Positions for this LM in oldList are found
      Returns:
      the new elements replacing the old ones
    • getWordChars

      public String getWordChars(Position pos)
      Get the word chars corresponding to the given position.
      Specified by:
      getWordChars in interface InlineLevelLayoutManager
      Parameters:
      pos - the position referring to the needed word chars.
      Returns:
      the word chars
    • hyphenate

      public void hyphenate(Position pos, HyphContext hc)
      Tell the LM to hyphenate a word
      Specified by:
      hyphenate in interface InlineLevelLayoutManager
      Parameters:
      pos - the Position referring to the word
      hc - the HyphContext storing hyphenation information
    • applyChanges

      public boolean applyChanges(List oldList)
      Tell the LM to apply the changes due to hyphenation
      Specified by:
      applyChanges in interface InlineLevelLayoutManager
      Parameters:
      oldList - the list of the old elements the changes refer to
      Returns:
      true if the LM had to change its data, false otherwise
    • applyChanges

      public boolean applyChanges(List oldList, int depth)
      Tell the LM to apply the changes due to hyphenation
      Specified by:
      applyChanges in interface InlineLevelLayoutManager
      Parameters:
      oldList - the list of the old elements the changes refer to
      depth - the depth at which the Positions for this LM in oldList are found
      Returns:
      true if the LM had to change its data, false otherwise
    • getChangedKnuthElements

      public 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.
      Specified by:
      getChangedKnuthElements in interface LayoutManager
      Overrides:
      getChangedKnuthElements in class AbstractLayoutManager
      Parameters:
      oldList - the elements to replace
      alignment - the desired text alignment
      Returns:
      the updated list of KnuthElements
    • getChangedKnuthElements

      public List getChangedKnuthElements(List oldList, int alignment, int depth)
      Get a sequence of KnuthElements representing the content of the node assigned to the LM, after changes have been applied
      Specified by:
      getChangedKnuthElements in interface InlineLevelLayoutManager
      Parameters:
      oldList - the elements to replace
      alignment - the desired text alignment
      depth - the depth at which the Positions for this LM in oldList are found
      Returns:
      the updated list of KnuthElements
    • getBreakBefore

      public int getBreakBefore()
      Description copied from interface: BreakOpportunity
      Returns the highest priority break-before value on this layout manager or its relevant descendants.
      Specified by:
      getBreakBefore in interface BreakOpportunity
      Returns:
      the break-before value (Constants.EN_*)