diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-01-19 19:45:45 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-01-25 08:52:03 +0200 |
commit | 752cd07d085ac0aadc99bd512d49072843139032 (patch) | |
tree | 21ff2f55761b34bfdd721b5e1ed43333e8874e46 /linguistic/source/lngsvcmgr.cxx | |
parent | 0e7cd653ea90da388820220bf6a3eb140b57bbd6 (diff) |
InterfaceContainer2 with vector instead of Sequence
create an InterfaceContainer2 class to replace InterfaceContainer.
It uses a std::vector instead of a Sequence for the mutable listener
list, which provides far better performance.
Switch all our internal use-sites to the new class.
Change-Id: I6b56cfa511ded2395faa22e68fab3b2f16c3cb88
Diffstat (limited to 'linguistic/source/lngsvcmgr.cxx')
-rw-r--r-- | linguistic/source/lngsvcmgr.cxx | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 9c5919f11f47..c7a38ffe49a8 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -183,8 +183,8 @@ class LngSvcMgrListenerHelper : { LngSvcMgr &rMyManager; - ::cppu::OInterfaceContainerHelper aLngSvcMgrListeners; - ::cppu::OInterfaceContainerHelper aLngSvcEvtBroadcasters; + ::comphelper::OInterfaceContainerHelper2 aLngSvcMgrListeners; + ::comphelper::OInterfaceContainerHelper2 aLngSvcEvtBroadcasters; uno::Reference< linguistic2::XSearchableDictionaryList > xDicList; sal_Int16 nCombinedLngSvcEvt; @@ -276,13 +276,7 @@ void LngSvcMgrListenerHelper::Timeout() rMyManager.pSpellDsp->FlushSpellCache(); // pass event on to linguistic2::XLinguServiceEventListener's - cppu::OInterfaceIteratorHelper aIt( aLngSvcMgrListeners ); - while (aIt.hasMoreElements()) - { - uno::Reference< linguistic2::XLinguServiceEventListener > xRef( aIt.next(), uno::UNO_QUERY ); - if (xRef.is()) - xRef->processLinguServiceEvent( aEvtObj ); - } + aLngSvcMgrListeners.notifyEach( &linguistic2::XLinguServiceEventListener::processLinguServiceEvent, aEvtObj ); } } @@ -318,13 +312,7 @@ void SAL_CALL // we do keep the original event source here though... // pass event on to linguistic2::XDictionaryListEventListener's - cppu::OInterfaceIteratorHelper aIt( aLngSvcMgrListeners ); - while (aIt.hasMoreElements()) - { - uno::Reference< linguistic2::XDictionaryListEventListener > xRef( aIt.next(), uno::UNO_QUERY ); - if (xRef.is()) - xRef->processDictionaryListEvent( rDicListEvent ); - } + aLngSvcMgrListeners.notifyEach( &linguistic2::XDictionaryListEventListener::processDictionaryListEvent, rDicListEvent ); // "translate" DictionaryList event into linguistic2::LinguServiceEvent sal_Int16 nLngSvcEvt = 0; @@ -365,13 +353,7 @@ void LngSvcMgrListenerHelper::LaunchEvent( sal_Int16 nLngSvcEvtFlags ) static_cast<css::linguistic2::XLinguServiceManager*>(&rMyManager), nLngSvcEvtFlags ); // pass event on to linguistic2::XLinguServiceEventListener's - cppu::OInterfaceIteratorHelper aIt( aLngSvcMgrListeners ); - while (aIt.hasMoreElements()) - { - uno::Reference< linguistic2::XLinguServiceEventListener > xRef( aIt.next(), uno::UNO_QUERY ); - if (xRef.is()) - xRef->processLinguServiceEvent( aEvt ); - } + aLngSvcMgrListeners.notifyEach( &linguistic2::XLinguServiceEventListener::processLinguServiceEvent, aEvt ); } @@ -397,7 +379,7 @@ void LngSvcMgrListenerHelper::DisposeAndClear( const lang::EventObject &rEvtObj aLngSvcMgrListeners .disposeAndClear( rEvtObj ); // remove references to this object hold by the broadcasters - cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtBroadcasters ); + comphelper::OInterfaceIteratorHelper2 aIt( aLngSvcEvtBroadcasters ); while (aIt.hasMoreElements()) { uno::Reference< linguistic2::XLinguServiceEventBroadcaster > xRef( aIt.next(), uno::UNO_QUERY ); |