summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2005-03-12 02:14:39 +0000
committerGlen Mazza <gmazza@apache.org>2005-03-12 02:14:39 +0000
commit8f552ad2f9f5d0ce365ff2dca91107831ad06933 (patch)
tree9aabef9c9bc88f9ed17178321a527675f1d381db
parenta31afbf3d068b2865e32062bb360abe6fb9cb01d (diff)
downloadxmlgraphics-fop-8f552ad2f9f5d0ce365ff2dca91107831ad06933.tar.gz
xmlgraphics-fop-8f552ad2f9f5d0ce365ff2dca91107831ad06933.zip
More simplifications to PSLM.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198485 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/area/PageViewport.java9
-rw-r--r--src/java/org/apache/fop/area/Span.java9
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java71
3 files changed, 41 insertions, 48 deletions
diff --git a/src/java/org/apache/fop/area/PageViewport.java b/src/java/org/apache/fop/area/PageViewport.java
index 78f478b09..48c9dd732 100644
--- a/src/java/org/apache/fop/area/PageViewport.java
+++ b/src/java/org/apache/fop/area/PageViewport.java
@@ -81,6 +81,15 @@ public class PageViewport implements Resolvable, Cloneable {
}
/**
+ * Convenience method to get BodyRegion of this PageViewport
+ * @return BodyRegion object
+ */
+ public BodyRegion getBodyRegion() {
+ return (BodyRegion)
+ getPage().getRegionViewport(Constants.FO_REGION_BODY).getRegion();
+ }
+
+ /**
* Set if this viewport should clip.
* @param c true if this viewport should clip
*/
diff --git a/src/java/org/apache/fop/area/Span.java b/src/java/org/apache/fop/area/Span.java
index 926e9d05b..c2dc267c7 100644
--- a/src/java/org/apache/fop/area/Span.java
+++ b/src/java/org/apache/fop/area/Span.java
@@ -46,15 +46,6 @@ public class Span extends Area {
}
/**
- * Add a normal-flow-reference-area to this span-reference-area.
- *
- * @param flow the normal-flow-reference-area to add
- */
- public void addNormalFlow(NormalFlow flow) {
- flowAreas.add(flow);
- }
-
- /**
* Create a new normal flow and add it to this span area
*
* @return the newly made NormalFlow object
diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
index a54b0b15d..1c5948e34 100644
--- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
@@ -81,9 +81,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
/** Current page being worked on. */
private PageViewport curPage;
- /** Body region of the current page */
- private BodyRegion curBody;
-
/** Current span being filled */
private Span curSpan;
@@ -480,14 +477,37 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
if (log.isDebugEnabled()) {
log.debug("[" + curPage.getPageNumberString() + "]");
}
- RegionViewport rv = curPage.getPage().getRegionViewport(
- FO_REGION_BODY);
- curBody = (BodyRegion) rv.getRegion();
- flowBPD = (int) curBody.getBPD();
+
+ flowBPD = (int) curPage.getBodyRegion().getBPD();
createSpan(1); // todo determine actual # of NormalFlows needed
return curPage;
}
+ 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)
+ // This determines the position of the new span area
+ // Attention: space calculation between the span areas.
+
+ //MinOptMax newpos ;
+ //if (curSpan != null) {
+ //newpos = curSpan.getPosition(BPD);
+ //newpos.add(curSpan.getDimension(BPD));
+ //}
+ //else newpos = new MinOptMax();
+ curSpan = new Span(numCols);
+ // get Width or Height as IPD for span
+
+ RegionViewport rv = curPage.getPage().getRegionViewport(FO_REGION_BODY);
+ int ipdWidth = (int) rv.getRegion().getIPD() -
+ rv.getBorderAndPaddingWidthStart() - rv.getBorderAndPaddingWidthEnd();
+
+ curSpan.setIPD(ipdWidth);
+ //curSpan.setPosition(BPD, newpos);
+ curPage.getBodyRegion().getMainReference().addSpan(curSpan);
+ curFlow = curSpan.addNewNormalFlow();
+ }
+
private void layoutStaticContent(Region region) {
if (region == null) {
return;
@@ -532,7 +552,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
private void finishPage() {
if (curPage == null) {
- curBody = null;
curSpan = null;
curFlow = null;
return;
@@ -546,7 +565,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
// Queue for ID resolution and rendering
areaTreeModel.addPage(curPage);
curPage = null;
- curBody = null;
curSpan = null;
curFlow = null;
}
@@ -583,7 +601,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
int numCols = 1;
if (span == Constants.EN_ALL) {
// Assume the number of columns is stored on the curBody object.
- //numCols = curBody.getProperty(NUMBER_OF_COLUMNS);
+ //numCols = curPage.getBodyRegion().getProperty(NUMBER_OF_COLUMNS);
}
if (curSpan == null) {
bNeedSpan = true;
@@ -607,17 +625,17 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
}
// Now handle different kinds of areas
if (aclass == Area.CLASS_BEFORE_FLOAT) {
- BeforeFloat bf = curBody.getBeforeFloat();
+ BeforeFloat bf = curPage.getBodyRegion().getBeforeFloat();
if (bf == null) {
bf = new BeforeFloat();
- curBody.setBeforeFloat(bf);
+ curPage.getBodyRegion().setBeforeFloat(bf);
}
return bf;
} else if (aclass == Area.CLASS_FOOTNOTE) {
- Footnote fn = curBody.getFootnote();
+ Footnote fn = curPage.getBodyRegion().getFootnote();
if (fn == null) {
fn = new Footnote();
- curBody.setFootnote(fn);
+ curPage.getBodyRegion().setFootnote(fn);
}
return fn;
}
@@ -699,31 +717,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
}
}
- 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)
- // This determines the position of the new span area
- // Attention: space calculation between the span areas.
-
- //MinOptMax newpos ;
- //if (curSpan != null) {
- //newpos = curSpan.getPosition(BPD);
- //newpos.add(curSpan.getDimension(BPD));
- //}
- //else newpos = new MinOptMax();
- curSpan = new Span(numCols);
- // get Width or Height as IPD for span
-
- RegionViewport rv = curPage.getPage().getRegionViewport(FO_REGION_BODY);
- int ipdWidth = (int) rv.getRegion().getIPD() -
- rv.getBorderAndPaddingWidthStart() - rv.getBorderAndPaddingWidthEnd();
-
- curSpan.setIPD(ipdWidth);
- //curSpan.setPosition(BPD, newpos);
- curBody.getMainReference().addSpan(curSpan);
- curFlow = curSpan.addNewNormalFlow();
- }
-
private PageViewport createPageAreas(SimplePageMaster spm) {
int pageWidth = spm.getPageWidth().getValue();
int pageHeight = spm.getPageHeight().getValue();