aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2005-05-14 05:22:16 +0000
committerGlen Mazza <gmazza@apache.org>2005-05-14 05:22:16 +0000
commite67ea113c1dda7b581d767e41d2046da8a10111f (patch)
tree562c460fa4726c07cfb3ce25f94a255ae93994f9 /src/java
parente835307c9373bed3a8f41bb43e4faee15fdaf548 (diff)
downloadxmlgraphics-fop-e67ea113c1dda7b581d767e41d2046da8a10111f.tar.gz
xmlgraphics-fop-e67ea113c1dda7b581d767e41d2046da8a10111f.zip
Providing the region FO to RegionReference, so it is no longer
necessary for PSLM to separately supply it to SCLM. Some simplification of SCLM's Breaker class. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198628 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/area/BodyRegion.java31
-rw-r--r--src/java/org/apache/fop/area/Page.java6
-rw-r--r--src/java/org/apache/fop/area/RegionReference.java23
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java24
5 files changed, 38 insertions, 48 deletions
diff --git a/src/java/org/apache/fop/area/BodyRegion.java b/src/java/org/apache/fop/area/BodyRegion.java
index 628330540..672b6b66d 100644
--- a/src/java/org/apache/fop/area/BodyRegion.java
+++ b/src/java/org/apache/fop/area/BodyRegion.java
@@ -18,7 +18,7 @@
package org.apache.fop.area;
-import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.pagination.RegionBody;
/**
* This class is a container for the areas that may be generated by
@@ -37,23 +37,14 @@ public class BodyRegion extends RegionReference {
* Constructor which can read traits directly
* from an fo:region-body formatting object.
*/
- public BodyRegion(int columnCount, int columnGap, RegionViewport parent) {
- super(Constants.FO_REGION_BODY, parent);
- this.columnCount = columnCount;
- this.columnGap = columnGap;
+ public BodyRegion(RegionBody rb, RegionViewport parent) {
+ super(rb, parent);
+ this.columnCount = rb.getColumnCount();
+ this.columnGap = rb.getColumnGap();
mainReference = new MainReference(this);
}
/**
- * Set the number of columns for blocks when not spanning
- *
- * @param colCount the number of columns
- */
- public void setColumnCount(int colCount) {
- this.columnCount = colCount;
- }
-
- /**
* Get the number of columns when not spanning
*
* @return the number of columns
@@ -62,16 +53,6 @@ public class BodyRegion extends RegionReference {
return this.columnCount;
}
- /**
- * Set the column gap between columns
- * The length is in millipoints.
- *
- * @param colGap the column gap in millipoints
- */
- public void setColumnGap(int colGap) {
- this.columnGap = colGap;
- }
-
/** @return the column-gap value */
public int getColumnGap() {
return this.columnGap;
@@ -126,7 +107,7 @@ public class BodyRegion extends RegionReference {
* @return a shallow copy of this object
*/
public Object clone() {
- BodyRegion br = new BodyRegion(columnCount, columnGap, regionViewport);
+ BodyRegion br = new BodyRegion((RegionBody) regionFO, regionViewport);
br.setCTM(getCTM());
br.setIPD(getIPD());
br.beforeFloat = beforeFloat;
diff --git a/src/java/org/apache/fop/area/Page.java b/src/java/org/apache/fop/area/Page.java
index 858c0722d..1733f4879 100644
--- a/src/java/org/apache/fop/area/Page.java
+++ b/src/java/org/apache/fop/area/Page.java
@@ -99,11 +99,9 @@ public class Page implements Serializable, Cloneable {
r.setLayoutDimension(PercentBase.BLOCK_IPD, rvp.getIPD());
r.setLayoutDimension(PercentBase.BLOCK_BPD, rvp.getBPD());
if (r.getNameId() == Constants.FO_REGION_BODY) {
- RegionBody rb = (RegionBody) r;
- rr = new BodyRegion(rb.getColumnCount(), rb.getColumnGap(),
- rvp);
+ rr = new BodyRegion((RegionBody) r, rvp);
} else {
- rr = new RegionReference(r.getNameId(), rvp);
+ rr = new RegionReference(r, rvp);
}
setRegionReferencePosition(rr, r, rvp.getViewArea());
rvp.setRegionReference(rr);
diff --git a/src/java/org/apache/fop/area/RegionReference.java b/src/java/org/apache/fop/area/RegionReference.java
index 6f671e96f..b9f256517 100644
--- a/src/java/org/apache/fop/area/RegionReference.java
+++ b/src/java/org/apache/fop/area/RegionReference.java
@@ -21,7 +21,7 @@ package org.apache.fop.area;
import java.util.ArrayList;
import java.util.List;
-import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.pagination.Region;
/**
* This is a region reference area for a page regions.
@@ -29,8 +29,9 @@ import org.apache.fop.fo.Constants;
* so the page master can make copies from the original page and regions.
*/
public class RegionReference extends Area implements Cloneable {
- private int regionClass = Constants.FO_REGION_BEFORE;
+ protected Region regionFO;
private CTM ctm;
+
// the list of block areas from the static flow
private List blocks = new ArrayList();
@@ -43,8 +44,8 @@ public class RegionReference extends Area implements Cloneable {
*
* @param type the region class type
*/
- public RegionReference(int type, RegionViewport parent) {
- regionClass = type;
+ public RegionReference(Region regionFO, RegionViewport parent) {
+ this.regionFO = regionFO;
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
regionViewport = parent;
}
@@ -93,7 +94,17 @@ public class RegionReference extends Area implements Cloneable {
* @return the region class
*/
public int getRegionClass() {
- return regionClass;
+ return regionFO.getNameId();
+ }
+
+ /**
+ * Return the Region FO which provides the
+ * traits for this region.
+ *
+ * @return the region formatting object
+ */
+ public Region getRegionFO() {
+ return regionFO;
}
/**
@@ -113,7 +124,7 @@ public class RegionReference extends Area implements Cloneable {
* @return a copy of this region reference area
*/
public Object clone() {
- RegionReference rr = new RegionReference(regionClass, regionViewport);
+ RegionReference rr = new RegionReference(regionFO, regionViewport);
rr.ctm = ctm;
rr.setIPD(getIPD());
return rr;
diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
index bd7cac98a..cde2e9097 100644
--- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
@@ -442,7 +442,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
areaTreeHandler.getLayoutManagerMaker().makeLayoutManager(sc);
lm.setTargetRegion(rv.getRegionReference());
lm.setParent(this);
- lm.doLayout(reg);
+ lm.doLayout();
lm.reset(null);
}
diff --git a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
index aaed403d4..8129473d0 100644
--- a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
@@ -228,9 +228,10 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
return targetRegion;
}
- public void doLayout(SideRegion region) {
- MinOptMax range = new MinOptMax(targetRegion.getIPD());
- StaticContentBreaker breaker = new StaticContentBreaker(region, this, range);
+ public void doLayout() {
+ Region region = targetRegion.getRegionFO();
+ StaticContentBreaker breaker = new StaticContentBreaker(
+ this, targetRegion.getIPD(), region.getDisplayAlign());
breaker.doLayout(targetRegion.getBPD());
if (breaker.isOverflow()) {
if (region.getOverflow() == EN_ERROR_IF_OVERFLOW) {
@@ -240,17 +241,17 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
}
}
- private class StaticContentBreaker extends AbstractBreaker {
-
- private Region region;
+ private class StaticContentBreaker extends AbstractBreaker {
private StaticContentLayoutManager lm;
- private MinOptMax ipd;
+ private int displayAlign;
+ private int ipd;
boolean overflow = false;
- public StaticContentBreaker(Region region, StaticContentLayoutManager lm, MinOptMax ipd) {
- this.region = region;
+ public StaticContentBreaker(StaticContentLayoutManager lm, int ipd,
+ int displayAlign) {
this.lm = lm;
this.ipd = ipd;
+ this.displayAlign = displayAlign;
}
public boolean isOverflow() {
@@ -263,7 +264,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
protected LayoutContext createLayoutContext() {
LayoutContext lc = super.createLayoutContext();
- lc.setRefIPD(ipd.opt);
+ lc.setRefIPD(ipd);
return lc;
}
@@ -290,7 +291,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
}
protected int getCurrentDisplayAlign() {
- return region.getDisplayAlign();
+ return displayAlign;
}
protected boolean hasMoreContent() {
@@ -317,7 +318,6 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
protected LayoutManager getCurrentChildLM() {
return null; //TODO NYI
}
-
}
}