From: Peter Bernard West Date: Wed, 12 May 2004 11:05:17 +0000 (+0000) Subject: getReferenceRectangle returns 1st normal-flow-reference-area X-Git-Tag: Defoe_export~169 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ee9554f4dff7ba8545c749ed3cf0ea1aef5c4ed3;p=xmlgraphics-fop.git getReferenceRectangle returns 1st normal-flow-reference-area getLayoutContext calls getReferenceRectangle Added getChildrensLayoutContext returns current normal-flow-reference-area from the current page git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197586 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/flow/FoFlow.java b/src/java/org/apache/fop/fo/flow/FoFlow.java index 7f254779e..cb46b3637 100644 --- a/src/java/org/apache/fop/fo/flow/FoFlow.java +++ b/src/java/org/apache/fop/fo/flow/FoFlow.java @@ -29,6 +29,7 @@ import java.util.BitSet; import org.apache.fop.apps.FOPException; import org.apache.fop.area.Area; +import org.apache.fop.area.Page; import org.apache.fop.datastructs.TreeException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOPageSeqNode; @@ -125,7 +126,7 @@ public class FoFlow extends FOPageSeqNode { makeSparsePropsSet(); } - public Area getReferenceRectangle() throws FOPException { + public Area getReferenceRectangle() { // TODO Reference rectangle is assumed to be the content rectangle of // the first region into which the content is flowed. For region-body // it is normal-flow reference-area; for other regions it is the @@ -139,12 +140,22 @@ public class FoFlow extends FOPageSeqNode { // Get the first page of the page-sequence // TODO check whether the current page from the page-sequence will be // enough - return pageSequence.getCurr1stPage().getRegionBodyRefArea(); + Page page = pageSequence.getCurr1stPage(); + if (page == null) return null; + return page.getNormalFlowRefArea(); } public Area getLayoutContext() { - // The layout context for fo:flow is is the region-body-reference-area. - return pageSequence.getPage().getRegionBodyRefArea(); + // The layout context for fo:flow is + // the first normal-flow-reference-area. + return getReferenceRectangle(); + } + + public Area getChildrensLayoutContext() { + // The layout context for the █ children of fo:flow is + // the current normal-flow-reference-area. + Page page = pageSequence.getPage(); + return page.getNormalFlowRefArea(); } }