public Property get(int subpropId, PropertyList propertyList,
boolean tryInherit, boolean tryDefault)
throws PropertyException {
Property p = super.get(0, propertyList, tryInherit, tryDefault);
TableFObj fo = (TableFObj) propertyList.getFObj();
TableFObj parent = (TableFObj) propertyList.getParentFObj();
int columnIndex = p.getNumeric().getValue();
if (columnIndex <= 0) {
fo.getLogger().warn("Specified negative or zero value for "
+ "column-number on " + fo.getName() + ": "
+ columnIndex + " forced to "
+ parent.getCurrentColumnIndex());
return new NumberProperty(parent.getCurrentColumnIndex());
}
//TODO: check for non-integer value and round
if (fo.getNameId() == Constants.FO_TABLE_CELL) {
//check if any of the column-numbers occupied by this cell
//are already in use in the current row...
int i = -1;
int colspan = propertyList.get(Constants.PR_NUMBER_COLUMNS_SPANNED)
.getNumeric().getValue();
while (++i < colspan) {
//if table has explicit columns and the column-number isn't
//assigned to any column, increment further until the next
//column is encountered
if (fo.getTable().getColumns() != null) {
while (columnIndex <= fo.getTable().getColumns().size()
&& !fo.getTable().isColumnNumberUsed(columnIndex)) {
columnIndex++;
}
}
//if column-number is already in use by another cell
//in the current row => error!
if (parent.isColumnNumberUsed(columnIndex + i)) {
throw new PropertyException("fo:table-cell overlaps in column "
+ (columnIndex + i));
}
}
}
//if column-number was explicitly specified, force the parent's current
//column index to the specified value, so that the updated index will
//be the correct initial value for the next cell/column (see Rec 7.26.8)
if (propertyList.getExplicit(Constants.PR_COLUMN_NUMBER) != null) {
parent.setCurrentColumnIndex(p.getNumeric().getValue());
}
return p;
}