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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Sep 15 09:58:07 UTC 2018


 sw/qa/extras/ooxmlexport/data/testTrackChangesEmptyParagraphsInADeletion.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx                                    |   10 +++
 sw/source/filter/ww8/ww8atr.cxx                                               |   30 +++++++---
 3 files changed, 31 insertions(+), 9 deletions(-)

New commits:
commit 2cdc870a7ee82d0faf35cdb5b2bf4e687cfd2b8d
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Fri Sep 14 17:14:43 2018 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Sat Sep 15 11:57:44 2018 +0200

    tdf#115521 DOCX export: keep empty paragraphs in tracked deletion
    
    of a paragraph sequence by inspecting every paragraph in a
    "redline" range. Before this fix, all empty paragraphs of
    a multiparagraph deletion reappeared as normal text in the DOCX
    export.
    
    Change-Id: I928504bdbd8c04673698e8f34c0b608eb3ecc5fc
    Reviewed-on: https://gerrit.libreoffice.org/60503
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/testTrackChangesEmptyParagraphsInADeletion.docx b/sw/qa/extras/ooxmlexport/data/testTrackChangesEmptyParagraphsInADeletion.docx
new file mode 100644
index 000000000000..fcd78e9cd105
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/testTrackChangesEmptyParagraphsInADeletion.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index e92bb8178b4b..9d0c9fa829ee 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -721,6 +721,16 @@ DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedEmptyParagraph, "testTrackChange
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:rPr/w:del");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTrackChangesEmptyParagraphsInADeletion, "testTrackChangesEmptyParagraphsInADeletion.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+
+    for (int i = 1; i < 12; ++i)
+        assertXPath(pXmlDoc, "/w:document/w:body/w:p[" + OString::number(i) + "]/w:pPr/w:rPr/w:del");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index a86094fda676..8cabd8d90f34 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5480,21 +5480,33 @@ const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTex
 
         const SwPosition* pCheckedStt = pRedl->Start();
         const SwPosition* pCheckedEnd = pRedl->End();
+        sal_uLong uStartNodeIndex = pCheckedStt->nNode.GetIndex();
+        sal_uLong uStartCharIndex = pCheckedStt->nContent.GetIndex();
+        sal_uLong uEndNodeIndex   = pCheckedEnd->nNode.GetIndex();
+        sal_uLong uEndCharIndex   = pCheckedEnd->nContent.GetIndex();
+        sal_uLong uNodeIndex = rNode.GetIndex();
 
-        if( pCheckedStt->nNode == rNode )
+        if( uStartNodeIndex <= uNodeIndex && uNodeIndex < uEndNodeIndex )
         {
             if ( !pCheckedEnd )
                 continue;
 
-            sal_uLong uStartNodeIndex = pCheckedStt->nNode.GetIndex();
-            sal_uLong uStartCharIndex = pCheckedStt->nContent.GetIndex();
-            sal_uLong uEndNodeIndex   = pCheckedEnd->nNode.GetIndex();
-            sal_uLong uEndCharIndex   = pCheckedEnd->nContent.GetIndex();
-
             // Maybe add here a check that also the start & end of the redline is the entire paragraph
-            if ( ( uStartNodeIndex == uEndNodeIndex - 1 ) &&
-                 ( uStartCharIndex == static_cast<sal_uLong>(rNode.Len()) ) &&
-                 ( uEndCharIndex == 0)
+            if ( ( uStartNodeIndex < uEndNodeIndex ) &&
+                 // check start:
+                 // 1. start in the same node
+                 (( uStartNodeIndex == uNodeIndex &&
+                    uStartCharIndex == static_cast<sal_uLong>(rNode.Len()) ) ||
+                 // 2. or in a previous node
+                    uStartNodeIndex < uNodeIndex
+                 ) &&
+                 // check end:
+                 // 1. end in the same node
+                 (( uEndNodeIndex == (uNodeIndex + 1) &&
+                    uEndCharIndex == 0) ||
+                 // 2. or end in after that
+                    uEndNodeIndex > (uNodeIndex + 1)
+                 )
                )
             {
                 return &( pRedl->GetRedlineData() );


More information about the Libreoffice-commits mailing list