sw/inc/IDocumentSettingAccess.hxx | 2 ++ sw/source/core/doc/DocumentSettingManager.cxx | 10 ++++++++++ sw/source/core/doc/notxtfrm.cxx | 5 ++++- sw/source/core/inc/DocumentSettingManager.hxx | 1 + sw/source/core/layout/fly.cxx | 18 ++++++++++++++---- sw/source/core/unocore/unoframe.cxx | 8 ++++++-- sw/source/uibase/uno/SwXDocumentSettings.cxx | 18 +++++++++++++++++- sw/source/writerfilter/dmapper/DomainMapper.cxx | 2 ++ sw/source/writerfilter/filter/WriterFilter.cxx | 2 ++ 9 files changed, 58 insertions(+), 8 deletions(-)
New commits: commit 4b811007b4f7122346ea513a2999f14c7869ec17 Author: Oliver Specht <[email protected]> AuthorDate: Tue Sep 24 16:10:15 2024 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Fri Oct 25 15:31:50 2024 +0200 tdf#161233 paint pictures completely also with contour wrap Pictures/shapes with contour wrap are clipped in Writer. Word paints the pictures completely while the text flows above around the contour. This is implemented here for imported documents. Change-Id: I2a5fd89c18cbb3e88b65bc63e8105cc07b95af82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173869 Tested-by: Jenkins Tested-by: Gabor Kelemen <[email protected]> Reviewed-by: Thorsten Behrens <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175552 Tested-by: Thorsten Behrens <[email protected]> diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 26ca334071d2..9c33b3bfd2c3 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -139,6 +139,8 @@ enum class DocumentSettingId PAINT_HELL_OVER_HEADER_FOOTER, // tdf#155229 calculate minimum row height including horizontal border width MIN_ROW_HEIGHT_INCL_BORDER, + // tdf#161233 pictures with wrap polygon should not be clipped + NO_CLIPPING_WITH_WRAP_POLYGON, }; /** Provides access to settings of a document diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 47d629df7f45..0e8e5d26c93c 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -273,6 +273,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::USE_VARIABLE_WIDTH_NBSP: return mbUseVariableWidthNBSP; case DocumentSettingId::PAINT_HELL_OVER_HEADER_FOOTER: return mbPaintHellOverHeaderFooter; case DocumentSettingId::MIN_ROW_HEIGHT_INCL_BORDER: return mbMinRowHeightInclBorder; + case DocumentSettingId::NO_CLIPPING_WITH_WRAP_POLYGON: return mbNoClippingWithWrapPolygon; default: OSL_FAIL("Invalid setting id"); } @@ -598,6 +599,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo case DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND: mbFootnoteInColumnToPageEnd = value; break; + case DocumentSettingId::NO_CLIPPING_WITH_WRAP_POLYGON: + mbNoClippingWithWrapPolygon = value; + break; default: OSL_FAIL("Invalid setting id"); } @@ -777,6 +781,7 @@ void sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti mbFootnoteInColumnToPageEnd = rSource.mbFootnoteInColumnToPageEnd; mbDropCapPunctuation = rSource.mbDropCapPunctuation; mbUseVariableWidthNBSP = rSource.mbUseVariableWidthNBSP; + mbNoClippingWithWrapPolygon = rSource.mbNoClippingWithWrapPolygon; } sal_uInt32 sw::DocumentSettingManager::Getn32DummyCompatibilityOptions1() const @@ -1163,6 +1168,11 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const BAD_CAST(OString::boolean(mbDoNotMirrorRtlDrawObjs).getStr())); (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbNoClippingWithWrapPolygon")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::boolean(mbNoClippingWithWrapPolygon).getStr())); + (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterEndElement(pWriter); } diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index b4ff11be973f..e2b7405047ae 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -261,7 +261,10 @@ void SwNoTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect cons FindFlyFrame()->GetContour( aPoly, true ) ) { - rRenderContext.SetClipRegion(vcl::Region(aPoly)); + // don't clip if related compatibility flag is set + const IDocumentSettingAccess& rIDSA = pSh->GetDoc()->getIDocumentSettingAccess(); + if (!rIDSA.get(DocumentSettingId::NO_CLIPPING_WITH_WRAP_POLYGON)) + rRenderContext.SetClipRegion(vcl::Region(aPoly)); bClip = false; } diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index 97ae5097376e..94e142d8ff49 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -188,6 +188,7 @@ class DocumentSettingManager final : bool mbUseVariableWidthNBSP : 1; // tdf#41652 bool mbPaintHellOverHeaderFooter : 1; // tdf#160198 bool mbMinRowHeightInclBorder : 1; // tdf#155229 + bool mbNoClippingWithWrapPolygon : 1; // tdf#161233 public: diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 313f047ece98..7ffb15cdd2e7 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -443,7 +443,16 @@ void SwFlyFrame::InitDrawObj(SwFrame& rAnchorFrame) if (!rAnchorFrame.FindFooterOrHeader()) nHellId = rIDDMA.GetHeaderFooterHellId(); } + bool bNoClippingWithWrapPolygon = rIDSA.get(DocumentSettingId::NO_CLIPPING_WITH_WRAP_POLYGON); + if (bNoClippingWithWrapPolygon && isOpaque) + { + if (GetFrameFormat()->GetSurround().IsContour()) + { + GetVirtDrawObj()->SetLayer(nHellId); + return; + } + } GetVirtDrawObj()->SetLayer( isOpaque ? nHeavenId :nHellId ); } @@ -1050,10 +1059,11 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, { nHellId = rIDDMA.GetHeaderFooterHellId(); } - - const SdrLayerID nId = GetFormat()->GetOpaque().GetValue() ? - rIDDMA.GetHeavenId() : - nHellId; + bool bNoClippingWithWrapPolygon = rIDSA.get(DocumentSettingId::NO_CLIPPING_WITH_WRAP_POLYGON); + SdrLayerID nId = nHellId; + if (GetFormat()->GetOpaque().GetValue() && + !(bNoClippingWithWrapPolygon && GetFrameFormat()->GetSurround().IsContour())) + nId = rIDDMA.GetHeavenId(); GetVirtDrawObj()->SetLayer( nId ); if ( Lower() ) diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 85d1eee41ece..3b7de5a62821 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1379,9 +1379,13 @@ SdrObject *SwXFrame::GetOrCreateSdrObject(SwFlyFrameFormat &rFormat) const ::SwFormatSurround& rSurround = rFormat.GetSurround(); const IDocumentSettingAccess& rIDSA = pDoc->getIDocumentSettingAccess(); bool isPaintHellOverHF = rIDSA.get(DocumentSettingId::PAINT_HELL_OVER_HEADER_FOOTER); + bool bNoClippingWithWrapPolygon = rIDSA.get(DocumentSettingId::NO_CLIPPING_WITH_WRAP_POLYGON); - //TODO: HeaderFooterHellId only appropriate if object is anchored in body - pObject->SetLayer( + if (bNoClippingWithWrapPolygon && rSurround.IsContour()) + pObject->SetLayer(pDoc->getIDocumentDrawModelAccess().GetHellId()); + else + //TODO: HeaderFooterHellId only appropriate if object is anchored in body + pObject->SetLayer( ( css::text::WrapTextMode_THROUGH == rSurround.GetSurround() && !rFormat.GetOpaque().GetValue() ) ? isPaintHellOverHF diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index b6448c702daf..bcc2f9e6663e 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -164,7 +164,8 @@ enum SwDocumentSettingsPropertyHandles HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH, HANDLE_DO_NOT_MIRROR_RTL_DRAW_OBJS, HANDLE_PAINT_HELL_OVER_HEADER_FOOTER, - HANDLE_MIN_ROW_HEIGHT_INCL_BORDER + HANDLE_MIN_ROW_HEIGHT_INCL_BORDER, + HANDLE_NO_CLIPPING_WITH_WRAP_POLYGON, }; } @@ -276,6 +277,7 @@ static rtl::Reference<MasterPropertySetInfo> lcl_createSettingsInfo() { OUString("DoNotMirrorRtlDrawObjs"), HANDLE_DO_NOT_MIRROR_RTL_DRAW_OBJS, cppu::UnoType<bool>::get(), 0 }, { OUString("PaintHellOverHeaderFooter"), HANDLE_PAINT_HELL_OVER_HEADER_FOOTER, cppu::UnoType<bool>::get(), 0 }, { OUString("MinRowHeightInclBorder"), HANDLE_MIN_ROW_HEIGHT_INCL_BORDER, cppu::UnoType<bool>::get(), 0 }, + { u"NoClippingWithWrapPolygon"_ustr, HANDLE_NO_CLIPPING_WITH_WRAP_POLYGON, cppu::UnoType<bool>::get(), 0 }, /* * As OS said, we don't have a view when we need to set this, so I have to @@ -1192,6 +1194,14 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::MIN_ROW_HEIGHT_INCL_BORDER, bTmp); } break; + case HANDLE_NO_CLIPPING_WITH_WRAP_POLYGON: + bool bTmp; + if (rValue >>= bTmp) + { + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::NO_CLIPPING_WITH_WRAP_POLYGON, + bTmp); + } + break; default: throw UnknownPropertyException(OUString::number(rInfo.mnHandle)); } @@ -1791,6 +1801,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::MIN_ROW_HEIGHT_INCL_BORDER); } break; + case HANDLE_NO_CLIPPING_WITH_WRAP_POLYGON: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( + DocumentSettingId::NO_CLIPPING_WITH_WRAP_POLYGON); + } + break; default: throw UnknownPropertyException(OUString::number(rInfo.mnHandle)); } diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx index 706bf1d162c1..dd01c1b0a06d 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx @@ -153,6 +153,8 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon m_pImpl->SetDocumentSettingsProperty(u"IgnoreTabsAndBlanksForLineCalculation"_ustr,uno::Any(true)); // calculate table row height with 'atLeast' including horizontal border width m_pImpl->SetDocumentSettingsProperty(u"MinRowHeightInclBorder"_ustr,uno::Any(true)); + // tdf#161233 pictures with wrap polygon should not be clipped + m_pImpl->SetDocumentSettingsProperty(u"NoClippingWithWrapPolygon"_ustr, uno::Any(true)); } // Initialize RDF metadata, to be able to add statements during the import. diff --git a/sw/source/writerfilter/filter/WriterFilter.cxx b/sw/source/writerfilter/filter/WriterFilter.cxx index 41410cba0205..ae86d79caf04 100644 --- a/sw/source/writerfilter/filter/WriterFilter.cxx +++ b/sw/source/writerfilter/filter/WriterFilter.cxx @@ -336,6 +336,8 @@ void WriterFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDo xSettings->setPropertyValue("DoNotMirrorRtlDrawObjs", uno::Any(true)); xSettings->setPropertyValue("ContinuousEndnotes", uno::Any(true)); + // tdf#161233 pictures with wrap polygon should not be clipped + xSettings->setPropertyValue(u"NoClippingWithWrapPolygon"_ustr, uno::Any(true)); } void WriterFilter::setSourceDocument(const uno::Reference<lang::XComponent>& xDoc)
