diff options
author | Karen Lease <klease@apache.org> | 2002-02-23 16:50:58 +0000 |
---|---|---|
committer | Karen Lease <klease@apache.org> | 2002-02-23 16:50:58 +0000 |
commit | 76705cc4238b38ecec2e4088b48358cbe3231934 (patch) | |
tree | bcee163bc4e4560b267b7098e33dd78e7559f957 /src | |
parent | a007e39924f89ff45a9905c2a714712bd4cde732 (diff) | |
download | xmlgraphics-fop-76705cc4238b38ecec2e4088b48358cbe3231934.tar.gz xmlgraphics-fop-76705cc4238b38ecec2e4088b48358cbe3231934.zip |
Correct margin handling on body region for writing-mode
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194669 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/org/apache/fop/fo/pagination/RegionBody.java | 45 | ||||
-rw-r--r-- | src/org/apache/fop/fo/pagination/SimplePageMaster.java | 4 | ||||
-rw-r--r-- | src/org/apache/fop/layout/MarginProps.java | 2 |
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 { |