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

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 26 15:54:04 UTC 2020


 sw/qa/extras/uiwriter/data2/tdf123102.odt |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx       |   10 ++++++++++
 sw/source/core/table/swnewtable.cxx       |   15 +++++++++++++++
 3 files changed, 25 insertions(+)

New commits:
commit 3a69e1a6b8eab79c55b6e8f3edd2ee2da45b39c0
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Wed Feb 26 10:18:32 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Feb 26 16:53:30 2020 +0100

    tdf#123102 Writer: fix numbering at row insertion
    
    in vertically merged cells. Hidden paragraph of
    the new merged cell inherited numbering of the
    previous row, resulting bad numbering of the next
    list item.
    
    Change-Id: Ib6b29947caa22747ba8c79725ab6f9ef4db31319
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89537
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/uiwriter/data2/tdf123102.odt b/sw/qa/extras/uiwriter/data2/tdf123102.odt
new file mode 100644
index 000000000000..731a9b1521c1
Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf123102.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 80e6019d7a79..4a9898fc31d1 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -934,6 +934,16 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413)
                          getProperty<OUString>(getParagraph(1), "ParaStyleName"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123102)
+{
+    createDoc("tdf123102.odt");
+    // insert a new row after a vertically merged cell
+    dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {});
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    // This was "3." - caused by the hidden numbered paragraph of the new merged cell
+    assertXPath(pXmlDoc, "/root/page/body/tab/row[6]/cell[1]/txt/Special", "rText", "2.");
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButtonSmallTable)
 {
     // The floating table in the test document is too small, so we don't provide an unfloat button
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index fb5f7cb5b9a3..d1e724936d11 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -1517,7 +1517,22 @@ bool SwTable::InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes,
                         if( nRowSpan == 1 || nRowSpan == -1 )
                             nRowSpan = n + 1;
                         else if( nRowSpan > 1 )
+                        {
                             nRowSpan = - nRowSpan;
+
+                            // tdf#123102 disable numbering of the new hidden
+                            // paragraph in merged cells to avoid of bad
+                            // renumbering of next list elements
+                            SwTableBox* pBox = pNewLine->GetTabBoxes()[nCurrBox];
+                            SwNodeIndex aIdx( *pBox->GetSttNd(), +1 );
+                            SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
+                            if( pCNd && pCNd->IsTextNode() && pCNd->GetTextNode()->GetNumRule() )
+                            {
+                                SwPosition aPos( *pCNd->GetTextNode() );
+                                SwPaM aPam( aPos, aPos );
+                                pDoc->DelNumRules( aPam );
+                            }
+                        }
                     }
                     else
                     {


More information about the Libreoffice-commits mailing list