git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@291270 13f79535-47bb-0310-9956-ffa450edef68pull/31/head
@@ -329,7 +329,7 @@ public class TableBody extends TableFObj { | |||
* | |||
* @param newIndex the new column index | |||
*/ | |||
protected void setCurrentColumnIndex(int newIndex) { | |||
public void setCurrentColumnIndex(int newIndex) { | |||
columnIndex = newIndex; | |||
} | |||
@@ -149,15 +149,9 @@ public class TableCell extends TableFObj { | |||
//in the current row => error! | |||
if (((TableFObj) parent).isColumnNumberUsed(columnIndex)) { | |||
throw new FOPException("fo:table-cell overlaps in column " | |||
+ i, locator); | |||
+ columnIndex, locator); | |||
} | |||
} | |||
//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 (see Rec 7.26.8) | |||
if (pList.getExplicit(PR_COLUMN_NUMBER) != null) { | |||
((TableFObj) parent).setCurrentColumnIndex(columnNumber.getValue()); | |||
} | |||
} | |||
/** |
@@ -75,18 +75,9 @@ public class TableColumn extends TableFObj { | |||
visibility = pList.get(PR_VISIBILITY).getEnum(); | |||
super.bind(pList); | |||
if (pList.getExplicit(PR_COLUMN_NUMBER) != null) { | |||
if (getTable().isColumnNumberUsed(columnNumber.getValue())) { | |||
throw new PropertyException("Specified column-number \"" | |||
+ columnNumber | |||
+ "\" has already been assigned to a previous column"); | |||
} else { | |||
//force parent table's current column index | |||
//to the specified value, so that the updated index | |||
//will be the correct initial value for the next column | |||
//(see Rec 7.26.8) | |||
getTable().setCurrentColumnIndex(columnNumber.getValue()); | |||
} | |||
if (getTable().isColumnNumberUsed(columnNumber.getValue())) { | |||
throw new PropertyException("column-number \"" + columnNumber | |||
+ "\" has already been assigned to a previous column"); | |||
} | |||
if (numberColumnsRepeated.getValue() <= 0) { | |||
throw new PropertyException("number-columns-repeated must be 1 or bigger, " |
@@ -125,7 +125,7 @@ public abstract class TableFObj extends FObj { | |||
* | |||
* @param newIndex new value for column index | |||
*/ | |||
protected void setCurrentColumnIndex(int newIndex) { | |||
public void setCurrentColumnIndex(int newIndex) { | |||
//do nothing by default | |||
} | |||
@@ -305,7 +305,7 @@ public class TableRow extends TableFObj { | |||
* | |||
* @param newIndex new value for column index | |||
*/ | |||
protected void setCurrentColumnIndex(int newIndex) { | |||
public void setCurrentColumnIndex(int newIndex) { | |||
columnIndex = newIndex; | |||
} | |||
@@ -86,9 +86,9 @@ public class ColumnNumberPropertyMaker extends NumberProperty.Maker { | |||
Property p = super.get(0, propertyList, tryInherit, tryDefault); | |||
FObj fo = propertyList.getFObj(); | |||
TableFObj parent = (TableFObj) propertyList.getParentFObj(); | |||
if (p.getNumeric().getValue() <= 0) { | |||
TableFObj parent = (TableFObj) propertyList.getParentFObj(); | |||
int columnIndex = parent.getCurrentColumnIndex(); | |||
fo.getLogger().warn("Specified negative or zero value for " | |||
+ "column-number on " + fo.getName() + ": " | |||
@@ -97,6 +97,13 @@ public class ColumnNumberPropertyMaker extends NumberProperty.Maker { | |||
return new NumberProperty(columnIndex); | |||
} | |||
//TODO: check for non-integer value and round | |||
//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 (see Rec 7.26.8) | |||
if (propertyList.getExplicit(Constants.PR_COLUMN_NUMBER) != null) { | |||
parent.setCurrentColumnIndex(p.getNumeric().getValue()); | |||
} | |||
return p; | |||
} | |||
} |