summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-07-19 12:08:31 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2018-08-02 21:20:58 +0200
commitfe2fac02e81fb26969bf507e09aaf0bd7d5ca43b (patch)
tree0e0e6b3dfcd3bcf343b14521d200a3c6639b1c81
parent3d4ac5116160b07465179134eb616b719dbac984 (diff)
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@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org> (cherry picked from commit bcdebc832b272662d28035007a4796e42d1305ae) Reviewed-on: https://gerrit.libreoffice.org/58193 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf104797.docxbin0 -> 11710 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx19
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx4
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx2
4 files changed, 24 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf104797.docx
Binary files 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;