]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Corinna Hischke's excellent table padding and partial border fixes. Very
authorSteve Coffman <gears@apache.org>
Wed, 8 Nov 2000 22:07:27 +0000 (22:07 +0000)
committerSteve Coffman <gears@apache.org>
Wed, 8 Nov 2000 22:07:27 +0000 (22:07 +0000)
Cool!

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193751 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/flow/TableCell.java
src/org/apache/fop/fo/flow/TableColumn.java
src/org/apache/fop/fo/flow/TableRow.java

index 16aba170453caf3916e58e4034afd059dfbe8869..ccb397b3d51266c892b073217d09cdd10fafacfe 100644 (file)
@@ -260,6 +260,10 @@ public class TableCell extends FObj {
        areaContainer.end();
        area.addChild(areaContainer);
 
+       area.setHeight(getHeight());
+       // reset absoluteHeight to beginning of row
+       area.setAbsoluteHeight(areaContainer.getAbsoluteHeight());
+
        return new Status(Status.OK);
     }
 
index 64398c22a078bed68711c9307d4d9f049b6d2be3..9d668b8a32fc164b4f14c68caf3290a77bde567c 100644 (file)
@@ -74,6 +74,11 @@ public class TableColumn extends FObj {
     ColorType borderRightColor;
     int borderRightWidth;
     int borderRightStyle;
+    int paddingTop;
+    int paddingBottom;
+    int paddingLeft;
+    int paddingRight;
+
     int columnWidth;
     int columnOffset;
     
@@ -167,6 +172,21 @@ public class TableColumn extends FObj {
                this.borderRightStyle = 
                    this.properties.get("border-right-style").getEnum();
            }
+           this.paddingTop =
+               this.properties.get("padding").getLength().mvalue();
+            this.paddingLeft = this.paddingTop;
+            this.paddingRight = this.paddingTop;
+            this.paddingBottom = this.paddingTop;
+            if (this.paddingTop == 0) {
+             this.paddingTop =
+                 this.properties.get("padding-top").getLength().mvalue();
+             this.paddingLeft =
+                 this.properties.get("padding-left").getLength().mvalue();
+             this.paddingBottom =
+                 this.properties.get("padding-bottom").getLength().mvalue();
+             this.paddingRight =
+                 this.properties.get("padding-right").getLength().mvalue();
+            }
             this.columnWidth = 
                 this.properties.get("column-width").getLength().mvalue();
             
@@ -179,6 +199,8 @@ public class TableColumn extends FObj {
            new AreaContainer(fs, columnOffset - area.borderWidthLeft, -area.borderWidthTop, columnWidth, 
                          area.getHeight(), Position.RELATIVE);
        areaContainer.setPage(area.getPage());
+       areaContainer.setPadding(paddingTop, paddingLeft, paddingBottom,
+                                paddingRight);
        areaContainer.setBackgroundColor(backgroundColor);
         areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle, 
                                     borderBottomStyle, borderRightStyle); 
index 7ee6edb6f681f05f970dd92815fbd18eea269df2..af4d03176cb63bef7b1a24d8d44e360a9c331e42 100644 (file)
@@ -93,6 +93,10 @@ public class TableRow extends FObj {
     ColorType borderRightColor;
     int borderRightWidth;
     int borderRightStyle;
+    int paddingTop;
+    int paddingBottom;
+    int paddingLeft;
+    int paddingRight;
 
     int widthOfCellsSoFar = 0;
     int largestCellHeight = 0;
@@ -178,6 +182,21 @@ public class TableRow extends FObj {
                this.borderRightStyle = 
                    this.properties.get("border-right-style").getEnum();
            }
+           this.paddingTop =
+               this.properties.get("padding").getLength().mvalue();
+            this.paddingLeft = this.paddingTop;
+            this.paddingRight = this.paddingTop;
+            this.paddingBottom = this.paddingTop;
+            if (this.paddingTop == 0) {
+             this.paddingTop =
+                 this.properties.get("padding-top").getLength().mvalue();
+             this.paddingLeft =
+                 this.properties.get("padding-left").getLength().mvalue();
+             this.paddingBottom =
+                 this.properties.get("padding-bottom").getLength().mvalue();
+             this.paddingRight =
+                 this.properties.get("padding-right").getLength().mvalue();
+            }
             this.id=
                  this.properties.get("id").getString();
 
@@ -205,6 +224,8 @@ public class TableRow extends FObj {
                            area.getAllocationWidth(), 
                          area.spaceLeft(), Position.RELATIVE);
        areaContainer.setPage(area.getPage());
+       areaContainer.setPadding(paddingTop, paddingLeft, paddingBottom,
+                                paddingRight);
        areaContainer.setBackgroundColor(backgroundColor);
         areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle, borderBottomStyle, borderRightStyle); 
         areaContainer.setBorderWidth(borderTopWidth, borderLeftWidth, borderBottomWidth, borderRightWidth); 
@@ -265,7 +286,11 @@ public class TableRow extends FObj {
 
        area.addChild(areaContainer);
        areaContainer.end();
-        area.addDisplaySpace(largestCellHeight);
+        area.addDisplaySpace(largestCellHeight
+                            + areaContainer.getPaddingTop()
+                            + areaContainer.borderWidthTop
+                            + areaContainer.getPaddingBottom()
+                            + areaContainer.borderWidthBottom);
 
        // bug fix from Eric Schaeffer
        //area.increaseHeight(largestCellHeight);