summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-03-12 17:28:10 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-12 18:11:40 +0100
commitf9b62506b22c3eb885ffd5a4ec8025c33df7b2d4 (patch)
tree421f580b0f5667bf1c071602cf7303ac78bc4b43
parent9cfa665706cbced0fa71c43bb9425f28a0145f67 (diff)
fdo#75110 SwEditShell::DeleteSel fix start of selection when bSelAll == true
Change-Id: I3e8ce585b29619061b18ab1ab8f0cf6c7d421074
-rw-r--r--sw/qa/extras/uiwriter/data/fdo75110.odtbin0 -> 13169 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx15
-rw-r--r--sw/source/core/edit/eddel.cxx9
3 files changed, 22 insertions, 2 deletions
diff --git a/sw/qa/extras/uiwriter/data/fdo75110.odt b/sw/qa/extras/uiwriter/data/fdo75110.odt
new file mode 100644
index 000000000000..f4c2f2bb699b
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/fdo75110.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 6df74260f47f..8e59941ef9f5 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -28,6 +28,7 @@ public:
void testFdo70807();
void testImportRTF();
void testExportRTF();
+ void testFdo75110();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -36,6 +37,7 @@ public:
CPPUNIT_TEST(testFdo70807);
CPPUNIT_TEST(testImportRTF);
CPPUNIT_TEST(testExportRTF);
+ CPPUNIT_TEST(testFdo75110);
CPPUNIT_TEST_SUITE_END();
private:
@@ -87,6 +89,19 @@ void SwUiWriterTest::testReplaceForward()
CPPUNIT_ASSERT_EQUAL(ORIGINAL_REPLACE_CONTENT, pTxtNode->GetTxt());
}
+void SwUiWriterTest::testFdo75110()
+{
+ SwDoc* pDoc = createDoc("fdo75110.odt");
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+ pWrtShell->SelAll();
+ // The problem was that SwEditShell::DeleteSel() what this Delete() invokes took the wrong selection...
+ pWrtShell->Delete();
+ sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+ // ... so this Undo() call resulted in a crash.
+ rUndoManager.Undo();
+}
+
void SwUiWriterTest::testReplaceBackward()
{
SwDoc* pDoc = createDoc();
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 3f5fe7cf7a13..c751a36c6fbc 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -89,9 +89,14 @@ void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo )
}
else
{
+ SwPaM aPam(rPam);
+ if (bSelectAll)
+ // Selection starts at the first para of the first cell, but we
+ // want to delete the table node before the first cell as well.
+ aPam.Start()->nNode = aPam.Start()->nNode.GetNode().FindTableNode()->GetIndex();
// delete everything
- GetDoc()->DeleteAndJoin( rPam );
- SaveTblBoxCntnt( rPam.GetPoint() );
+ GetDoc()->DeleteAndJoin( aPam );
+ SaveTblBoxCntnt( aPam.GetPoint() );
}
// Selection is not needed anymore