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

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 14 06:03:16 UTC 2019


 sw/qa/extras/uiwriter/data2/tdf125881.docx    |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx           |   16 ++++++++++++++++
 sw/source/core/doc/DocumentRedlineManager.cxx |   11 +++++++----
 3 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit be9379d0a955bd06a8d22c4dc8d99a87ed062ac4
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Jun 13 17:42:08 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Jun 14 08:02:17 2019 +0200

    tdf#125881 DOCX import: handle list level after tracked deletion
    
    to avoid bad numbering (for example import "II.1" instead of "I.3").
    
    Commit cbd894925e6b9869baedcd6476484c14d3a3df87
    "tdf#125319 DOCX track changes: don't change numbering" fixed losing
    numbering after tracked deletion (for example, during switching off the
    Show Changes mode or by DOCX export of the attached test document), but
    not handling list levels still changed the numbering.
    
    Change-Id: I67cd9459bc44e9bb470bfed6834be2e88edfe0d0
    Reviewed-on: https://gerrit.libreoffice.org/73978
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/uiwriter/data2/tdf125881.docx b/sw/qa/extras/uiwriter/data2/tdf125881.docx
new file mode 100644
index 000000000000..569d048eefe3
Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf125881.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index da1838597825..1be95f8a0ea5 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1252,6 +1252,22 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf118699_redline_numbering)
             .is());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125881_redline_list_level)
+{
+    load(DATA_DIRECTORY, "tdf125881.docx");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    // deleted paragraph gets the numbering of the next paragraph
+    uno::Reference<beans::XPropertySet> xProps(getParagraph(8), uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("first paragraph after the first deletion: missing numbering",
+                           xProps->getPropertyValue("NumberingRules").hasValue());
+
+    // check numbering level at deletion (1 instead of 0)
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(getParagraph(8), "NumberingLevel"));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125310)
 {
     load(DATA_DIRECTORY, "tdf125310.fodt");
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 94a361e14f37..8548768793eb 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -3029,7 +3029,7 @@ void DocumentRedlineManager::SetAutoFormatRedlineComment( const OUString* pText,
 
 void DocumentRedlineManager::FinalizeImport()
 {
-    // tdf#118699 fix numbering after deletion of numbered list items
+    // set correct numbering after deletion
     for( SwRedlineTable::size_type n = 0; n < mpRedlineTable->size(); ++n )
     {
         SwRangeRedline* pRedl = (*mpRedlineTable)[ n ];
@@ -3040,19 +3040,22 @@ void DocumentRedlineManager::FinalizeImport()
                                 ? pRedl->GetMark() : pRedl->GetPoint();
             SwTextNode* pDelNode = pStt->nNode.GetNode().GetTextNode();
             SwTextNode* pTextNode = pEnd->nNode.GetNode().GetTextNode();
-            // avoid of incorrect numbering after the deletion
+
             if ( pDelNode->GetNumRule() && !pTextNode->GetNumRule() )
             {
-                // remove numbering of the first deleted list item
+                // tdf#118699 remove numbering of the first deleted list item
                 const SwPaM aPam( *pStt, *pStt );
                 m_rDoc.DelNumRules( aPam );
             }
             else if ( pDelNode->GetNumRule() != pTextNode->GetNumRule() )
             {
-                // copy numbering to the first deleted list item
+                // tdf#125319 copy numbering to the first deleted list item
                 const SwPaM aPam( *pStt, *pStt );
                 SwNumRule *pRule = pTextNode->GetNumRule();
                 m_rDoc.SetNumRule( aPam, *pRule, false );
+
+                // tdf#125881 copy also numbering level
+                pDelNode->SetAttrListLevel( pTextNode->GetAttrListLevel() );
             }
         }
     }


More information about the Libreoffice-commits mailing list