diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 92910435383e..10d01fa05e33 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -337,7 +337,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMovingDOCX) SwEditShell* const pEditShell(pDoc->GetEditShell()); // This was 2 (moveFrom and moveTo joined other redlines) - CPPUNIT_ASSERT_EQUAL(static_cast(6), pEditShell->GetRedlineCount()); + CPPUNIT_ASSERT_EQUAL(static_cast(5), pEditShell->GetRedlineCount()); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 6600928f37e9..609d3f7f30b6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -766,10 +766,37 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123460, "tdf123460.docx") CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 2), "RedlineType")); CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty(getRun(getParagraph(2), 2), "RedlineType")); CPPUNIT_ASSERT_EQUAL(true, getRun( getParagraph( 2 ), 3 )->getString().endsWith("tellus.")); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 4), "Bookmark")); // deleted paragraph mark at the end of the second paragraph - CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 5), "RedlineType")); - CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty(getRun(getParagraph(2), 5), "RedlineType")); - CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 6 )->getString()); + if (mbExported) + { + // there is no run after the MoveBookmark + bool bCaught = false; + try + { + getRun( getParagraph( 2 ), 5 ); + } + catch (container::NoSuchElementException&) + { + bCaught = true; + } + CPPUNIT_ASSERT_EQUAL(true, bCaught); + } +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf146140) +{ + loadAndSave("tdf123460.docx"); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + CPPUNIT_ASSERT(pXmlDoc); + + // This was 1 (put end of paragraph of the previous moveFrom into a w:del, + // resulting double deletions at the same position, which is an + // ODT back-compatibility issue described in tdf#107292) + assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:del", 0); + // This was 0 + assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:moveFrom", 1); } //tdf#125298: fix charlimit restrictions in bookmarknames and field references if they contain non-ascii characters diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 28d7295fe344..96f3742ce8f1 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -802,7 +802,7 @@ bool SwRedlineTable::isMoved( size_type rPos ) const } const OUString sTrimmed = pPaM->GetText().trim(); - if ( sTrimmed.isEmpty() ) + if ( sTrimmed.getLength() < 2 ) { if ( bDeletePaM ) delete pPaM; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index befa25aed954..5662e8967d8b 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3119,7 +3119,6 @@ void DomainMapper_Impl::CheckParaMarkerRedline( uno::Reference< text::XTextRange else if ( m_pParaMarkerRedlineMoveFrom ) { // terminating moveFrom redline removes also the paragraph mark - m_pParaMarkerRedlineMoveFrom->m_nToken = XML_del; CreateRedline( xRange, m_pParaMarkerRedlineMoveFrom ); } if ( m_pParaMarkerRedlineMoveFrom )