diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf128913.docx | bin | 0 -> 10392 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 32 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 4 |
5 files changed, 45 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf128913.docx b/sw/qa/extras/ooxmlexport/data/tdf128913.docx Binary files differnew file mode 100644 index 000000000000..42cc2d75d3ff --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf128913.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 3e34dd10946f..0dd8614cf156 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -1361,6 +1361,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121176, "tdf121176.docx") CPPUNIT_ASSERT_EQUAL( OUString( "must" ), getRun( getParagraph( 1 ), 2 )->getString()); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128913, "tdf128913.docx") +{ + xmlDocUniquePtr pXmlDoc = parseExport(); + // w:ins and w:del are imported correctly, if they contain only inline images + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:ins/w:r/w:drawing/wp:inline/a:graphic"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:del/w:r/w:drawing/wp:inline/a:graphic"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf123054, "tdf123054.docx") { CPPUNIT_ASSERT_EQUAL(OUString("No Spacing"), diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b0ef95e0a785..863526d814fd 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1834,6 +1834,24 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con } } + // apply redlines for inline images + if (IsParaWithInlineObject()) + { + for (const auto& rAnchored : rAppendContext.m_aAnchoredObjects) + { + // process only inline objects with redlining + if (!rAnchored.m_xRedlineForInline) + continue; + + // select the inline image and set its redline + auto xAnchorRange = rAnchored.m_xAnchoredObject->getAnchor(); + uno::Reference< text::XTextCursor > xCursorOnImage = + xAnchorRange->getText()->createTextCursorByRange(xAnchorRange); + xCursorOnImage->goRight(1, true); + CreateRedline( xCursorOnImage, rAnchored.m_xRedlineForInline ); + } + } + xTextRange = xTextAppend->finishParagraph( comphelper::containerToSequence(aProperties) ); m_xPreviousParagraph.set(xTextRange, uno::UNO_QUERY); @@ -7060,7 +7078,21 @@ void DomainMapper_Impl::ImportGraphic(const writerfilter::Reference< Properties m_aTextAppendStack.top().m_aAnchoredObjects.push_back(aInfo); } else if (eGraphicImportType == IMPORT_AS_DETECTED_INLINE) + { m_bParaWithInlineObject = true; + + // store inline images with track changes, because the anchor point + // to set redlining is not available yet + if (!m_aTextAppendStack.empty() && !m_aRedlines.top().empty() ) + { + // Remember this object is anchored to the current paragraph. + AnchoredObjectInfo aInfo; + aInfo.m_xAnchoredObject = xTextContent; + aInfo.m_xRedlineForInline = m_aRedlines.top().back(); + m_aTextAppendStack.top().m_aAnchoredObjects.push_back(aInfo); + } + + } } // Clear the reference, so in case the embedded object is inside a diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index c12d75e201fa..99d266968c72 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -420,6 +420,7 @@ struct AnchoredObjectInfo { css::uno::Reference<css::text::XTextContent> m_xAnchoredObject; sal_Int32 m_nLeftMargin = 0; + RedlineParamsPtr m_xRedlineForInline; }; /// Stores info about objects anchored to a given paragraph. diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index cc556ddc6330..9b4c819e35cb 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1275,6 +1275,10 @@ void SectionPropertyMap::HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl& sal_Int32 nOpaqueCount = 0; for (const auto& rAnchored : rAnchor.m_aAnchoredObjects) { + // Ignore inline objects stored only for redlining. + if (rAnchored.m_xRedlineForInline) + continue; + uno::Reference<beans::XPropertySet> xShape(rAnchored.m_xAnchoredObject, uno::UNO_QUERY); if (!xShape.is()) { |