Package org.apache.fop.layoutmgr.inline
Class ContentLayoutManager
java.lang.Object
org.apache.fop.layoutmgr.AbstractBaseLayoutManager
org.apache.fop.layoutmgr.inline.ContentLayoutManager
- All Implemented Interfaces:
PercentBaseContext,InlineLevelLayoutManager,LayoutManager
public class ContentLayoutManager
extends AbstractBaseLayoutManager
implements InlineLevelLayoutManager
Content Layout Manager.
For use with objects that contain inline areas such as
leader use-content and title.
-
Field Summary
Fields inherited from class org.apache.fop.layoutmgr.AbstractBaseLayoutManager
fobj, generatesBlockArea, generatesReferenceArea -
Constructor Summary
ConstructorsConstructorDescriptionContentLayoutManager(Area area, LayoutManager parentLM) Constructs a new ContentLayoutManagerContentLayoutManager(PageSequenceLayoutManager pslm, Title foTitle) Constructor using a fo:title formatting object and its PageSequenceLayoutManager parent. -
Method Summary
Modifier and TypeMethodDescriptionaddALetterSpaceTo(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 elementsaddALetterSpaceTo(List oldList, int depth) Tell the LM to modify its data, adding a letter space to the word fragment represented by the given elements, and returning the corrected elementsvoidaddAreas(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.voidaddChildArea(Area childArea) Add the area as a child of the current area.voidAdd the LM in the argument to the list of child LMs; set this LM as the parent; initialize the LM.voidaddChildLMs(List<LayoutManager> newLMs) Add the LMs in the argument to the list of child LMs;booleanapplyChanges(List oldList) Tell the LM to apply the changes due to hyphenationbooleanapplyChanges(List oldList, int depth) Tell the LM to apply the changes due to hyphenationbooleancreateNextChildLMs(int pos) Create more child LMs of the parent, up to child LM index posintReturns the position of the dominant-baseline of this FO's first descendant line-area.getChangedKnuthElements(List<ListElement> 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.getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth) Get a sequence of KnuthElements representing the content of the node assigned to the LM, after changes have been appliedintReturns the BPD of the content areaintReturns the IPD of the content areabooleanReturns an indication if the layout manager generates a block area.booleanReturns an indication if the layout manager generates a line area.booleanReturns an indication if the layout manager generates a reference area.getNextKnuthElements(LayoutContext context, int alignment) Get a sequence of KnuthElements representing the content of the node assigned to the LM.Get the parent layout manager.getParentArea(Area childArea) Get the parent area for an area.getPSLM()Get the active PageSequenceLayoutManager instance for this layout process.intgetWordChars(Position pos) Get the word chars corresponding to the given position.booleanWhether the FO handled by this layout manager has a descendant (including itself) that will generate a line-area.voidhyphenate(Position pos, HyphContext hc) Tell the LM to hyphenate a wordvoidinitialize the layout manager.booleanReturn a value indicating whether this LayoutManager has laid out all its content (or generated BreakPossibilities for all content.)Adds a Position to the Position participating in the first|last determination by assigning it a unique position index.voidsetFinished(boolean isFinished) Set a flag indicating whether the LayoutManager has laid out all its content.voidSet the parent layout manager.Methods inherited from class org.apache.fop.layoutmgr.AbstractBaseLayoutManager
getAncestorBlockAreaBPD, getAncestorBlockAreaIPD, getBaseLength, getChangeBarList, getFObj, getNextKnuthElements, getParentAreaBPD, getParentAreaIPD, getReferenceAreaBPD, getReferenceAreaIPD, isFromFootnote, isRestartable, preserveChildrenAtEndOfLayout, recreateChildrenLMs, reset, setFromFootnote, setGeneratesBlockArea, setGeneratesReferenceAreaMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.fop.layoutmgr.LayoutManager
getFObj, getNextKnuthElements, isFromFootnote, isRestartable, reset, setFromFootnoteMethods inherited from interface org.apache.fop.datatypes.PercentBaseContext
getBaseLength
-
Constructor Details
-
ContentLayoutManager
Constructs a new ContentLayoutManager- Parameters:
area- The parent areaparentLM- the parent layout manager
-
ContentLayoutManager
Constructor using a fo:title formatting object and its PageSequenceLayoutManager parent. throws IllegalStateException if the foTitle has no children. TODO: convert IllegalStateException to FOPException; also in makeLayoutManager and makeContentLayoutManager and callers.- Parameters:
pslm- the PageSequenceLayoutManager parent of this LMfoTitle- the Title FO for which this LM is made
-
-
Method Details
-
initialize
public void initialize()initialize the layout manager. Allows each layout manager to calculate often used values.- Specified by:
initializein interfaceLayoutManager
-
addAreas
Tell the layout manager to add all the child areas implied by Position objects which will be returned by the Iterator.- Specified by:
addAreasin interfaceLayoutManager- Parameters:
posIter- the position iteratorcontext- the context
-
getStackingSize
public int getStackingSize()- Returns:
- stack size
-
getParentArea
Get the parent area for an area. This should get the parent depending on the class of the area passed in.- Specified by:
getParentAreain interfaceLayoutManager- Parameters:
childArea- the child area to get the parent for- Returns:
- the parent Area
-
addChildArea
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.- Specified by:
addChildAreain interfaceLayoutManager- Parameters:
childArea- the child area to add
-
setParent
Set the parent layout manager. The parent layout manager is required for adding areas.- Specified by:
setParentin interfaceLayoutManager- Parameters:
lm- the parent layout manager
-
getParent
Get the parent layout manager.- Specified by:
getParentin interfaceLayoutManager- Returns:
- the parent layout manager.
-
isFinished
public boolean isFinished()Return a value indicating whether this LayoutManager has laid out all its content (or generated BreakPossibilities for all content.)- Specified by:
isFinishedin interfaceLayoutManager- Returns:
- true if this layout manager is finished
-
setFinished
public 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.- Specified by:
setFinishedin interfaceLayoutManager- Parameters:
isFinished- the value to set the finished flag to
-
createNextChildLMs
public boolean createNextChildLMs(int pos) Create more child LMs of the parent, up to child LM index pos- Specified by:
createNextChildLMsin interfaceLayoutManager- Parameters:
pos- index up to which child LMs are requested- Returns:
- true if requested index does exist
-
getChildLMs
- Specified by:
getChildLMsin interfaceLayoutManager- Returns:
- the list of child LMs
-
addChildLM
Add the LM in the argument to the list of child LMs; set this LM as the parent; initialize the LM.- Specified by:
addChildLMin interfaceLayoutManager- Parameters:
lm- the LM to be added
-
addChildLMs
Add the LMs in the argument to the list of child LMs;- Specified by:
addChildLMsin interfaceLayoutManager- Parameters:
newLMs- the list of LMs to be added
-
getNextKnuthElements
Get a sequence of KnuthElements representing the content of the node assigned to the LM.- Specified by:
getNextKnuthElementsin interfaceLayoutManager- Parameters:
context- the LayoutContext used to store layout informationalignment- the desired text alignment- Returns:
- the list of KnuthElements
-
addALetterSpaceTo
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:
addALetterSpaceToin interfaceInlineLevelLayoutManager- Parameters:
oldList- the elements which must be given one more letter space- Returns:
- the new elements replacing the old ones
-
addALetterSpaceTo
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:
addALetterSpaceToin interfaceInlineLevelLayoutManager- Parameters:
oldList- the elements which must be given one more letter spacedepth- the depth at which the Positions for this LM in oldList are found- Returns:
- the new elements replacing the old ones
-
getWordChars
Get the word chars corresponding to the given position.- Specified by:
getWordCharsin interfaceInlineLevelLayoutManager- Parameters:
pos- the position referring to the needed word chars.- Returns:
- the word chars
-
hyphenate
Tell the LM to hyphenate a word- Specified by:
hyphenatein interfaceInlineLevelLayoutManager- Parameters:
pos- the Position referring to the wordhc- the HyphContext storing hyphenation information
-
applyChanges
Tell the LM to apply the changes due to hyphenation- Specified by:
applyChangesin interfaceInlineLevelLayoutManager- 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
Tell the LM to apply the changes due to hyphenation- Specified by:
applyChangesin interfaceInlineLevelLayoutManager- Parameters:
oldList- the list of the old elements the changes refer todepth- 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
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:
getChangedKnuthElementsin interfaceLayoutManager- Parameters:
oldList- the elements to replacealignment- the desired text alignment- Returns:
- the updated list of KnuthElements
-
getChangedKnuthElements
public List<ListElement> getChangedKnuthElements(List<ListElement> 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:
getChangedKnuthElementsin interfaceInlineLevelLayoutManager- Parameters:
oldList- the elements to replacealignment- the desired text alignmentdepth- the depth at which the Positions for this LM in oldList are found- Returns:
- the updated list of KnuthElements
-
getPSLM
Get the active PageSequenceLayoutManager instance for this layout process.- Specified by:
getPSLMin interfaceLayoutManager- Returns:
- the PageSequenceLayoutManager
-
hasLineAreaDescendant
public boolean hasLineAreaDescendant()Description copied from interface:LayoutManagerWhether the FO handled by this layout manager has a descendant (including itself) that will generate a line-area.- Specified by:
hasLineAreaDescendantin interfaceLayoutManager- Returns:
trueif a descendant line-area will be generated,falseotherwise
-
getBaselineOffset
public int getBaselineOffset()Description copied from interface:LayoutManagerReturns 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
LayoutManager.hasLineAreaDescendant()- Specified by:
getBaselineOffsetin interfaceLayoutManager- 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:
-
getContentAreaIPD
public int getContentAreaIPD()Returns the IPD of the content area- Specified by:
getContentAreaIPDin interfaceLayoutManager- Overrides:
getContentAreaIPDin classAbstractBaseLayoutManager- Returns:
- the IPD of the content area
-
getContentAreaBPD
public int getContentAreaBPD()Returns the BPD of the content area- Specified by:
getContentAreaBPDin interfaceLayoutManager- Overrides:
getContentAreaBPDin classAbstractBaseLayoutManager- Returns:
- the BPD of the content area
-
getGeneratesReferenceArea
public boolean getGeneratesReferenceArea()Returns an indication if the layout manager generates a reference area.- Specified by:
getGeneratesReferenceAreain interfaceLayoutManager- Overrides:
getGeneratesReferenceAreain classAbstractBaseLayoutManager- Returns:
- True if the layout manager generates a reference area
-
getGeneratesBlockArea
public boolean getGeneratesBlockArea()Returns an indication if the layout manager generates a block area.- Specified by:
getGeneratesBlockAreain interfaceLayoutManager- Overrides:
getGeneratesBlockAreain classAbstractBaseLayoutManager- Returns:
- True if the layout manager generates a block area
-
getGeneratesLineArea
public boolean getGeneratesLineArea()Returns an indication if the layout manager generates a line area.- Specified by:
getGeneratesLineAreain interfaceLayoutManager- Overrides:
getGeneratesLineAreain classAbstractBaseLayoutManager- Returns:
- True if the layout manager generates a line area
-
notifyPos
Adds a Position to the Position participating in the first|last determination by assigning it a unique position index.- Specified by:
notifyPosin interfaceLayoutManager- Parameters:
pos- the Position- Returns:
- the same Position but with a position index
-