diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-11-23 15:26:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-23 20:57:46 +0100 |
commit | 943c108071c82541c619ea3071fe97634a7a8bab (patch) | |
tree | b8ce5484ceedd6825d9c0854ce2147fc69845b2e /writerfilter/source/dmapper/OLEHandler.cxx | |
parent | 85cc3d3f6932f73abda2dcd4814f6a8c000b09bf (diff) |
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 <caolanm@redhat.com>
Diffstat (limited to 'writerfilter/source/dmapper/OLEHandler.cxx')
-rw-r--r-- | writerfilter/source/dmapper/OLEHandler.cxx | 41 |
1 files changed, 28 insertions, 13 deletions
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) { |