aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-08-27 01:13:44 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-08-27 01:13:44 +0000
commit62d15ba053656772267158cafb5705c654ec9be0 (patch)
tree1a256fb0d869832161c8f4fbea3f3f10f3f662ce /src
parentb65f9e230afd52e92ef1fc439f2c3193641f22dd (diff)
downloadxmlgraphics-fop-62d15ba053656772267158cafb5705c654ec9be0.tar.gz
xmlgraphics-fop-62d15ba053656772267158cafb5705c654ec9be0.zip
instead of storing and cloning page reference-area and viewport objects for each SimplePageMaster, create them on the fly (there will shortly be no convenient place to store the templates, and any performance benefit to cloning would appear to be small)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196858 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageLayoutManager.java31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
index e31e33770..b7c554938 100644
--- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -719,19 +719,14 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
*/
public PageViewport createPage(boolean bIsBlank, boolean bIsLast)
throws FOPException {
- currentSimplePageMaster = getSimpleMasterPageToUse(bIsBlank);
+ currentSimplePageMaster = getSimplePageMasterToUse(bIsBlank);
Region body = currentSimplePageMaster.getRegion(Region.BODY);
if (!pageSequence.getMainFlow().getFlowName().equals(body.getRegionName())) {
throw new FOPException("Flow '" + pageSequence.getMainFlow().getFlowName()
+ "' does not map to the region-body in page-master '"
+ currentSimplePageMaster.getMasterName() + "'");
}
- PageMaster pageMaster = currentSimplePageMaster.getPageMaster();
- if (pageMaster == null) {
- createSimplePageMasterAreas(currentSimplePageMaster);
- }
- pageMaster = currentSimplePageMaster.getPageMaster();
- PageViewport p = pageMaster.makePage();
+ PageViewport p = createPageAreas(currentSimplePageMaster);
return p;
// The page will have a viewport/reference area pair defined
// for each region in the master.
@@ -745,7 +740,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
//forcePage(areaTree, firstAvailPageNumber);
}
- private SimplePageMaster getSimpleMasterPageToUse(boolean bIsBlank)
+ private SimplePageMaster getSimplePageMasterToUse(boolean bIsBlank)
throws FOPException {
if (pageSequence.getPageSequenceMaster() == null) {
return pageSequence.getSimplePageMaster();
@@ -755,13 +750,13 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
.getNextSimplePageMaster(isOddPage, isFirstPage, bIsBlank);
}
- public void createSimplePageMasterAreas(SimplePageMaster node) {
+ public PageViewport createPageAreas(SimplePageMaster spm) {
int pageWidth =
- node.properties.get("page-width").getLength().getValue();
+ spm.properties.get("page-width").getLength().getValue();
int pageHeight =
- node.properties.get("page-height").getLength().getValue();
+ spm.properties.get("page-height").getLength().getValue();
// Get absolute margin properties (top, left, bottom, right)
- CommonMarginBlock mProps = node.getPropertyManager().getMarginProps();
+ CommonMarginBlock mProps = spm.getPropertyManager().getMarginProps();
/* Create the page reference area rectangle (0,0 is at top left
* of the "page media" and y increases
@@ -773,20 +768,19 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
pageWidth - mProps.marginLeft - mProps.marginRight,
pageHeight - mProps.marginTop - mProps.marginBottom);
- // ??? KL shouldn't this take the viewport too???
Page page = new Page(); // page reference area
// Set up the CTM on the page reference area based on writing-mode
// and reference-orientation
FODimension reldims = new FODimension(0, 0);
- CTM pageCTM = CTM.getCTMandRelDims(node.getPropertyManager().getAbsRefOrient(),
- node.getPropertyManager().getWritingMode(), pageRefRect, reldims);
+ CTM pageCTM = CTM.getCTMandRelDims(spm.getPropertyManager().getAbsRefOrient(),
+ spm.getPropertyManager().getWritingMode(), pageRefRect, reldims);
// Create a RegionViewport/ reference area pair for each page region
boolean bHasBody = false;
- for (Iterator regenum = node.getRegions().values().iterator();
+ for (Iterator regenum = spm.getRegions().values().iterator();
regenum.hasNext();) {
Region r = (Region)regenum.next();
RegionViewport rvp = r.makeRegionViewport(reldims, pageCTM);
@@ -798,11 +792,10 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
}
if (!bHasBody) {
- node.getLogger().error("simple-page-master has no region-body");
+ spm.getLogger().error("simple-page-master has no region-body");
}
- node.setPageMaster(new PageMaster(new PageViewport(page,
- new Rectangle(0, 0, pageWidth, pageHeight))));
+ return new PageViewport(page, new Rectangle(0, 0, pageWidth, pageHeight));
}