newTable.addRow(rowStart, (rowStart + rowCount)
- newTableRowCount);
}
} else if (TextTableCellRange.class.isAssignableFrom(position
.getType())) {
TextTableCellRange tableCellRange = ((TextTableCellRange) position
.getDestinationObject());
int tmpColumnCount = tableCellRange.getColumnCount();
int tmpRowCount = tableCellRange.getRowCount();
if (tmpColumnCount == 0 || tmpRowCount == 0) {
CloneException cloneException = new CloneException(
"No range selected.");
throw cloneException;
}
newTable = tableCellRange.getCell(0, 0).getTextTable();
;
ITextTableCellRangeName rangeName = tableCellRange
.getRangeName();
columnStart = rangeName.getRangeStartColumnIndex();
rowStart = rangeName.getRangeStartRowIndex();
if (tmpColumnCount != columnCount || tmpRowCount != rowCount) {
CloneException cloneException = new CloneException(
"The selected range is not valid.");
throw cloneException;
}
} else if (TextTableRow.class.isAssignableFrom(position.getType())) {
TextTableRow textTableRow = ((TextTableRow) position
.getDestinationObject());
ITextTableCellRange tableCellRange = textTableRow
.getCellRange();
int tmpColumnCount = tableCellRange.getColumnCount();
int tmpRowCount = tableCellRange.getRowCount();
if (tmpColumnCount == 0 || tmpRowCount == 0) {
CloneException cloneException = new CloneException(
"No range selected.");
throw cloneException;
}
newTable = tableCellRange.getCell(0, 0).getTextTable();
;
ITextTableCellRangeName rangeName = tableCellRange
.getRangeName();
columnStart = rangeName.getRangeStartColumnIndex();
rowStart = rangeName.getRangeStartRowIndex();
if (tmpColumnCount != columnCount || tmpRowCount != rowCount) {
CloneException cloneException = new CloneException(