org.apache.fop.layoutmgr

Class LayoutContext


public class LayoutContext
extends java.lang.Object

This class is used to pass information to the getNextKnuthElements() method. It is set up by higher level LM and used by lower level LM.

Field Summary

static int
CHECK_REF_AREA
Signal to a Line LM that a higher level LM may provoke a change in the reference area, thus ref area IPD.
static int
FIRST_AREA
static int
IPD_UNKNOWN
static int
KEEP_WITH_NEXT_PENDING
This flag indicates that there's a keep-with-next that hasn't been processed, yet.
static int
KEEP_WITH_PREVIOUS_PENDING
This flag indicates that there's a keep-with-previous that hasn't been processed, yet.
static int
LAST_AREA
static int
LINEBREAK_AT_LF_ONLY
Values for flags.
static int
NEW_AREA
Generated break possibility is first in a new area
static int
RESOLVE_LEADING_SPACE
static int
SUPPRESS_LEADING_SPACE
If this flag is set, it indicates that any leading fo:character objects with suppress-at-line-break="suppress" should not generate areas.
static int
TRY_HYPHENATE

Constructor Summary

LayoutContext(int flags)
Main constructor.
LayoutContext(LayoutContext parentLC)
Copy constructor for creating child layout contexts.

Method Summary

void
addPendingAfterMark(UnresolvedListElementWithLength element)
Adds a border or padding element to the pending list which will be used to generate the right element list for break possibilities.
void
addPendingBeforeMark(UnresolvedListElementWithLength element)
Adds a border or padding element to the pending list which will be used to generate the right element list for break possibilities.
void
copyPendingMarksFrom(LayoutContext source)
AlignmentContext
getAlignmentContext()
int
getBPAlignment()
HyphContext
getHyphContext()
double
getIPDAdjust()
SpaceSpecifier
getLeadingSpace()
int
getLineEndBorderAndPaddingWidth()
Get the width to be reserved for border and padding at the end of the line.
int
getLineStartBorderAndPaddingWidth()
Get the width to be reserved for border and padding at the start of the line.
int
getNextSpan()
List
getPendingAfterMarks()
List
getPendingBeforeMarks()
int
getRefIPD()
Returns the inline-progression-dimension of the nearest ancestor reference area.
double
getSpaceAdjust()
int
getSpaceAfter()
Get the current amount of space after / end
int
getSpaceBefore()
Get the current amount of space before / start
MinOptMax
getStackLimit()
SpaceSpecifier
getTrailingSpace()
int
getWritingMode()
Get the writing mode of the relevant reference area.
boolean
isFirstArea()
boolean
isKeepWithNextPending()
boolean
isKeepWithPreviousPending()
boolean
isLastArea()
boolean
isStart()
void
resetAlignmentContext()
boolean
resolveLeadingSpace()
void
setAlignmentContext(AlignmentContext alignmentContext)
void
setBPAlignment(int alignment)
Sets the currently applicable alignment in BP direction.
void
setFlags(int flags)
void
setFlags(int flags, boolean bSet)
void
setHyphContext(HyphContext hyph)
void
setIPDAdjust(double ipdA)
void
setLeadingSpace(SpaceSpecifier space)
void
setLineEndBorderAndPaddingWidth(int lineEndBorderAndPaddingWidth)
Set the width to be reserved for border and padding at the end of the line.
void
setLineStartBorderAndPaddingWidth(int lineStartBorderAndPaddingWidth)
Set the width to be reserved for border and padding at the start of the line.
void
setRefIPD(int ipd)
Sets the inline-progression-dimension of the nearest ancestor reference area.
void
setSpaceAdjust(double adjust)
void
setSpaceAfter(int spaceAfter)
Set the amount of space after / end
void
setSpaceBefore(int spaceBefore)
Set the amount of space before / start
void
setStackLimit(MinOptMax limit)
void
setTrailingSpace(SpaceSpecifier space)
void
setWritingMode(int writingMode)
Set the writing mode.
void
signalSpanChange(int span)
Used to signal the PSLM that the element list ends early because of a span change in multi-column layout.
boolean
startsNewArea()
boolean
suppressLeadingSpace()
String
toString()
boolean
tryHyphenate()
void
unsetFlags(int flags)

Field Details

CHECK_REF_AREA

public static final int CHECK_REF_AREA
Signal to a Line LM that a higher level LM may provoke a change in the reference area, thus ref area IPD. The LineLM should return without looking for a line break.
Field Value:
8

FIRST_AREA

public static final int FIRST_AREA
Field Value:
32

IPD_UNKNOWN

public static final int IPD_UNKNOWN
Field Value:
4

KEEP_WITH_NEXT_PENDING

public static final int KEEP_WITH_NEXT_PENDING
This flag indicates that there's a keep-with-next that hasn't been processed, yet.
Field Value:
512

KEEP_WITH_PREVIOUS_PENDING

public static final int KEEP_WITH_PREVIOUS_PENDING
This flag indicates that there's a keep-with-previous that hasn't been processed, yet.
Field Value:
1024

LAST_AREA

public static final int LAST_AREA
Field Value:
128

LINEBREAK_AT_LF_ONLY

public static final int LINEBREAK_AT_LF_ONLY
Values for flags.
Field Value:
1

NEW_AREA

public static final int NEW_AREA
Generated break possibility is first in a new area
Field Value:
2

RESOLVE_LEADING_SPACE

public static final int RESOLVE_LEADING_SPACE
Field Value:
256

SUPPRESS_LEADING_SPACE

public static final int SUPPRESS_LEADING_SPACE
If this flag is set, it indicates that any leading fo:character objects with suppress-at-line-break="suppress" should not generate areas. This is the case at the beginning of each new LineArea except the first.
Field Value:
16

