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;
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);
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()) {
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();
//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) {
}
//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