summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-11-23 15:26:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-11-23 20:57:46 +0100
commit943c108071c82541c619ea3071fe97634a7a8bab (patch)
treeb8ce5484ceedd6825d9c0854ce2147fc69845b2e /writerfilter/source/dmapper
parent85cc3d3f6932f73abda2dcd4814f6a8c000b09bf (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')
-rw-r--r--writerfilter/source/dmapper/OLEHandler.cxx41
-rw-r--r--writerfilter/source/dmapper/OLEHandler.hxx8
2 files changed, 30 insertions, 19 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)
{
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;
};
}