From d1ee27cf9b83ad9b69d1ee00e2e8969fb35446c9 Mon Sep 17 00:00:00 2001 From: László Németh Date: Wed, 21 Nov 2018 17:18:39 +0100 Subject: tdf#121597 DOCX: don't export empty paragraphs at tracked deletion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit of non-empty multiple paragraphs. Complete the fix for "tdf#115521 DOCX export: keep empty paragraphs in tracked deletion" in commit 2cdc870a7ee82d0faf35cdb5b2bf4e687cfd2b8d Change-Id: Ic3446e2a2118e604a7a4d269c8fed1f9f157846f Reviewed-on: https://gerrit.libreoffice.org/63731 Tested-by: Jenkins Reviewed-by: László Németh --- sw/qa/extras/ooxmlexport/data/tdf121597.odt | Bin 0 -> 10592 bytes sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 15 ++++++++++++++ sw/source/filter/ww8/ww8atr.cxx | 31 +++------------------------- 3 files changed, 18 insertions(+), 28 deletions(-) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf121597.odt (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/data/tdf121597.odt b/sw/qa/extras/ooxmlexport/data/tdf121597.odt new file mode 100644 index 000000000000..760b46e76379 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf121597.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 2728c75b51be..c7e6bac3a8ea 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -826,6 +826,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf58944RepeatingTableHeader, "tdf58944-repeating-t parseDump("/root/page[2]/body/tab/row[2]/cell[1]/txt/text()")); } +DECLARE_OOXMLEXPORT_TEST(testTdf121597TrackedDeletionOfMultipleParagraphs, "tdf121597.odt") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + // check paragraphs with removed paragraph mark + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:del"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:del"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:rPr/w:del"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:pPr/w:rPr/w:del"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:pPr/w:rPr/w:del"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[10]/w:pPr/w:rPr/w:del"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index d8411eed8796..b911ef83b6a7 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -5505,37 +5505,12 @@ const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTex if ( pRedl->GetRedlineData().GetType() != aRedlineType ) continue; - const SwPosition* pCheckedEnd = pRedl->End(); - const SwPosition* pCheckedStt = pRedl->Start(); - sal_uLong uStartNodeIndex = pCheckedStt->nNode.GetIndex(); - sal_uLong uStartCharIndex = pCheckedStt->nContent.GetIndex(); - sal_uLong uEndNodeIndex = pCheckedEnd->nNode.GetIndex(); - sal_uLong uEndCharIndex = pCheckedEnd->nContent.GetIndex(); + sal_uLong uStartNodeIndex = pRedl->Start()->nNode.GetIndex(); + sal_uLong uEndNodeIndex = pRedl->End()->nNode.GetIndex(); sal_uLong uNodeIndex = rNode.GetIndex(); if( uStartNodeIndex <= uNodeIndex && uNodeIndex < uEndNodeIndex ) - { - // Maybe add here a check that also the start & end of the redline is the entire paragraph - if ( ( uStartNodeIndex < uEndNodeIndex ) && - // check start: - // 1. start in the same node - (( uStartNodeIndex == uNodeIndex && - uStartCharIndex == static_cast(rNode.Len()) ) || - // 2. or in a previous node - uStartNodeIndex < uNodeIndex - ) && - // check end: - // 1. end in the same node - (( uEndNodeIndex == (uNodeIndex + 1) && - uEndCharIndex == 0) || - // 2. or end in after that - uEndNodeIndex > (uNodeIndex + 1) - ) - ) - { - return &( pRedl->GetRedlineData() ); - } - } + return &( pRedl->GetRedlineData() ); } return nullptr; } -- cgit