jeremias 2005/02/17 01:17:36
Modified: src/java/org/apache/fop/layoutmgr
PageSequenceLayoutManager.java
src/java/org/apache/fop/fo/pagination RegionBody.java
Region.java
Log:
Fix for bad page-master and region margin calculations. All margin
calculations now use margin-* attributes directly, ignoring start|end-indent
and space-*.
Better check for borders and padding on regions.
Revision Changes Path
1.34 +3 -11
xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
Index: PageSequenceLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- PageSequenceLayoutManager.java 17 Feb 2005 00:27:54 -0000 1.33
+++ PageSequenceLayoutManager.java 17 Feb 2005 09:17:35 -0000 1.34
@@ -486,9 +486,7 @@
RegionViewport rv = curPage.getPage().getRegionViewport(
FO_REGION_BODY);
curBody = (BodyRegion) rv.getRegion();
- flowBPD = (int) curBody.getBPD()
- - rv.getBorderAndPaddingWidthBefore()
- - rv.getBorderAndPaddingWidthAfter();
+ flowBPD = (int) curBody.getBPD();
return curPage;
}
@@ -805,11 +803,6 @@
// transforming it using the page CTM
RegionViewport rv = new RegionViewport(absRegionRect);
rv.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
- if
(r.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false) != 0
- ||
r.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false) != 0) {
- log.error("Border and padding for a region must be '0'.");
- //See 6.4.13 in XSL 1.0
- }
rv.setBPD((int)relRegionRect.getHeight());
rv.setIPD((int)relRegionRect.getWidth());
setRegionViewportTraits(r, rv);
@@ -824,8 +817,7 @@
* @param r the region viewport
*/
private void setRegionViewportTraits(Region r, RegionViewport rv) {
- // Common Border, Padding, and Background Properties
- TraitSetter.addBorders(rv, r.getCommonBorderPaddingBackground());
+ // Apply Background Properties, no border and padding on region
viewports
TraitSetter.addBackground(rv, r.getCommonBorderPaddingBackground());
}
1.35 +7 -14
xml-fop/src/java/org/apache/fop/fo/pagination/RegionBody.java
Index: RegionBody.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RegionBody.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- RegionBody.java 28 Oct 2004 10:00:23 -0000 1.34
+++ RegionBody.java 17 Feb 2005 09:17:35 -0000 1.35
@@ -81,20 +81,13 @@
* @see
org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
public 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.
- */
- int start = commonMarginBlock.startIndent.getValue();
- int end = commonMarginBlock.endIndent.getValue();
- int before =
commonMarginBlock.spaceBefore.getOptimum().getLength().getValue();
- int after =
commonMarginBlock.spaceAfter.getOptimum().getLength().getValue();
- return new Rectangle(start, before,
- reldims.ipd - start - end,
- reldims.bpd - before - after);
+ int left = commonMarginBlock.marginLeft.getValue();
+ int right = commonMarginBlock.marginRight.getValue();
+ int top = commonMarginBlock.marginTop.getValue();
+ int bottom = commonMarginBlock.marginBottom.getValue();
+ return new Rectangle(left, top,
+ reldims.ipd - left - right,
+ reldims.bpd - top - bottom);
}
/**
1.36 +22 -14 xml-fop/src/java/org/apache/fop/fo/pagination/Region.java
Index: Region.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Region.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- Region.java 28 Oct 2004 10:00:23 -0000 1.35
+++ Region.java 17 Feb 2005 09:17:36 -0000 1.36
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
@@ -79,6 +80,12 @@
+ " is not permitted.", locator);
}
}
+
+ if (getCommonBorderPaddingBackground().getBPPaddingAndBorder(false)
!= 0
+ ||
getCommonBorderPaddingBackground().getIPPaddingAndBorder(false) != 0) {
+ throw new PropertyException("Border and padding for a region "
+ + "must be '0' (See 6.4.13 in XSL 1.0).");
+ }
}
/**
@@ -90,6 +97,10 @@
invalidChildError(loc, nsURI, localName);
}
+ /**
+ * @param pageRefRect reference dimension of the page area.
+ * @return the rectangle for the viewport area
+ */
public abstract Rectangle getViewportRectangle(FODimension pageRefRect);
/**
@@ -132,36 +143,33 @@
}
/**
- * Return the Common Border, Padding, and Background Properties.
+ * @return the Background Properties (border and padding are not used
here).
*/
public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
return commonBorderPaddingBackground;
}
- /**
- * Return the "region-name" property.
- */
+ /** @return the "region-name" property. */
public String getRegionName() {
return regionName;
}
- /**
- * Return the "writing-mode" property.
- */
+ /** @return the "writing-mode" property. */
public int getWritingMode() {
return writingMode;
}
- /**
- * Return the "overflow" property.
- */
+ /** @return the "overflow" property. */
public int getOverflow() {
return overflow;
}
- /**
- * Return the "reference-orientation" property.
- */
+ /** @return the display-align property. */
+ public int getDisplayAlign() {
+ return displayAlign;
+ }
+
+ /** @return the "reference-orientation" property. */
public int getReferenceOrientation() {
return referenceOrientation.getValue();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]