[Libreoffice-commits] core.git: 2 commits - sfx2/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 12 08:51:51 UTC 2021


 sfx2/source/control/bindings.cxx |   18 ++++++++----------
 sfx2/source/control/objface.cxx  |   34 ++++++++++++++++------------------
 2 files changed, 24 insertions(+), 28 deletions(-)

New commits:
commit 9ce7ada4530074d95d05efdc89a7eba1032d99e0
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Wed Aug 11 20:47:36 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 12 10:51:19 2021 +0200

    flatten SfxInterface_Impl
    
    Change-Id: Ic66ed6d9738ee6fbbc2dc0b5a572e1ea57092b34
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120345
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx
index a9bb8f37ba09..5938b68f0b8d 100644
--- a/sfx2/source/control/objface.cxx
+++ b/sfx2/source/control/objface.cxx
@@ -70,9 +70,9 @@ struct SfxObjectUI_Impl
 
 struct SfxInterface_Impl
 {
-    std::vector<std::unique_ptr<SfxObjectUI_Impl>>
+    std::vector<SfxObjectUI_Impl>
                             aObjectBars;    // registered ObjectBars
-    std::vector<std::unique_ptr<SfxObjectUI_Impl>>
+    std::vector<SfxObjectUI_Impl>
                             aChildWindows;  // registered ChildWindows
     OUString                aPopupName;     // registered PopupMenu
     StatusBarId             eStatBarResId;  // registered StatusBar
@@ -83,7 +83,7 @@ struct SfxInterface_Impl
     }
 };
 
-static SfxObjectUI_Impl* CreateObjectBarUI_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId, SfxShellFeature nFeature);
+static SfxObjectUI_Impl CreateObjectBarUI_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId, SfxShellFeature nFeature);
 
 // constructor, registers a new unit
 SfxInterface::SfxInterface( const char *pClassName,
@@ -248,17 +248,15 @@ void SfxInterface::RegisterObjectBar(sal_uInt16 nPos, SfxVisibilityFlags nFlags,
 
 void SfxInterface::RegisterObjectBar(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId, SfxShellFeature nFeature)
 {
-    SfxObjectUI_Impl* pUI = CreateObjectBarUI_Impl(nPos, nFlags, eId, nFeature);
-    if ( pUI )
-        pImplData->aObjectBars.emplace_back(pUI);
+    pImplData->aObjectBars.emplace_back( CreateObjectBarUI_Impl(nPos, nFlags, eId, nFeature) );
 }
 
-SfxObjectUI_Impl* CreateObjectBarUI_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId, SfxShellFeature nFeature)
+SfxObjectUI_Impl CreateObjectBarUI_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId, SfxShellFeature nFeature)
 {
     if (nFlags == SfxVisibilityFlags::Invisible)
         nFlags |= SfxVisibilityFlags::Standard;
 
-    return new SfxObjectUI_Impl(nPos, nFlags, static_cast<sal_uInt32>(eId), nFeature);
+    return SfxObjectUI_Impl(nPos, nFlags, static_cast<sal_uInt32>(eId), nFeature);
 }
 
 ToolbarId SfxInterface::GetObjectBarId(sal_uInt16 nNo) const
@@ -277,7 +275,7 @@ ToolbarId SfxInterface::GetObjectBarId(sal_uInt16 nNo) const
 
     assert( nNo<pImplData->aObjectBars.size() );
 
-    return static_cast<ToolbarId>(pImplData->aObjectBars[nNo]->nObjId);
+    return static_cast<ToolbarId>(pImplData->aObjectBars[nNo].nObjId);
 }
 
 sal_uInt16 SfxInterface::GetObjectBarPos( sal_uInt16 nNo ) const
@@ -296,7 +294,7 @@ sal_uInt16 SfxInterface::GetObjectBarPos( sal_uInt16 nNo ) const
 
     assert( nNo<pImplData->aObjectBars.size() );
 
-    return pImplData->aObjectBars[nNo]->nPos;
+    return pImplData->aObjectBars[nNo].nPos;
 }
 
 SfxVisibilityFlags SfxInterface::GetObjectBarFlags( sal_uInt16 nNo ) const
@@ -315,7 +313,7 @@ SfxVisibilityFlags SfxInterface::GetObjectBarFlags( sal_uInt16 nNo ) const
 
     assert( nNo<pImplData->aObjectBars.size() );
 
-    return pImplData->aObjectBars[nNo]->nFlags;
+    return pImplData->aObjectBars[nNo].nFlags;
 }
 
 sal_uInt16 SfxInterface::GetObjectBarCount() const
