jeremias 2005/02/09 03:51:30
Modified: src/java/org/apache/fop/layoutmgr/table Row.java Cell.java
Log:
Fix for handling of horizontal border-separation. My first interpretation was
wrong.
Revision Changes Path
1.22 +2 -12 xml-fop/src/java/org/apache/fop/layoutmgr/table/Row.java
Index: Row.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Row.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Row.java 8 Feb 2005 16:37:23 -0000 1.21
+++ Row.java 9 Feb 2005 11:51:30 -0000 1.22
@@ -229,16 +229,10 @@
//Determine which columns this cell will occupy
getColumnsForCell(cellLM, startColumn, spannedColumns);
int childRefIPD = 0;
- Iterator i = spannedColumns.iterator();
- while (i.hasNext()) {
- Column col = (Column)i.next();
+ for (int i = 0; i < spannedColumns.size(); i++) {
+ Column col = (Column)spannedColumns.get(i);
childRefIPD += col.getWidth().getValue();
}
- //Handle border-separation when border-collapse="separate"
- if (getTable().getBorderCollapse() == EN_SEPARATE) {
- childRefIPD += (spannedColumns.size() - 1)
- *
getTable().getBorderSeparation().getIPD().getLength().getValue();
- }
childLC.setRefIPD(childRefIPD);
if (cellLM != null) {
@@ -280,11 +274,7 @@
}
//Adjust in-row x offset for individual cells
- //TODO Probably needs more work to support writing modes
ipdOffset += childRefIPD;
- if (getTable().getBorderCollapse() == EN_SEPARATE) {
- ipdOffset +=
getTable().getBorderSeparation().getIPD().getLength().getValue();
- }
// the min is the maximum min of all cells
1.19 +24 -1 xml-fop/src/java/org/apache/fop/layoutmgr/table/Cell.java
Index: Cell.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Cell.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Cell.java 8 Feb 2005 17:41:23 -0000 1.18
+++ Cell.java 9 Feb 2005 11:51:30 -0000 1.19
@@ -18,6 +18,8 @@
package org.apache.fop.layoutmgr.table;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.flow.Table;
import org.apache.fop.fo.flow.TableCell;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
@@ -74,6 +76,17 @@
return this.fobj;
}
+ /**
+ * @return the table owning this cell
+ */
+ public Table getTable() {
+ FONode node = fobj.getParent();
+ while (!(node instanceof Table)) {
+ node = node.getParent();
+ }
+ return (Table)node;
+ }
+
private int getIPIndents() {
int iIndents = 0;
iIndents +=
fobj.getCommonBorderPaddingBackground().getIPPaddingAndBorder(false);
@@ -102,6 +115,11 @@
referenceIPD = context.getRefIPD();
cellIPD = referenceIPD;
cellIPD -= getIPIndents();
+ if (getTable().getBorderCollapse() == EN_SEPARATE) {
+ int borderSep = getTable().getBorderSeparation().getLengthPair()
+ .getIPD().getLength().getValue();
+ cellIPD -= borderSep;
+ }
while ((curLM = getChildLM()) != null) {
if (curLM.generatesInlineAreas()) {
@@ -294,7 +312,12 @@
indent +=
fobj.getCommonBorderPaddingBackground().getBorderStartWidth(false);
indent +=
fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
// set position
- curBlockArea.setXOffset(xoffset + inRowIPDOffset + indent);
+ int halfBorderSep = 0;
+ if (getTable().getBorderCollapse() == EN_SEPARATE) {
+ halfBorderSep =
getTable().getBorderSeparation().getLengthPair()
+ .getIPD().getLength().getValue() / 2;
+ }
+ curBlockArea.setXOffset(xoffset + inRowIPDOffset + halfBorderSep
+ indent);
curBlockArea.setYOffset(yoffset);
curBlockArea.setIPD(cellIPD);
//curBlockArea.setHeight();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]