[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Mar 14 02:54:47 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/ui/shells/tabsh.cxx | 3 ++-
4 files changed, 27 insertions(+), 1 deletion(-)
New commits:
commit 9b0cffd68316e6ecb6f11f77504bca64ff34ba72
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
(cherry picked from commit f1f9b5b1b73218274ee69cf4e518c2ba926458af)
Reviewed-on: https://gerrit.libreoffice.org/8574
Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
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 a86d2ca..e30db24 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -24,12 +24,14 @@ public:
void testReplaceBackward();
void testFdo69893();
void testFdo75110();
+ void testFdo75898();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
CPPUNIT_TEST(testReplaceBackward);
CPPUNIT_TEST(testFdo69893);
CPPUNIT_TEST(testFdo75110);
+ CPPUNIT_TEST(testFdo75898);
CPPUNIT_TEST_SUITE_END();
private:
@@ -93,6 +95,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 b2589d0..f3e9491 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -207,6 +207,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/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx
index 44ddfca..10a11a0 100644
--- a/sw/source/ui/shells/tabsh.cxx
+++ b/sw/source/ui/shells/tabsh.cxx
@@ -165,7 +165,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