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(
"The selected range is not valid.");
throw cloneException;
}
} else if (TextTableColumn.class.isAssignableFrom(position
.getType())) {
// TODO fill with logic
} else {
CloneException cloneException = new CloneException(
"No range selected.");
throw cloneException;
}
if (newTable != null) {
int rowArrayLength = cellCloneServices.length;
for (int rows = 0; rows < rowArrayLength; rows++) {
for (int columns = 0; columns < columnArrayLength; columns++) {
ICloneService cellClone = cellCloneServices[rows][columns];
ITextTableCell textTableCell = newTable.getCell(
columnStart + columns, rowStart + rows);
CloneDestinationPosition destinationCell = new CloneDestinationPosition(
textTableCell, textTableCell.getClass());
cellClone.cloneToPositionNoReturn(destinationCell,
adoptContent, propertyKeysContainer);
}
}
if (generateReturnValue) {
ITextTableCellRange textTableCellRange = newTable
.getCellRange(columnStart, rowStart,
columnArrayLength, rowArrayLength);
return new ClonedObject(textTableCellRange,
textTableCellRange.getClass());
} else
return null;
} else {
CloneException cloneException = new CloneException(
"No range selected.");