diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-29 11:29:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-30 14:34:11 +0200 |
commit | 05992ce5d03aeb2db8d4fc7a68053ebd9a9aa511 (patch) | |
tree | e2af3748fa2bb1394b0cf6ab59b79e76296ca8f5 /sw | |
parent | 5ba64bba76ca1d23191300d1b5080cc091d432de (diff) |
tdf#135316 cache propertysetinfo in SwXShape
shaves 3% off loaad time
Change-Id: I6541f94553d862787566672d91e2a87902835664
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118158
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unodraw.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 29 |
2 files changed, 17 insertions, 13 deletions
diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx index 28a4dc612357..b6404abae7af 100644 --- a/sw/inc/unodraw.hxx +++ b/sw/inc/unodraw.hxx @@ -144,6 +144,7 @@ class SwXShape : public SwXShapeBaseClass, public SvtListener const SfxItemPropertySet* m_pPropSet; const SfxItemPropertyMapEntry* m_pPropertyMapEntries; + css::uno::Reference< css::beans::XPropertySetInfo > mxPropertySetInfo; std::unique_ptr<SwShapeDescriptor_Impl> m_pImpl; diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index cd8e799fee00..6faa27465851 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -1016,23 +1016,26 @@ uno::Sequence< sal_Int8 > SwXShape::getImplementationId( ) uno::Reference< beans::XPropertySetInfo > SwXShape::getPropertySetInfo() { SolarMutexGuard aGuard; - uno::Reference< beans::XPropertySetInfo > aRet; - if(m_xShapeAgg.is()) + if (!mxPropertySetInfo) { - const uno::Type& rPropSetType = cppu::UnoType<beans::XPropertySet>::get(); - uno::Any aPSet = m_xShapeAgg->queryAggregation( rPropSetType ); - if(auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>( - aPSet)) + uno::Reference< beans::XPropertySetInfo > aRet; + if(m_xShapeAgg.is()) { - uno::Reference< beans::XPropertySetInfo > xInfo = (*xPrSet)->getPropertySetInfo(); - // Expand PropertySetInfo! - const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); - aRet = new SfxExtItemPropertySetInfo( m_pPropertyMapEntries, aPropSeq ); + const uno::Type& rPropSetType = cppu::UnoType<beans::XPropertySet>::get(); + uno::Any aPSet = m_xShapeAgg->queryAggregation( rPropSetType ); + if(auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>( + aPSet)) + { + uno::Reference< beans::XPropertySetInfo > xInfo = (*xPrSet)->getPropertySetInfo(); + // Expand PropertySetInfo! + const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); + mxPropertySetInfo = new SfxExtItemPropertySetInfo( m_pPropertyMapEntries, aPropSeq ); + } } + if(!mxPropertySetInfo) + mxPropertySetInfo = m_pPropSet->getPropertySetInfo(); } - if(!aRet.is()) - aRet = m_pPropSet->getPropertySetInfo(); - return aRet; + return mxPropertySetInfo; } void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue) |