diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-09-17 16:11:09 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-09-17 16:27:24 +0200 |
commit | 0fb4adcff534e3841cf6df0e2363fb0797af7022 (patch) | |
tree | 071bc8697f5ee8a0fe6e9d02eb6e2c179fb87a00 | |
parent | 7f76c90a982eb06396a96c32088bfd5de941516a (diff) |
fdo#37606 SwEditShell::DeleteSel(): handle document starting with a table
If the whole document is selected and the document starts with a table,
then we used to delete the contents of the document, except the starting
table, which was just cleared. Change this and do what is expected:
remove the table as well, so the document will have a single empty
paragraph only.
Change-Id: I47d3fab462e2a4149f6459d61e487fee8c5c30ed
-rw-r--r-- | sw/source/core/edit/eddel.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 2d7adb6e816b..8ea582c99835 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -35,6 +35,7 @@ void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo ) { + bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(); // only for selections if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark()) return; @@ -42,10 +43,11 @@ void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo ) // Is the selection in a table? Then delete only the content of the selected boxes. // Here, there are two cases: // 1. Point and Mark are in one box, delete selection as usual - // 2. Point and Mare are in different boxes, search all selected boxes and delete content + // 2. Point and Mark are in different boxes, search all selected boxes and delete content + // 3. Point and Mark are at the document start and end, Point is in a table: delete selection as usual if( rPam.GetNode()->FindTableNode() && rPam.GetNode()->StartOfSectionNode() != - rPam.GetNode(sal_False)->StartOfSectionNode() ) + rPam.GetNode(sal_False)->StartOfSectionNode() && !bSelectAll ) { // group the Undo in the table if( pUndo && !*pUndo ) |