[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Mar 12 10:12:03 PDT 2014
sw/qa/extras/uiwriter/data/fdo75110.odt |binary
sw/qa/extras/uiwriter/uiwriter.cxx | 15 +++++++++++++++
sw/source/core/edit/eddel.cxx | 9 +++++++--
3 files changed, 22 insertions(+), 2 deletions(-)
New commits:
commit f9b62506b22c3eb885ffd5a4ec8025c33df7b2d4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Mar 12 17:28:10 2014 +0100
fdo#75110 SwEditShell::DeleteSel fix start of selection when bSelAll == true
Change-Id: I3e8ce585b29619061b18ab1ab8f0cf6c7d421074
diff --git a/sw/qa/extras/uiwriter/data/fdo75110.odt b/sw/qa/extras/uiwriter/data/fdo75110.odt
new file mode 100644
index 0000000..f4c2f2b
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/fdo75110.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 6df7426..8e59941 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 3f5fe7c..c751a36 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
More information about the Libreoffice-commits
mailing list