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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 31 12:30:36 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 |   36 ------------------------------------
 sfx2/source/inc/appdata.hxx    |    3 +--
 sfx2/source/inc/shellimpl.hxx  |   21 ---------------------
 sfx2/source/view/lokhelper.cxx |   10 +++++-----
 sfx2/source/view/viewsh.cxx    |   10 +++++-----
 9 files changed, 15 insertions(+), 75 deletions(-)

New commits:
commit 5d64720ce7571cb491e8c477e3744e1c19894625
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Aug 30 21:43:12 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 31 14:30:01 2021 +0200

    flatten SfxViewShellArr_Impl
    
    Change-Id: I781f877b0c94fdd667b4fd00342e68b35b127867
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121336
    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 824cc65c2559..de32df639728 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -46,7 +46,6 @@ class SfxObjectShellLock;
 class SfxProgress;
 class SfxSlotPool;
 class SfxViewFrame;
-class SfxViewShellArr_Impl;
 class StarBASIC;
 class SfxWorkWindow;
 class SfxFilterMatcher;
@@ -174,7 +173,7 @@ public:
     SAL_DLLPRIVATE SfxStbCtrlFactory* GetStbCtrlFactory(const std::type_info& rSlotType, sal_uInt16 nSlotID) const;
     SAL_DLLPRIVATE SfxChildWinFactory* GetChildWinFactoryById(sal_uInt16 nId) const;
     SAL_DLLPRIVATE std::vector<SfxViewFrame*>& GetViewFrames_Impl() const;
-    SAL_DLLPRIVATE SfxViewShellArr_Impl& GetViewShells_Impl() const;
+    SAL_DLLPRIVATE std::vector<SfxViewShell*>& 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 69b2b9522820..342ee1aa2e70 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -379,9 +379,9 @@ std::vector<SfxViewFrame*>& SfxApplication::GetViewFrames_Impl() const
     return pImpl->maViewFrames;
 }
 
-SfxViewShellArr_Impl&       SfxApplication::GetViewShells_Impl() const
+std::vector<SfxViewShell*>& SfxApplication::GetViewShells_Impl() const
 {
-    return *pImpl->pViewShells;
+    return pImpl->maViewShells;
 }
 
 SfxObjectShellArr_Impl&     SfxApplication::GetObjectShells_Impl() const
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 64fd807c0178..8291239659b7 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->pViewShells.reset(new SfxViewShellArr_Impl);
     pImpl->pObjShells.reset(new SfxObjectShellArr_Impl);
 
     Registrations_Impl();
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index a16e4d381f31..8a1d3b780f2b 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -89,7 +89,7 @@ void SfxApplication::Deinitialize()
     pImpl->maTbxCtrlFactories.clear();
     pImpl->maStbCtrlFactories.clear();
     pImpl->maViewFrames.clear();
-    pImpl->pViewShells.reset();
+    pImpl->maViewShells.clear();
     pImpl->pObjShells.reset();
 
     //TODO/CLEANUP
diff --git a/sfx2/source/appl/shellimpl.cxx b/sfx2/source/appl/shellimpl.cxx
index 83698a179f75..e2f41e5ef3d8 100644
--- a/sfx2/source/appl/shellimpl.cxx
+++ b/sfx2/source/appl/shellimpl.cxx
@@ -54,40 +54,4 @@ size_t SfxObjectShellArr_Impl::size() const
     return maData.size();
 }
 
-
-SfxViewShellArr_Impl::iterator SfxViewShellArr_Impl::begin()
-{
-    return maData.begin();
-}
-
-SfxViewShellArr_Impl::iterator SfxViewShellArr_Impl::end()
-{
-    return maData.end();
-}
-
-const SfxViewShell* SfxViewShellArr_Impl::operator[] ( size_t i ) const
-{
-    return maData[i];
-}
-
-SfxViewShell* SfxViewShellArr_Impl::operator[] ( size_t i )
-{
-    return maData[i];
-}
-
-void SfxViewShellArr_Impl::erase( const iterator& it )
-{
-    maData.erase(it);
-}
-
-void SfxViewShellArr_Impl::push_back( SfxViewShell* p )
-{
-    maData.push_back(p);
-}
-
-size_t SfxViewShellArr_Impl::size() const
-{
-    return maData.size();
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 1a68c1a52b66..cd5effc040f7 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -99,8 +99,7 @@ public:
     std::vector<SfxStbCtrlFactory>
                                 maStbCtrlFactories;
     std::vector<SfxViewFrame*>  maViewFrames;
-    std::unique_ptr<SfxViewShellArr_Impl>
-                                pViewShells;
+    std::vector<SfxViewShell*>  maViewShells;
     std::unique_ptr<SfxObjectShellArr_Impl>
                                 pObjShells;
     std::unique_ptr<SfxBasicManagerHolder>
diff --git a/sfx2/source/inc/shellimpl.hxx b/sfx2/source/inc/shellimpl.hxx
index ec82bd14b0dd..ccf015c23efc 100644
--- a/sfx2/source/inc/shellimpl.hxx
+++ b/sfx2/source/inc/shellimpl.hxx
@@ -48,27 +48,6 @@ public:
     size_t size() const;
 };
 
