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 04b53321ca56844521787563914fad21513fd58d
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Thu Jul 19 12:08:31 2018 +0200
Commit:     Miklos Vajna <vmik...@collabora.co.uk>
CommitDate: Fri Jul 20 12:58:51 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 <nem...@numbertext.org>
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-on: https://gerrit.libreoffice.org/57729
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

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 f27c88facc67..af4fa6661907 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -401,6 +401,25 @@ DECLARE_OOXMLEXPORT_TEST(testOpenDocumentAsReadOnly, 
"open-as-read-only.docx")
     CPPUNIT_ASSERT(pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly());
 }
 
+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 cbcce6bda2ef..9eab98638e99 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3833,13 +3833,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 8a9c038d8c2f..321866daf85a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1860,9 +1860,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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to