public class TableCellLayoutManager extends BlockStackingLayoutManager
implements BlockLevelLayoutManager {
- private TableCell fobj;
private PrimaryGridUnit gridUnit;
private Block curBlockArea;
/** @return the table-cell FO */
public TableCell getTableCell() {
- return this.fobj;
+ return (TableCell)this.fobj;
}
private boolean isSeparateBorderModel() {
- return fobj.isSeparateBorderModel();
+ return getTableCell().isSeparateBorderModel();
}
/** @see org.apache.fop.layoutmgr.LayoutManager#initialize() */
public void initialize() {
borderAndPaddingBPD = 0;
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderAfterWidth(false);
+ borderAndPaddingBPD += getTableCell()
+ .getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
+ borderAndPaddingBPD += getTableCell()
+ .getCommonBorderPaddingBackground().getBorderAfterWidth(false);
if (!isSeparateBorderModel()) {
borderAndPaddingBPD /= 2;
}
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground()
+ borderAndPaddingBPD += getTableCell().getCommonBorderPaddingBackground()
.getPaddingBefore(false, this);
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground()
+ borderAndPaddingBPD += getTableCell().getCommonBorderPaddingBackground()
.getPaddingAfter(false, this);
}
if (!isSeparateBorderModel()) {
iIndents /= 2;
}
- iIndents += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
- iIndents += fobj.getCommonBorderPaddingBackground().getPaddingEnd(false, this);
+ iIndents += getTableCell().getCommonBorderPaddingBackground().getPaddingStart(false, this);
+ iIndents += getTableCell().getCommonBorderPaddingBackground().getPaddingEnd(false, this);
return iIndents;
}
cellIPD = referenceIPD;
cellIPD -= getIPIndents();
if (isSeparateBorderModel()) {
- int borderSep = fobj.getBorderSeparation().getLengthPair()
+ int borderSep = getTableCell().getBorderSeparation().getLengthPair()
.getIPD().getLength().getValue(this);
cellIPD -= borderSep;
}
LayoutContext layoutContext) {
getParentArea(null);
- getPSLM().addIDToPage(fobj.getId());
+ getPSLM().addIDToPage(getTableCell().getId());
if (isSeparateBorderModel()) {
- if (!emptyCell || fobj.showEmptyCells()) {
- TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground(), this);
+ if (!emptyCell || getTableCell().showEmptyCells()) {
+ TraitSetter.addBorders(curBlockArea,
+ getTableCell().getCommonBorderPaddingBackground(), this);
}
} else {
boolean[] outer = new boolean[] {
//Handle display-align
int contentBPD = getContentHeight(rowHeight, gridUnit);
if (usedBPD < contentBPD) {
- if (fobj.getDisplayAlign() == EN_CENTER) {
+ if (getTableCell().getDisplayAlign() == EN_CENTER) {
Block space = new Block();
space.setBPD((contentBPD - usedBPD) / 2);
curBlockArea.addBlock(space);
- } else if (fobj.getDisplayAlign() == EN_AFTER) {
+ } else if (getTableCell().getDisplayAlign() == EN_AFTER) {
Block space = new Block();
space.setBPD((contentBPD - usedBPD));
curBlockArea.addBlock(space);
// Add background after we know the BPD
if (isSeparateBorderModel()) {
- if (!emptyCell || fobj.showEmptyCells()) {
+ if (!emptyCell || getTableCell().showEmptyCells()) {
TraitSetter.addBackground(curBlockArea,
- fobj.getCommonBorderPaddingBackground(),
- this);
+ getTableCell().getCommonBorderPaddingBackground(),
+ this);
}
} else {
TraitSetter.addBackground(curBlockArea,
- fobj.getCommonBorderPaddingBackground(),
- this);
+ getTableCell().getCommonBorderPaddingBackground(),
+ this);
}
flush();
if (curBlockArea == null) {
curBlockArea = new Block();
curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
- TraitSetter.setProducerID(curBlockArea, fobj.getId());
+ TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
curBlockArea.setPositioning(Block.ABSOLUTE);
int indent = 0;
indent += startBorderWidth;
if (!isSeparateBorderModel()) {
indent /= 2;
}
- indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
+ indent += getTableCell()
+ .getCommonBorderPaddingBackground().getPaddingStart(false, this);
// set position
int halfBorderSep = 0;
if (isSeparateBorderModel()) {
- halfBorderSep = fobj.getBorderSeparation().getLengthPair()
+ halfBorderSep = getTableCell().getBorderSeparation().getLengthPair()
.getIPD().getLength().getValue(this) / 2;
}
int borderAdjust = 0;
public class TableLayoutManager extends BlockStackingLayoutManager
implements ConditionalElementListener {
- private Table fobj;
-
private TableContentLayoutManager contentLM;
private ColumnSetup columns = null;
*/
public TableLayoutManager(Table node) {
super(node);
- fobj = node;
this.columns = new ColumnSetup(node);
}
/** @return the table FO */
public Table getTable() {
- return this.fobj;
+ return (Table)this.fobj;
}
/**
/** @see org.apache.fop.layoutmgr.LayoutManager#initialize() */
public void initialize() {
- foSpaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore, this).getSpace();
- foSpaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter, this).getSpace();
+ foSpaceBefore = new SpaceVal(
+ getTable().getCommonMarginBlock().spaceBefore, this).getSpace();
+ foSpaceAfter = new SpaceVal(
+ getTable().getCommonMarginBlock().spaceAfter, this).getSpace();
- if (!fobj.isAutoLayout()
- && fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
+ if (!getTable().isAutoLayout()
+ && getTable().getInlineProgressionDimension().getOptimum(this).getEnum()
+ != EN_AUTO) {
autoLayout = false;
}
}
private int getIPIndents() {
int iIndents = 0;
- iIndents += fobj.getCommonMarginBlock().startIndent.getValue(this);
- iIndents += fobj.getCommonMarginBlock().endIndent.getValue(this);
+ iIndents += getTable().getCommonMarginBlock().startIndent.getValue(this);
+ iIndents += getTable().getCommonMarginBlock().endIndent.getValue(this);
return iIndents;
}
referenceBPD = context.getStackLimit().opt;
referenceIPD = context.getRefIPD();
- if (fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
- referenceIPD = fobj.getInlineProgressionDimension().getOptimum(this)
+ if (getTable().getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
+ referenceIPD = getTable().getInlineProgressionDimension().getOptimum(this)
.getLength().getValue(this);
contentIPD = referenceIPD;
} else {
- if (!fobj.isAutoLayout()) {
+ if (!getTable().isAutoLayout()) {
log.info("table-layout=\"fixed\" and width=\"auto\", "
+ "but auto-layout not supported "
+ "=> assuming width=\"100%\"");
addKnuthElementsForSpaceBefore(returnList, alignment);
- if (fobj.isSeparateBorderModel()) {
+ if (getTable().isSeparateBorderModel()) {
addKnuthElementsForBorderPaddingBefore(returnList);
}
}
}
wrapPositionElements(contentList, returnList);
- if (fobj.isSeparateBorderModel()) {
+ if (getTable().isSeparateBorderModel()) {
addKnuthElementsForBorderPaddingAfter(returnList);
}
addKnuthElementsForSpaceAfter(returnList, alignment);
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
getParentArea(null);
- getPSLM().addIDToPage(fobj.getId());
+ getPSLM().addIDToPage(getTable().getId());
- int startXOffset = fobj.getCommonMarginBlock().startIndent.getValue(this);
+ int startXOffset = getTable().getCommonMarginBlock().startIndent.getValue(this);
// add column, body then row areas
curBlockArea.setBPD(tableHeight);
- if (fobj.isSeparateBorderModel()) {
+ if (getTable().isSeparateBorderModel()) {
TraitSetter.addBorders(curBlockArea,
getTable().getCommonBorderPaddingBackground(),
discardBorderBefore, discardBorderAfter, false, false, this);
discardPaddingBefore, discardPaddingAfter, false, false, this);
}
TraitSetter.addBackground(curBlockArea,
- fobj.getCommonBorderPaddingBackground(),
+ getTable().getCommonBorderPaddingBackground(),
this);
TraitSetter.addMargins(curBlockArea,
- fobj.getCommonBorderPaddingBackground(),
- fobj.getCommonMarginBlock(),
+ getTable().getCommonBorderPaddingBackground(),
+ getTable().getCommonMarginBlock(),
this);
TraitSetter.addBreaks(curBlockArea,
- fobj.getBreakBefore(), fobj.getBreakAfter());
+ getTable().getBreakBefore(), getTable().getBreakAfter());
TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(),
effSpaceBefore, effSpaceAfter);
public boolean mustKeepTogether() {
//TODO Keeps will have to be more sophisticated sooner or later
return ((BlockLevelLayoutManager)getParent()).mustKeepTogether()
- || !fobj.getKeepTogether().getWithinPage().isAuto()
- || !fobj.getKeepTogether().getWithinColumn().isAuto();
+ || !getTable().getKeepTogether().getWithinPage().isAuto()
+ || !getTable().getKeepTogether().getWithinColumn().isAuto();
}
/**
* @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithPrevious()
*/
public boolean mustKeepWithPrevious() {
- return !fobj.getKeepWithPrevious().getWithinPage().isAuto()
- || !fobj.getKeepWithPrevious().getWithinColumn().isAuto();
+ return !getTable().getKeepWithPrevious().getWithinPage().isAuto()
+ || !getTable().getKeepWithPrevious().getWithinColumn().isAuto();
}
/**
* @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithNext()
*/
public boolean mustKeepWithNext() {
- return !fobj.getKeepWithNext().getWithinPage().isAuto()
- || !fobj.getKeepWithNext().getWithinColumn().isAuto();
+ return !getTable().getKeepWithNext().getWithinPage().isAuto()
+ || !getTable().getKeepWithNext().getWithinColumn().isAuto();
}
// --------- Property Resolution related functions --------- //