TRY_HYPHENATE

public static final int TRY_HYPHENATE
Field Value:
64

Constructor Details

LayoutContext

public LayoutContext(int flags)
Main constructor.
Parameters:
flags - the initial flags

LayoutContext

public LayoutContext(LayoutContext parentLC)
Copy constructor for creating child layout contexts.
Parameters:
parentLC - the parent layout context to copy from

Method Details

addPendingAfterMark

public void addPendingAfterMark(UnresolvedListElementWithLength element)
Adds a border or padding element to the pending list which will be used to generate the right element list for break possibilities. Conditionality resolution will be done elsewhere.
Parameters:
element - the border, padding or space element

addPendingBeforeMark

public void addPendingBeforeMark(UnresolvedListElementWithLength element)
Adds a border or padding element to the pending list which will be used to generate the right element list for break possibilities. Conditionality resolution will be done elsewhere.
Parameters:
element - the border, padding or space element

copyPendingMarksFrom

public void copyPendingMarksFrom(LayoutContext source)

getAlignmentContext

public AlignmentContext getAlignmentContext()

getBPAlignment

public int getBPAlignment()
Returns:
the currently applicable alignment in BP direction (EN_START, EN_JUSTIFY...)

getHyphContext

public HyphContext getHyphContext()

getIPDAdjust

public double getIPDAdjust()

getLeadingSpace

public SpaceSpecifier getLeadingSpace()

getLineEndBorderAndPaddingWidth

public int getLineEndBorderAndPaddingWidth()
Get the width to be reserved for border and padding at the end of the line.
Returns:
the width to be reserved

getLineStartBorderAndPaddingWidth

public int getLineStartBorderAndPaddingWidth()
Get the width to be reserved for border and padding at the start of the line.
Returns:
the width to be reserved

getNextSpan

public int getNextSpan()
Returns:
true if the current element list ends early because of a span change in multi-column layout.

getPendingAfterMarks

public List getPendingAfterMarks()
Returns:
the pending border and padding elements at the after edge

getPendingBeforeMarks

public List getPendingBeforeMarks()
Returns:
the pending border and padding elements at the before edge

getRefIPD

public int getRefIPD()
Returns the inline-progression-dimension of the nearest ancestor reference area.
Returns:
the inline-progression-dimension of the nearest ancestor reference area

getSpaceAdjust

public double getSpaceAdjust()

getSpaceAfter

public int getSpaceAfter()
Get the current amount of space after / end
Returns:
the space after / end amount

getSpaceBefore

public int getSpaceBefore()
Get the current amount of space before / start
Returns:
the space before / start amount

getStackLimit

public MinOptMax getStackLimit()

getTrailingSpace

public SpaceSpecifier getTrailingSpace()

getWritingMode

public int getWritingMode()
Get the writing mode of the relevant reference area.
Returns:
the applicable writing mode

isFirstArea

public boolean isFirstArea()

isKeepWithNextPending

public boolean isKeepWithNextPending()

isKeepWithPreviousPending

public boolean isKeepWithPreviousPending()

isLastArea

public boolean isLastArea()

isStart

public boolean isStart()

resetAlignmentContext

public void resetAlignmentContext()

resolveLeadingSpace

public boolean resolveLeadingSpace()

setAlignmentContext

public void setAlignmentContext(AlignmentContext alignmentContext)

setBPAlignment

public void setBPAlignment(int alignment)
Sets the currently applicable alignment in BP direction.
Parameters:
alignment - one of EN_START, EN_JUSTIFY etc.

setFlags

public void setFlags(int flags)

setFlags

public void setFlags(int flags,
                     boolean bSet)

setHyphContext

public void setHyphContext(HyphContext hyph)

setIPDAdjust

public void setIPDAdjust(double ipdA)

setLeadingSpace

public void setLeadingSpace(SpaceSpecifier space)

setLineEndBorderAndPaddingWidth

public void setLineEndBorderAndPaddingWidth(int lineEndBorderAndPaddingWidth)
Set the width to be reserved for border and padding at the end of the line.
Parameters:
lineEndBorderAndPaddingWidth - the width to be reserved

setLineStartBorderAndPaddingWidth

public void setLineStartBorderAndPaddingWidth(int lineStartBorderAndPaddingWidth)
Set the width to be reserved for border and padding at the start of the line.
Parameters:
lineStartBorderAndPaddingWidth - the width to be reserved

setRefIPD

public void setRefIPD(int ipd)
Sets the inline-progression-dimension of the nearest ancestor reference area.

setSpaceAdjust

public void setSpaceAdjust(double adjust)

setSpaceAfter

public void setSpaceAfter(int spaceAfter)
Set the amount of space after / end
Parameters:
spaceAfter - the amount of space after / end

setSpaceBefore

public void setSpaceBefore(int spaceBefore)
Set the amount of space before / start
Parameters:
spaceBefore - the amount of space before / start

setStackLimit

public void setStackLimit(MinOptMax limit)

setTrailingSpace

public void setTrailingSpace(SpaceSpecifier space)

setWritingMode

public void setWritingMode(int writingMode)
Set the writing mode.
Parameters:
writingMode - the writing mode

signalSpanChange

public void signalSpanChange(int span)
Used to signal the PSLM that the element list ends early because of a span change in multi-column layout.
Parameters:
span - the new span value (legal values: NOT_SET, EN_NONE, EN_ALL)

startsNewArea

public boolean startsNewArea()

suppressLeadingSpace

public boolean suppressLeadingSpace()

toString

public String toString()
See Also:
java.lang.Object.toString()

tryHyphenate

public boolean tryHyphenate()

unsetFlags

public void unsetFlags(int flags)

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.