diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-13 17:26:20 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-20 19:46:38 +0200 |
commit | 7f91d56e078048e2e0bc8f3edf1e47ff0b7f0d5a (patch) | |
tree | 34269e2a53522661ce5b7cf10894cdbf3549c8a8 /sfx2 | |
parent | Remove dead DECL_PTRARRAY(SfxFilterArr_Impl) declaration and member (diff) | |
download | core-7f91d56e078048e2e0bc8f3edf1e47ff0b7f0d5a.tar.gz core-7f91d56e078048e2e0bc8f3edf1e47ff0b7f0d5a.zip |
Convert SV_DECL_PTRARR_DEL( SfxChildWinFactArr_Impl) to std::vector
I couldn't use ptr_vector because some of the code deletes
entries without deallocating them.
Change-Id: Iafbb19dc8ca9f8337169e116d47dcf0ccf78ed0e
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/arrdecl.hxx | 7 | ||||
-rw-r--r-- | sfx2/source/appl/appchild.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/appl/appmisc.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/appl/module.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 4 |
6 files changed, 25 insertions, 18 deletions
diff --git a/sfx2/inc/arrdecl.hxx b/sfx2/inc/arrdecl.hxx index 06daab4bbe85..f8e4eb478226 100644 --- a/sfx2/inc/arrdecl.hxx +++ b/sfx2/inc/arrdecl.hxx @@ -51,7 +51,12 @@ struct SfxMenuCtrlFactory; SV_DECL_PTRARR_DEL( SfxMenuCtrlFactArr_Impl, SfxMenuCtrlFactory*, 2 ) struct SfxChildWinFactory; -SV_DECL_PTRARR_DEL( SfxChildWinFactArr_Impl, SfxChildWinFactory*, 2 ) +class SfxChildWinFactArr_Impl : public std::vector<SfxChildWinFactory*> +{ +public: + // de-allocates child objects + ~SfxChildWinFactArr_Impl(); +}; class SfxModule; SV_DECL_PTRARR( SfxModuleArr_Impl, SfxModule*, 2 ) diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx index 55e7d336de6a..183d3811c4d1 100644 --- a/sfx2/source/appl/appchild.cxx +++ b/sfx2/source/appl/appchild.cxx @@ -57,16 +57,15 @@ void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, SfxChildWinFacto if (!pAppData_Impl->pFactArr) pAppData_Impl->pFactArr = new SfxChildWinFactArr_Impl; - for (sal_uInt16 nFactory=0; nFactory<pAppData_Impl->pFactArr->Count(); ++nFactory) + for (sal_uInt16 nFactory=0; nFactory<pAppData_Impl->pFactArr->size(); ++nFactory) { if (pFact->nId == (*pAppData_Impl->pFactArr)[nFactory]->nId) { - pAppData_Impl->pFactArr->Remove( nFactory ); + pAppData_Impl->pFactArr->erase( pAppData_Impl->pFactArr->begin() + nFactory ); } } - pAppData_Impl->pFactArr->C40_INSERT( - SfxChildWinFactory, pFact, pAppData_Impl->pFactArr->Count() ); + pAppData_Impl->pFactArr->push_back( pFact ); } void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt16 nId, @@ -80,7 +79,7 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1 pFactories = pMod->GetChildWinFactories_Impl(); if ( pFactories ) { - sal_uInt16 nCount = pFactories->Count(); + sal_uInt16 nCount = pFactories->size(); for (sal_uInt16 nFactory=0; nFactory<nCount; ++nFactory) { SfxChildWinFactory *pFac = (*pFactories)[nFactory]; @@ -101,7 +100,7 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1 DBG_ASSERT( pAppData_Impl->pFactArr, "No Factories!" ); pFactories = pAppData_Impl->pFactArr; - sal_uInt16 nCount = pFactories->Count(); + sal_uInt16 nCount = pFactories->size(); for (sal_uInt16 nFactory=0; nFactory<nCount; ++nFactory) { SfxChildWinFactory *pFac = (*pFactories)[nFactory]; diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 1e62b634e6b5..5599268ea6c7 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -91,7 +91,6 @@ using namespace ::com::sun::star::container; SV_IMPL_PTRARR( SfxTbxCtrlFactArr_Impl, SfxTbxCtrlFactory* ); SV_IMPL_PTRARR( SfxStbCtrlFactArr_Impl, SfxStbCtrlFactory* ); SV_IMPL_PTRARR( SfxMenuCtrlFactArr_Impl, SfxMenuCtrlFactory* ); -SV_IMPL_PTRARR( SfxChildWinFactArr_Impl, SfxChildWinFactory* ); SV_IMPL_PTRARR( SfxModuleArr_Impl, SfxModule* ); //=================================================================== @@ -284,4 +283,9 @@ Image SfxApplication::GetApplicationLogo() return Image( aBitmap ); } +SfxChildWinFactArr_Impl::~SfxChildWinFactArr_Impl() +{ + for( const_iterator it = begin(); it != end(); ++it ) + delete *it; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 003021bb77d6..8335e65a9347 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -213,7 +213,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, SfxApplication *pApp = SFX_APP(); { SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl(); - for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory ) + for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { pFact = rFactories[nFactory]; if ( pFact->nId == nId ) @@ -244,7 +244,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, if ( pFactories ) { SfxChildWinFactArr_Impl &rFactories = *pFactories; - for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory ) + for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { pFact = rFactories[nFactory]; if ( pFact->nId == nId ) @@ -428,7 +428,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding if ( pFactories ) { SfxChildWinFactArr_Impl &rFactories = *pFactories; - for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory ) + for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { pFact = rFactories[nFactory]; if ( pFact->nId == GetType() ) @@ -459,7 +459,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding if ( !pCon ) { SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl(); - for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory ) + for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { pFact = rFactories[nFactory]; if ( pFact->nId == GetType() ) diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 47ec441ef1a0..5903b5aa8e04 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -202,18 +202,17 @@ void SfxModule::RegisterChildWindow(SfxChildWinFactory *pFact) if (!pImpl->pFactArr) pImpl->pFactArr = new SfxChildWinFactArr_Impl; - for (sal_uInt16 nFactory=0; nFactory<pImpl->pFactArr->Count(); ++nFactory) + for (sal_uInt16 nFactory=0; nFactory<pImpl->pFactArr->size(); ++nFactory) { if (pFact->nId == (*pImpl->pFactArr)[nFactory]->nId) { - pImpl->pFactArr->Remove( nFactory ); + pImpl->pFactArr->erase( pImpl->pFactArr->begin() + nFactory ); SAL_WARN("sfx2.appl", "ChildWindow registered multiple times!"); return; } } - pImpl->pFactArr->C40_INSERT( - SfxChildWinFactory, pFact, pImpl->pFactArr->Count() ); + pImpl->pFactArr->push_back( pFact ); } //------------------------------------------------------------------------- diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 5f6d001ad6e4..0f4906eda40a 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -2457,7 +2457,7 @@ void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW) SfxApplication *pApp = SFX_APP(); { SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl(); - for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory ) + for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { pFact = rFactories[nFactory]; if ( pFact->nId == pCW->nSaveId ) @@ -2487,7 +2487,7 @@ void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW) if ( pFactories ) { SfxChildWinFactArr_Impl &rFactories = *pFactories; - for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory ) + for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { pFact = rFactories[nFactory]; if ( pFact->nId == pCW->nSaveId ) |