// 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 {
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()