aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2005-06-01 04:22:18 +0000
committerGlen Mazza <gmazza@apache.org>2005-06-01 04:22:18 +0000
commit317270ae05f404dd9f17cf3f1ce5e9141e7d5c13 (patch)
tree9062dba19e178facf9ecca7c87b64606c8df79bc /src/java/org/apache/fop/layoutmgr
parent2f75a4659d2cfe7f61f5a98521031d81cfb02c56 (diff)
downloadxmlgraphics-fop-317270ae05f404dd9f17cf3f1ce5e9141e7d5c13.tar.gz
xmlgraphics-fop-317270ae05f404dd9f17cf3f1ce5e9141e7d5c13.zip
Simplifications to PSLM.gKNE().
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198711 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr')
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractBreaker.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java11
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java36
3 files changed, 22 insertions, 31 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
index 8cfa6d052..0a0c1eeb2 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
@@ -104,6 +104,12 @@ public abstract class AbstractBreaker {
protected abstract void addAreas(PositionIterator posIter, LayoutContext context);
protected abstract LayoutManager getTopLevelLM();
protected abstract LayoutManager getCurrentChildLM();
+
+ /*
+ * This method is to contain the logic to determine the LM's
+ * getNextKnuthElements() implementation(s) that are to be called.
+ * @return LinkedList of Knuth elements.
+ */
protected abstract LinkedList getNextKnuthElements(LayoutContext context, int alignment);
/** @return true if there's no content that could be handled. */
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index 4541a1be5..d44d5fd4e 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -124,17 +124,6 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants
return null;
}
- protected boolean hasMoreLM(LayoutManager prevLM) {
- // prevLM should = curChildLM
- if (prevLM != curChildLM) {
- //log.debug("AbstractLayoutManager.peekNextLM: " +
- // "passed LM is not current child LM!");
- return false;
- }
- return !childLMiter.hasNext();
- }
-
-
/**
* Reset the layoutmanager "iterator" so that it will start
* with the passed Position's generating LM
diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
index 428e2d061..369c0664e 100644
--- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
@@ -33,6 +33,7 @@ import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.flow.Marker;
import org.apache.fop.fo.flow.RetrieveMarker;
+import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.SideRegion;
@@ -129,6 +130,11 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
curPV = makeNewPage(false, true, false);
+ Flow mainFlow = pageSeq.getMainFlow();
+ childFLM = (FlowLayoutManager)
+ getLayoutManagerMaker().makeLayoutManager(mainFlow);
+ childFLM.setParent(this);
+
PageBreaker breaker = new PageBreaker(this);
int flowBPD = (int) curPV.getBodyRegion().getBPD();
breaker.doLayout(flowBPD);
@@ -312,35 +318,25 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
* @param context the layout context for finding breaks
* @return the break for the page
*/
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
-
- LayoutManager curLM; // currently active LM
-
- while ((curLM = getChildLM()) != null) {
- LinkedList returnedList = null;
- if (childFLM == null && (curLM instanceof FlowLayoutManager)) {
- childFLM = (FlowLayoutManager)curLM;
- } else {
- if (curLM != childFLM) {
- log.error("PSLM> invalid child LM");
- }
- }
+ public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ LinkedList returnedList = null;
+ while (!childFLM.isFinished()) {
LayoutContext childLC = new LayoutContext(0);
childLC.setStackLimit(context.getStackLimit());
childLC.setRefIPD(context.getRefIPD());
- if (!curLM.isFinished()) {
- int flowIPD = curPV.getCurrentSpan().getColumnWidth();
- int flowBPD = (int) curPV.getBodyRegion().getBPD();
- pageSeq.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, flowIPD);
- pageSeq.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, flowBPD);
- returnedList = curLM.getNextKnuthElements(childLC, alignment);
- }
+ int flowIPD = curPV.getCurrentSpan().getColumnWidth();
+ int flowBPD = (int) curPV.getBodyRegion().getBPD();
+ pageSeq.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, flowIPD);
+ pageSeq.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, flowBPD);
+ returnedList = childFLM.getNextKnuthElements(childLC, alignment);
+
if (returnedList != null) {
return returnedList;
}
}
+
setFinished(true);
return null;
}