diff options
-rw-r--r-- | src/org/apache/fop/fo/pagination/RegionBody.java | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/src/org/apache/fop/fo/pagination/RegionBody.java b/src/org/apache/fop/fo/pagination/RegionBody.java index b8c6daa42..999620dcd 100644 --- a/src/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/org/apache/fop/fo/pagination/RegionBody.java @@ -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() |