aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-08-27 01:51:06 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-08-27 01:51:06 +0000
commitc62845df2a4bf856320d2bfba24b3a2a49294177 (patch)
tree6a1292aad56def82f0fc80199589d94d85d7802c /src/java
parent73fc28f7963ef7cbf96b9f241ceba2c9280823fd (diff)
downloadxmlgraphics-fop-c62845df2a4bf856320d2bfba24b3a2a49294177.tar.gz
xmlgraphics-fop-c62845df2a4bf856320d2bfba24b3a2a49294177.zip
move makeRegionViewport() and setRegionViewportTraits() from fo/pagination/Region to layoutmgr/PageLayoutManager
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196860 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/fo/pagination/Region.java37
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionAfter.java2
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBefore.java2
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBody.java2
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionEnd.java2
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionStart.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageLayoutManager.java36
7 files changed, 41 insertions, 42 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java
index 8c7043875..3ae25fdd4 100644
--- a/src/java/org/apache/fop/fo/pagination/Region.java
+++ b/src/java/org/apache/fop/fo/pagination/Region.java
@@ -59,13 +59,9 @@ import org.apache.fop.datatypes.FODimension;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOTreeVisitor;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.apps.FOPException;
import org.apache.fop.area.CTM;
-import org.apache.fop.area.RegionViewport;
import org.apache.fop.area.RegionReference;
-import org.apache.fop.layoutmgr.TraitSetter;
// SAX
import org.xml.sax.Attributes;
@@ -133,44 +129,13 @@ public abstract class Region extends FObj {
+ parent.getName());
}
this.wm = this.properties.get("writing-mode").getEnum();
- }
-
- /**
- * Creates a RegionViewport Area object for this pagination Region.
- * @param reldims relative dimensions
- * @param pageCTM page coordinate transformation matrix
- * @return the new region viewport
- */
- public RegionViewport makeRegionViewport(FODimension reldims, CTM pageCTM) {
- Rectangle2D relRegionRect = getViewportRectangle(reldims);
- Rectangle2D absRegionRect = pageCTM.transform(relRegionRect);
- // Get the region viewport rectangle in absolute coords by
- // transforming it using the page CTM
- RegionViewport rv = new RegionViewport(absRegionRect);
- setRegionViewportTraits(rv);
- return rv;
- }
-
- /**
- * Set the region viewport traits.
- * The viewport has the border, background and
- * clipping overflow traits.
- *
- * @param r the region viewport
- */
- protected void setRegionViewportTraits(RegionViewport r) {
- // Common Border, Padding, and Background Properties
- CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
- CommonBackground bProps = propMgr.getBackgroundProps();
- TraitSetter.addBorders(r, bap);
- TraitSetter.addBackground(r, bProps);
// this.properties.get("clip");
// this.properties.get("display-align");
this.overflow = this.properties.get("overflow").getEnum();
}
- protected abstract Rectangle getViewportRectangle(FODimension pageRefRect);
+ public abstract Rectangle getViewportRectangle(FODimension pageRefRect);
/**
* Create the region reference area for this region master.
diff --git a/src/java/org/apache/fop/fo/pagination/RegionAfter.java b/src/java/org/apache/fop/fo/pagination/RegionAfter.java
index 02a1ef6a8..bdaebcd60 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionAfter.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionAfter.java
@@ -75,7 +75,7 @@ public class RegionAfter extends RegionBA {
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- protected Rectangle getViewportRectangle (FODimension reldims) {
+ public Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent, precedence ans writing mode
Rectangle vpRect;
if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBefore.java b/src/java/org/apache/fop/fo/pagination/RegionBefore.java
index ddeed18f9..a6dc419bf 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBefore.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBefore.java
@@ -96,7 +96,7 @@ public class RegionBefore extends RegionBA {
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- protected Rectangle getViewportRectangle (FODimension reldims) {
+ public Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent, precedence and writing mode
// This should return rectangle in writing-mode coordinates relative
// to the page-reference area rectangle
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java
index 056d22ee2..b03098b32 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBody.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java
@@ -85,7 +85,7 @@ public class RegionBody extends Region {
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- protected Rectangle getViewportRectangle (FODimension reldims) {
+ public Rectangle getViewportRectangle (FODimension reldims) {
/*
* Use space-before and space-after which will use corresponding
* absolute margin properties if specified. For indents:
diff --git a/src/java/org/apache/fop/fo/pagination/RegionEnd.java b/src/java/org/apache/fop/fo/pagination/RegionEnd.java
index 760873a99..ce7a2ad34 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionEnd.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionEnd.java
@@ -76,7 +76,7 @@ public class RegionEnd extends RegionSE {
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- protected Rectangle getViewportRectangle (FODimension reldims) {
+ public Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent, precedence and writing mode
Rectangle vpRect;
if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
diff --git a/src/java/org/apache/fop/fo/pagination/RegionStart.java b/src/java/org/apache/fop/fo/pagination/RegionStart.java
index 66b1e55af..476073862 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionStart.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionStart.java
@@ -75,7 +75,7 @@ public class RegionStart extends RegionSE {
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- protected Rectangle getViewportRectangle (FODimension reldims) {
+ public Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent, precedence and writing mode
// This is the rectangle relative to the page-reference area in
// writing-mode relative coordinates
diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
index 7c82d52e9..732187728 100644
--- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -79,6 +79,8 @@ import org.apache.fop.fo.properties.RetrieveBoundary;
import org.apache.fop.fo.pagination.SimplePageMaster;
import org.apache.fop.fo.pagination.StaticContent;
+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;
@@ -87,6 +89,7 @@ import java.util.List;
import java.util.Map;
import java.awt.Rectangle;
import java.util.Iterator;
+import java.awt.geom.Rectangle2D;
/**
* LayoutManager for a PageSequence and its flow.
@@ -781,7 +784,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
for (Iterator regenum = spm.getRegions().values().iterator();
regenum.hasNext();) {
Region r = (Region)regenum.next();
- RegionViewport rvp = r.makeRegionViewport(reldims, pageCTM);
+ RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM);
rvp.setRegion(r.makeRegionReferenceArea(rvp.getViewArea()));
page.setRegion(r.getRegionAreaClass(), rvp);
if (r.getRegionAreaClass() == RegionReference.BODY) {
@@ -797,5 +800,36 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
}
+ /**
+ * Creates a RegionViewport Area object for this pagination Region.
+ * @param reldims relative dimensions
+ * @param pageCTM page coordinate transformation matrix
+ * @return the new region viewport
+ */
+ public RegionViewport makeRegionViewport(Region r, FODimension reldims, CTM pageCTM) {
+ Rectangle2D relRegionRect = r. getViewportRectangle(reldims);
+ Rectangle2D absRegionRect = pageCTM.transform(relRegionRect);
+ // Get the region viewport rectangle in absolute coords by
+ // transforming it using the page CTM
+ RegionViewport rv = new RegionViewport(absRegionRect);
+ setRegionViewportTraits(r, rv);
+ return rv;
+ }
+
+ /**
+ * Set the region viewport traits.
+ * The viewport has the border, background and
+ * clipping overflow traits.
+ *
+ * @param r the region viewport
+ */
+ protected void setRegionViewportTraits(Region r, RegionViewport rv) {
+ // Common Border, Padding, and Background Properties
+ CommonBorderAndPadding bap = r.getPropertyManager().getBorderAndPadding();
+ CommonBackground bProps = r.getPropertyManager().getBackgroundProps();
+ TraitSetter.addBorders(rv, bap);
+ TraitSetter.addBackground(rv, bProps);
+ }
+
}