aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/fo/pagination/RegionBody.java45
-rw-r--r--src/org/apache/fop/fo/pagination/SimplePageMaster.java4
-rw-r--r--src/org/apache/fop/layout/MarginProps.java2
3 files changed, 35 insertions, 16 deletions
diff --git a/src/org/apache/fop/fo/pagination/RegionBody.java b/src/org/apache/fop/fo/pagination/RegionBody.java
index 5a6429ed2..b2132c330 100644
--- a/src/org/apache/fop/fo/pagination/RegionBody.java
+++ b/src/org/apache/fop/fo/pagination/RegionBody.java
@@ -13,7 +13,9 @@ import java.awt.geom.Rectangle2D;
// FOP
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.Property;
import org.apache.fop.fo.properties.Overflow;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.FODimension;
@@ -32,22 +34,35 @@ public class RegionBody extends Region {
protected Rectangle getViewportRectangle (FODimension reldims)
{
- // Common Margin Properties-Block
- // Need these in writing-mode relative coordinates
- // Or shall we get absolute and transform to relative using writing mode?
+ /*
+ * Use space-before and space-after which will use corresponding
+ * absolute margin properties if specified. For indents:
+ * try to get corresponding absolute margin property using the
+ * writing-mode on the page (not on the region-body!). If that's not
+ * set but indent is explicitly set, it will return that.
+ */
MarginProps mProps = propMgr.getMarginProps();
- /**
- System.err.println("BodyRegion margin props=" + mProps.startIndent + ","
- + mProps.spaceBefore + "," + mProps.endIndent + ","
- + mProps.spaceAfter);
-
- return new Rectangle( mProps.startIndent, mProps.spaceBefore,
- reldims.ipd - mProps.startIndent - mProps.endIndent,
- reldims.bpd - mProps.spaceBefore - mProps.spaceAfter);
- **/
- return new Rectangle( mProps.marginLeft, mProps.marginTop,
- reldims.ipd - mProps.marginLeft - mProps.marginRight,
- reldims.bpd - mProps.marginTop - mProps.marginBottom);
+ int start = getRelMargin(PropertyList.START, "start-indent");
+ return new Rectangle( start, mProps.spaceBefore,
+ reldims.ipd - start -
+ getRelMargin(PropertyList.END, "end-indent"),
+ reldims.bpd - mProps.spaceBefore -
+ mProps.spaceAfter);
+ }
+
+ /**
+ * Get the relative margin using parent's writing mode, not own
+ * writing mode.
+ */
+ private int getRelMargin(int reldir, String sRelPropName) {
+ FObj parent = (FObj) getParent();
+ String sPropName = "margin-" +
+ parent.properties.wmRelToAbs(reldir);
+ Property prop = properties.getExplicitBaseProp(sPropName);
+ if (prop == null) {
+ prop = properties.getExplicitBaseProp(sRelPropName);
+ }
+ return ((prop != null)? prop.getLength().mvalue() : 0);
}
protected void setRegionTraits(RegionReference r, Rectangle2D absRegVPRect) {
diff --git a/src/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/org/apache/fop/fo/pagination/SimplePageMaster.java
index 9cd1dea09..73be3f0e2 100644
--- a/src/org/apache/fop/fo/pagination/SimplePageMaster.java
+++ b/src/org/apache/fop/fo/pagination/SimplePageMaster.java
@@ -125,6 +125,10 @@ public class SimplePageMaster extends FObj {
properties = null;
}
+ public boolean generatesReferenceAreas() {
+ return true;
+ }
+
public PageMaster getPageMaster() {
return this.pageMaster;
}
diff --git a/src/org/apache/fop/layout/MarginProps.java b/src/org/apache/fop/layout/MarginProps.java
index 2d8bfcf32..793fb8acf 100644
--- a/src/org/apache/fop/layout/MarginProps.java
+++ b/src/org/apache/fop/layout/MarginProps.java
@@ -8,7 +8,7 @@
package org.apache.fop.layout;
/**
- * Store all hyphenation related properties on an FO.
+ * Store all block-level margin related properties on an FO.
* Public "structure" allows direct member access.
*/
public class MarginProps {