private int xoffset;
private int yoffset;
private int cellIPD;
- private int allocBPD;
+ private int rowHeight;
private int usedBPD;
+ private int borderAndPaddingBPD;
/**
* Create a new Cell layout manager.
fobj = node;
}
+ private int getIPIndents() {
+ int iIndents = 0;
+ iIndents += fobj.getCommonBorderPaddingBackground().getIPPaddingAndBorder(false);
+ return iIndents;
+ }
+
/**
* Get the next break possibility for this cell.
* A cell contains blocks so there are breaks around the blocks
public BreakPoss getNextBreakPoss(LayoutContext context) {
LayoutManager curLM; // currently active LM
+ borderAndPaddingBPD = fobj.getCommonBorderPaddingBackground()
+ .getBPPaddingAndBorder(false);
+
MinOptMax stackSize = new MinOptMax();
// if starting add space before
// stackSize.add(spaceBefore);
BreakPoss lastPos = null;
cellIPD = context.getRefIPD();
+ cellIPD -= getIPIndents();
while ((curLM = getChildLM()) != null) {
if (curLM.generatesInlineAreas()) {
}
MinOptMaxUtil.restrict(stackSize, specifiedBPD);
}
+ stackSize = MinOptMax.add(stackSize, new MinOptMax(borderAndPaddingBPD));
BreakPoss breakPoss = new BreakPoss(
new LeafPosition(this, childBreaks.size() - 1));
}
/**
- * Set the row height that contains this cell.
+ * Set the row height that contains this cell. This method is used during
+ * addAreas() stage.
*
* @param h the height of the row
*/
public void setRowHeight(int h) {
- allocBPD = h;
+ rowHeight = h;
}
/**
}
//Handle display-align
- if (usedBPD < allocBPD) {
+ if (usedBPD < rowHeight) {
if (fobj.getDisplayAlign() == EN_CENTER) {
Block space = new Block();
- space.setBPD((allocBPD - usedBPD) / 2);
+ space.setBPD((rowHeight - usedBPD) / 2);
curBlockArea.addBlock(space);
} else if (fobj.getDisplayAlign() == EN_AFTER) {
Block space = new Block();
- space.setBPD((allocBPD - usedBPD));
+ space.setBPD((rowHeight - usedBPD));
curBlockArea.addBlock(space);
}
}
TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
- curBlockArea.setBPD(allocBPD);
+ int contentBPD = rowHeight;
+ contentBPD -= borderAndPaddingBPD;
+ curBlockArea.setBPD(contentBPD);
flush();
curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
curBlockArea.setPositioning(Block.ABSOLUTE);
// set position
- curBlockArea.setXOffset(xoffset);
+ int x = xoffset; //mimic start-indent
+ x += fobj.getCommonBorderPaddingBackground().getBorderStartWidth(false);
+ curBlockArea.setXOffset(x);
curBlockArea.setYOffset(yoffset);
curBlockArea.setIPD(cellIPD);
//curBlockArea.setHeight();
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.TableRow;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
fobj = node;
}
+ /**
+ * @return the table owning this row
+ */
+ public Table getTable() {
+ FONode node = fobj.getParent();
+ while (!(node instanceof Table)) {
+ node = node.getParent();
+ }
+ return (Table)node;
+ }
+
/**
* Set the columns from the table.
*
childLM.addAreas(breakPosIter, lc);
}
x += col.getWidth().getValue();
+
+ //Handle border-separation
+ Table table = getTable();
+ if (table.getBorderCollapse() == EN_SEPARATE) {
+ x += table.getBorderSeparation().getIPD().getLength().getValue();
+ }
}
}