[Libreoffice-commits] core.git: sw/inc sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 30 12:34:45 UTC 2021


 sw/inc/unodraw.hxx                 |    1 +
 sw/source/core/unocore/unodraw.cxx |   29 ++++++++++++++++-------------
 2 files changed, 17 insertions(+), 13 deletions(-)

New commits:
commit 05992ce5d03aeb2db8d4fc7a68053ebd9a9aa511
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jun 29 11:29:18 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jun 30 14:34:11 2021 +0200

    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 at collabora.co.uk>

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)


More information about the Libreoffice-commits mailing list