From 7fcdab2487519faa410d53f47d3adf5cd89648aa Mon Sep 17 00:00:00 2001 From: Karen Lease Date: Sun, 14 Oct 2001 20:39:54 +0000 Subject: Make it possible to use percentages to specify Length values for flow and static-content children git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194508 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/fo/flow/Flow.java | 15 +++++++++++---- src/org/apache/fop/fo/flow/StaticContent.java | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/org/apache/fop/fo/flow/Flow.java b/src/org/apache/fop/fo/flow/Flow.java index e2819fb14..9846c86d7 100644 --- a/src/org/apache/fop/fo/flow/Flow.java +++ b/src/org/apache/fop/fo/flow/Flow.java @@ -54,6 +54,11 @@ public class Flow extends FObj { */ private String _flowName; + /** + * Content-width of current column area during layout + */ + private int contentWidth; + private Status _status = new Status(Status.AREA_FULL_NONE); @@ -145,6 +150,8 @@ public class Flow extends FObj { this.marker = i; markerSnapshot = this.getMarkerSnapshot(new Vector()); } + // Set current content width for percent-based lengths in children + setContentWidth(currentArea.getContentWidth()); _status = fo.layout(currentArea); @@ -200,15 +207,15 @@ public class Flow extends FObj { return _status; } + protected void setContentWidth(int contentWidth) { + this.contentWidth = contentWidth; + } /** * Return the content width of this flow (really of the region * in which it is flowing). */ public int getContentWidth() { - if (area != null) - return area.getContentWidth(); // getAllocationWidth()?? - else - return 0; // not laid out yet + return this.contentWidth; } protected String getElementName() { diff --git a/src/org/apache/fop/fo/flow/StaticContent.java b/src/org/apache/fop/fo/flow/StaticContent.java index 35a388432..9e50e242b 100644 --- a/src/org/apache/fop/fo/flow/StaticContent.java +++ b/src/org/apache/fop/fo/flow/StaticContent.java @@ -70,6 +70,7 @@ public class StaticContent extends Flow { } else if (regionClass.equals(RegionAfter.REGION_CLASS)) { area.setAbsoluteHeight(area.getPage().getBody().getMaxHeight()); } + setContentWidth(area.getContentWidth()); for (int i = 0; i < numChildren; i++) { FObj fo = (FObj)children.elementAt(i); -- cgit v1.2.3