-class SfxViewShellArr_Impl
-{
-    typedef std::vector<SfxViewShell*> DataType;
-    DataType maData;
-
-public:
-    typedef DataType::iterator iterator;
-
-    iterator begin();
-    iterator end();
-
-    const SfxViewShell* operator[](size_t i) const;
-    SfxViewShell* operator[](size_t i);
-
-    void erase(const iterator& it);
-
-    void push_back(SfxViewShell* p);
-
-    size_t size() const;
-};
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 97bef9e48472..2918c51a49eb 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -133,7 +133,7 @@ void SfxLokHelper::destroyView(int nId)
         return;
 
     const ViewShellId nViewShellId(nId);
-    SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
+    std::vector<SfxViewShell*>& rViewArr = pApp->GetViewShells_Impl();
 
     for (const SfxViewShell* pViewShell : rViewArr)
     {
@@ -154,7 +154,7 @@ void SfxLokHelper::setView(int nId)
         return;
 
     const ViewShellId nViewShellId(nId);
-    SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
+    std::vector<SfxViewShell*>& rViewArr = pApp->GetViewShells_Impl();
 
     for (const SfxViewShell* pViewShell : rViewArr)
     {
@@ -189,7 +189,7 @@ SfxViewShell* SfxLokHelper::getViewOfId(int nId)
         return nullptr;
 
     const ViewShellId nViewShellId(nId);
-    SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
+    std::vector<SfxViewShell*>& rViewArr = pApp->GetViewShells_Impl();
     for (SfxViewShell* pViewShell : rViewArr)
     {
         if (pViewShell->GetViewShellId() == nViewShellId)
@@ -283,7 +283,7 @@ void SfxLokHelper::setDefaultLanguage(const OUString& rBcp47LanguageTag)
 
 void SfxLokHelper::setViewLanguage(int nId, const OUString& rBcp47LanguageTag)
 {
-    SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
+    std::vector<SfxViewShell*>& rViewArr = SfxGetpApp()->GetViewShells_Impl();
 
     for (SfxViewShell* pViewShell : rViewArr)
     {
@@ -297,7 +297,7 @@ void SfxLokHelper::setViewLanguage(int nId, const OUString& rBcp47LanguageTag)
 
 void SfxLokHelper::setViewLocale(int nId, const OUString& rBcp47LanguageTag)
 {
-    SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
+    std::vector<SfxViewShell*>& rViewArr = SfxGetpApp()->GetViewShells_Impl();
 
     for (SfxViewShell* pViewShell : rViewArr)
     {
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 8e6a3b32b0d8..bcb60d6c20a4 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1076,7 +1076,7 @@ SfxViewShell::SfxViewShell
     StartListening(*pViewFrame->GetObjectShell());
 
     // Insert into list
-    SfxViewShellArr_Impl &rViewArr = SfxGetpApp()->GetViewShells_Impl();
+    std::vector<SfxViewShell*> &rViewArr = SfxGetpApp()->GetViewShells_Impl();
     rViewArr.push_back(this);
 
     if (comphelper::LibreOfficeKit::isActive())
@@ -1097,8 +1097,8 @@ SfxViewShell::~SfxViewShell()
 {
     // Remove from list
     const SfxViewShell *pThis = this;
-    SfxViewShellArr_Impl &rViewArr = SfxGetpApp()->GetViewShells_Impl();
-    SfxViewShellArr_Impl::iterator it = std::find( rViewArr.begin(), rViewArr.end(), pThis );
+    std::vector<SfxViewShell*> &rViewArr = SfxGetpApp()->GetViewShells_Impl();
+    auto it = std::find( rViewArr.begin(), rViewArr.end(), pThis );
     rViewArr.erase( it );
 
     if ( pImpl->xClipboardListener.is() )
@@ -1324,7 +1324,7 @@ SfxViewShell* SfxViewShell::GetFirst
 )
 {
     // search for a SfxViewShell of the specified type
-    SfxViewShellArr_Impl &rShells = SfxGetpApp()->GetViewShells_Impl();
+    std::vector<SfxViewShell*> &rShells = SfxGetpApp()->GetViewShells_Impl();
     auto &rFrames = SfxGetpApp()->GetViewFrames_Impl();
     for (SfxViewShell* pShell : rShells)
     {
@@ -1359,7 +1359,7 @@ SfxViewShell* SfxViewShell::GetNext
     const std::function<bool ( const SfxViewShell* )>& isViewShell
 )
 {
-    SfxViewShellArr_Impl &rShells = SfxGetpApp()->GetViewShells_Impl();
+    std::vector<SfxViewShell*> &rShells = SfxGetpApp()->GetViewShells_Impl();
     auto &rFrames = SfxGetpApp()->GetViewFrames_Impl();
     size_t nPos;
     for ( nPos = 0; nPos < rShells.size(); ++nPos )


More information about the Libreoffice-commits mailing list