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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 31 07:15:41 UTC 2021


 include/sfx2/app.hxx           |    3 +--
 sfx2/source/appl/app.cxx       |    4 ++--
 sfx2/source/appl/appinit.cxx   |    1 -
 sfx2/source/appl/appquit.cxx   |    2 +-
 sfx2/source/appl/shellimpl.cxx |   34 ----------------------------------
 sfx2/source/inc/appdata.hxx    |    3 +--
 sfx2/source/inc/shellimpl.hxx  |   20 --------------------
 sfx2/source/view/viewfrm.cxx   |   13 +++++--------
 sfx2/source/view/viewsh.cxx    |    6 +++---
 9 files changed, 13 insertions(+), 73 deletions(-)

New commits:
commit 4b64d6ac2a186a68f5360d31ae21aefcceb84d12
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Aug 30 21:36:37 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 31 09:15:06 2021 +0200

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

diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index b2cd45dd5756..824cc65c2559 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -46,7 +46,6 @@ class SfxObjectShellLock;
 class SfxProgress;
 class SfxSlotPool;
 class SfxViewFrame;
-class SfxViewFrameArr_Impl;
 class SfxViewShellArr_Impl;
 class StarBASIC;
 class SfxWorkWindow;
@@ -174,7 +173,7 @@ public:
     SAL_DLLPRIVATE SfxTbxCtrlFactory* GetTbxCtrlFactory(const std::type_info& rSlotType, sal_uInt16 nSlotID) const;
     SAL_DLLPRIVATE SfxStbCtrlFactory* GetStbCtrlFactory(const std::type_info& rSlotType, sal_uInt16 nSlotID) const;
     SAL_DLLPRIVATE SfxChildWinFactory* GetChildWinFactoryById(sal_uInt16 nId) const;
-    SAL_DLLPRIVATE SfxViewFrameArr_Impl& GetViewFrames_Impl() const;
+    SAL_DLLPRIVATE std::vector<SfxViewFrame*>& GetViewFrames_Impl() const;
     SAL_DLLPRIVATE SfxViewShellArr_Impl& GetViewShells_Impl() const;
     SAL_DLLPRIVATE SfxObjectShellArr_Impl& GetObjectShells_Impl() const;
     SAL_DLLPRIVATE void         SetViewFrame_Impl(SfxViewFrame *pViewFrame);
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 1e45a6ed1586..69b2b9522820 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -374,9 +374,9 @@ SfxStbCtrlFactory* SfxApplication::GetStbCtrlFactory(const std::type_info& rSlot
     return nullptr;
 }
 
-SfxViewFrameArr_Impl&       SfxApplication::GetViewFrames_Impl() const
+std::vector<SfxViewFrame*>& SfxApplication::GetViewFrames_Impl() const
 {
-    return *pImpl->pViewFrames;
+    return pImpl->maViewFrames;
 }
 
 SfxViewShellArr_Impl&       SfxApplication::GetViewShells_Impl() const
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 343da98c8585..64fd807c0178 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -208,7 +208,6 @@ void SfxApplication::Initialize_Impl()
     DBG_ASSERT( !pImpl->pAppDispat, "AppDispatcher already exists" );
     pImpl->pAppDispat.reset(new SfxDispatcher);
     pImpl->pSlotPool.reset(new SfxSlotPool);
-    pImpl->pViewFrames.reset(new SfxViewFrameArr_Impl);
     pImpl->pViewShells.reset(new SfxViewShellArr_Impl);
     pImpl->pObjShells.reset(new SfxObjectShellArr_Impl);
 
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index 1245ef6e1c7d..a16e4d381f31 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -88,7 +88,7 @@ void SfxApplication::Deinitialize()
 
     pImpl->maTbxCtrlFactories.clear();
     pImpl->maStbCtrlFactories.clear();
-    pImpl->pViewFrames.reset();
+    pImpl->maViewFrames.clear();
     pImpl->pViewShells.reset();
     pImpl->pObjShells.reset();
 
diff --git a/sfx2/source/appl/shellimpl.cxx b/sfx2/source/appl/shellimpl.cxx
index 2ef1a7fe31c2..83698a179f75 100644
--- a/sfx2/source/appl/shellimpl.cxx
+++ b/sfx2/source/appl/shellimpl.cxx
@@ -54,40 +54,6 @@ size_t SfxObjectShellArr_Impl::size() const
     return maData.size();
 }
 
