[Libreoffice-commits] core.git: sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Mar 13 07:41:51 PDT 2014


 sw/qa/extras/uiwriter/data/fdo75898.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx      |   17 +++++++++++++++++
 sw/source/core/frmedt/fetab.cxx         |    8 ++++++++
 sw/source/core/uibase/shells/tabsh.cxx  |    3 ++-
 4 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit f1f9b5b1b73218274ee69cf4e518c2ba926458af
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Mar 13 15:03:33 2014 +0100

    fdo#75898 SwFEShell::InsertRow: fix this in case bSelectAll == true
    
    Change-Id: Iaf59db6a55c3f81d11d0196d5d3e52056e31c4b1

diff --git a/sw/qa/extras/uiwriter/data/fdo75898.odt b/sw/qa/extras/uiwriter/data/fdo75898.odt
new file mode 100644
index 0000000..81a5062
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/fdo75898.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 8e59941..5aef75b 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -29,6 +29,7 @@ public:
     void testImportRTF();
     void testExportRTF();
     void testFdo75110();
+    void testFdo75898();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -38,6 +39,7 @@ public:
     CPPUNIT_TEST(testImportRTF);
     CPPUNIT_TEST(testExportRTF);
     CPPUNIT_TEST(testFdo75110);
+    CPPUNIT_TEST(testFdo75898);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -102,6 +104,21 @@ void SwUiWriterTest::testFdo75110()
     rUndoManager.Undo();
 }
 
+void SwUiWriterTest::testFdo75898()
+{
+    SwDoc* pDoc = createDoc("fdo75898.odt");
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->SelAll();
+    pWrtShell->InsertRow(1, true);
+    pWrtShell->InsertRow(1, true);
+
+    // Now check if the table has 3 lines.
+    SwShellCrsr* pShellCrsr = pWrtShell->getShellCrsr(false);
+    SwTableNode* pTableNode = pShellCrsr->Start()->nNode.GetNode().FindTableNode();
+    // This was 1, when doing the same using the UI, Writer even crashed.
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pTableNode->GetTable().GetTabLines().size());
+}
+
 void SwUiWriterTest::testReplaceBackward()
 {
     SwDoc* pDoc = createDoc();
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 56a8d75..593d1f2 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -204,6 +204,14 @@ bool SwFEShell::InsertRow( sal_uInt16 nCnt, bool bBehind )
 
     // search boxes via the layout
     SwSelBoxes aBoxes;
+    bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(/*bFootnotes=*/false);
+    if (bSelectAll)
+    {
+        SwPaM* pPaM = getShellCrsr(false);
+        SwNode* pNode = pPaM->Start()->nNode.GetNode().FindTableNode()->EndOfSectionNode();
+        pPaM->End()->nNode = pNode->GetIndex() - 2;
+        pPaM->End()->nContent.Assign(pPaM->End()->nNode.GetNode().GetCntntNode(), 0);
+    }
     GetTblSel( *this, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
 
     TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
diff --git a/sw/source/core/uibase/shells/tabsh.cxx b/sw/source/core/uibase/shells/tabsh.cxx
index 5b60daf..7f47c80 100644
--- a/sw/source/core/uibase/shells/tabsh.cxx
+++ b/sw/source/core/uibase/shells/tabsh.cxx
@@ -167,7 +167,8 @@ static SwTableRep*  lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
     if(rSh.GetBoxDirection( aBoxDirection ))
         rSet.Put(aBoxDirection, FN_TABLE_BOX_TEXTORIENTATION);
 
-    sal_Bool bTableSel = rSh.IsTableMode();
+    bool bSelectAll = rSh.StartsWithTable() && rSh.ExtendedSelectedAll(/*bFootnotes=*/false);
+    sal_Bool bTableSel = rSh.IsTableMode() || bSelectAll;
     if(!bTableSel)
     {
         rSh.StartAllAction();


More information about the Libreoffice-commits mailing list