MainReference (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.area

## Class MainReference

- java.lang.Object
- - org.apache.fop.area.AreaTreeObject
  - - org.apache.fop.area.Area
    - - org.apache.fop.area.MainReference

- All Implemented Interfaces:
    Serializable, Cloneable

      public class MainReference
      extends Area

  The main-reference-area generated by an fo:region-body This object holds one or more span-reference-areas (block-areas stacked in the block progression direction) See fo:region-body definition in the XSL Rec for more information.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.area.Area

      `bidiLevel, bpd, CLASS_ABSOLUTE, CLASS_BEFORE_FLOAT, CLASS_FIXED, CLASS_FOOTNOTE, CLASS_MAX, CLASS_NORMAL, CLASS_SIDE_FLOAT, effectiveIPD, ipd, log, ORIENT_0, ORIENT_180, ORIENT_270, ORIENT_90, traits`

    - ### Fields inherited from class org.apache.fop.area.AreaTreeObject

      `extensionAttachments, foreignAttributes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MainReference(BodyRegion parent)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Span` | `createSpan(boolean spanAll)` Add a span area to this area.
    `int` | `getColumnCount()`
    `int` | `getColumnGap()`
    `Span` | `getCurrentSpan()` Get the span area currently being filled (i.e., the last span created).
    `List<Span>` | `getSpans()` Get the span areas from this area.
    `boolean` | `isEmpty()` Indicates whether any child areas have been added to this reference area.
    `void` | `setSpans(List<Span> spans)` Do not use.
    `void` | `setWritingModeTraits(WritingModeTraitsGetter wmtg)` Sets the writing mode traits for the spans of this main reference area.

    - ### Methods inherited from class org.apache.fop.area.Area

      `activateEffectiveIPD, addChildArea, addTrait, clone, getAllocBPD, getAllocIPD, getAreaClass, getBidiLevel, getBorderAndPaddingWidthAfter, getBorderAndPaddingWidthBefore, getBorderAndPaddingWidthEnd, getBorderAndPaddingWidthStart, getBPD, getChangeBarList, getEffectiveAllocIPD, getEffectiveIPD, getIPD, getSpaceAfter, getSpaceBefore, getSpaceEnd, getSpaceStart, getTrait, getTraitAsBoolean, getTraitAsInteger, getTraits, hasTrait, hasTraits, isFromFootnote, resetBidiLevel, setAreaClass, setBidiLevel, setBPD, setChangeBarList, setFromFootnote, setIPD, setTraits, toString`

    - ### Methods inherited from class org.apache.fop.area.AreaTreeObject

      `addExtensionAttachment, getExtensionAttachments, getForeignAttributes, getForeignAttributeValue, hasExtensionAttachments, setExtensionAttachments, setForeignAttribute, setForeignAttributes`

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

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

- - ### Constructor Detail

    - #### MainReference

          public MainReference(BodyRegion parent)

      Constructor
      Parameters:
        `parent` - the body region this reference area is placed in.

  - ### Method Detail

    - #### createSpan

          public Span createSpan(boolean spanAll)

      Add a span area to this area.
      Parameters:
        `spanAll` - whether to make a single-column span
      Returns:
        the created span area.

    - #### getSpans

          public List<Span> getSpans()

      Get the span areas from this area.
      Returns:
        the list of span areas

    - #### setSpans

          public void setSpans(List<Span> spans)

      Do not use. Used to handle special page-master for last page: transfer the content that had already been added to a normal page to this main reference for the last page. TODO this is hacky.
      Parameters:
        `spans` - content already laid out

    - #### getCurrentSpan

          public Span getCurrentSpan()

      Get the span area currently being filled (i.e., the last span created).
      Returns:
        the active span.

    - #### isEmpty

          public boolean isEmpty()

      Indicates whether any child areas have been added to this reference area. This is achieved by looping through each span.
      Returns:
        true if no child areas have been added yet.

    - #### getColumnCount

          public int getColumnCount()

      Returns:
        the number of columns

    - #### getColumnGap

          public int getColumnGap()

      Returns:
        the column gap in millipoints

    - #### setWritingModeTraits

          public void setWritingModeTraits(WritingModeTraitsGetter wmtg)

      Sets the writing mode traits for the spans of this main reference area.
      Overrides:
        `setWritingModeTraits` in class `Area`
      Parameters:
        `wmtg` - a WM traits getter

Copyright © 2025 Apache Software Foundation. All rights reserved.