@@ -333,9 +331,9 @@ void SfxInterface::RegisterChildWindow(sal_uInt16 nId, bool bContext)
 
 void SfxInterface::RegisterChildWindow(sal_uInt16 nId, bool bContext, SfxShellFeature nFeature)
 {
-    SfxObjectUI_Impl* pUI = new SfxObjectUI_Impl(0, SfxVisibilityFlags::Invisible, nId, nFeature);
-    pUI->bContext = bContext;
-    pImplData->aChildWindows.emplace_back(pUI);
+    SfxObjectUI_Impl aUI(0, SfxVisibilityFlags::Invisible, nId, nFeature);
+    aUI.bContext = bContext;
+    pImplData->aChildWindows.emplace_back(aUI);
 }
 
 void SfxInterface::RegisterStatusBar(StatusBarId eId)
@@ -358,8 +356,8 @@ sal_uInt32 SfxInterface::GetChildWindowId (sal_uInt16 nNo) const
 
     assert( nNo<pImplData->aChildWindows.size() );
 
-    sal_uInt32 nRet = pImplData->aChildWindows[nNo]->nObjId;
-    if ( pImplData->aChildWindows[nNo]->bContext )
+    sal_uInt32 nRet = pImplData->aChildWindows[nNo].nObjId;
+    if ( pImplData->aChildWindows[nNo].bContext )
         nRet += sal_uInt16( nClassId ) << 16;
     return nRet;
 }
@@ -379,7 +377,7 @@ SfxShellFeature SfxInterface::GetChildWindowFeature (sal_uInt16 nNo) const
 
     assert( nNo<pImplData->aChildWindows.size() );
 
-    return pImplData->aChildWindows[nNo]->nFeature;
+    return pImplData->aChildWindows[nNo].nFeature;
 }
 
 
@@ -420,7 +418,7 @@ SfxShellFeature SfxInterface::GetObjectBarFeature ( sal_uInt16 nNo ) const
 
     assert( nNo<pImplData->aObjectBars.size() );
 
-    return pImplData->aObjectBars[nNo]->nFeature;
+    return pImplData->aObjectBars[nNo].nFeature;
 }
 
 bool SfxInterface::IsObjectBarVisible(sal_uInt16 nNo) const
commit 4cd64dcd4857eafbe3146df287b517d8e5e455c0
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Wed Aug 11 20:42:31 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 12 10:51:01 2021 +0200

    flatten SfxFoundCacheArr_Impl
    
    Change-Id: Ie2b29b041bb0f678494126b21df651371a40dbda
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120344
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index b217534376d2..26d6926016e7 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -77,14 +77,13 @@ struct SfxFoundCache_Impl
 
 class SfxFoundCacheArr_Impl
 {
-    typedef std::vector<std::unique_ptr<SfxFoundCache_Impl> > DataType;
-    DataType maData;
+    std::vector<SfxFoundCache_Impl> maData;
 
 public:
 
     SfxFoundCache_Impl& operator[] ( size_t i )
     {
-        return *maData[i];
+        return maData[i];
     }
 
     size_t size() const
@@ -92,9 +91,9 @@ public:
         return maData.size();
     }
 
-    void push_back( SfxFoundCache_Impl* p )
+    void push_back( SfxFoundCache_Impl p )
     {
-        maData.push_back(std::unique_ptr<SfxFoundCache_Impl>(p));
+        maData.push_back(p);
     }
 };
 
@@ -1122,9 +1121,8 @@ std::optional<SfxItemSet> SfxBindings::CreateSet_Impl
     pFnc = pRealSlot->GetStateFnc();
 
     // the RealSlot is always on
-    SfxFoundCache_Impl *pFound = new SfxFoundCache_Impl(
-        pRealSlot->GetWhich(rPool), pRealSlot, rCache);
-    rFound.push_back( pFound );
+    SfxFoundCache_Impl aFound(pRealSlot->GetWhich(rPool), pRealSlot, rCache);
+    rFound.push_back( aFound );
 
     // Search through the bindings for slots served by the same function. This ,    // will only affect slots which are present in the found interface.
 
@@ -1155,11 +1153,11 @@ std::optional<SfxItemSet> SfxBindings::CreateSet_Impl
 
         if ( bInsert && bSameMethod )
         {
-            SfxFoundCache_Impl *pFoundCache = new SfxFoundCache_Impl(
+            SfxFoundCache_Impl aFoundCache(
                 pSibling->GetWhich(rPool),
                 pSibling, *pSiblingCache);
 
-            rFound.push_back( pFoundCache );
+            rFound.push_back( aFoundCache );
         }
 
         pSibling = pSibling->GetNextSlot();


More information about the Libreoffice-commits mailing list