tdf#121176 DOCX track changes: same size w:del in w:ins

Instead of showing the tracked deletion as untracked
normal text, losing the original and actual text contents,
now w:del within a same size w:ins is imported as
tracked deletion correctly.

Change-Id: I7390df34f557664860a63779c5f972d5013ecc99
Reviewed-on: https://gerrit.libreoffice.org/68779
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf121176.docx b/sw/qa/extras/ooxmlexport/data/tdf121176.docx
new file mode 100644
index 0000000..f95c023
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf121176.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 9b1dd06..a830638 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -959,7 +959,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf116084, "tdf116084.docx")
    CPPUNIT_ASSERT_EQUAL( OUString( "must" ), getRun( getParagraph( 1 ), 5 )->getString());
}


DECLARE_OOXMLIMPORT_TEST(testTdf121176, "tdf121176.docx")
{
    // w:del is imported correctly when it is in a same size w:ins
    CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 1 ), 1 )->getString());
    CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(1), 1), "RedlineType"));
    CPPUNIT_ASSERT_EQUAL( OUString( "must" ), getRun( getParagraph( 1 ), 2 )->getString());
}

CPPUNIT_PLUGIN_IMPLEMENT();

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index c7d473c..e55b04b 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1473,10 +1473,12 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall

                                bCompress = true;
                            }
                            if( !bCallDelete && *pEnd == *pREnd )
                            if( !bCallDelete && !bDec && *pEnd == *pREnd )
                                pRedl->SetEnd( *pStt, pREnd );
                            else
                            else if ( bCallDelete || !bDec )
                            {
                                // delete new redline, except in some cases of fallthrough from previous
                                // case ::Equal (eg. same portion w:del in w:ins in OOXML import)
                                delete pNewRedl;
                                pNewRedl = nullptr;
                            }