1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sfx2.hxx" 30*cdf0e10cSrcweir #include <tools/stream.hxx> 31*cdf0e10cSrcweir #include <rsc/rscsfx.hxx> 32*cdf0e10cSrcweir #ifndef GCC 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir // wg. pSlotPool 36*cdf0e10cSrcweir #include "appdata.hxx" 37*cdf0e10cSrcweir #include <sfx2/msgpool.hxx> 38*cdf0e10cSrcweir #include <sfx2/minarray.hxx> 39*cdf0e10cSrcweir #include <sfx2/msg.hxx> 40*cdf0e10cSrcweir #include <sfx2/app.hxx> 41*cdf0e10cSrcweir #include <sfx2/objface.hxx> 42*cdf0e10cSrcweir #include "sfxtypes.hxx" 43*cdf0e10cSrcweir #include "sfx2/sfxresid.hxx" 44*cdf0e10cSrcweir #include "arrdecl.hxx" 45*cdf0e10cSrcweir #include <sfx2/module.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include <sfx2/sfx.hrc> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir //==================================================================== 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir struct SfxSIDRegistration_Impl 52*cdf0e10cSrcweir { 53*cdf0e10cSrcweir String _aGroup; 54*cdf0e10cSrcweir String _aName; 55*cdf0e10cSrcweir sal_uInt16 _nSID; 56*cdf0e10cSrcweir }; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir struct SfxSlotType_Impl 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir sal_uInt16 nId; 61*cdf0e10cSrcweir TypeId nType; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir SfxSlotType_Impl( sal_uInt16 nTheId, TypeId nTheType ): 64*cdf0e10cSrcweir nId(nTheId), nType(nTheType) 65*cdf0e10cSrcweir {} 66*cdf0e10cSrcweir }; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir DECL_2BYTEARRAY(SfxSlotGroupArr_Impl, sal_uInt16, 6, 4) 69*cdf0e10cSrcweir DECL_PTRARRAY(SfxInterfaceArr_Impl, SfxInterface*, 6, 3) 70*cdf0e10cSrcweir DECL_PTRARRAY(SfxSlotTypeArr_Impl, SfxSlotType_Impl*, 8, 8) 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir //==================================================================== 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir SfxSlotPool::SfxSlotPool( SfxSlotPool *pParent, ResMgr* pResManager ) 76*cdf0e10cSrcweir : _pGroups(0) 77*cdf0e10cSrcweir , _pTypes(0) 78*cdf0e10cSrcweir , _pParentPool( pParent ) 79*cdf0e10cSrcweir , _pResMgr( pResManager ) 80*cdf0e10cSrcweir , _pInterfaces(0) 81*cdf0e10cSrcweir , _nCurGroup(0) 82*cdf0e10cSrcweir , _nCurInterface(0) 83*cdf0e10cSrcweir , _nCurMsg(0) 84*cdf0e10cSrcweir , _pUnoSlots( 0 ) 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir if ( !_pResMgr ) 87*cdf0e10cSrcweir _pResMgr = SfxApplication::GetOrCreate()->GetOffResManager_Impl(); 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir //==================================================================== 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir SfxSlotPool::~SfxSlotPool() 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir _pParentPool = 0; 95*cdf0e10cSrcweir for ( SfxInterface *pIF = FirstInterface(); pIF; pIF = FirstInterface() ) 96*cdf0e10cSrcweir delete pIF; 97*cdf0e10cSrcweir delete _pInterfaces; 98*cdf0e10cSrcweir delete _pGroups; 99*cdf0e10cSrcweir if ( _pTypes ) 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir for ( sal_uInt16 n =_pTypes->Count(); n--; ) 102*cdf0e10cSrcweir delete _pTypes->GetObject(n); 103*cdf0e10cSrcweir delete _pTypes; 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir //==================================================================== 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir // registers the availability of the Interface of functions 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir DBG_MEMTEST(); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir // add to the list of SfxObjectInterface instances 116*cdf0e10cSrcweir if ( _pInterfaces == 0 ) 117*cdf0e10cSrcweir _pInterfaces = new SfxInterfaceArr_Impl; 118*cdf0e10cSrcweir _pInterfaces->Append(&rInterface); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir // bei einem (einzelnen) Null-Slot abbrechen (aus syntaktischen Gr"unden 121*cdf0e10cSrcweir // enthalten interfaces immer mindestens einen Slot) 122*cdf0e10cSrcweir if ( rInterface.Count() == 1 && !rInterface[0]->nSlotId ) 123*cdf0e10cSrcweir return; 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir // possibly add Interface-id and group-ids of funcs to the list of groups 126*cdf0e10cSrcweir if ( !_pGroups ) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir _pGroups = new SfxSlotGroupArr_Impl; 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir if ( _pParentPool ) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir // Die Groups im parent Slotpool sind auch hier bekannt 133*cdf0e10cSrcweir SfxSlotGroupArr_Impl& rGroups = *_pParentPool->_pGroups; 134*cdf0e10cSrcweir for ( sal_uInt16 n=0; n<rGroups.Count(); n++ ) 135*cdf0e10cSrcweir _pGroups->Append( rGroups[n] ); 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir if ( !_pTypes ) 140*cdf0e10cSrcweir _pTypes = new SfxSlotTypeArr_Impl; 141*cdf0e10cSrcweir for ( sal_uInt16 nFunc = 0; nFunc < rInterface.Count(); ++nFunc ) 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir SfxSlot *pDef = rInterface[nFunc]; 144*cdf0e10cSrcweir if ( pDef->GetGroupId() && /* pDef->GetGroupId() != GID_INTERN && */ 145*cdf0e10cSrcweir !_pGroups->Contains(pDef->GetGroupId()) ) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir if (pDef->GetGroupId() == GID_INTERN) 148*cdf0e10cSrcweir _pGroups->Insert(0, pDef->GetGroupId()); 149*cdf0e10cSrcweir else 150*cdf0e10cSrcweir _pGroups->Append(pDef->GetGroupId()); 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir #if 0 153*cdf0e10cSrcweir const TypeId &rTypeId = pDef->GetType()->Type(); 154*cdf0e10cSrcweir if ( /*rTypeId != TYPE(SfxVoidItem) &&*/ rTypeId != 0 ) 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir sal_uInt16 nPos; 157*cdf0e10cSrcweir for ( nPos = 0; nPos < _pTypes->Count(); ++nPos ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir if ( _pTypes->GetObject(nPos)->nId == pDef->GetSlotId() ) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir DBG_ASSERT( rTypeId == _pTypes->GetObject(nPos)->nType, 162*cdf0e10cSrcweir "same slot id with unequal item types" ); 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir else if ( _pTypes->GetObject(nPos)->nId > pDef->GetSlotId() ) 165*cdf0e10cSrcweir break; 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir if ( nPos >= _pTypes->Count() || 168*cdf0e10cSrcweir _pTypes->GetObject(nPos)->nId > pDef->GetSlotId() ) 169*cdf0e10cSrcweir _pTypes->Append( new SfxSlotType_Impl( pDef->GetSlotId(), rTypeId ) ); 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir #endif 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir //==================================================================== 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir TypeId SfxSlotPool::GetSlotType( sal_uInt16 nId ) const 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir const SfxSlot* pSlot = (const_cast <SfxSlotPool*> (this))->GetSlot( nId ); 180*cdf0e10cSrcweir return pSlot ? pSlot->GetType()->Type() : 0; 181*cdf0e10cSrcweir /* 182*cdf0e10cSrcweir for ( sal_uInt16 nPos = 0; nPos < _pTypes->Count(); ++nPos ) 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir if ( _pTypes->GetObject(nPos)->nId == nId ) 185*cdf0e10cSrcweir return _pTypes->GetObject(nPos)->nType; 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir return _pParentPool ? _pParentPool->GetSlotType( nId ) : 0; 188*cdf0e10cSrcweir */ 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir //==================================================================== 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir // unregisters the availability of the Interface of functions 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir void SfxSlotPool::ReleaseInterface( SfxInterface& rInterface ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir DBG_MEMTEST(); 198*cdf0e10cSrcweir DBG_ASSERT( _pInterfaces, "releasing SfxInterface, but there are none" ); 199*cdf0e10cSrcweir // remove from the list of SfxInterface instances 200*cdf0e10cSrcweir _pInterfaces->Remove(&rInterface); 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir //-------------------------------------------------------------------- 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir // get the first SfxMessage for a special Id (e.g. for getting check-mode) 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir const SfxSlot* SfxSlotPool::GetSlot( sal_uInt16 nId ) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir DBG_MEMTEST(); 210*cdf0e10cSrcweir DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir // Zun"achst die eigenen Interfaces absuchen 213*cdf0e10cSrcweir for ( sal_uInt16 nInterf = 0; nInterf < _pInterfaces->Count(); ++nInterf ) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir const SfxSlot *pDef = _pInterfaces->GetObject(nInterf)->GetSlot(nId); 216*cdf0e10cSrcweir if ( pDef ) 217*cdf0e10cSrcweir return pDef; 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir // Dann beim eventuell vorhandenen parent versuchen 221*cdf0e10cSrcweir return _pParentPool ? _pParentPool->GetSlot( nId ) : 0; 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir //-------------------------------------------------------------------- 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir // skips to the next group 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir String SfxSlotPool::SeekGroup( sal_uInt16 nNo ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir DBG_MEMTEST(); 231*cdf0e10cSrcweir DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir // if the group exists, use it 234*cdf0e10cSrcweir if ( _pGroups && nNo < _pGroups->Count() ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir _nCurGroup = nNo; 237*cdf0e10cSrcweir if ( _pParentPool ) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir // Meistens stimmt die Reihenfolge der Ids "uberein 240*cdf0e10cSrcweir sal_uInt16 nParentCount = _pParentPool->_pGroups->Count(); 241*cdf0e10cSrcweir if ( nNo < nParentCount && (*_pGroups)[nNo] == (*_pParentPool->_pGroups)[nNo] ) 242*cdf0e10cSrcweir _pParentPool->_nCurGroup = nNo; 243*cdf0e10cSrcweir else 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir // Ansonsten mu\s gesucht werden 246*cdf0e10cSrcweir // Wenn die Gruppe im parent pool nicht gefunden wird, wird 247*cdf0e10cSrcweir // _nCurGroup au\serhalb des g"ultigen Bereiches gesetzt 248*cdf0e10cSrcweir sal_uInt16 i; 249*cdf0e10cSrcweir for ( i=1; i<nParentCount; i++ ) 250*cdf0e10cSrcweir if ( (*_pGroups)[nNo] == (*_pParentPool->_pGroups)[i] ) 251*cdf0e10cSrcweir break; 252*cdf0e10cSrcweir _pParentPool->_nCurGroup = i; 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir SfxResId aResId( (*_pGroups)[_nCurGroup] ); 257*cdf0e10cSrcweir aResId.SetRT(RSC_STRING); 258*cdf0e10cSrcweir if ( !aResId.GetResMgr()->IsAvailable(aResId) ) 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir DBG_ERROR( "GroupId-Name nicht im SFX definiert!" ); 261*cdf0e10cSrcweir return String(); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir return String( aResId ); 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir return String(); 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir //-------------------------------------------------------------------- 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir sal_uInt16 SfxSlotPool::GetGroupCount() 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir return _pGroups->Count(); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir //-------------------------------------------------------------------- 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir // internal search loop 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir const SfxSlot* SfxSlotPool::SeekSlot( sal_uInt16 nStartInterface ) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir DBG_MEMTEST(); 286*cdf0e10cSrcweir DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir // Die Numerierung der interfaces startet beim parent pool 289*cdf0e10cSrcweir sal_uInt16 nFirstInterface = _pParentPool ? _pParentPool->_pInterfaces->Count() : 0; 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir // sind wir am Ende des Parent-Pools angekommen? 292*cdf0e10cSrcweir if ( nStartInterface < nFirstInterface && 293*cdf0e10cSrcweir _pParentPool->_nCurGroup >= _pParentPool->_pGroups->Count() ) 294*cdf0e10cSrcweir nStartInterface = nFirstInterface; 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir // liegt das Interface noch im Parent-Pool? 297*cdf0e10cSrcweir if ( nStartInterface < nFirstInterface ) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir DBG_ASSERT( _pParentPool, "Kein parent pool!" ); 300*cdf0e10cSrcweir _nCurInterface = nStartInterface; 301*cdf0e10cSrcweir return _pParentPool->SeekSlot( nStartInterface ); 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir // find the first func-def with the current group id 305*cdf0e10cSrcweir sal_uInt16 nCount = _pInterfaces->Count() + nFirstInterface; 306*cdf0e10cSrcweir for ( _nCurInterface = nStartInterface; 307*cdf0e10cSrcweir _nCurInterface < nCount; 308*cdf0e10cSrcweir ++_nCurInterface ) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir SfxInterface* pInterface = (*_pInterfaces)[_nCurInterface-nFirstInterface]; 311*cdf0e10cSrcweir for ( _nCurMsg = 0; 312*cdf0e10cSrcweir _nCurMsg < pInterface->Count(); 313*cdf0e10cSrcweir ++_nCurMsg ) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir const SfxSlot* pMsg = (*pInterface)[_nCurMsg]; 316*cdf0e10cSrcweir if ( pMsg->GetGroupId() == _pGroups->GetObject(_nCurGroup) ) 317*cdf0e10cSrcweir return pMsg; 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir return 0; 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir //-------------------------------------------------------------------- 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir // skips to the next func in the current group 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir const SfxSlot* SfxSlotPool::NextSlot() 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir DBG_MEMTEST(); 331*cdf0e10cSrcweir DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir // Die Numerierung der interfaces startet beim parent pool 334*cdf0e10cSrcweir sal_uInt16 nFirstInterface = _pParentPool ? _pParentPool->_pInterfaces->Count() : 0; 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir if ( _nCurInterface < nFirstInterface && _nCurGroup >= _pParentPool->_pGroups->Count() ) 337*cdf0e10cSrcweir _nCurInterface = nFirstInterface; 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir if ( _nCurInterface < nFirstInterface ) 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir DBG_ASSERT( _pParentPool, "Kein parent pool!" ); 342*cdf0e10cSrcweir const SfxSlot *pSlot = _pParentPool->NextSlot(); 343*cdf0e10cSrcweir _nCurInterface = _pParentPool->_nCurInterface; 344*cdf0e10cSrcweir if ( pSlot ) 345*cdf0e10cSrcweir return pSlot; 346*cdf0e10cSrcweir if ( _nCurInterface == nFirstInterface ) 347*cdf0e10cSrcweir // parent pool ist fertig 348*cdf0e10cSrcweir return SeekSlot( nFirstInterface ); 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir sal_uInt16 nInterface = _nCurInterface - nFirstInterface; 352*cdf0e10cSrcweir // possibly we are already at the end 353*cdf0e10cSrcweir if ( nInterface >= _pInterfaces->Count() ) 354*cdf0e10cSrcweir return 0; 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir // look for further matching func-defs within the same Interface 357*cdf0e10cSrcweir SfxInterface* pInterface = (*_pInterfaces)[nInterface]; 358*cdf0e10cSrcweir while ( ++_nCurMsg < pInterface->Count() ) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir SfxSlot* pMsg = (*pInterface)[_nCurMsg]; 361*cdf0e10cSrcweir if ( pMsg->GetGroupId() == _pGroups->GetObject(_nCurGroup) ) 362*cdf0e10cSrcweir return pMsg; 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir return SeekSlot(++_nCurInterface ); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir //-------------------------------------------------------------------- 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir // SlotName erfragen, gfs. mit HilfeText 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir //-------------------------------------------------------------------- 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir SfxInterface* SfxSlotPool::FirstInterface() 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir _nCurInterface = 0; 378*cdf0e10cSrcweir if ( !_pInterfaces || !_pInterfaces->Count() ) 379*cdf0e10cSrcweir return 0; 380*cdf0e10cSrcweir return _pParentPool ? _pParentPool->FirstInterface() : (*_pInterfaces)[0]; 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir //-------------------------------------------------------------------- 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir SfxInterface* SfxSlotPool::NextInterface() 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir _nCurInterface++; 389*cdf0e10cSrcweir sal_uInt16 nFirstInterface = _pParentPool ? _pParentPool->_pInterfaces->Count() : 0; 390*cdf0e10cSrcweir if ( _nCurInterface < nFirstInterface ) 391*cdf0e10cSrcweir return (*_pParentPool->_pInterfaces)[_nCurInterface]; 392*cdf0e10cSrcweir sal_uInt16 nInterface = _nCurInterface - nFirstInterface; 393*cdf0e10cSrcweir return nInterface < _pInterfaces->Count() ? (*_pInterfaces)[nInterface] : 0; 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir const SfxSlot* SfxSlotPool::GetUnoSlot( const String& rName ) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir const SfxSlot *pSlot = NULL; 399*cdf0e10cSrcweir for ( sal_uInt16 nInterface=0; nInterface<_pInterfaces->Count(); nInterface++ ) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir pSlot = (*_pInterfaces)[nInterface]->GetSlot( rName ); 402*cdf0e10cSrcweir if ( pSlot ) 403*cdf0e10cSrcweir break; 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir if ( !pSlot && _pParentPool ) 407*cdf0e10cSrcweir pSlot = _pParentPool->GetUnoSlot( rName ); 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir return pSlot; 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir SfxSlotPool& SfxSlotPool::GetSlotPool( SfxViewFrame *pFrame ) 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir SfxModule *pMod = SfxModule::GetActiveModule( pFrame ); 415*cdf0e10cSrcweir if ( pMod && pMod->GetSlotPool() ) 416*cdf0e10cSrcweir return *pMod->GetSlotPool(); 417*cdf0e10cSrcweir else 418*cdf0e10cSrcweir return *SFX_APP()->Get_Impl()->pSlotPool; 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir 422