From 474e16bbb613c2ca61b8d41d1562d9b86f689851 Mon Sep 17 00:00:00 2001 From: László Németh Date: Wed, 7 Jul 2021 12:18:42 +0200 Subject: tdf#142700 DOCX: fix lost track changes of images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit anchored to characters or paragraphs. Tracked deletions and insertions weren't imported, if they contain only images anchored to character, resulting loss of the document content: i.e. deleted images were reappeared, as not deleted images. Note: because change tracking of the OpenDocument and Writer supports only text range based changes, the fix is a workaround using zero width spaces to create an invisible text around the anchoring point of the images. This workaround is not used, if it's not necessary, i.e. if the image is part of a bigger deletion or insertion, which contains also text, not only an image. Change-Id: Iaae6aae2c01191512c71117a0c788a4147c4cae0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118557 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 8726cf692299ea262a7455adcf6ec25451c7869d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118612 --- sw/qa/extras/ooxmlexport/data/tdf142700.docx | Bin 0 -> 18373 bytes sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 8 ++++++++ 2 files changed, 8 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf142700.docx (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/data/tdf142700.docx b/sw/qa/extras/ooxmlexport/data/tdf142700.docx new file mode 100644 index 000000000000..393e2ff4771b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf142700.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 9cfaf5aa6e6c..1864c4bcf83e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -1376,6 +1376,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128913, "tdf128913.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:del/w:r/w:drawing/wp:inline/a:graphic"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf142700, "tdf142700.docx") +{ + xmlDocUniquePtr pXmlDoc = parseExport(); + // w:ins and w:del are imported correctly, if they contain only images anchored to character + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:ins/w:r/w:drawing/wp:anchor/a:graphic"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:del/w:r/w:drawing/wp:anchor/a:graphic"); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf142387, "tdf142387.docx") { xmlDocUniquePtr pXmlDoc = parseExport(); -- cgit v1.2.3