diff options
author | Oleg Tkachenko <olegt@apache.org> | 2002-11-24 07:23:51 +0000 |
---|---|---|
committer | Oleg Tkachenko <olegt@apache.org> | 2002-11-24 07:23:51 +0000 |
commit | eb38f7030da62d3c307199547c5620f9b2839375 (patch) | |
tree | 1e720c2ce9cfbf90d2b73ecb048ea77c80fabcaa /src | |
parent | b78f0e158a8f17a8fd7d6a747eed94dedd345ee4 (diff) | |
download | xmlgraphics-fop-eb38f7030da62d3c307199547c5620f9b2839375.tar.gz xmlgraphics-fop-eb38f7030da62d3c307199547c5620f9b2839375.zip |
Support for page-width and page-height "auto" values (fallback to 8 and 11in). Fixes infinite loop when page-height is "auto".
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195621 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/codegen/foproperties.xml | 6 | ||||
-rw-r--r-- | src/org/apache/fop/fo/pagination/SimplePageMaster.java | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/codegen/foproperties.xml b/src/codegen/foproperties.xml index bc8f18f64..465e23571 100644 --- a/src/codegen/foproperties.xml +++ b/src/codegen/foproperties.xml @@ -1592,7 +1592,7 @@ <datatype>Length</datatype> <default>1.0pt</default> </property> - + <!-- Properties for Dynamic Effects Formatting Objects --> <property> @@ -1849,7 +1849,7 @@ <inherited>false</inherited> <datatype>Length</datatype> <auto-ok/> - <default>11in</default> + <default>auto</default> </property> <property> <name>page-position</name> @@ -1868,7 +1868,7 @@ <inherited>false</inherited> <datatype>Length</datatype> <auto-ok/> - <default>8in</default> + <default>auto</default> </property> <property> <name>precedence</name> diff --git a/src/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/org/apache/fop/fo/pagination/SimplePageMaster.java index e792df673..543eff03d 100644 --- a/src/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -9,12 +9,11 @@ package org.apache.fop.fo.pagination; // FOP import org.apache.fop.fo.*; -import org.apache.fop.fo.properties.*; import org.apache.fop.layout.PageMaster; -import org.apache.fop.layout.RegionArea; import org.apache.fop.layout.BodyRegionArea; import org.apache.fop.layout.MarginProps; import org.apache.fop.apps.FOPException; +import org.apache.fop.datatypes.Length; import java.util.HashMap; import java.util.Iterator; @@ -27,6 +26,9 @@ import java.util.Iterator; * ¶6.4.12</a> */ public class SimplePageMaster extends FObj { + // Fallback values for "auto" page size: 8x11in + private final static int FALLBACK_PAGE_HEIGHT = 792000; + private final static int FALLBACK_PAGE_WIDTH = 576000; public static class Maker extends FObj.Maker { public FObj make(FObj parent, @@ -82,10 +84,10 @@ public class SimplePageMaster extends FObj { } protected void end() { - int pageWidth = - this.properties.get("page-width").getLength().mvalue(); - int pageHeight = - this.properties.get("page-height").getLength().mvalue(); + Length pageWidthLen = this.properties.get("page-width").getLength(); + int pageWidth = pageWidthLen.isAuto() ? FALLBACK_PAGE_WIDTH : pageWidthLen.mvalue(); + Length pageHeightLen = this.properties.get("page-height").getLength(); + int pageHeight = pageHeightLen.isAuto() ? FALLBACK_PAGE_HEIGHT : pageHeightLen.mvalue(); // this.properties.get("reference-orientation"); // this.properties.get("writing-mode"); |