aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache
diff options
context:
space:
mode:
authorKaren Lease <klease@apache.org>2000-11-10 22:06:21 +0000
committerKaren Lease <klease@apache.org>2000-11-10 22:06:21 +0000
commit44883bb9871c47ad9ed1c0cf83bee441f32894de (patch)
treee73d5e3176e63c90b6e41a98a35292b40ce38503 /src/org/apache
parent07d8b132b3aa0f7f686e8e8e1cde610c3cc3157b (diff)
downloadxmlgraphics-fop-44883bb9871c47ad9ed1c0cf83bee441f32894de.tar.gz
xmlgraphics-fop-44883bb9871c47ad9ed1c0cf83bee441f32894de.zip
New methods used in calculating percent-based property values
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193768 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache')
-rw-r--r--src/org/apache/fop/fo/FObj.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/org/apache/fop/fo/FObj.java b/src/org/apache/fop/fo/FObj.java
index bc4f789f6..221c25e27 100644
--- a/src/org/apache/fop/fo/FObj.java
+++ b/src/org/apache/fop/fo/FObj.java
@@ -142,7 +142,31 @@ public class FObj extends FONode {
return(properties.get(name));
}
-
+ /**
+ * Return the width of the containing area for this FO's areas.
+ * This is used by percent-based properties to get the dimension of
+ * the containing block.
+ * If an FO has a property with a percentage value, that value
+ * is usually calculated on the basis of the corresponding dimenions
+ * of the block which contains areas generated by the FO.
+ * Implementation note: if this block has an FObj parent, this method
+ * returns the value of getContentWidth() on that FObj. Normally subclasses
+ * will override getContentWidth and not getContainingWidth().
+ */
+ public int getContainingWidth() {
+ FObj parent = getParent();
+ if (parent != null)
+ return parent.getContentWidth();
+ else return 0; // no parent, top level box
+ }
+
+ /**
+ * Return the "content width" of the areas generated by this FO.
+ * NOTE: subclasses of FObj should implement this!
+ */
+ protected int getContentWidth() {
+ return 0;
+ }
/**
* removes property id