aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/fo/pagination/RegionBody.java
diff options
context:
space:
mode:
authorOleg Tkachenko <olegt@apache.org>2003-01-05 09:03:12 +0000
committerOleg Tkachenko <olegt@apache.org>2003-01-05 09:03:12 +0000
commit89334b80f73efa8abfbd6a4d7db94a6fbd8e854f (patch)
tree99d10db67b70f0ab999c961924fab121e3dd1086 /src/org/apache/fop/fo/pagination/RegionBody.java
parent41de4c5a95e80e47892680036ca247dcfc3a4d3f (diff)
downloadxmlgraphics-fop-89334b80f73efa8abfbd6a4d7db94a6fbd8e854f.tar.gz
xmlgraphics-fop-89334b80f73efa8abfbd6a4d7db94a6fbd8e854f.zip
Made regions to be writing-mod� aware, now it's ok for lr-tb, rl-tb and tb-rl.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195815 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/fo/pagination/RegionBody.java')
-rw-r--r--src/org/apache/fop/fo/pagination/RegionBody.java71
1 files changed, 41 insertions, 30 deletions
diff --git a/src/org/apache/fop/fo/pagination/RegionBody.java b/src/org/apache/fop/fo/pagination/RegionBody.java
index be058b33b..938ea1ac3 100644
--- a/src/org/apache/fop/fo/pagination/RegionBody.java
+++ b/src/org/apache/fop/fo/pagination/RegionBody.java
@@ -17,6 +17,7 @@ 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.fo.properties.WritingMode;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.area.RegionReference;
@@ -33,20 +34,30 @@ public class RegionBody extends Region {
protected Rectangle getViewportRectangle (FODimension reldims)
{
- /*
- * 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.
- */
+ /*
+ * 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();
- 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);
+ int start = getRelMargin(PropertyList.START, "start-indent");
+ Rectangle vpRect;
+ if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB)
+ vpRect = new Rectangle( start, mProps.spaceBefore,
+ reldims.ipd - start -
+ getRelMargin(PropertyList.END, "end-indent"),
+ reldims.bpd - mProps.spaceBefore -
+ mProps.spaceAfter);
+ else
+ vpRect = new Rectangle( start, mProps.spaceBefore,
+ reldims.bpd - mProps.spaceBefore -
+ mProps.spaceAfter,
+ reldims.ipd - start -
+ getRelMargin(PropertyList.END, "end-indent")
+ );
+ return vpRect;
}
/**
@@ -54,14 +65,14 @@ public class RegionBody extends Region {
* 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);
+ 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 String getDefaultRegionName() {
@@ -80,24 +91,24 @@ public class RegionBody extends Region {
* Override the inherited method.
*/
public RegionReference makeRegionReferenceArea(Rectangle2D absRegVPRect) {
- // Should set some column stuff here I think, or put it elsewhere
- BodyRegion body = new BodyRegion();
- setRegionPosition(body, absRegVPRect);
+ // Should set some column stuff here I think, or put it elsewhere
+ BodyRegion body = new BodyRegion();
+ setRegionPosition(body, absRegVPRect);
int columnCount=
- this.properties.get("column-count").getNumber().intValue();
+ this.properties.get("column-count").getNumber().intValue();
if ((columnCount > 1) && (overflow == Overflow.SCROLL)) {
// recover by setting 'column-count' to 1. This is allowed but
// not required by the spec.
getLogger().error("Setting 'column-count' to 1 because "
- + "'overflow' is set to 'scroll'");
+ + "'overflow' is set to 'scroll'");
columnCount = 1;
}
- body.setColumnCount(columnCount);
+ body.setColumnCount(columnCount);
int columnGap =
- this.properties.get("column-gap").getLength().mvalue();
- body.setColumnGap(columnGap);
- return body;
+ this.properties.get("column-gap").getLength().mvalue();
+ body.setColumnGap(columnGap);
+ return body;
}
}