-SfxViewFrameArr_Impl::iterator SfxViewFrameArr_Impl::begin()
-{
-    return maData.begin();
-}
-
-SfxViewFrameArr_Impl::iterator SfxViewFrameArr_Impl::end()
-{
-    return maData.end();
-}
-
-const SfxViewFrame* SfxViewFrameArr_Impl::operator[] ( size_t i ) const
-{
-    return maData[i];
-}
-
-SfxViewFrame* SfxViewFrameArr_Impl::operator[] ( size_t i )
-{
-    return maData[i];
-}
-
-void SfxViewFrameArr_Impl::erase( const iterator& it )
-{
-    maData.erase(it);
-}
-
-void SfxViewFrameArr_Impl::push_back( SfxViewFrame* p )
-{
-    maData.push_back(p);
-}
-
-size_t SfxViewFrameArr_Impl::size() const
-{
-    return maData.size();
-}
 
 SfxViewShellArr_Impl::iterator SfxViewShellArr_Impl::begin()
 {
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 589497b757d2..1a68c1a52b66 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -98,8 +98,7 @@ public:
                                 maTbxCtrlFactories;
     std::vector<SfxStbCtrlFactory>
                                 maStbCtrlFactories;
-    std::unique_ptr<SfxViewFrameArr_Impl>
-                                pViewFrames;
+    std::vector<SfxViewFrame*>  maViewFrames;
     std::unique_ptr<SfxViewShellArr_Impl>
                                 pViewShells;
     std::unique_ptr<SfxObjectShellArr_Impl>
diff --git a/sfx2/source/inc/shellimpl.hxx b/sfx2/source/inc/shellimpl.hxx
index 1476271bbbc0..ec82bd14b0dd 100644
--- a/sfx2/source/inc/shellimpl.hxx
+++ b/sfx2/source/inc/shellimpl.hxx
@@ -48,26 +48,6 @@ public:
     size_t size() const;
 };
 
-class SfxViewFrameArr_Impl
-{
-    typedef std::vector<SfxViewFrame*> DataType;
-    DataType maData;
-
-public:
-    typedef DataType::iterator iterator;
-    iterator begin();
-    iterator end();
-
-    const SfxViewFrame* operator[](size_t i) const;
-    SfxViewFrame* operator[](size_t i);
-
-    void erase(const iterator& it);
-
-    void push_back(SfxViewFrame* p);
-
-    size_t size() const;
-};
-
 class SfxViewShellArr_Impl
 {
     typedef std::vector<SfxViewShell*> DataType;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 2881bbd4208f..795af1a5dffb 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1724,8 +1724,7 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh )
         m_pDispatcher->Flush();
     }
 
-    SfxViewFrameArr_Impl &rViewArr = SfxGetpApp()->GetViewFrames_Impl();
-    rViewArr.push_back( this );
+    SfxGetpApp()->GetViewFrames_Impl().push_back(this);
 }
 
 /*  [Description]
@@ -1779,8 +1778,8 @@ SfxViewFrame::~SfxViewFrame()
     SfxApplication *pSfxApp = SfxApplication::Get();
     if (pSfxApp)
     {
-        SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl();
-        SfxViewFrameArr_Impl::iterator it = std::find( rFrames.begin(), rFrames.end(), this );
+        auto &rFrames = pSfxApp->GetViewFrames_Impl();
+        auto it = std::find( rFrames.begin(), rFrames.end(), this );
         rFrames.erase( it );
     }
 
@@ -1828,10 +1827,8 @@ SfxViewFrame* SfxViewFrame::GetFirst
     if (!pSfxApp)
         return nullptr;
 
-    SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl();
-
     // search for a SfxDocument of the specified type
-    for (SfxViewFrame* pFrame : rFrames)
+    for (SfxViewFrame* pFrame : pSfxApp->GetViewFrames_Impl())
     {
         if  (   ( !pDoc || pDoc == pFrame->GetObjectShell() )
             &&  ( !bOnlyIfVisible || pFrame->IsVisible() )
@@ -1854,7 +1851,7 @@ SfxViewFrame* SfxViewFrame::GetNext
     if (!pSfxApp)
         return nullptr;
 
-    SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl();
+    auto &rFrames = pSfxApp->GetViewFrames_Impl();
 
     // refind the specified predecessor
     size_t nPos;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 920ffd6090a1..8e6a3b32b0d8 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1325,7 +1325,7 @@ SfxViewShell* SfxViewShell::GetFirst
 {
     // search for a SfxViewShell of the specified type
     SfxViewShellArr_Impl &rShells = SfxGetpApp()->GetViewShells_Impl();
-    SfxViewFrameArr_Impl &rFrames = SfxGetpApp()->GetViewFrames_Impl();
+    auto &rFrames = SfxGetpApp()->GetViewFrames_Impl();
     for (SfxViewShell* pShell : rShells)
     {
         if ( pShell )
@@ -1360,7 +1360,7 @@ SfxViewShell* SfxViewShell::GetNext
 )
 {
     SfxViewShellArr_Impl &rShells = SfxGetpApp()->GetViewShells_Impl();
-    SfxViewFrameArr_Impl &rFrames = SfxGetpApp()->GetViewFrames_Impl();
+    auto &rFrames = SfxGetpApp()->GetViewFrames_Impl();
     size_t nPos;
     for ( nPos = 0; nPos < rShells.size(); ++nPos )
         if ( rShells[nPos] == &rPrev )
@@ -1402,7 +1402,7 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC,
         return;
 
     // avoid access to dangling ViewShells
-    SfxViewFrameArr_Impl &rFrames = SfxGetpApp()->GetViewFrames_Impl();
+    auto &rFrames = SfxGetpApp()->GetViewFrames_Impl();
     for (SfxViewFrame* frame : rFrames)
     {
         if ( frame == GetViewFrame() && &rBC == GetObjectShell() )


More information about the Libreoffice-commits mailing list