diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-08-12 23:58:14 +0900 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-08-13 08:53:48 -0500 |
commit | a247b8257a904372fcc2330bd8820176d4a71ebd (patch) | |
tree | a5b0c4e19be964abdd7cf680d9d10bb52d2ede42 | |
parent | a8c503a69c467526ef80ec36b7916e7b931f9101 (diff) |
fdo#75757: remove inheritance to std::vector
... by replacing the following 3 classes with typedefs of std::vector:
SfxObjectShellArr_Impl / SfxViewFrameArr_Impl / SfxViewShellArr_Impl
and the following 4 with typedefs of boost::ptr_vector:
SfxChildWinFactArr_Impl / SfxMenuCtrlFactArr_Impl /
SfxStbCtrlFactArr_Impl / SfxTbxCtrlFactArr_Impl
Change-Id: I1754bd19ec418a3e7ba5c47fb6d8568e8fca9b29
Reviewed-on: https://gerrit.libreoffice.org/10891
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | include/sfx2/app.hxx | 20 | ||||
-rw-r--r-- | include/sfx2/module.hxx | 5 | ||||
-rw-r--r-- | sfx2/inc/arrdecl.hxx | 41 | ||||
-rw-r--r-- | sfx2/source/appl/appchild.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/appl/appmisc.cxx | 25 | ||||
-rw-r--r-- | sfx2/source/appl/appreg.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/appl/module.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/inc/appdata.hxx | 8 | ||||
-rw-r--r-- | sfx2/source/menu/mnuitem.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/statbar/stbitem.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/toolbox/tbxitem.cxx | 17 |
13 files changed, 54 insertions, 133 deletions
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index 0a11a0616b5a..ca2200067552 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -35,7 +35,12 @@ // header file because in former times SfxApplication was derived from it #include <vcl/svapp.hxx> +#include <sfx2/childwin.hxx> +#include <sfx2/mnuitem.hxx> #include <sfx2/shell.hxx> +#include <sfx2/stbitem.hxx> +#include <sfx2/tbxctrl.hxx> +#include <boost/ptr_container/ptr_vector.hpp> #include <vector> class Timer; @@ -51,32 +56,31 @@ class AppSettings; struct SfxChildWinContextFactory; class SfxAppData_Impl; class SfxBindings; -class SfxChildWinFactArr_Impl; +typedef boost::ptr_vector<SfxChildWinFactory> SfxChildWinFactArr_Impl; class SfxChildWindow; class SfxDispatcher; class SfxEventConfiguration; class SfxEventHint; class SfxItemSet; class SfxMedium; -class SfxMenuCtrlFactArr_Impl; +typedef boost::ptr_vector<SfxMenuCtrlFactory> SfxMenuCtrlFactArr_Impl; class SfxNewFileDialog; class SfxObjectShell; -class SfxObjectShellArr_Impl; +typedef ::std::vector<SfxObjectShell*> SfxObjectShellArr_Impl; class SfxProgress; class SfxSlotPool; -class SfxStbCtrlFactArr_Impl; -class SfxTbxCtrlFactArr_Impl; +typedef boost::ptr_vector<SfxStbCtrlFactory> SfxStbCtrlFactArr_Impl; +typedef boost::ptr_vector<SfxTbxCtrlFactory> SfxTbxCtrlFactArr_Impl; class SfxTemplateDialog; class SfxViewFrame; -class SfxViewFrameArr_Impl; +typedef ::std::vector<SfxViewFrame*> SfxViewFrameArr_Impl; class SfxViewShell; -class SfxViewShellArr_Impl; +typedef ::std::vector<SfxViewShell*> SfxViewShellArr_Impl; class StarBASIC; class SfxWorkWindow; class SfxFilterMatcher; class SfxModule; class SfxModule; -typedef ::std::vector<SfxModule*> SfxModuleArr_Impl; class Window; struct SfxChildWinFactory; struct SfxMenuCtrlFactory; diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx index 9dbfbad287bd..cf9130f97b8a 100644 --- a/include/sfx2/module.hxx +++ b/include/sfx2/module.hxx @@ -21,6 +21,7 @@ #define _SFXMOD_HXX // external #include <sal/config.h> +#include <sfx2/app.hxx> #include <sfx2/dllapi.h> #include <sfx2/shell.hxx> #include <svtools/imgdef.hxx> @@ -44,10 +45,6 @@ struct SfxChildWinFactory; struct SfxMenuCtrlFactory; struct SfxStbCtrlFactory; struct SfxTbxCtrlFactory; -class SfxTbxCtrlFactArr_Impl; -class SfxChildWinFactArr_Impl; -class SfxMenuCtrlFactArr_Impl; -class SfxStbCtrlFactArr_Impl; class SfxTabPage; class Window; diff --git a/sfx2/inc/arrdecl.hxx b/sfx2/inc/arrdecl.hxx index 1ce03bc03e79..31cd3545546e 100644 --- a/sfx2/inc/arrdecl.hxx +++ b/sfx2/inc/arrdecl.hxx @@ -21,47 +21,6 @@ #include <vector> -class SfxObjectShell; -class SfxObjectShellArr_Impl : public std::vector<SfxObjectShell*> {}; - -class SfxViewFrame; -class SfxViewFrameArr_Impl : public std::vector<SfxViewFrame*> {}; - -class SfxViewShell; -class SfxViewShellArr_Impl : public std::vector<SfxViewShell*> {}; - -struct SfxTbxCtrlFactory; -class SfxTbxCtrlFactArr_Impl : public std::vector<SfxTbxCtrlFactory*> -{ -public: - // de-allocates child objects - ~SfxTbxCtrlFactArr_Impl(); -}; - -struct SfxStbCtrlFactory; -class SfxStbCtrlFactArr_Impl : public std::vector<SfxStbCtrlFactory*> -{ -public: - // de-allocates child objects - ~SfxStbCtrlFactArr_Impl(); -}; - -struct SfxMenuCtrlFactory; -class SfxMenuCtrlFactArr_Impl : public std::vector<SfxMenuCtrlFactory*> -{ -public: - // de-allocates child objects - ~SfxMenuCtrlFactArr_Impl(); -}; - -struct SfxChildWinFactory; -class SfxChildWinFactArr_Impl : public std::vector<SfxChildWinFactory*> -{ -public: - // de-allocates child objects - ~SfxChildWinFactArr_Impl(); -}; - class SfxModule; typedef ::std::vector<SfxModule*> SfxModuleArr_Impl; diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx index 1ab79aa492f0..43ff5f1fbe9d 100644 --- a/sfx2/source/appl/appchild.cxx +++ b/sfx2/source/appl/appchild.cxx @@ -25,7 +25,6 @@ #include "appdata.hxx" #include "workwin.hxx" #include <sfx2/childwin.hxx> -#include "arrdecl.hxx" #include <sfx2/templdlg.hxx> #include <sfx2/request.hxx> #include <sfx2/bindings.hxx> @@ -50,7 +49,7 @@ void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, SfxChildWinFacto for (sal_uInt16 nFactory=0; nFactory<pAppData_Impl->pFactArr->size(); ++nFactory) { - if (pFact->nId == (*pAppData_Impl->pFactArr)[nFactory]->nId) + if (pFact->nId == (*pAppData_Impl->pFactArr)[nFactory].nId) { pAppData_Impl->pFactArr->erase( pAppData_Impl->pFactArr->begin() + nFactory ); } @@ -73,7 +72,7 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1 sal_uInt16 nCount = pFactories->size(); for (sal_uInt16 nFactory=0; nFactory<nCount; ++nFactory) { - SfxChildWinFactory *pFac = (*pFactories)[nFactory]; + SfxChildWinFactory *pFac = &(*pFactories)[nFactory]; if ( nId == pFac->nId ) { // Factory found, registrer Context here. @@ -94,7 +93,7 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1 sal_uInt16 nCount = pFactories->size(); for (sal_uInt16 nFactory=0; nFactory<nCount; ++nFactory) { - SfxChildWinFactory *pFac = (*pFactories)[nFactory]; + SfxChildWinFactory *pFac = &(*pFactories)[nFactory]; if ( nId == pFac->nId ) { if ( pMod ) diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 04e9d4ecdb9e..73d38e3e754a 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -53,7 +53,6 @@ #include <sfx2/sfxresid.hxx> #include <sfx2/app.hxx> #include "appdata.hxx" -#include "arrdecl.hxx" #include <sfx2/tbxctrl.hxx> #include <sfx2/stbitem.hxx> #include <sfx2/mnuitem.hxx> @@ -224,28 +223,4 @@ BitmapEx SfxApplication::GetApplicationLogo(long nWidth) return aBitmap; } -SfxChildWinFactArr_Impl::~SfxChildWinFactArr_Impl() -{ - for( const_iterator it = begin(); it != end(); ++it ) - delete *it; -} - -SfxMenuCtrlFactArr_Impl::~SfxMenuCtrlFactArr_Impl() -{ - for( const_iterator it = begin(); it != end(); ++it ) - delete *it; -} - -SfxStbCtrlFactArr_Impl::~SfxStbCtrlFactArr_Impl() -{ - for( const_iterator it = begin(); it != end(); ++it ) - delete *it; -} - -SfxTbxCtrlFactArr_Impl::~SfxTbxCtrlFactArr_Impl() -{ - for( const_iterator it = begin(); it != end(); ++it ) - delete *it; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index a53f9871e255..caa32b13a0f2 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -22,7 +22,6 @@ #include <sfx2/app.hxx> #include "appdata.hxx" -#include "arrdecl.hxx" #include <sfx2/sfxhelp.hxx> #include <sfx2/templdlg.hxx> #include "inettbc.hxx" @@ -78,7 +77,7 @@ void SfxApplication::RegisterToolBoxControl_Impl( SfxModule *pMod, SfxTbxCtrlFac #ifdef DBG_UTIL for ( sal_uInt16 n=0; n<pAppData_Impl->pTbxCtrlFac->size(); n++ ) { - SfxTbxCtrlFactory *pF = (*pAppData_Impl->pTbxCtrlFac)[n]; + SfxTbxCtrlFactory *pF = &(*pAppData_Impl->pTbxCtrlFac)[n]; if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { @@ -103,7 +102,7 @@ void SfxApplication::RegisterStatusBarControl_Impl( SfxModule *pMod, SfxStbCtrlF #ifdef DBG_UTIL for ( sal_uInt16 n=0; n<pAppData_Impl->pStbCtrlFac->size(); n++ ) { - SfxStbCtrlFactory *pF = (*pAppData_Impl->pStbCtrlFac)[n]; + SfxStbCtrlFactory *pF = &(*pAppData_Impl->pStbCtrlFac)[n]; if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { @@ -128,7 +127,7 @@ void SfxApplication::RegisterMenuControl_Impl( SfxModule *pMod, SfxMenuCtrlFacto #ifdef DBG_UTIL for ( sal_uInt16 n=0; n<pAppData_Impl->pMenuCtrlFac->size(); n++ ) { - SfxMenuCtrlFactory *pF = (*pAppData_Impl->pMenuCtrlFac)[n]; + SfxMenuCtrlFactory *pF = &(*pAppData_Impl->pMenuCtrlFac)[n]; if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 1397e3403b2a..50634e774d11 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -32,7 +32,6 @@ #include <sfx2/childwin.hxx> #include <sfx2/app.hxx> -#include "arrdecl.hxx" #include <sfx2/bindings.hxx> #include <sfx2/module.hxx> #include <sfx2/dockwin.hxx> @@ -205,7 +204,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl(); for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { - pFact = rFactories[nFactory]; + pFact = &rFactories[nFactory]; if ( pFact->nId == nId ) { SfxChildWinInfo& rFactInfo = pFact->aInfo; @@ -236,7 +235,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, SfxChildWinFactArr_Impl &rFactories = *pFactories; for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { - pFact = rFactories[nFactory]; + pFact = &rFactories[nFactory]; if ( pFact->nId == nId ) { SfxChildWinInfo& rFactInfo = pFact->aInfo; @@ -429,7 +428,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding SfxChildWinFactArr_Impl &rFactories = *pFactories; for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { - pFact = rFactories[nFactory]; + pFact = &rFactories[nFactory]; if ( pFact->nId == GetType() ) { DBG_ASSERT( pFact->pArr, "No context registered!" ); @@ -460,7 +459,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl(); for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { - pFact = rFactories[nFactory]; + pFact = &rFactories[nFactory]; if ( pFact->nId == GetType() ) { DBG_ASSERT( pFact->pArr, "No context registered!" ); diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index fe416c37431d..3c783fe5cbf3 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -23,7 +23,6 @@ #include <cstdarg> #include <sfx2/module.hxx> #include <sfx2/app.hxx> -#include "arrdecl.hxx" #include <sfx2/sfxresid.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/tbxctrl.hxx> @@ -190,7 +189,7 @@ void SfxModule::RegisterChildWindow(SfxChildWinFactory *pFact) for (sal_uInt16 nFactory=0; nFactory<pImpl->pFactArr->size(); ++nFactory) { - if (pFact->nId == (*pImpl->pFactArr)[nFactory]->nId) + if (pFact->nId == (*pImpl->pFactArr)[nFactory].nId) { pImpl->pFactArr->erase( pImpl->pFactArr->begin() + nFactory ); SAL_WARN("sfx.appl", "ChildWindow registered multiple times!"); @@ -211,7 +210,7 @@ void SfxModule::RegisterToolBoxControl( SfxTbxCtrlFactory *pFact ) #ifdef DBG_UTIL for ( sal_uInt16 n=0; n<pImpl->pTbxCtrlFac->size(); n++ ) { - SfxTbxCtrlFactory *pF = (*pImpl->pTbxCtrlFac)[n]; + SfxTbxCtrlFactory *pF = &(*pImpl->pTbxCtrlFac)[n]; if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { @@ -233,7 +232,7 @@ void SfxModule::RegisterStatusBarControl( SfxStbCtrlFactory *pFact ) #ifdef DBG_UTIL for ( sal_uInt16 n=0; n<pImpl->pStbCtrlFac->size(); n++ ) { - SfxStbCtrlFactory *pF = (*pImpl->pStbCtrlFac)[n]; + SfxStbCtrlFactory *pF = &(*pImpl->pStbCtrlFac)[n]; if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { @@ -255,7 +254,7 @@ void SfxModule::RegisterMenuControl( SfxMenuCtrlFactory *pFact ) #ifdef DBG_UTIL for ( sal_uInt16 n=0; n<pImpl->pMenuCtrlFac->size(); n++ ) { - SfxMenuCtrlFactory *pF = (*pImpl->pMenuCtrlFac)[n]; + SfxMenuCtrlFactory *pF = &(*pImpl->pMenuCtrlFac)[n]; if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index ae65b615a014..b4b12132ce4c 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -27,7 +27,6 @@ #include <sfx2/app.hxx> #include "workwin.hxx" #include <sfx2/viewfrm.hxx> -#include "arrdecl.hxx" #include <sfx2/module.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/dockwin.hxx> @@ -2436,7 +2435,7 @@ void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW) SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl(); for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { - pFact = rFactories[nFactory]; + pFact = &rFactories[nFactory]; if ( pFact->nId == pCW->nSaveId ) { pCW->aInfo = pFact->aInfo; @@ -2465,7 +2464,7 @@ void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW) SfxChildWinFactArr_Impl &rFactories = *pFactories; for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) { - pFact = rFactories[nFactory]; + pFact = &rFactories[nFactory]; if ( pFact->nId == pCW->nSaveId ) { pCW->aInfo = pFact->aInfo; diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 8a5acb6b6260..19fd3ed8b122 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -24,6 +24,7 @@ #include <svl/lstner.hxx> #include <svtools/ehdl.hxx> #include <vcl/timer.hxx> +#include <sfx2/app.hxx> #include <com/sun/star/frame/XModel.hpp> @@ -32,7 +33,6 @@ class SfxApplication; class SfxProgress; -class SfxChildWinFactArr_Impl; class SfxDdeDocTopics_Impl; class DdeService; class SfxItemPool; @@ -47,12 +47,6 @@ typedef ::std::vector<SfxFrame*> SfxFrameArr_Impl; class SvtSaveOptions; class SvtHelpOptions; class ResMgr; -class SfxTbxCtrlFactArr_Impl; -class SfxStbCtrlFactArr_Impl; -class SfxMenuCtrlFactArr_Impl; -class SfxViewFrameArr_Impl; -class SfxViewShellArr_Impl; -class SfxObjectShellArr_Impl; class ResMgr; class SfxViewFrame; class SfxSlotPool; diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index ebe6439853f9..ce1d1bb08ee2 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -51,7 +51,6 @@ #include "virtmenu.hxx" #include <sfx2/mnuitem.hxx> #include <sfx2/tbxctrl.hxx> -#include "arrdecl.hxx" #include <sfx2/module.hxx> #include <sfx2/unoctitm.hxx> #include <sfx2/viewfrm.hxx> @@ -272,20 +271,20 @@ SfxMenuControl* SfxMenuControl::CreateControl( sal_uInt16 nId, Menu &rMenu, SfxB { SfxMenuCtrlFactArr_Impl &rFactories = *pFactories; for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) - if ( rFactories[nFactory]->nTypeId == aSlotType && - ( ( rFactories[nFactory]->nSlotId == 0 ) || - ( rFactories[nFactory]->nSlotId == nId) ) ) - return rFactories[nFactory]->pCtor( nId, rMenu, rBindings ); + if ( rFactories[nFactory].nTypeId == aSlotType && + ( ( rFactories[nFactory].nSlotId == 0 ) || + ( rFactories[nFactory].nSlotId == nId) ) ) + return rFactories[nFactory].pCtor( nId, rMenu, rBindings ); } } SfxMenuCtrlFactArr_Impl &rFactories = pApp->GetMenuCtrlFactories_Impl(); for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) - if ( rFactories[nFactory]->nTypeId == aSlotType && - ( ( rFactories[nFactory]->nSlotId == 0 ) || - ( rFactories[nFactory]->nSlotId == nId) ) ) - return rFactories[nFactory]->pCtor( nId, rMenu, rBindings ); + if ( rFactories[nFactory].nTypeId == aSlotType && + ( ( rFactories[nFactory].nSlotId == 0 ) || + ( rFactories[nFactory].nSlotId == nId) ) ) + return rFactories[nFactory].pCtor( nId, rMenu, rBindings ); } return 0; } diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 3de5bcd9ab84..942279b4b04a 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -33,7 +33,6 @@ #include <sfx2/stbitem.hxx> #include "sfxtypes.hxx" #include <sfx2/msg.hxx> -#include "arrdecl.hxx" #include <sfx2/bindings.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/module.hxx> @@ -644,19 +643,19 @@ SfxStatusBarControl* SfxStatusBarControl::CreateControl { SfxStbCtrlFactArr_Impl &rFactories = *pFactories; for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) - if ( rFactories[nFactory]->nTypeId == aSlotType && - ( ( rFactories[nFactory]->nSlotId == 0 ) || - ( rFactories[nFactory]->nSlotId == nSlotID) ) ) - return rFactories[nFactory]->pCtor( nSlotID, nStbId, *pBar ); + if ( rFactories[nFactory].nTypeId == aSlotType && + ( ( rFactories[nFactory].nSlotId == 0 ) || + ( rFactories[nFactory].nSlotId == nSlotID) ) ) + return rFactories[nFactory].pCtor( nSlotID, nStbId, *pBar ); } } SfxStbCtrlFactArr_Impl &rFactories = pApp->GetStbCtrlFactories_Impl(); for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory ) - if ( rFactories[nFactory]->nTypeId == aSlotType && - ( ( rFactories[nFactory]->nSlotId == 0 ) || - ( rFactories[nFactory]->nSlotId == nSlotID) ) ) - return rFactories[nFactory]->pCtor( nSlotID, nStbId, *pBar ); + if ( rFactories[nFactory].nTypeId == aSlotType && + ( ( rFactories[nFactory].nSlotId == 0 ) || + ( rFactories[nFactory].nSlotId == nSlotID) ) ) + return rFactories[nFactory].pCtor( nSlotID, nStbId, *pBar ); } return NULL; diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index d4152af0f4b4..25781db35c10 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -76,7 +76,6 @@ #include <sfx2/msgpool.hxx> #include "statcach.hxx" #include <sfx2/viewfrm.hxx> -#include "arrdecl.hxx" #include "sfxtypes.hxx" #include <sfx2/genlink.hxx> #include <sfx2/sfxresid.hxx> @@ -331,7 +330,7 @@ SfxToolBoxControl* SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId, sal_uIn // search for a factory with the given slot id for( nFactory = 0; nFactory < nCount; ++nFactory ) - if( (rFactories[nFactory]->nTypeId == aSlotType) && (rFactories[nFactory]->nSlotId == nSlotId) ) + if( (rFactories[nFactory].nTypeId == aSlotType) && (rFactories[nFactory].nSlotId == nSlotId) ) break; if( nFactory == nCount ) @@ -339,14 +338,14 @@ SfxToolBoxControl* SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId, sal_uIn // if no factory exists for the given slot id, see if we // have a generic factory with the correct slot type and slot id == 0 for ( nFactory = 0; nFactory < nCount; ++nFactory ) - if( (rFactories[nFactory]->nTypeId == aSlotType) && (rFactories[nFactory]->nSlotId == 0) ) + if( (rFactories[nFactory].nTypeId == aSlotType) && (rFactories[nFactory].nSlotId == 0) ) break; } if( nFactory < nCount ) { - pCtrl = rFactories[nFactory]->pCtor( nSlotId, nTbxId, *pBox ); - pCtrl->pImpl->pFact = rFactories[nFactory]; + pCtrl = rFactories[nFactory].pCtor( nSlotId, nTbxId, *pBox ); + pCtrl->pImpl->pFact = &rFactories[nFactory]; return pCtrl; } } @@ -357,7 +356,7 @@ SfxToolBoxControl* SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId, sal_uIn const sal_uInt16 nCount = rFactories.size(); for( nFactory = 0; nFactory < nCount; ++nFactory ) - if( (rFactories[nFactory]->nTypeId == aSlotType) && (rFactories[nFactory]->nSlotId == nSlotId) ) + if( (rFactories[nFactory].nTypeId == aSlotType) && (rFactories[nFactory].nSlotId == nSlotId) ) break; if( nFactory == nCount ) @@ -365,14 +364,14 @@ SfxToolBoxControl* SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId, sal_uIn // if no factory exists for the given slot id, see if we // have a generic factory with the correct slot type and slot id == 0 for( nFactory = 0; nFactory < nCount; ++nFactory ) - if( (rFactories[nFactory]->nTypeId == aSlotType) && (rFactories[nFactory]->nSlotId == 0) ) + if( (rFactories[nFactory].nTypeId == aSlotType) && (rFactories[nFactory].nSlotId == 0) ) break; } if( nFactory < nCount ) { - pCtrl = rFactories[nFactory]->pCtor( nSlotId, nTbxId, *pBox ); - pCtrl->pImpl->pFact = rFactories[nFactory]; + pCtrl = rFactories[nFactory].pCtor( nSlotId, nTbxId, *pBox ); + pCtrl->pImpl->pFact = &rFactories[nFactory]; return pCtrl; } } |