diff options
Diffstat (limited to 'sfx2/source/control/msgpool.cxx')
-rwxr-xr-x[-rw-r--r--] | sfx2/source/control/msgpool.cxx | 81 |
1 files changed, 20 insertions, 61 deletions
diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx index 9cda943c8509..b2afa3dc1e22 100644..100755 --- a/sfx2/source/control/msgpool.cxx +++ b/sfx2/source/control/msgpool.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,10 +30,8 @@ #include "precompiled_sfx2.hxx" #include <tools/stream.hxx> #include <rsc/rscsfx.hxx> -#ifndef GCC -#endif -// wg. pSlotPool +// due to pSlotPool #include "appdata.hxx" #include <sfx2/msgpool.hxx> #include <sfx2/minarray.hxx> @@ -48,13 +47,6 @@ //==================================================================== -struct SfxSIDRegistration_Impl -{ - String _aGroup; - String _aName; - sal_uInt16 _nSID; -}; - struct SfxSlotType_Impl { sal_uInt16 nId; @@ -105,7 +97,6 @@ SfxSlotPool::~SfxSlotPool() } //==================================================================== - // registers the availability of the Interface of functions void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) @@ -117,8 +108,8 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) _pInterfaces = new SfxInterfaceArr_Impl; _pInterfaces->Append(&rInterface); - // bei einem (einzelnen) Null-Slot abbrechen (aus syntaktischen Gr"unden - // enthalten interfaces immer mindestens einen Slot) + // Stop at a (single) Null-slot (for syntactic reasons the interfaces + // always contain at least one slot) if ( rInterface.Count() == 1 && !rInterface[0]->nSlotId ) return; @@ -129,7 +120,7 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) if ( _pParentPool ) { - // Die Groups im parent Slotpool sind auch hier bekannt + // The Groups in parent Slotpool are also known here SfxSlotGroupArr_Impl& rGroups = *_pParentPool->_pGroups; for ( sal_uInt16 n=0; n<rGroups.Count(); n++ ) _pGroups->Append( rGroups[n] ); @@ -149,26 +140,6 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) else _pGroups->Append(pDef->GetGroupId()); } -#if 0 - const TypeId &rTypeId = pDef->GetType()->Type(); - if ( /*rTypeId != TYPE(SfxVoidItem) &&*/ rTypeId != 0 ) - { - sal_uInt16 nPos; - for ( nPos = 0; nPos < _pTypes->Count(); ++nPos ) - { - if ( _pTypes->GetObject(nPos)->nId == pDef->GetSlotId() ) - { - DBG_ASSERT( rTypeId == _pTypes->GetObject(nPos)->nType, - "same slot id with unequal item types" ); - } - else if ( _pTypes->GetObject(nPos)->nId > pDef->GetSlotId() ) - break; - } - if ( nPos >= _pTypes->Count() || - _pTypes->GetObject(nPos)->nId > pDef->GetSlotId() ) - _pTypes->Append( new SfxSlotType_Impl( pDef->GetSlotId(), rTypeId ) ); - } -#endif } } @@ -178,18 +149,9 @@ TypeId SfxSlotPool::GetSlotType( sal_uInt16 nId ) const { const SfxSlot* pSlot = (const_cast <SfxSlotPool*> (this))->GetSlot( nId ); return pSlot ? pSlot->GetType()->Type() : 0; -/* - for ( sal_uInt16 nPos = 0; nPos < _pTypes->Count(); ++nPos ) - { - if ( _pTypes->GetObject(nPos)->nId == nId ) - return _pTypes->GetObject(nPos)->nType; - } - return _pParentPool ? _pParentPool->GetSlotType( nId ) : 0; - */ } //==================================================================== - // unregisters the availability of the Interface of functions void SfxSlotPool::ReleaseInterface( SfxInterface& rInterface ) @@ -209,7 +171,7 @@ const SfxSlot* SfxSlotPool::GetSlot( sal_uInt16 nId ) DBG_MEMTEST(); DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); - // Zun"achst die eigenen Interfaces absuchen + // First, search their own interfaces for ( sal_uInt16 nInterf = 0; nInterf < _pInterfaces->Count(); ++nInterf ) { const SfxSlot *pDef = _pInterfaces->GetObject(nInterf)->GetSlot(nId); @@ -217,7 +179,7 @@ const SfxSlot* SfxSlotPool::GetSlot( sal_uInt16 nId ) return pDef; } - // Dann beim eventuell vorhandenen parent versuchen + // Then try any of the possible existing parent return _pParentPool ? _pParentPool->GetSlot( nId ) : 0; } @@ -236,15 +198,14 @@ String SfxSlotPool::SeekGroup( sal_uInt16 nNo ) _nCurGroup = nNo; if ( _pParentPool ) { - // Meistens stimmt die Reihenfolge der Ids "uberein + // In most cases, the order of the IDs agree sal_uInt16 nParentCount = _pParentPool->_pGroups->Count(); if ( nNo < nParentCount && (*_pGroups)[nNo] == (*_pParentPool->_pGroups)[nNo] ) _pParentPool->_nCurGroup = nNo; else { - // Ansonsten mu\s gesucht werden - // Wenn die Gruppe im parent pool nicht gefunden wird, wird - // _nCurGroup au\serhalb des g"ultigen Bereiches gesetzt + // Otherwise search. If the group is not found in the parent + // pool, _nCurGroup is set outside the valid range sal_uInt16 i; for ( i=1; i<nParentCount; i++ ) if ( (*_pGroups)[nNo] == (*_pParentPool->_pGroups)[i] ) @@ -257,7 +218,7 @@ String SfxSlotPool::SeekGroup( sal_uInt16 nNo ) aResId.SetRT(RSC_STRING); if ( !aResId.GetResMgr()->IsAvailable(aResId) ) { - DBG_ERROR( "GroupId-Name nicht im SFX definiert!" ); + OSL_FAIL( "GroupId-Name not defined in SFX!" ); return String(); } @@ -285,18 +246,18 @@ const SfxSlot* SfxSlotPool::SeekSlot( sal_uInt16 nStartInterface ) DBG_MEMTEST(); DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); - // Die Numerierung der interfaces startet beim parent pool + // The numbering starts at the interfaces of the parent pool sal_uInt16 nFirstInterface = _pParentPool ? _pParentPool->_pInterfaces->Count() : 0; - // sind wir am Ende des Parent-Pools angekommen? + // have reached the end of the Parent-Pools? if ( nStartInterface < nFirstInterface && _pParentPool->_nCurGroup >= _pParentPool->_pGroups->Count() ) nStartInterface = nFirstInterface; - // liegt das Interface noch im Parent-Pool? + // Is the Interface still in the Parent-Pool? if ( nStartInterface < nFirstInterface ) { - DBG_ASSERT( _pParentPool, "Kein parent pool!" ); + DBG_ASSERT( _pParentPool, "No parent pool!" ); _nCurInterface = nStartInterface; return _pParentPool->SeekSlot( nStartInterface ); } @@ -322,7 +283,6 @@ const SfxSlot* SfxSlotPool::SeekSlot( sal_uInt16 nStartInterface ) } //-------------------------------------------------------------------- - // skips to the next func in the current group const SfxSlot* SfxSlotPool::NextSlot() @@ -330,7 +290,7 @@ const SfxSlot* SfxSlotPool::NextSlot() DBG_MEMTEST(); DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); - // Die Numerierung der interfaces startet beim parent pool + // The numbering starts at the interfaces of the parent pool sal_uInt16 nFirstInterface = _pParentPool ? _pParentPool->_pInterfaces->Count() : 0; if ( _nCurInterface < nFirstInterface && _nCurGroup >= _pParentPool->_pGroups->Count() ) @@ -338,13 +298,13 @@ const SfxSlot* SfxSlotPool::NextSlot() if ( _nCurInterface < nFirstInterface ) { - DBG_ASSERT( _pParentPool, "Kein parent pool!" ); + DBG_ASSERT( _pParentPool, "No parent pool!" ); const SfxSlot *pSlot = _pParentPool->NextSlot(); _nCurInterface = _pParentPool->_nCurInterface; if ( pSlot ) return pSlot; if ( _nCurInterface == nFirstInterface ) - // parent pool ist fertig + // parent pool is ready return SeekSlot( nFirstInterface ); } @@ -367,9 +327,7 @@ const SfxSlot* SfxSlotPool::NextSlot() //-------------------------------------------------------------------- - -// SlotName erfragen, gfs. mit HilfeText - +// Query SlotName with help text //-------------------------------------------------------------------- SfxInterface* SfxSlotPool::FirstInterface() @@ -419,3 +377,4 @@ SfxSlotPool& SfxSlotPool::GetSlotPool( SfxViewFrame *pFrame ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |