gmazza 2003/11/02 08:20:16
Modified: src/java/org/apache/fop/area RegionViewport.java
src/java/org/apache/fop/layoutmgr PageLayoutManager.java
src/java/org/apache/fop/render/pdf PDFRenderer.java
Log:
Clearer method names given for finding border and padding for regions.
See: http://marc.theaimsgroup.com/?l=fop-dev&m=106777246222766&w=2
and http://www.w3.org/TR/2001/REC-xsl-20011015/slice4.html#area-stackblock
Revision Changes Path
1.3 +12 -16 xml-fop/src/java/org/apache/fop/area/RegionViewport.java
Index: RegionViewport.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/RegionViewport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RegionViewport.java 1 Nov 2003 21:05:23 -0000 1.2
+++ RegionViewport.java 2 Nov 2003 16:20:16 -0000 1.3
@@ -112,12 +112,11 @@
}
/**
- * Return the margin-before offset for printing text
- * (sum of region border and padding)
+ * Return the sum of region border- and padding-before
*
- * @return margin-before offset, in millipoints
+ * @return width in millipoints
*/
- public int getMarginBeforeWidth() {
+ public int getBorderAndPaddingWidthBefore() {
int margin = 0;
BorderProps bps = (BorderProps) getTrait(Trait.BORDER_BEFORE);
if (bps != null) {
@@ -133,12 +132,11 @@
}
/**
- * Return the margin-after offset for printing text
- * (sum of region border and padding)
+ * Return the sum of region border- and padding-after
*
- * @return margin-after offset, in millipoints
+ * @return width in millipoints
*/
- public int getMarginAfterWidth() {
+ public int getBorderAndPaddingWidthAfter() {
int margin = 0;
BorderProps bps = (BorderProps) getTrait(Trait.BORDER_AFTER);
@@ -155,12 +153,11 @@
}
/**
- * Return the margin-start offset for printing text
- * (sum of region border and padding)
+ * Return the sum of region border- and padding-start
*
- * @return margin-start offset, in millipoints
+ * @return width in millipoints
*/
- public int getMarginStartWidth() {
+ public int getBorderAndPaddingWidthStart() {
int margin = 0;
BorderProps bps = (BorderProps) getTrait(Trait.BORDER_START);
if (bps != null) {
@@ -176,12 +173,11 @@
}
/**
- * Return the margin-end offset for printing text
- * (sum of region border and padding)
+ * Return the sum of region border- and padding-end
*
- * @return margin-end offset, in millipoints
+ * @return width in millipoints
*/
- public int getMarginEndWidth() {
+ public int getBorderAndPaddingWidthEnd() {
int margin = 0;
BorderProps bps = (BorderProps) getTrait(Trait.BORDER_END);
if (bps != null) {
1.23 +3 -2 xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
Index: PageLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- PageLayoutManager.java 1 Nov 2003 21:05:23 -0000 1.22
+++ PageLayoutManager.java 2 Nov 2003 16:20:16 -0000 1.23
@@ -475,7 +475,8 @@
Region.BODY_CODE);
curBody = (BodyRegion) rv.getRegion();
flowBPD = (int) rv.getViewArea().getHeight() -
- rv.getMarginBeforeWidth() - rv.getMarginAfterWidth();
+ rv.getBorderAndPaddingWidthBefore() -
rv.getBorderAndPaddingWidthAfter();
+
return curPage;
}
@@ -714,7 +715,7 @@
RegionViewport rv = curPage.getPage().getRegionViewport(Region.BODY_CODE);
int ipdWidth = (int) rv.getViewArea().getWidth() -
- rv.getMarginStartWidth() - rv.getMarginEndWidth();
+ rv.getBorderAndPaddingWidthStart() - rv.getBorderAndPaddingWidthEnd();
curSpan.setIPD(ipdWidth);
//curSpan.setPosition(BPD, newpos);
1.23 +4 -7 xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java
Index: PDFRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- PDFRenderer.java 1 Nov 2003 21:05:23 -0000 1.22
+++ PDFRenderer.java 2 Nov 2003 16:20:16 -0000 1.23
@@ -530,15 +530,12 @@
Rectangle2D viewArea = region.getViewArea();
float width = (float)(viewArea.getWidth() / 1000f);
float height = (float)(viewArea.getHeight() / 1000f);
- /*
- Trait.Background back;
- back = (Trait.Background)region.getTrait(Trait.BACKGROUND);
- */
- if (region.getRegion().getRegionClass() ==
org.apache.fop.fo.pagination.Region.BODY_CODE)
+ if (region.getRegion().getRegionClass()
+ == org.apache.fop.fo.pagination.Region.BODY_CODE)
{
- BPMarginOffset = region.getMarginBeforeWidth();
- IPMarginOffset = region.getMarginStartWidth();
+ BPMarginOffset = region.getBorderAndPaddingWidthBefore();
+ IPMarginOffset = region.getBorderAndPaddingWidthStart();
}
drawBackAndBorders(region, startx, starty, width, height);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]