]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Slight mods
authorarved <arved@unknown>
Mon, 18 Dec 2000 03:40:00 +0000 (03:40 +0000)
committerarved <arved@unknown>
Mon, 18 Dec 2000 03:40:00 +0000 (03:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193896 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/pagination/RegionBody.java

index b8c6daa427f6b579cdd74cd77c347497d4c69524..999620dcd8b6caac4c69b00c91fe2c7e232b5368 100644 (file)
@@ -53,8 +53,11 @@ package org.apache.fop.fo.pagination;
 // FOP
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.properties.Overflow;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.layout.RegionArea;
+import org.apache.fop.layout.BodyRegionArea;
+import org.apache.fop.messaging.MessageHandler;
 
 public class RegionBody extends Region {
 
@@ -83,16 +86,43 @@ public class RegionBody extends Region {
                      int allocationRectangleYPosition,
                      int allocationRectangleWidth,
                      int allocationRectangleHeight) {
-       int marginTop = this.properties.get("margin-top").getLength().mvalue();
-       int marginBottom = this.properties.get("margin-bottom").getLength().mvalue();
-       int marginLeft = this.properties.get("margin-left").getLength().mvalue();
-       int marginRight = this.properties.get("margin-right").getLength().mvalue();
+               int marginTop = this.properties.get("margin-top").getLength().mvalue();
+               int marginBottom = this.properties.get("margin-bottom").getLength().mvalue();
+               int marginLeft = this.properties.get("margin-left").getLength().mvalue();
+               int marginRight = this.properties.get("margin-right").getLength().mvalue();
 
-       return new RegionArea(allocationRectangleXPosition + marginLeft,
+               BodyRegionArea body = new BodyRegionArea(allocationRectangleXPosition + marginLeft,
                          allocationRectangleYPosition - marginTop,
                          allocationRectangleWidth - marginLeft -
                          marginRight, allocationRectangleHeight -
-                         marginTop - marginBottom); 
+                         marginTop - marginBottom);
+                         
+               int overflow = this.properties.get("overflow").getEnum();
+               String columnCountAsString = this.properties.get("column-count").getString();
+               int columnCount = 1;
+               try
+               {
+                       columnCount = Integer.parseInt(columnCountAsString); 
+               }
+               catch (NumberFormatException nfe)
+               {
+                       MessageHandler.errorln("Bad value on region body 'column-count'");
+                       columnCount = 1;
+               }
+               if ((columnCount > 1) && (overflow == Overflow.SCROLL))
+               {
+                       // recover by setting 'column-count' to 1. This is allowed but
+                       // not required by the spec.
+                       MessageHandler.errorln("Setting 'column-count' to 1 because "
+                               + "'overflow' is set to 'scroll'");
+                       columnCount = 1;
+               }
+               body.setColumnCount(columnCount);
+               
+               int columnGap = this.properties.get("column-gap").getLength().mvalue();
+               body.setColumnGap(columnGap);
+               
+               return body;
     }
        
     protected String getDefaultRegionName()