155
155
container = dynamic_cast<KoShapeContainer *>((lay->shapes()).at(0));
158
container->addChild(anchor->shape());
158
container->addShape(anchor->shape());
159
159
QUndoCommand *shapeCommand = m_canvas->shapeController()->addShapeDirect(anchor->shape());
160
160
shapeCommand->redo();
161
161
m_shapeCommands.push_front(shapeCommand);
177
177
QTextCharFormat f;
178
178
int deletePosition = element->getDeleteChangeMarker()->position() + 1 - numDeletedChars;
179
179
caret.setPosition(deletePosition);
180
caret.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, fragmentLength(element->getDeleteData()));
180
int deletedLength = fragmentLength(element->getDeleteData());
181
caret.setPosition(deletePosition + deletedLength, QTextCursor::KeepAnchor);
181
182
checkAndRemoveAnchoredShapes(deletePosition, fragmentLength(element->getDeleteData()));
182
183
caret.removeSelectedText();
183
184
numDeletedChars += fragmentLength(element->getDeleteData());
247
248
currentList->add(cursor.block(), deletedListItemLevel);
250
} else if (tempCursor.currentTable()) {
251
QTextTable *deletedTable = tempCursor.currentTable();
252
int numRows = deletedTable->rows();
253
int numColumns = deletedTable->columns();
254
QTextTable *insertedTable = cursor.insertTable(numRows, numColumns, deletedTable->format());
255
for (int i=0; i<numRows; i++) {
256
for (int j=0; j<numColumns; j++) {
257
tempCursor.setPosition(deletedTable->cellAt(i,j).firstCursorPosition().position());
258
tempCursor.setPosition(deletedTable->cellAt(i,j).lastCursorPosition().position(), QTextCursor::KeepAnchor);
259
insertedTable->cellAt(i,j).setFormat(deletedTable->cellAt(i,j).format().toTableCellFormat());
260
cursor.setPosition(insertedTable->cellAt(i,j).firstCursorPosition().position());
261
cursor.insertFragment(tempCursor.selection());
264
tempCursor.setPosition(deletedTable->cellAt(numRows-1,numColumns-1).lastCursorPosition().position());
265
currentBlock = tempCursor.block();
266
//Move the cursor outside of table
267
cursor.setPosition(cursor.position() + 1);
250
270
// This block does not contain a list. So no special work here.
251
271
if (currentBlock != tempDoc.begin())
284
303
tempCursor.insertFragment(fragment);
286
305
bool deletedListItem = false;
288
306
for (QTextBlock currentBlock = tempDoc.begin(); currentBlock != tempDoc.end(); currentBlock = currentBlock.next()) {
289
307
tempCursor.setPosition(currentBlock.position());
290
308
if (tempCursor.currentList()) {
291
309
deletedListItem = currentBlock.blockFormat().property(KoDeleteChangeMarker::DeletedListItem).toBool();
292
310
if (currentBlock != tempDoc.begin() && deletedListItem)
293
311
length += 1; //For the Block separator
312
} else if (tempCursor.currentTable()) {
313
QTextTable *deletedTable = tempCursor.currentTable();
314
int numRows = deletedTable->rows();
315
int numColumns = deletedTable->columns();
316
for (int i=0; i<numRows; i++) {
317
for (int j=0; j<numColumns; j++) {
319
length += (deletedTable->cellAt(i,j).lastCursorPosition().position() - deletedTable->cellAt(i,j).firstCursorPosition().position());
322
tempCursor.setPosition(deletedTable->cellAt(numRows-1,numColumns-1).lastCursorPosition().position());
323
currentBlock = tempCursor.block();
295
327
if (currentBlock != tempDoc.begin())
296
328
length += 1; //For the Block Separator