aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo/pagination/RegionBefore.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/fo/pagination/RegionBefore.java')
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBefore.java45
1 files changed, 25 insertions, 20 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBefore.java b/src/java/org/apache/fop/fo/pagination/RegionBefore.java
index c1f683c05..53279e4da 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBefore.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBefore.java
@@ -46,28 +46,33 @@ public class RegionBefore extends RegionBA {
}
/**
- * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
+ * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension, SimplePageMaster)
*/
- public Rectangle getViewportRectangle (FODimension reldims, FODimension pageViewPortRect) {
- // Depends on extent, precedence and writing mode
- // This should return rectangle in writing-mode coordinates relative
- // to the page-reference area rectangle
- // This means the origin is (start, before) and the dimensions are (ipd,bpd)
- // Before is always 0, start depends on extent
- // ipd depends on precedence, bpd=extent
- /* Special rules apply to resolving extent.
- * In the property subsystem the extent property is configured to
- * using BLOCK_WIDTH as its percent base.
- * However, depending on the writing mode extent import resolved either
- * against the page width or the page height.
+ public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) {
+ /* Special rules apply to resolving extent as values are resolved relative
+ * to the page size and reference orientation.
*/
- Rectangle vpRect;
- SimplePercentBaseContext pageWidthContext
- = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.ipd);
- SimplePercentBaseContext pageHeightContext
- = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.bpd);
+ SimplePercentBaseContext pageWidthContext;
+ SimplePercentBaseContext pageHeightContext;
+ if (spm.getReferenceOrientation() % 180 == 0) {
+ pageWidthContext = new SimplePercentBaseContext(null,
+ LengthBase.CUSTOM_BASE,
+ spm.getPageWidth().getValue());
+ pageHeightContext = new SimplePercentBaseContext(null,
+ LengthBase.CUSTOM_BASE,
+ spm.getPageHeight().getValue());
+ } else {
+ // invert width and height since top left are rotated by 90 (cl or ccl)
+ pageWidthContext = new SimplePercentBaseContext(null,
+ LengthBase.CUSTOM_BASE,
+ spm.getPageHeight().getValue());
+ pageHeightContext = new SimplePercentBaseContext(null,
+ LengthBase.CUSTOM_BASE,
+ spm.getPageWidth().getValue());
+ }
SimplePercentBaseContext neighbourContext;
- if (getWritingMode() == EN_LR_TB || getWritingMode() == EN_RL_TB) {
+ Rectangle vpRect;
+ if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) {
neighbourContext = pageWidthContext;
vpRect = new Rectangle(0, 0, reldims.ipd, getExtent().getValue(pageHeightContext));
} else {
@@ -75,7 +80,7 @@ public class RegionBefore extends RegionBA {
vpRect = new Rectangle(0, 0, getExtent().getValue(pageWidthContext), reldims.ipd);
}
if (getPrecedence() == EN_FALSE) {
- adjustIPD(vpRect, getWritingMode(), neighbourContext);
+ adjustIPD(vpRect, spm.getWritingMode(), neighbourContext);
}
return vpRect;
}