summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Bernard West <pbwest@apache.org>2004-06-03 13:32:03 +0000
committerPeter Bernard West <pbwest@apache.org>2004-06-03 13:32:03 +0000
commit845863f9f534e054b026406ac9f958ccc3af159f (patch)
tree3ea7a40164c568c5de2493be5b3290ffb4b24999
parent4e07ad4cfe1020b1d1c5fa33c4e18c319f8c753e (diff)
downloadxmlgraphics-fop-845863f9f534e054b026406ac9f958ccc3af159f.tar.gz
xmlgraphics-fop-845863f9f534e054b026406ac9f958ccc3af159f.zip
Added some features corresponding to fo:flow
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197684 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fo/flow/FoStaticContent.java36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/fo/flow/FoStaticContent.java b/src/java/org/apache/fop/fo/flow/FoStaticContent.java
index 9a1518500..b097a31fe 100644
--- a/src/java/org/apache/fop/fo/flow/FoStaticContent.java
+++ b/src/java/org/apache/fop/fo/flow/FoStaticContent.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.datatypes.NCName;
import org.apache.fop.fo.FONode;
@@ -152,14 +153,45 @@ public class FoStaticContent extends FOPageSeqNode {
public String getFlowName() {
return flowName;
}
+//
+// public Area getReferenceRectangle() throws FOPException {
+// // 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
+// // region-reference-area. See
+// // 7.3 Reference Rectangle for Percentage Computations
+// throw new FOPException("Called from FoStaticContent");
+// }
- 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
// region-reference-area. See
// 7.3 Reference Rectangle for Percentage Computations
- throw new FOPException("Called from FoStaticContent");
+ // The difficulty is that there may be multiple attempts to layout the
+ // flow. Each attempt will generate its own page set, only the first
+ // of which contains a region-body-reference-area which qualifies as
+ // the reference rectangle for percentages defined on the flow.
+ //
+ // Get the first page of the page-sequence
+ // TODO check whether the current page from the page-sequence will be
+ // enough
+ Page page = pageSequence.getCurr1stPage();
+ if (page == null) return null;
+ return page.getNormalFlowRefArea();
+ }
+
+ public Area getLayoutContext() {
+ // The layout context for fo:flow is
+ // the first normal-flow-reference-area.
+ return getReferenceRectangle();
+ }
+
+ public Area getChildrensLayoutContext() {
+ // The layout context for the &block; children of fo:flow is
+ // the current normal-flow-reference-area.
+ return pageSequence.getPage().getNormalFlowRefArea();
}
}