writerfilter/source/dmapper/OLEHandler.cxx | 41 +++++++++++++++++++---------- writerfilter/source/dmapper/OLEHandler.hxx | 8 +---- 2 files changed, 30 insertions(+), 19 deletions(-)
New commits: commit 943c108071c82541c619ea3071fe97634a7a8bab Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 23 15:26:22 2020 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Nov 23 20:57:46 2020 +0100 ofz#27519 only generate bitmap preview when needed Change-Id: I35d20d65b607d6441b001c7d839a793349ef3b1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106425 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx index ae1967a4a7eb..46cb83f4c732 100644 --- a/writerfilter/source/dmapper/OLEHandler.cxx +++ b/writerfilter/source/dmapper/OLEHandler.cxx @@ -105,23 +105,22 @@ void OLEHandler::lcl_attribute(Id rName, Value & rVal) if( xTempShape.is() ) { m_xShape.set( xTempShape ); - uno::Reference< beans::XPropertySet > xShapeProps( xTempShape, uno::UNO_QUERY ); - try - { - // Shapes in the header or footer should be in the background, since the default is WrapTextMode_THROUGH. - if (m_rDomainMapper.IsInHeaderFooter()) - xShapeProps->setPropertyValue("Opaque", uno::makeAny(false)); - - m_aShapeSize = xTempShape->getSize(); + // No need to set the wrapping here as it's either set in oox or will be set later - xShapeProps->getPropertyValue( getPropertyName( PROP_BITMAP ) ) >>= m_xReplacement; - } - catch( const uno::Exception& ) + // Shapes in the header or footer should be in the background, since the default is WrapTextMode_THROUGH. + if (m_rDomainMapper.IsInHeaderFooter()) { - TOOLS_WARN_EXCEPTION("writerfilter", "Exception in OLE Handler"); + try + { + uno::Reference<beans::XPropertySet> xShapeProps(m_xShape, uno::UNO_QUERY); + xShapeProps->setPropertyValue("Opaque", uno::makeAny(false)); + } + catch( const uno::Exception& ) + { + TOOLS_WARN_EXCEPTION("writerfilter", "Exception in OLE Handler"); + } } - // No need to set the wrapping here as it's either set in oox or will be set later } } break; @@ -130,6 +129,22 @@ void OLEHandler::lcl_attribute(Id rName, Value & rVal) } } +css::awt::Size OLEHandler::getSize() const +{ + if (!m_xShape) + return css::awt::Size(); + return m_xShape->getSize(); +} + +css::uno::Reference<css::graphic::XGraphic> OLEHandler::getReplacement() const +{ + if (!m_xShape) + return nullptr; + uno::Reference<beans::XPropertySet> xShapeProps(m_xShape, uno::UNO_QUERY); + css::uno::Reference<css::graphic::XGraphic> xReplacement; + xShapeProps->getPropertyValue(getPropertyName(PROP_BITMAP)) >>= xReplacement; + return xReplacement; +} void OLEHandler::lcl_sprm(Sprm & rSprm) { diff --git a/writerfilter/source/dmapper/OLEHandler.hxx b/writerfilter/source/dmapper/OLEHandler.hxx index cbb92aa9a53b..eb04d4782c90 100644 --- a/writerfilter/source/dmapper/OLEHandler.hxx +++ b/writerfilter/source/dmapper/OLEHandler.hxx @@ -57,10 +57,6 @@ class OLEHandler : public LoggedProperties css::uno::Reference<css::drawing::XShape> m_xShape; - css::awt::Size m_aShapeSize; - - css::uno::Reference<css::graphic::XGraphic> m_xReplacement; - css::uno::Reference<css::io::XInputStream> m_xInputStream; DomainMapper& m_rDomainMapper; @@ -90,8 +86,8 @@ public: OUString copyOLEOStream(css::uno::Reference<css::text::XTextDocument> const& xTextDocument); - const css::awt::Size& getSize() const { return m_aShapeSize; } - const css::uno::Reference<css::graphic::XGraphic>& getReplacement() const { return m_xReplacement; } + css::awt::Size getSize() const; + css::uno::Reference<css::graphic::XGraphic> getReplacement() const; }; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits