]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Support for page-width and page-height "auto" values (fallback to 8 and 11in). Fixes...
authorOleg Tkachenko <olegt@apache.org>
Sun, 24 Nov 2002 07:23:51 +0000 (07:23 +0000)
committerOleg Tkachenko <olegt@apache.org>
Sun, 24 Nov 2002 07:23:51 +0000 (07:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195621 13f79535-47bb-0310-9956-ffa450edef68

src/codegen/foproperties.xml
src/org/apache/fop/fo/pagination/SimplePageMaster.java

index bc8f18f6454fd24852ad7909cd6dcb0b46e6a8cc..465e23571312b3e214f54a0cbd0825261f5a2d14 100644 (file)
       <datatype>Length</datatype>
       <default>1.0pt</default>
     </property>
-    
+
     <!-- Properties for Dynamic Effects Formatting Objects -->
 
     <property>
       <inherited>false</inherited>
       <datatype>Length</datatype>
       <auto-ok/>
-      <default>11in</default>
+      <default>auto</default>
     </property>
     <property>
       <name>page-position</name>
       <inherited>false</inherited>
       <datatype>Length</datatype>
       <auto-ok/>
-      <default>8in</default>
+      <default>auto</default>
     </property>
     <property>
       <name>precedence</name>
index e792df673b6215784049cd91c5228b8033d7e934..543eff03d81e649f61efabe47e665b9167c6e40e 100644 (file)
@@ -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;
  *     &para;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");