sw/source/core/unocore/unostyle.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit cfd94adadb88ce0518d61269d47585192b0f0dfa
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Aug 13 13:13:27 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 13 18:27:16 2024 +0200

    tdf#158556 flatten SwStyleBase_Impl a little
    
    less pointer chasing
    
    Change-Id: I117880dcfaef730f1d19b6b3b4b1f5d8188e0c1c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171817
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index 5eb521441245..9be86396be79 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -442,7 +442,7 @@ private:
     const SwPageDesc* m_pOldPageDesc;
     rtl::Reference<SwDocStyleSheet> m_xNewBase;
     SfxItemSet* m_pItemSet;
-    std::unique_ptr<SfxItemSet> m_pMyItemSet;
+    std::optional<SfxItemSet> m_oMyItemSet;
     OUString m_rStyleName;
     const SwAttrSet* m_pParentStyle;
 public:
@@ -474,8 +474,8 @@ public:
         assert(m_xNewBase.is());
         if(!m_pItemSet)
         {
-            m_pMyItemSet.reset(new SfxItemSet(m_xNewBase->GetItemSet()));
-            m_pItemSet = m_pMyItemSet.get();
+            m_oMyItemSet.emplace(m_xNewBase->GetItemSet());
+            m_pItemSet = &*m_oMyItemSet;
 
             // set parent style to have the correct XFillStyle setting as 
XFILL_NONE
             if(!m_pItemSet->GetParent() && m_pParentStyle)
commit 4f222adca86d88ce8ee18c50b31485253a5398f9
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Aug 13 12:59:23 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 13 18:27:03 2024 +0200

    tdf#158556 avoid unnecessary work
    
    in SwXStyle::PrepareStyleBase, which is called multiple times during
    getProperties(), but we only need to do the GetStyleSheetBase() the
    first time
    
    Change-Id: I18438f11402588e5172f6b1638769fc9ba0b1784
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171816
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index 5e5202bd5a6f..5eb521441245 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -2045,11 +2045,13 @@ SfxStyleSheetBase* SwXStyle::GetStyleSheetBase()
 }
 void SwXStyle::PrepareStyleBase(SwStyleBase_Impl& rBase)
 {
-    SfxStyleSheetBase* pBase(GetStyleSheetBase());
-    if(!pBase)
-        throw uno::RuntimeException();
     if(!rBase.getNewBase().is())
+    {
+        SfxStyleSheetBase* pBase(GetStyleSheetBase());
+        if(!pBase)
+            throw uno::RuntimeException();
         rBase.setNewBase(new 
SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
+    }
 }
 
 template<>

Reply via email to