diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-08-30 21:36:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-31 09:15:06 +0200 |
commit | 4b64d6ac2a186a68f5360d31ae21aefcceb84d12 (patch) | |
tree | 5e8825673224c505eaab1ee5363b681098978abc /sfx2 | |
parent | af24eaef7a9a8b8e5adf297901d08273342e7e93 (diff) |
flatten SfxViewFrameArr_Impl
Change-Id: I1d9b0e117a08ddafe56546a58e536b76529966fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121335
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/app.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/appl/appinit.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/appl/appquit.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/shellimpl.cxx | 34 | ||||
-rw-r--r-- | sfx2/source/inc/appdata.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/inc/shellimpl.hxx | 20 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 6 |
8 files changed, 12 insertions, 71 deletions
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() ) |