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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 19 13:34:46 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf104797.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx        |   19 +++++++++++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx      |    4 +++-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    2 ++
 4 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit bcdebc832b272662d28035007a4796e42d1305ae
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Jul 19 12:08:31 2018 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Jul 19 15:34:21 2018 +0200

    tdf#104797 DOCX change tracking: handle moveFrom and moveTo
    
    data as deletion and insertion instead of importing them
    as normal (unmodified) texts (messing up document content
    and losing change tracking information).
    
    Change-Id: I9c0a7da83f3e8235d65d47afdb99ffe188f52704
    Reviewed-on: https://gerrit.libreoffice.org/57723
    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/ooxmlexport/data/tdf104797.docx b/sw/qa/extras/ooxmlexport/data/tdf104797.docx
new file mode 100644
index 000000000000..6e52190ce671
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104797.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 034f252bad26..bc9e3f7f3328 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -464,6 +464,25 @@ DECLARE_OOXMLEXPORT_TEST(testMarginsFromStyle, "margins_from_style.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(600), getProperty<sal_Int32>(getParagraph(3), "ParaBottomMargin"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf104797, "tdf104797.docx")
+{
+    // check moveFrom and moveTo
+    CPPUNIT_ASSERT_EQUAL( OUString( "Will this sentence be duplicated?" ), getParagraph( 1 )->getString());
+    CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 1 ), 1 )->getString());
+    CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(1), 2), "RedlineType"));
+    CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty<OUString>(getRun(getParagraph(1), 2), "RedlineType"));
+    CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(1), 2), "IsStart"));
+    CPPUNIT_ASSERT_EQUAL( OUString( "This is a filler sentence. Will this sentence be duplicated ADDED STUFF?" ),
+            getParagraph( 2 )->getString());
+    CPPUNIT_ASSERT_EQUAL( OUString( "This is a filler sentence." ), getRun( getParagraph( 2 ), 1 )->getString());
+    CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 2 )->getString());
+    CPPUNIT_ASSERT_EQUAL( OUString( " Will this sentence be duplicated ADDED STUFF?" ), getRun( getParagraph( 2 ), 3 )->getString());
+    CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 4 )->getString());
+    CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 5), "RedlineType"));
+    CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(2), 5), "RedlineType"));
+    CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(2), 5), "IsStart"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 124a2061904d..b5f3d504fb77 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3823,13 +3823,15 @@ void DomainMapper::HandleRedline( Sprm& rSprm )
         case XML_mod:
         case XML_ins:
         case XML_del:
+        case XML_moveTo:
+        case XML_moveFrom:
         case XML_ParagraphFormat:
         case XML_tableRowInsert:
         case XML_tableRowDelete:
         case XML_tableCellInsert:
         case XML_tableCellDelete:
             break;
-        default: OSL_FAIL( "redline token other than mod, ins, del or table row" ); break;
+        default: OSL_FAIL( "redline token other than mod, ins, del, moveTo, moveFrom or table row" ); break;
     }
     m_pImpl->EndParaMarkerChange( );
     m_pImpl->SetCurrentRedlineIsRead();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e89417e99468..a1fde6baae1b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1933,9 +1933,11 @@ void DomainMapper_Impl::CreateRedline(uno::Reference<text::XTextRange> const& xR
             case XML_mod:
                 sType = getPropertyName( PROP_FORMAT );
                 break;
+            case XML_moveTo:
             case XML_ins:
                 sType = getPropertyName( PROP_INSERT );
                 break;
+            case XML_moveFrom:
             case XML_del:
                 sType = getPropertyName( PROP_DELETE );
                 break;


More information about the Libreoffice-commits mailing list