aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2002-09-03 11:45:13 +0000
committerKeiron Liddle <keiron@apache.org>2002-09-03 11:45:13 +0000
commit3f5a6946913a30d383a1c9ff3dd020cbf05365f5 (patch)
tree90fa72a17e939c4032111d94d155f1ca645b9474
parent0706f737a76da81f1e53a07341a3a57e8d759d03 (diff)
downloadxmlgraphics-fop-3f5a6946913a30d383a1c9ff3dd020cbf05365f5.tar.gz
xmlgraphics-fop-3f5a6946913a30d383a1c9ff3dd020cbf05365f5.zip
removed BP from BPLayoutManager and combined
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195147 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/org/apache/fop/fo/FOText.java4
-rw-r--r--src/org/apache/fop/fo/FObjMixed.java4
-rw-r--r--src/org/apache/fop/fo/Title.java6
-rw-r--r--src/org/apache/fop/fo/flow/Leader.java6
-rw-r--r--src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java207
-rw-r--r--src/org/apache/fop/layoutmgr/AbstractLayoutManager.java181
-rw-r--r--src/org/apache/fop/layoutmgr/BPLayoutManager.java61
-rw-r--r--src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java6
-rw-r--r--src/org/apache/fop/layoutmgr/BlockLayoutManager.java12
-rw-r--r--src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java2
-rw-r--r--src/org/apache/fop/layoutmgr/BreakPoss.java4
-rw-r--r--src/org/apache/fop/layoutmgr/BreakPossPosIter.java2
-rw-r--r--src/org/apache/fop/layoutmgr/ContentLayoutManager.java29
-rw-r--r--src/org/apache/fop/layoutmgr/FlowLayoutManager.java4
-rw-r--r--src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java (renamed from src/org/apache/fop/layoutmgr/InlineStackingBPLayoutManager.java)22
-rw-r--r--src/org/apache/fop/layoutmgr/LayoutManager.java43
-rw-r--r--src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java2
-rw-r--r--src/org/apache/fop/layoutmgr/LeafPosition.java2
-rw-r--r--src/org/apache/fop/layoutmgr/LineLayoutManager.java (renamed from src/org/apache/fop/layoutmgr/LineBPLayoutManager.java)14
-rw-r--r--src/org/apache/fop/layoutmgr/NonLeafPosition.java2
-rw-r--r--src/org/apache/fop/layoutmgr/PageLayoutManager.java6
-rw-r--r--src/org/apache/fop/layoutmgr/Position.java6
-rw-r--r--src/org/apache/fop/layoutmgr/PositionIterator.java8
-rw-r--r--src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java4
-rw-r--r--src/org/apache/fop/layoutmgr/TextLayoutManager.java (renamed from src/org/apache/fop/layoutmgr/TextBPLayoutManager.java)6
25 files changed, 305 insertions, 338 deletions
diff --git a/src/org/apache/fop/fo/FOText.java b/src/org/apache/fop/fo/FOText.java
index b3d83fa64..3d9a04770 100644
--- a/src/org/apache/fop/fo/FOText.java
+++ b/src/org/apache/fop/fo/FOText.java
@@ -14,7 +14,7 @@ import org.apache.fop.datatypes.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.LayoutManager;
-import org.apache.fop.layoutmgr.TextBPLayoutManager;
+import org.apache.fop.layoutmgr.TextLayoutManager;
import org.apache.fop.apps.StructureHandler;
import java.util.NoSuchElementException;
@@ -76,7 +76,7 @@ public class FOText extends FObj {
ca = new char[length];
System.arraycopy(tmp, 0, ca, 0, length);
}
- list.add(new TextBPLayoutManager(this, ca, textInfo));
+ list.add(new TextLayoutManager(this, ca, textInfo));
}
public CharIterator charIterator() {
diff --git a/src/org/apache/fop/fo/FObjMixed.java b/src/org/apache/fop/fo/FObjMixed.java
index 94d572fab..f0a0d1f7e 100644
--- a/src/org/apache/fop/fo/FObjMixed.java
+++ b/src/org/apache/fop/fo/FObjMixed.java
@@ -12,7 +12,7 @@ import org.apache.fop.layout.FontInfo;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.StructureHandler;
import org.apache.fop.datatypes.ColorType;
-import org.apache.fop.layoutmgr.InlineStackingBPLayoutManager;
+import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
import org.apache.fop.layoutmgr.LMiter;
import java.util.List;
@@ -35,7 +35,7 @@ public class FObjMixed extends FObj {
}
public void addLayoutManager(List lms) {
- lms.add(new InlineStackingBPLayoutManager(this,
+ lms.add(new InlineStackingLayoutManager(this,
new LMiter(children.listIterator())));
// set start and end properties for this element, id, etc.
// int numChildren = this.children.size();
diff --git a/src/org/apache/fop/fo/Title.java b/src/org/apache/fop/fo/Title.java
index 7799f70ee..6ac1df5ca 100644
--- a/src/org/apache/fop/fo/Title.java
+++ b/src/org/apache/fop/fo/Title.java
@@ -16,7 +16,7 @@ import org.apache.fop.fo.properties.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.LMiter;
-import org.apache.fop.layoutmgr.InlineStackingBPLayoutManager;
+import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
import org.apache.fop.layoutmgr.ContentLayoutManager;
/**
@@ -32,8 +32,8 @@ public class Title extends FObjMixed {
new org.apache.fop.area.Title();
// use special layout manager to add the inline areas
// to the Title.
- InlineStackingBPLayoutManager lm;
- lm = new InlineStackingBPLayoutManager(this,
+ InlineStackingLayoutManager lm;
+ lm = new InlineStackingLayoutManager(this,
new LMiter(children.listIterator()));
lm.init();
diff --git a/src/org/apache/fop/fo/flow/Leader.java b/src/org/apache/fop/fo/flow/Leader.java
index 07bb6aab3..0a84fc928 100644
--- a/src/org/apache/fop/fo/flow/Leader.java
+++ b/src/org/apache/fop/fo/flow/Leader.java
@@ -16,7 +16,7 @@ import org.apache.fop.layout.*;
import org.apache.fop.layout.FontState;
import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.LayoutManager;
-import org.apache.fop.layoutmgr.InlineStackingBPLayoutManager;
+import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
import org.apache.fop.layoutmgr.LeafNodeLayoutManager;
import org.apache.fop.layoutmgr.ContentLayoutManager;
import org.apache.fop.layoutmgr.LayoutContext;
@@ -117,8 +117,8 @@ public class Leader extends FObjMixed {
leaderArea = fa;
} else if(leaderPattern == LeaderPattern.USECONTENT) {
- InlineStackingBPLayoutManager lm;
- lm = new InlineStackingBPLayoutManager(this,
+ InlineStackingLayoutManager lm;
+ lm = new InlineStackingLayoutManager(this,
new LMiter(children.listIterator()));
lm.init();
diff --git a/src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java b/src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java
deleted file mode 100644
index b0478917f..000000000
--- a/src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.layoutmgr;
-
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.area.Area;
-
-import java.util.ListIterator;
-import java.util.ArrayList;
-
-/**
- * The base class for all BPLayoutManagers.
- */
-public abstract class AbstractBPLayoutManager extends AbstractLayoutManager implements BPLayoutManager {
-
-
- /** True if this LayoutManager has handled all of its content. */
- private boolean m_bFinished = false;
- protected BPLayoutManager m_curChildLM = null;
- protected ListIterator m_childLMiter;
- protected boolean m_bInited = false;
-
-
- public AbstractBPLayoutManager(FObj fobj) {
- this(fobj, new LMiter(fobj.getChildren()));
- }
-
-
- public AbstractBPLayoutManager(FObj fobj, ListIterator lmIter) {
- super(fobj);
- m_childLMiter = lmIter;
- }
-
-
- /**
- * Return currently active child LayoutManager or null if
- * all children have finished layout.
- * Note: child must implement BPLayoutManager! If it doesn't, skip it
- * and print a warning.
- */
- protected BPLayoutManager getChildLM() {
- if (m_curChildLM != null && !m_curChildLM.isFinished()) {
- return m_curChildLM;
- }
- while (m_childLMiter.hasNext()) {
- Object obj = m_childLMiter.next();
- if (obj instanceof BPLayoutManager) {
- m_curChildLM = (BPLayoutManager) obj;
- m_curChildLM.setParentLM(this);
- m_curChildLM.init();
- return m_curChildLM;
- } else {
- m_childLMiter.remove();
- //log.warn(
- // "child LM not a BPLayoutManager: " +
- // obj.getClass().getName());
- }
- }
- return null;
- }
-
- protected boolean hasMoreLM(BPLayoutManager prevLM) {
- // prevLM should = m_curChildLM
- if (prevLM != m_curChildLM) {
- //log.debug("AbstractBPLayoutManager.peekNextLM: " +
- // "passed LM is not current child LM!");
- return false;
- }
- return !m_childLMiter.hasNext();
- }
-
-
- /**
- * Reset the layoutmanager "iterator" so that it will start
- * with the passed Position's generating LM
- * on the next call to getChildLM.
- * @param pos a Position returned by a child layout manager
- * representing a potential break decision.
- * If pos is null, then back up to the first child LM.
- */
- protected void reset(Position pos) {
- //if (lm == null) return;
- BPLayoutManager lm = (pos != null) ? pos.getLM() : null;
- if (m_curChildLM != lm) {
- // ASSERT m_curChildLM == (BPLayoutManager)m_childLMiter.previous()
- if (m_childLMiter.hasPrevious() && m_curChildLM !=
- (BPLayoutManager) m_childLMiter.previous()) {
- //log.error("LMiter problem!");
- }
- while (m_curChildLM != lm && m_childLMiter.hasPrevious()) {
- m_curChildLM.resetPosition(null);
- m_curChildLM = (BPLayoutManager) m_childLMiter.previous();
- }
- m_childLMiter.next(); // Otherwise next returns same object
- }
- if(m_curChildLM != null) {
- m_curChildLM.resetPosition(pos);
- }
- if (isFinished()) {
- setFinished(false);
- }
- }
-
- public void resetPosition(Position resetPos) {
- // if (resetPos == null) {
- // reset(null);
- // }
- }
-
-
- /**
- * This method provides a hook for a LayoutManager to intialize traits
- * for the areas it will create, based on Properties set on its FO.
- */
- public void init() {
- if (fobj != null && m_bInited == false) {
- initProperties(fobj.getPropertyManager());
- m_bInited = true;
- }
- }
-
-
- /**
- * This method provides a hook for a LayoutManager to intialize traits
- * for the areas it will create, based on Properties set on its FO.
- */
- protected void initProperties(PropertyManager pm) {
- //log.debug("AbstractBPLayoutManager.initProperties");
- }
-
-
- /**
- * Tell whether this LayoutManager has handled all of its content.
- * @return True if there are no more break possibilities,
- * ie. the last one returned represents the end of the content.
- */
- public boolean isFinished() {
- return m_bFinished;
- }
-
- public void setFinished(boolean bFinished) {
- m_bFinished = bFinished;
- }
-
-
- /**
- * Generate and return the next break possibility.
- * Each layout manager must implement this.
- * TODO: should this be abstract or is there some reasonable
- * default implementation?
- */
- public BreakPoss getNextBreakPoss(LayoutContext context) {
- return null;
- }
-
-
- /**
- * Return value indicating whether the next area to be generated could
- * start a new line or flow area.
- * In general, if can't break at the current level, delegate to
- * the first child LM.
- * NOTE: should only be called if the START_AREA flag is set in context,
- * since the previous sibling LM must have returned a BreakPoss which
- * does not allow break-after.
- * QUESTION: in block-stacked areas, does this mean some kind of keep
- * condition, or is it only used for inline-stacked areas?
- * Default implementation always returns true.
- */
- public boolean canBreakBefore(LayoutContext context) {
- return true;
- }
-
-
- public void addAreas(PositionIterator posIter, LayoutContext context) {
- }
-
-
- public void getWordChars(StringBuffer sbChars, Position bp1,
- Position bp2) {
- }
-
- /* ---------------------------------------------------------
- * PROVIDE NULL IMPLEMENTATIONS OF METHODS from LayoutManager
- * interface which are declared abstract in AbstractLayoutManager.
- * ---------------------------------------------------------*/
- public Area getParentArea(Area childArea) {
- return null;
- }
-
- protected boolean flush() {
- return false;
- }
-
-
-
- public boolean addChild(Area childArea) {
- return false;
- }
-}
-
diff --git a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index 79e12d33a..e64e7c81b 100644
--- a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -10,6 +10,7 @@ package org.apache.fop.layoutmgr;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FONode;
import org.apache.fop.area.Area;
+import org.apache.fop.fo.PropertyManager;
import java.util.ListIterator;
import java.util.ArrayList;
@@ -21,6 +22,12 @@ public abstract class AbstractLayoutManager implements LayoutManager {
protected LayoutManager parentLM;
protected FObj fobj;
+ /** True if this LayoutManager has handled all of its content. */
+ private boolean m_bFinished = false;
+ protected LayoutManager m_curChildLM = null;
+ protected ListIterator m_childLMiter;
+ protected boolean m_bInited = false;
+
protected LayoutPos curPos = new LayoutPos();
static class LayoutPos {
@@ -29,8 +36,13 @@ public abstract class AbstractLayoutManager implements LayoutManager {
}
public AbstractLayoutManager(FObj fobj) {
+ this(fobj, new LMiter(fobj.getChildren()));
+ }
+
+ public AbstractLayoutManager(FObj fobj, ListIterator lmIter) {
this.fobj = fobj;
this.parentLM = null;
+ m_childLMiter = lmIter;
}
public void setParentLM(LayoutManager lm) {
@@ -62,12 +74,6 @@ public abstract class AbstractLayoutManager implements LayoutManager {
// }
/**
- * Force current area to be added to parent area.
- */
- abstract protected boolean flush();
-
-
- /**
* Return an Area which can contain the passed childArea. The childArea
* may not yet have any content, but it has essential traits set.
* In general, if the LayoutManager already has an Area it simply returns
@@ -77,7 +83,6 @@ public abstract class AbstractLayoutManager implements LayoutManager {
* its own area. This includes setting the content IPD and the maximum
* BPD.
*/
- abstract public Area getParentArea(Area childArea);
public boolean generatesInlineAreas() {
@@ -89,7 +94,167 @@ public abstract class AbstractLayoutManager implements LayoutManager {
* dimension of the current area to be exceeded, the parent LM is called
* to add it.
*/
- abstract public boolean addChild(Area childArea);
+ /**
+ * Return currently active child LayoutManager or null if
+ * all children have finished layout.
+ * Note: child must implement LayoutManager! If it doesn't, skip it
+ * and print a warning.
+ */
+ protected LayoutManager getChildLM() {
+ if (m_curChildLM != null && !m_curChildLM.isFinished()) {
+ return m_curChildLM;
+ }
+ while (m_childLMiter.hasNext()) {
+ Object obj = m_childLMiter.next();
+ if (obj instanceof LayoutManager) {
+ m_curChildLM = (LayoutManager) obj;
+ m_curChildLM.setParentLM(this);
+ m_curChildLM.init();
+ return m_curChildLM;
+ } else {
+ m_childLMiter.remove();
+ //log.warn(
+ // "child LM not a LayoutManager: " +
+ // obj.getClass().getName());
+ }
+ }
+ return null;
+ }
+
+ protected boolean hasMoreLM(LayoutManager prevLM) {
+ // prevLM should = m_curChildLM
+ if (prevLM != m_curChildLM) {
+ //log.debug("AbstractLayoutManager.peekNextLM: " +
+ // "passed LM is not current child LM!");
+ return false;
+ }
+ return !m_childLMiter.hasNext();
+ }
+
+
+ /**
+ * Reset the layoutmanager "iterator" so that it will start
+ * with the passed Position's generating LM
+ * on the next call to getChildLM.
+ * @param pos a Position returned by a child layout manager
+ * representing a potential break decision.
+ * If pos is null, then back up to the first child LM.
+ */
+ protected void reset(Position pos) {
+ //if (lm == null) return;
+ LayoutManager lm = (pos != null) ? pos.getLM() : null;
+ if (m_curChildLM != lm) {
+ // ASSERT m_curChildLM == (LayoutManager)m_childLMiter.previous()
+ if (m_childLMiter.hasPrevious() && m_curChildLM !=
+ (LayoutManager) m_childLMiter.previous()) {
+ //log.error("LMiter problem!");
+ }
+ while (m_curChildLM != lm && m_childLMiter.hasPrevious()) {
+ m_curChildLM.resetPosition(null);
+ m_curChildLM = (LayoutManager) m_childLMiter.previous();
+ }
+ m_childLMiter.next(); // Otherwise next returns same object
+ }
+ if(m_curChildLM != null) {
+ m_curChildLM.resetPosition(pos);
+ }
+ if (isFinished()) {
+ setFinished(false);
+ }
+ }
+
+ public void resetPosition(Position resetPos) {
+ // if (resetPos == null) {
+ // reset(null);
+ // }
+ }
+
+
+ /**
+ * This method provides a hook for a LayoutManager to intialize traits
+ * for the areas it will create, based on Properties set on its FO.
+ */
+ public void init() {
+ if (fobj != null && m_bInited == false) {
+ initProperties(fobj.getPropertyManager());
+ m_bInited = true;
+ }
+ }
+
+ /**
+ * This method provides a hook for a LayoutManager to intialize traits
+ * for the areas it will create, based on Properties set on its FO.
+ */
+ protected void initProperties(PropertyManager pm) {
+ //log.debug("AbstractLayoutManager.initProperties");
+ }
+
+
+ /**
+ * Tell whether this LayoutManager has handled all of its content.
+ * @return True if there are no more break possibilities,
+ * ie. the last one returned represents the end of the content.
+ */
+ public boolean isFinished() {
+ return m_bFinished;
+ }
+
+ public void setFinished(boolean bFinished) {
+ m_bFinished = bFinished;
+ }
+
+
+ /**
+ * Generate and return the next break possibility.
+ * Each layout manager must implement this.
+ * TODO: should this be abstract or is there some reasonable
+ * default implementation?
+ */
+ public BreakPoss getNextBreakPoss(LayoutContext context) {
+ return null;
+ }
+
+
+ /**
+ * Return value indicating whether the next area to be generated could
+ * start a new line or flow area.
+ * In general, if can't break at the current level, delegate to
+ * the first child LM.
+ * NOTE: should only be called if the START_AREA flag is set in context,
+ * since the previous sibling LM must have returned a BreakPoss which
+ * does not allow break-after.
+ * QUESTION: in block-stacked areas, does this mean some kind of keep
+ * condition, or is it only used for inline-stacked areas?
+ * Default implementation always returns true.
+ */
+ public boolean canBreakBefore(LayoutContext context) {
+ return true;
+ }
+
+
+ public void addAreas(PositionIterator posIter, LayoutContext context) {
+ }
+
+
+ public void getWordChars(StringBuffer sbChars, Position bp1,
+ Position bp2) {
+ }
+
+ /* ---------------------------------------------------------
+ * PROVIDE NULL IMPLEMENTATIONS OF METHODS from LayoutManager
+ * interface which are declared abstract in AbstractLayoutManager.
+ * ---------------------------------------------------------*/
+ public Area getParentArea(Area childArea) {
+ return null;
+ }
+
+ protected boolean flush() {
+ return false;
+ }
+
+ public boolean addChild(Area childArea) {
+ return false;
+ }
}
diff --git a/src/org/apache/fop/layoutmgr/BPLayoutManager.java b/src/org/apache/fop/layoutmgr/BPLayoutManager.java
deleted file mode 100644
index eef90a60d..000000000
--- a/src/org/apache/fop/layoutmgr/BPLayoutManager.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.layoutmgr;
-
-
-import org.apache.fop.area.Area;
-
-/**
- * The interface for all BreakPoss LayoutManagers.
- */
-public interface BPLayoutManager extends LayoutManager {
-
- /**
- * Return true if the next area which would be generated by this
- * LayoutManager could start a new line (or flow for block-level FO).
- */
- public boolean canBreakBefore(LayoutContext lc);
-
- /**
- * Generate and return the next break possibility.
- * @param context The layout context contains information about pending
- * space specifiers from ancestor areas or previous areas, reference
- * area inline-progression-dimension and various other layout-related
- * information.
- */
- public BreakPoss getNextBreakPoss(LayoutContext context);
-
-
- /**
- * Return a value indicating whether this LayoutManager has laid out
- * all its content (or generated BreakPossibilities for all content.)
- */
- public 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.
- */
- public void setFinished(boolean isFinished);
-
- /**
- * Tell the layout manager to add all the child areas implied
- * by Position objects which will be returned by the
- * Iterator.
- */
- public void addAreas(PositionIterator posIter, LayoutContext context);
-
- public void init();
-
- public void resetPosition(Position position);
-
- public void getWordChars(StringBuffer sbChars, Position bp1,
- Position bp2);
-
-}
diff --git a/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index 749a0d0e1..4c6ea73ff 100644
--- a/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -102,7 +102,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
stackLimit = context.getStackLimit();
}
- BPLayoutManager curLM ; // currently active LM
+ LayoutManager curLM ; // currently active LM
MinOptMax stackSize = new MinOptMax();
// if starting add space before
@@ -160,7 +160,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
public BreakPoss getAbsoluteBreakPoss(LayoutContext context) {
- BPLayoutManager curLM ; // currently active LM
+ LayoutManager curLM ; // currently active LM
MinOptMax stackSize = new MinOptMax();
@@ -205,7 +205,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
LayoutContext layoutContext) {
getParentArea(null);
- BPLayoutManager childLM ;
+ LayoutManager childLM ;
int iStartPos = 0;
LayoutContext lc = new LayoutContext(0);
while (parentIter.hasNext()) {
diff --git a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java
index f8938ea4c..a381129e4 100644
--- a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -51,7 +51,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
while (proxy.hasNext()) {
LayoutManager lm = (LayoutManager) proxy.next();
if(lm.generatesInlineAreas()) {
- LineBPLayoutManager lineLM = createLineManager(lm);
+ LineLayoutManager lineLM = createLineManager(lm);
m_listLMs.add(lineLM);
} else {
m_listLMs.add(lm);
@@ -63,7 +63,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
return false;
}
- protected LineBPLayoutManager createLineManager(
+ protected LineLayoutManager createLineManager(
LayoutManager firstlm) {
LayoutManager lm;
ArrayList inlines = new ArrayList();
@@ -77,8 +77,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
break;
}
}
- LineBPLayoutManager child;
- child = new LineBPLayoutManager(fobj, inlines, lineHeight,
+ LineLayoutManager child;
+ child = new LineLayoutManager(fobj, inlines, lineHeight,
lead, follow);
return child;
@@ -109,7 +109,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
}
public BreakPoss getNextBreakPoss(LayoutContext context) {
- BPLayoutManager curLM ; // currently active LM
+ LayoutManager curLM ; // currently active LM
MinOptMax stackSize = new MinOptMax();
// if starting add space before
@@ -173,7 +173,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
LayoutContext layoutContext) {
getParentArea(null);
- BPLayoutManager childLM ;
+ LayoutManager childLM ;
int iStartPos = 0;
LayoutContext lc = new LayoutContext(0);
while (parentIter.hasNext()) {
diff --git a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
index b5433ea45..1b091a662 100644
--- a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
@@ -19,7 +19,7 @@ import java.util.Iterator;
* Base LayoutManager class for all areas which stack their child
* areas in the block-progression direction, such as Flow, Block, ListBlock.
*/
-public abstract class BlockStackingLayoutManager extends AbstractBPLayoutManager {
+public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
/** Reference to FO whose areas it's managing or to the traits
* of the FO.
*/
diff --git a/src/org/apache/fop/layoutmgr/BreakPoss.java b/src/org/apache/fop/layoutmgr/BreakPoss.java
index 7a8aa3099..004e8970b 100644
--- a/src/org/apache/fop/layoutmgr/BreakPoss.java
+++ b/src/org/apache/fop/layoutmgr/BreakPoss.java
@@ -83,11 +83,11 @@ public class BreakPoss {
/**
* The top-level layout manager responsible for this break
*/
- public BPLayoutManager getLayoutManager() {
+ public LayoutManager getLayoutManager() {
return m_position.getLM();
}
- // public void setLayoutManager(BPLayoutManager lm) {
+ // public void setLayoutManager(LayoutManager lm) {
// m_lm = lm;
// }
diff --git a/src/org/apache/fop/layoutmgr/BreakPossPosIter.java b/src/org/apache/fop/layoutmgr/BreakPossPosIter.java
index 823751cee..b9342b28c 100644
--- a/src/org/apache/fop/layoutmgr/BreakPossPosIter.java
+++ b/src/org/apache/fop/layoutmgr/BreakPossPosIter.java
@@ -38,7 +38,7 @@ public class BreakPossPosIter extends PositionIterator {
return (BreakPoss) peekNext();
}
- protected BPLayoutManager getLM(Object nextObj) {
+ protected LayoutManager getLM(Object nextObj) {
return ((BreakPoss) nextObj).getLayoutManager();
}
diff --git a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java
index 03fb82a98..e9238c7d9 100644
--- a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java
@@ -26,7 +26,7 @@ public class ContentLayoutManager implements LayoutManager {
holder = area;
}
- public void fillArea(BPLayoutManager curLM) {
+ public void fillArea(LayoutManager curLM) {
ArrayList childBreaks = new ArrayList();
MinOptMax stack = new MinOptMax();
@@ -81,5 +81,32 @@ public class ContentLayoutManager implements LayoutManager {
return 10000000;
}
+ public boolean canBreakBefore(LayoutContext lc) {
+ return false;
+ }
+
+ public BreakPoss getNextBreakPoss(LayoutContext context) {
+ return null;
+ }
+
+ public boolean isFinished() {
+ return false;
+ }
+
+ public void setFinished(boolean isFinished) {
+ }
+
+ public void addAreas(PositionIterator posIter, LayoutContext context) {
+ }
+
+ public void init() {
+ }
+
+ public void resetPosition(Position position) {
+ }
+
+ public void getWordChars(StringBuffer sbChars, Position bp1,
+ Position bp2) {
+ }
}
diff --git a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java
index e55647d1f..f7dce7825 100644
--- a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java
@@ -38,7 +38,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
public BreakPoss getNextBreakPoss(LayoutContext context) {
- BPLayoutManager curLM ; // currently active LM
+ LayoutManager curLM ; // currently active LM
MinOptMax stackSize = new MinOptMax();
while ((curLM = getChildLM()) != null) {
@@ -87,7 +87,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) {
- BPLayoutManager childLM ;
+ LayoutManager childLM ;
int iStartPos = 0;
LayoutContext lc = new LayoutContext(0);
while (parentIter.hasNext()) {
diff --git a/src/org/apache/fop/layoutmgr/InlineStackingBPLayoutManager.java b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
index d4e66e76f..dcc6414c8 100644
--- a/src/org/apache/fop/layoutmgr/InlineStackingBPLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
@@ -25,7 +25,7 @@ import java.util.HashMap;
* LayoutManager for objects which stack children in the inline direction,
* such as Inline or Line
*/
-public class InlineStackingBPLayoutManager extends AbstractBPLayoutManager {
+public class InlineStackingLayoutManager extends AbstractLayoutManager {
private static class StackingIter extends PositionIterator {
@@ -34,7 +34,7 @@ public class InlineStackingBPLayoutManager extends AbstractBPLayoutManager {
super(parentIter);
}
- protected BPLayoutManager getLM(Object nextObj) {
+ protected LayoutManager getLM(Object nextObj) {
return ((Position) nextObj).getPosition().getLM();
}
@@ -64,13 +64,13 @@ public class InlineStackingBPLayoutManager extends AbstractBPLayoutManager {
private BreakPoss m_prevBP;
private LayoutContext m_childLC ;
- private BPLayoutManager m_lastChildLM = null; // Set when return last breakposs
+ private LayoutManager m_lastChildLM = null; // Set when return last breakposs
private boolean m_bAreaCreated = false;
/** Used to store previous content IPD for each child LM. */
private HashMap m_hmPrevIPD = new HashMap();
- public InlineStackingBPLayoutManager(FObj fobj,
+ public InlineStackingLayoutManager(FObj fobj,
ListIterator childLMiter) {
super(fobj, childLMiter);
// Initialize inline properties (borders, padding, space)
@@ -131,7 +131,7 @@ public class InlineStackingBPLayoutManager extends AbstractBPLayoutManager {
// ASSERT (prevPos.getLM() == this)
if (prevPos.getLM() != this) {
//log.error(
- // "InlineStackingBPLayoutManager.resetPosition: " +
+ // "InlineStackingLayoutManager.resetPosition: " +
// "LM mismatch!!!");
}
// Back up the child LM Position
@@ -167,7 +167,7 @@ public class InlineStackingBPLayoutManager extends AbstractBPLayoutManager {
hasLeadingFence(false)) {
return true;
}
- BPLayoutManager lm = getChildLM();
+ LayoutManager lm = getChildLM();
if (lm != null) {
return lm.canBreakBefore(context);
} else
@@ -187,7 +187,7 @@ public class InlineStackingBPLayoutManager extends AbstractBPLayoutManager {
public BreakPoss getNextBreakPoss(LayoutContext lc) {
// Get a break from currently active child LM
BreakPoss bp = null;
- BPLayoutManager curLM ;
+ LayoutManager curLM ;
SpaceSpecifier leadingSpace = lc.getLeadingSpace();
if (lc.startsNewArea()) {
@@ -249,7 +249,7 @@ public class InlineStackingBPLayoutManager extends AbstractBPLayoutManager {
}
}
- /** ATTENTION: ALSO USED BY LineBPLayoutManager! */
+ /** ATTENTION: ALSO USED BY LineLayoutManager! */
protected void initChildLC(LayoutContext childLC, BreakPoss prevBP,
boolean bStartParent, boolean bFirstChildBP,
SpaceSpecifier leadingSpace) {
@@ -328,7 +328,7 @@ public class InlineStackingBPLayoutManager extends AbstractBPLayoutManager {
}
- /** ATTENTION: ALSO USED BY LineBPLayoutManager! */
+ /** ATTENTION: ALSO USED BY LineLayoutManager! */
protected MinOptMax updatePrevIPD(BreakPoss bp, BreakPoss prevBP,
boolean bStartParent, boolean bFirstArea) {
MinOptMax prevIPD = new MinOptMax(0);
@@ -410,8 +410,8 @@ public class InlineStackingBPLayoutManager extends AbstractBPLayoutManager {
// posIter iterates over positions returned by this LM
StackingIter childPosIter = new StackingIter(parentIter);
- BPLayoutManager prevLM = null;
- BPLayoutManager childLM ;
+ LayoutManager prevLM = null;
+ LayoutManager childLM ;
while ((childLM = childPosIter.getNextChildLM()) != null) {
//getContext().setTrailingSpace(new SpaceSpecifier(false));
childLM.addAreas(childPosIter, getContext());
diff --git a/src/org/apache/fop/layoutmgr/LayoutManager.java b/src/org/apache/fop/layoutmgr/LayoutManager.java
index e547d01bf..422979cf9 100644
--- a/src/org/apache/fop/layoutmgr/LayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/LayoutManager.java
@@ -19,4 +19,47 @@ public interface LayoutManager {
public boolean addChild (Area childArea);
public void setParentLM(LayoutManager lm);
public int getContentIPD();
+
+ /**
+ * Return true if the next area which would be generated by this
+ * LayoutManager could start a new line (or flow for block-level FO).
+ */
+ public boolean canBreakBefore(LayoutContext lc);
+
+ /**
+ * Generate and return the next break possibility.
+ * @param context The layout context contains information about pending
+ * space specifiers from ancestor areas or previous areas, reference
+ * area inline-progression-dimension and various other layout-related
+ * information.
+ */
+ public BreakPoss getNextBreakPoss(LayoutContext context);
+
+
+ /**
+ * Return a value indicating whether this LayoutManager has laid out
+ * all its content (or generated BreakPossibilities for all content.)
+ */
+ public 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.
+ */
+ public void setFinished(boolean isFinished);
+
+ /**
+ * Tell the layout manager to add all the child areas implied
+ * by Position objects which will be returned by the
+ * Iterator.
+ */
+ public void addAreas(PositionIterator posIter, LayoutContext context);
+
+ public void init();
+
+ public void resetPosition(Position position);
+
+ public void getWordChars(StringBuffer sbChars, Position bp1,
+ Position bp2);
}
diff --git a/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java b/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
index 261d24aeb..f05d026e8 100644
--- a/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
@@ -18,7 +18,7 @@ import org.apache.fop.fo.properties.VerticalAlign;
* These are all inline objects. Most of them cannot be split (Text is
* an exception to this rule.)
*/
-public class LeafNodeLayoutManager extends AbstractBPLayoutManager {
+public class LeafNodeLayoutManager extends AbstractLayoutManager {
private InlineArea curArea = null;
private int alignment;
diff --git a/src/org/apache/fop/layoutmgr/LeafPosition.java b/src/org/apache/fop/layoutmgr/LeafPosition.java
index 0a8205ad1..95f4dbd9e 100644
--- a/src/org/apache/fop/layoutmgr/LeafPosition.java
+++ b/src/org/apache/fop/layoutmgr/LeafPosition.java
@@ -11,7 +11,7 @@ public class LeafPosition extends Position {
private int m_iLeafPos;
- public LeafPosition(BPLayoutManager lm, int iLeafPos) {
+ public LeafPosition(LayoutManager lm, int iLeafPos) {
super(lm);
m_iLeafPos = iLeafPos;
}
diff --git a/src/org/apache/fop/layoutmgr/LineBPLayoutManager.java b/src/org/apache/fop/layoutmgr/LineLayoutManager.java
index 7fdb7d547..a21d41ce5 100644
--- a/src/org/apache/fop/layoutmgr/LineBPLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/LineLayoutManager.java
@@ -33,10 +33,10 @@ import java.util.ArrayList;
/**
- * BPLayoutManager for lines. It builds one or more lines containing
+ * LayoutManager for lines. It builds one or more lines containing
* inline areas generated by its sub layout managers.
*/
-public class LineBPLayoutManager extends InlineStackingBPLayoutManager {
+public class LineLayoutManager extends InlineStackingLayoutManager {
/**
* Private class to store information about inline breaks.
@@ -52,7 +52,7 @@ public class LineBPLayoutManager extends InlineStackingBPLayoutManager {
int lineHeight;
int baseline;
- LineBreakPosition(BPLayoutManager lm, int iBreakIndex,
+ LineBreakPosition(LayoutManager lm, int iBreakIndex,
double ipdA, double dAdjust, int ind, int lh, int bl) {
super(lm, iBreakIndex);
// m_iPos = iBreakIndex;
@@ -81,7 +81,7 @@ public class LineBPLayoutManager extends InlineStackingBPLayoutManager {
// inline start pos when adding areas
int iStartPos = 0;
- public LineBPLayoutManager(FObj fobj, List lms, int lh, int l, int f) {
+ public LineLayoutManager(FObj fobj, List lms, int lh, int l, int f) {
//super(fobj, lms.listIterator(), lh, l, f);
super(fobj, lms.listIterator());
lineHeight = lh;
@@ -108,7 +108,7 @@ public class LineBPLayoutManager extends InlineStackingBPLayoutManager {
// Get a break from currently active child LM
// Set up constraints for inline level managers
- BPLayoutManager curLM ; // currently active LM
+ LayoutManager curLM ; // currently active LM
BreakPoss prevBP = null;
BreakPoss bp = null; // proposed BreakPoss
@@ -295,7 +295,7 @@ public class LineBPLayoutManager extends InlineStackingBPLayoutManager {
// See if could break before next area
// TODO: do we need to set anything on the layout context?
LayoutContext lc = new LayoutContext(0);
- BPLayoutManager nextLM = getChildLM();
+ LayoutManager nextLM = getChildLM();
return (nextLM == null || nextLM.canBreakBefore(lc));
}
}
@@ -534,7 +534,7 @@ public class LineBPLayoutManager extends InlineStackingBPLayoutManager {
// Set size etc
// dSpaceAdjust should reference extra space in the BPD
public void addAreas(PositionIterator parentIter, double dSpaceAdjust) {
- BPLayoutManager childLM ;
+ LayoutManager childLM ;
//int iStartPos = 0;
LayoutContext lc = new LayoutContext(0);
while (parentIter.hasNext()) {
diff --git a/src/org/apache/fop/layoutmgr/NonLeafPosition.java b/src/org/apache/fop/layoutmgr/NonLeafPosition.java
index c4c2a0725..38ed0e227 100644
--- a/src/org/apache/fop/layoutmgr/NonLeafPosition.java
+++ b/src/org/apache/fop/layoutmgr/NonLeafPosition.java
@@ -11,7 +11,7 @@ public class NonLeafPosition extends Position {
private Position m_subPos ;
- public NonLeafPosition(BPLayoutManager lm, Position subPos) {
+ public NonLeafPosition(LayoutManager lm, Position subPos) {
super(lm);
m_subPos = subPos;
}
diff --git a/src/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/org/apache/fop/layoutmgr/PageLayoutManager.java
index 464334022..d34fee09a 100644
--- a/src/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -22,12 +22,12 @@ import java.util.List;
* LayoutManager for a PageSequence and its flow.
* It manages all page-related layout.
*/
-public class PageLayoutManager extends AbstractBPLayoutManager implements Runnable {
+public class PageLayoutManager extends AbstractLayoutManager implements Runnable {
private static class BlockBreakPosition extends LeafPosition {
BreakPoss breakps;
- BlockBreakPosition(BPLayoutManager lm, BreakPoss bp) {
+ BlockBreakPosition(LayoutManager lm, BreakPoss bp) {
super(lm, 0);
breakps = bp;
}
@@ -110,7 +110,7 @@ public class PageLayoutManager extends AbstractBPLayoutManager implements Runnab
public BreakPoss getNextBreakPoss(LayoutContext context) {
- BPLayoutManager curLM ; // currently active LM
+ LayoutManager curLM ; // currently active LM
while ((curLM = getChildLM()) != null) {
BreakPoss bp = null;
diff --git a/src/org/apache/fop/layoutmgr/Position.java b/src/org/apache/fop/layoutmgr/Position.java
index 72342104c..35b173b91 100644
--- a/src/org/apache/fop/layoutmgr/Position.java
+++ b/src/org/apache/fop/layoutmgr/Position.java
@@ -8,13 +8,13 @@
package org.apache.fop.layoutmgr;
public class Position {
- private BPLayoutManager m_lm;
+ private LayoutManager m_lm;
- public Position(BPLayoutManager lm) {
+ public Position(LayoutManager lm) {
m_lm = lm;
}
- public BPLayoutManager getLM() {
+ public LayoutManager getLM() {
return m_lm;
}
diff --git a/src/org/apache/fop/layoutmgr/PositionIterator.java b/src/org/apache/fop/layoutmgr/PositionIterator.java
index 4ece96999..e3d5bc262 100644
--- a/src/org/apache/fop/layoutmgr/PositionIterator.java
+++ b/src/org/apache/fop/layoutmgr/PositionIterator.java
@@ -14,7 +14,7 @@ import java.util.NoSuchElementException;
abstract class PositionIterator implements Iterator {
Iterator m_parentIter;
Object m_nextObj;
- BPLayoutManager m_childLM;
+ LayoutManager m_childLM;
boolean m_bHasNext;
PositionIterator(Iterator parentIter) {
@@ -23,7 +23,7 @@ abstract class PositionIterator implements Iterator {
//checkNext();
}
- BPLayoutManager getNextChildLM() {
+ LayoutManager getNextChildLM() {
// Move to next "segment" of iterator, ie: new childLM
if (m_childLM == null && m_nextObj != null) {
m_childLM = getLM(m_nextObj);
@@ -32,7 +32,7 @@ abstract class PositionIterator implements Iterator {
return m_childLM;
}
- abstract protected BPLayoutManager getLM(Object nextObj);
+ abstract protected LayoutManager getLM(Object nextObj);
abstract protected Position getPos(Object nextObj);
@@ -46,7 +46,7 @@ abstract class PositionIterator implements Iterator {
}
protected boolean checkNext() {
- BPLayoutManager lm = getLM(m_nextObj);
+ LayoutManager lm = getLM(m_nextObj);
if (m_childLM == null) {
m_childLM = lm;
} else if (m_childLM != lm) {
diff --git a/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
index 94599533a..9932e1a45 100644
--- a/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
@@ -36,7 +36,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
public BreakPoss getNextBreakPoss(LayoutContext context) {
- BPLayoutManager curLM ; // currently active LM
+ LayoutManager curLM; // currently active LM
while ((curLM = getChildLM()) != null) {
// Make break positions and return page break
@@ -63,7 +63,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) {
- BPLayoutManager childLM ;
+ LayoutManager childLM;
int iStartPos = 0;
LayoutContext lc = new LayoutContext(0);
while (parentIter.hasNext()) {
diff --git a/src/org/apache/fop/layoutmgr/TextBPLayoutManager.java b/src/org/apache/fop/layoutmgr/TextLayoutManager.java
index 9921eab50..0eb1b977e 100644
--- a/src/org/apache/fop/layoutmgr/TextBPLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/TextLayoutManager.java
@@ -28,7 +28,7 @@ import java.util.ArrayList;
* LayoutManager for text (a sequence of characters) which generates one
* or more inline areas.
*/
-public class TextBPLayoutManager extends AbstractBPLayoutManager {
+public class TextLayoutManager extends AbstractLayoutManager {
/**
* Store information about each potential word area.
@@ -86,7 +86,7 @@ public class TextBPLayoutManager extends AbstractBPLayoutManager {
private int m_iNbSpacesPending;
- public TextBPLayoutManager(FObj fobj, char[] chars, TextInfo textInfo) {
+ public TextLayoutManager(FObj fobj, char[] chars, TextInfo textInfo) {
super(fobj);
this.chars = chars;
this.textInfo = textInfo;
@@ -151,7 +151,7 @@ public class TextBPLayoutManager extends AbstractBPLayoutManager {
// ASSERT (prevPos.getLM() == this)
if (prevPos.getLM() != this) {
//log.error(
- // "TextBPLayoutManager.resetPosition: " + "LM mismatch!!!");
+ // "TextLayoutManager.resetPosition: " + "LM mismatch!!!");
}
LeafPosition tbp = (LeafPosition) prevPos;
AreaInfo ai =