diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-06-29 12:59:31 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-06-29 12:59:31 +0000 |
commit | 8c3ee10b15c1aae9c4157fab047672583911f6ed (patch) | |
tree | faa92bc468502a09e42819e58368d1bc22cf30cf /src | |
parent | f9a98ac2dcc84393751d82cb8d45f3f6eb3c44c9 (diff) | |
download | xmlgraphics-fop-8c3ee10b15c1aae9c4157fab047672583911f6ed.tar.gz xmlgraphics-fop-8c3ee10b15c1aae9c4157fab047672583911f6ed.zip |
Span change detection and infastructure for signalling it.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@202364 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java | 22 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/LayoutContext.java | 28 |
2 files changed, 40 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java index 9408d03e8..89015813d 100644 --- a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java @@ -41,11 +41,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager /** Array of areas currently being filled stored by area class */ private BlockParent[] currentAreas = new BlockParent[Area.CLASS_MAX]; - /** - * Used to count the number of subsequent times to layout child areas on - * multiple pages. - */ - private int numSubsequentOverflows = 0; + private int currentSpan = EN_NONE; /** * This is the top level layout manager. @@ -72,8 +68,6 @@ public class FlowLayoutManager extends BlockStackingLayoutManager // currently active LM BlockLevelLayoutManager curLM; - BlockLevelLayoutManager prevLM = null; - //MinOptMax stackSize = new MinOptMax(); LinkedList returnedList; LinkedList returnList = new LinkedList(); @@ -84,6 +78,19 @@ public class FlowLayoutManager extends BlockStackingLayoutManager continue; } + int span = EN_NONE; + if (curLM instanceof BlockLayoutManager) { + span = ((BlockLayoutManager)curLM).getBlockFO().getSpan(); + } else if (curLM instanceof BlockContainerLayoutManager) { + span = ((BlockContainerLayoutManager)curLM).getBlockContainerFO().getSpan(); + } + if (currentSpan != span) { + log.debug("span change from " + currentSpan + " to " + span); + context.signalSpanChange(span); + currentSpan = span; + return returnList; + } + // Set up a LayoutContext //MinOptMax bpd = context.getStackLimit(); @@ -142,7 +149,6 @@ public class FlowLayoutManager extends BlockStackingLayoutManager childLC.setFlags(LayoutContext.KEEP_WITH_NEXT_PENDING, false); context.setFlags(LayoutContext.KEEP_WITH_NEXT_PENDING); } - prevLM = curLM; } setFinished(true); diff --git a/src/java/org/apache/fop/layoutmgr/LayoutContext.java b/src/java/org/apache/fop/layoutmgr/LayoutContext.java index cc468fec5..3703502b0 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutContext.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutContext.java @@ -18,6 +18,7 @@ package org.apache.fop.layoutmgr; +import org.apache.fop.fo.Constants; import org.apache.fop.traits.MinOptMax; @@ -74,8 +75,8 @@ public class LayoutContext { */ MinOptMax stackLimit; - /** True if current top-level reference area is spanning. */ - boolean bIsSpan; + /** True if current element list is spanning in multi-column layout. */ + private int nextSpan = Constants.NOT_SET; /** inline-progression-dimension of nearest ancestor reference area */ int refIPD; @@ -294,6 +295,29 @@ public class LayoutContext { iSpaceAfter = sp; } + /** + * @return true if the current element list ends early because of a span change + * in multi-column layout. + */ + public int getNextSpan() { + return nextSpan; + } + + /** + * Used to signal the PSLM that the element list ends early because of a span change in + * multi-column layout. + * @param span the new span value (legal values: NOT_SET, EN_NONE, EN_ALL) + */ + public void signalSpanChange(int span) { + if (span == Constants.NOT_SET || span == Constants.EN_NONE || span == Constants.EN_ALL) { + this.nextSpan = span; + } else { + throw new IllegalArgumentException("Illegal value on signalSpanChange() for span: " + + span); + } + } + + /** @see java.lang.Object#toString() */ public String toString() { return "Layout Context:" + "\nStack Limit: \t" + (getStackLimit() == null ? "null" : getStackLimit().toString()) + |