aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2005-03-05 19:53:13 +0000
committerGlen Mazza <gmazza@apache.org>2005-03-05 19:53:13 +0000
commit2b60d0cdfdf3208e3d5650535b0d6a54129f1950 (patch)
treef7ed26a97cb2e950367da07adaf05da81d20d961 /src/java/org/apache/fop
parent22ed7684d345f0504de4547f6735069a07d2eb1d (diff)
downloadxmlgraphics-fop-2b60d0cdfdf3208e3d5650535b0d6a54129f1950.tar.gz
xmlgraphics-fop-2b60d0cdfdf3208e3d5650535b0d6a54129f1950.zip
More simplifications to PSLM.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198471 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/area/BodyRegion.java1
-rw-r--r--src/java/org/apache/fop/area/Flow.java7
-rw-r--r--src/java/org/apache/fop/area/RegionReference.java1
-rw-r--r--src/java/org/apache/fop/area/RegionViewport.java1
-rw-r--r--src/java/org/apache/fop/area/Span.java15
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java23
6 files changed, 27 insertions, 21 deletions
diff --git a/src/java/org/apache/fop/area/BodyRegion.java b/src/java/org/apache/fop/area/BodyRegion.java
index 97a07bc76..785e25f56 100644
--- a/src/java/org/apache/fop/area/BodyRegion.java
+++ b/src/java/org/apache/fop/area/BodyRegion.java
@@ -38,6 +38,7 @@ public class BodyRegion extends RegionReference {
*/
public BodyRegion() {
super(Constants.FO_REGION_BODY);
+ addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
}
/**
diff --git a/src/java/org/apache/fop/area/Flow.java b/src/java/org/apache/fop/area/Flow.java
index dbaaa2119..e451292ad 100644
--- a/src/java/org/apache/fop/area/Flow.java
+++ b/src/java/org/apache/fop/area/Flow.java
@@ -25,5 +25,12 @@ package org.apache.fop.area;
public class Flow extends BlockParent {
// the list of blocks created from the flow
private int stacking = TB;
+
+ /**
+ * Constructor.
+ */
+ public Flow() {
+ addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
+ }
}
diff --git a/src/java/org/apache/fop/area/RegionReference.java b/src/java/org/apache/fop/area/RegionReference.java
index 3d9f5def8..e1ebf97f3 100644
--- a/src/java/org/apache/fop/area/RegionReference.java
+++ b/src/java/org/apache/fop/area/RegionReference.java
@@ -43,6 +43,7 @@ public class RegionReference extends Area implements Cloneable {
*/
public RegionReference(int type) {
regionClass = type;
+ addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
}
/**
diff --git a/src/java/org/apache/fop/area/RegionViewport.java b/src/java/org/apache/fop/area/RegionViewport.java
index 37dd8a519..3e1381310 100644
--- a/src/java/org/apache/fop/area/RegionViewport.java
+++ b/src/java/org/apache/fop/area/RegionViewport.java
@@ -39,6 +39,7 @@ public class RegionViewport extends Area implements Cloneable {
*/
public RegionViewport(Rectangle2D viewArea) {
this.viewArea = viewArea;
+ addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
}
/**
diff --git a/src/java/org/apache/fop/area/Span.java b/src/java/org/apache/fop/area/Span.java
index f7e517acc..ddad76d48 100644
--- a/src/java/org/apache/fop/area/Span.java
+++ b/src/java/org/apache/fop/area/Span.java
@@ -37,10 +37,11 @@ public class Span extends Area {
*/
public Span(int cols) {
flowAreas = new java.util.ArrayList(cols);
+ addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
}
/**
- * Add the flow area to this span area.
+ * Add a flow area to this span area.
*
* @param flow the flow area to add
*/
@@ -49,6 +50,18 @@ public class Span extends Area {
}
/**
+ * Create a new flow and add it to this span area
+ *
+ * @return the newly made Flow object
+ */
+ public Flow addNewFlow() {
+ Flow newFlow = new Flow();
+ newFlow.setIPD(getIPD());
+ flowAreas.add(newFlow);
+ return newFlow;
+ }
+
+ /**
* Get the column count for this span area.
*
* @return the number of columns in this span area
diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
index 890f09aff..097163f45 100644
--- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
@@ -80,9 +80,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
private String pageNumberString;
private boolean isFirstPage = true;
- /** True if haven't yet laid out any pages.*/
- private boolean bFirstPage;
-
/** Current page being worked on. */
private PageViewport curPage;
@@ -602,7 +599,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
// Make a new span and the first flow
createSpan(numCols);
} else if (curFlow == null) {
- createFlow();
+ curFlow = curSpan.addNewFlow();
}
return curFlow;
} else {
@@ -642,7 +639,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
if (curSpan != null
&& curSpan.getColumnCount() != curSpanColumns) {
// Move to next column
- createFlow();
+ curFlow = curSpan.addNewFlow();
return;
}
// else need new page
@@ -707,16 +704,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
curBody.setMainReference(new MainReference());
}
- private Flow createFlow() {
- curFlow = new Flow();
- curFlow.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
- curFlow.setIPD(curSpan.getIPD()); // adjust for columns
- //curFlow.setBPD(100000);
- // Set IPD and max BPD on the curFlow from curBody
- curSpan.addFlow(curFlow);
- return curFlow;
- }
-
private void createSpan(int numCols) {
// check number of columns (= all in Body or 1)
// If already have a span, get its size and position (as MinMaxOpt)
@@ -730,7 +717,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
//}
//else newpos = new MinOptMax();
curSpan = new Span(numCols);
- curSpan.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
curSpanColumns = numCols;
// get Width or Height as IPD for span
@@ -741,7 +727,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
curSpan.setIPD(ipdWidth);
//curSpan.setPosition(BPD, newpos);
curBody.getMainReference().addSpan(curSpan);
- createFlow();
+ curFlow = curSpan.addNewFlow();
}
private PageViewport createPageAreas(SimplePageMaster spm) {
@@ -803,7 +789,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
// Get the region viewport rectangle in absolute coords by
// transforming it using the page CTM
RegionViewport rv = new RegionViewport(absRegionRect);
- rv.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
rv.setBPD((int)relRegionRect.getHeight());
rv.setIPD((int)relRegionRect.getWidth());
setRegionViewportTraits(r, rv);
@@ -826,7 +811,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
Rectangle2D absRegVPRect) {
// Should set some column stuff here I think, or put it elsewhere
BodyRegion body = new BodyRegion();
- body.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
setRegionPosition(r, body, absRegVPRect);
int columnCount = r.getColumnCount();
if ((columnCount > 1) && (r.getOverflow() == EN_SCROLL)) {
@@ -853,7 +837,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
private RegionReference makeRegionReferenceArea(Region r,
Rectangle2D absRegVPRect) {
RegionReference rr = new RegionReference(r.getNameId());
- rr.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
setRegionPosition(r, rr, absRegVPRect);
return rr;
}