aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-08-27 15:33:59 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-08-27 15:33:59 +0000
commitdf97fe5c1e4c17b504950f661d4a8856357e2705 (patch)
tree083c14b72cd4e086ba6f9bfe3b6091246eb07b32 /src
parentc62845df2a4bf856320d2bfba24b3a2a49294177 (diff)
downloadxmlgraphics-fop-df97fe5c1e4c17b504950f661d4a8856357e2705.tar.gz
xmlgraphics-fop-df97fe5c1e4c17b504950f661d4a8856357e2705.zip
1. move fo/pagination/Region.makeRegionReferenceArea() to layoutmgr/PageLayoutManager.makeRegionReferenceArea()
2. move fo/pagination/RegionBody.makeRegionReferenceArea() layoutmgr/PageLayoutManager.makeRegionBodyReferenceArea() git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196861 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/pagination/Region.java17
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBody.java26
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageLayoutManager.java48
3 files changed, 48 insertions, 43 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java
index 3ae25fdd4..47327d26c 100644
--- a/src/java/org/apache/fop/fo/pagination/Region.java
+++ b/src/java/org/apache/fop/fo/pagination/Region.java
@@ -88,7 +88,7 @@ public abstract class Region extends FObj {
private String regionName;
/** Holds the overflow attribute */
- protected int overflow;
+ public int overflow;
/** Holds the writing mode */
protected int wm;
@@ -138,19 +138,6 @@ public abstract class Region extends FObj {
public abstract Rectangle getViewportRectangle(FODimension pageRefRect);
/**
- * Create the region reference area for this region master.
- * @param absRegVPRect The region viewport rectangle is "absolute" coordinates
- * where x=distance from left, y=distance from bottom, width=right-left
- * height=top-bottom
- * @return a new region reference area
- */
- public RegionReference makeRegionReferenceArea(Rectangle2D absRegVPRect) {
- RegionReference r = new RegionReference(getRegionAreaClass());
- setRegionPosition(r, absRegVPRect);
- return r;
- }
-
- /**
* Set the region position inside the region viewport.
* This sets the trasnform that is used to place the contents of
* the region.
@@ -158,7 +145,7 @@ public abstract class Region extends FObj {
* @param r the region reference area
* @param absRegVPRect the rectangle to place the region contents
*/
- protected void setRegionPosition(RegionReference r, Rectangle2D absRegVPRect) {
+ public void setRegionPosition(RegionReference r, Rectangle2D absRegVPRect) {
FODimension reldims = new FODimension(0, 0);
r.setCTM(CTM.getCTMandRelDims(propMgr.getAbsRefOrient(),
propMgr.getWritingMode(), absRegVPRect, reldims));
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java
index b03098b32..e717a3722 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBody.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java
@@ -60,7 +60,6 @@ import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeVisitor;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.Property;
-import org.apache.fop.fo.properties.Overflow;
import org.apache.fop.fo.properties.WritingMode;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.FODimension;
@@ -147,31 +146,6 @@ public class RegionBody extends Region {
}
/**
- * Override the inherited method.
- * @see org.apache.fop.fo.pagination.Region#makeRegionReferenceArea(Rectangle2D)
- */
- public RegionReference makeRegionReferenceArea(Rectangle2D absRegVPRect) {
- // Should set some column stuff here I think, or put it elsewhere
- BodyRegion body = new BodyRegion();
- setRegionPosition(body, absRegVPRect);
- int columnCount =
- this.properties.get("column-count").getNumber().intValue();
- if ((columnCount > 1) && (overflow == Overflow.SCROLL)) {
- // recover by setting 'column-count' to 1. This is allowed but
- // not required by the spec.
- getLogger().error("Setting 'column-count' to 1 because "
- + "'overflow' is set to 'scroll'");
- columnCount = 1;
- }
- body.setColumnCount(columnCount);
-
- int columnGap =
- this.properties.get("column-gap").getLength().getValue();
- body.setColumnGap(columnGap);
- return body;
- }
-
- /**
* This is a hook for an FOTreeVisitor subclass to be able to access
* this object.
* @param fotv the FOTreeVisitor subclass that can access this object.
diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
index 732187728..c839ada34 100644
--- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -83,6 +83,7 @@ import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.Constants;
+import org.apache.fop.fo.properties.Overflow;
import java.util.ArrayList;
import java.util.List;
@@ -785,7 +786,11 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
regenum.hasNext();) {
Region r = (Region)regenum.next();
RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM);
- rvp.setRegion(r.makeRegionReferenceArea(rvp.getViewArea()));
+ if (r.getRegionAreaClass() == RegionReference.BODY) {
+ rvp.setRegion(makeRegionBodyReferenceArea(r, rvp.getViewArea()));
+ } else {
+ rvp.setRegion(makeRegionReferenceArea(r, rvp.getViewArea()));
+ }
page.setRegion(r.getRegionAreaClass(), rvp);
if (r.getRegionAreaClass() == RegionReference.BODY) {
bHasBody = true;
@@ -831,5 +836,44 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
TraitSetter.addBackground(rv, bProps);
}
-}
+ /**
+ * Override the inherited method.
+ * @see org.apache.fop.fo.pagination.Region#makeRegionReferenceArea(Rectangle2D)
+ */
+ public RegionReference makeRegionBodyReferenceArea(Region r,
+ Rectangle2D absRegVPRect) {
+ // Should set some column stuff here I think, or put it elsewhere
+ BodyRegion body = new BodyRegion();
+ r.setRegionPosition(body, absRegVPRect);
+ int columnCount =
+ r.properties.get("column-count").getNumber().intValue();
+ if ((columnCount > 1) && (r.overflow == Overflow.SCROLL)) {
+ // recover by setting 'column-count' to 1. This is allowed but
+ // not required by the spec.
+ getLogger().error("Setting 'column-count' to 1 because "
+ + "'overflow' is set to 'scroll'");
+ columnCount = 1;
+ }
+ body.setColumnCount(columnCount);
+ int columnGap =
+ r.properties.get("column-gap").getLength().getValue();
+ body.setColumnGap(columnGap);
+ return body;
+ }
+
+ /**
+ * Create the region reference area for this region master.
+ * @param absRegVPRect The region viewport rectangle is "absolute" coordinates
+ * where x=distance from left, y=distance from bottom, width=right-left
+ * height=top-bottom
+ * @return a new region reference area
+ */
+ public RegionReference makeRegionReferenceArea(Region r,
+ Rectangle2D absRegVPRect) {
+ RegionReference rr = new RegionReference(r.getRegionAreaClass());
+ r.setRegionPosition(rr, absRegVPRect);
+ return rr;
+ }
+
+}