summaryrefslogtreecommitdiff
path: root/linguistic/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-01-19 19:45:45 +0200
committerNoel Grandin <noel@peralex.com>2016-01-25 08:52:03 +0200
commit752cd07d085ac0aadc99bd512d49072843139032 (patch)
tree21ff2f55761b34bfdd721b5e1ed43333e8874e46 /linguistic/source
parent0e7cd653ea90da388820220bf6a3eb140b57bbd6 (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')
-rw-r--r--linguistic/source/convdic.cxx8
-rw-r--r--linguistic/source/convdic.hxx4
-rw-r--r--linguistic/source/convdiclist.hxx2
-rw-r--r--linguistic/source/dicimp.cxx8
-rw-r--r--linguistic/source/dicimp.hxx4
-rw-r--r--linguistic/source/dlistimp.cxx10
-rw-r--r--linguistic/source/dlistimp.hxx2
-rw-r--r--linguistic/source/gciterator.hxx4
-rw-r--r--linguistic/source/lngopt.hxx3
-rw-r--r--linguistic/source/lngprophelp.cxx8
-rw-r--r--linguistic/source/lngsvcmgr.cxx30
-rw-r--r--linguistic/source/lngsvcmgr.hxx4
12 files changed, 23 insertions, 64 deletions
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index d04e4f166f2c..e78127c97ff2 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -618,13 +618,7 @@ void SAL_CALL ConvDic::flush( )
// notify listeners
EventObject aEvtObj;
aEvtObj.Source = uno::Reference< XFlushable >( this );
- cppu::OInterfaceIteratorHelper aIt( aFlushListeners );
- while (aIt.hasMoreElements())
- {
- uno::Reference< util::XFlushListener > xRef( aIt.next(), UNO_QUERY );
- if (xRef.is())
- xRef->flushed( aEvtObj );
- }
+ aFlushListeners.notifyEach( &util::XFlushListener::flushed, aEvtObj );
}
diff --git a/linguistic/source/convdic.hxx b/linguistic/source/convdic.hxx
index 4a3a0e45342c..fe5585bc6de0 100644
--- a/linguistic/source/convdic.hxx
+++ b/linguistic/source/convdic.hxx
@@ -24,7 +24,7 @@
#include <com/sun/star/util/XFlushable.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/interfacecontainer.h>
+#include <comphelper/interfacecontainer2.hxx>
#include <memory>
#include <set>
@@ -79,7 +79,7 @@ class ConvDic :
protected:
- ::cppu::OInterfaceContainerHelper aFlushListeners;
+ ::comphelper::OInterfaceContainerHelper2 aFlushListeners;
ConvMap aFromLeft;
std::unique_ptr< ConvMap > pFromRight; // only available for bidirectional conversion dictionaries
diff --git a/linguistic/source/convdiclist.hxx b/linguistic/source/convdiclist.hxx
index dd02dee99340..ffa0ea5dd37a 100644
--- a/linguistic/source/convdiclist.hxx
+++ b/linguistic/source/convdiclist.hxx
@@ -52,7 +52,7 @@ class ConvDicList :
};
- ::cppu::OInterfaceContainerHelper aEvtListeners;
+ ::comphelper::OInterfaceContainerHelper2 aEvtListeners;
ConvDicNameContainer *pNameContainer;
css::uno::Reference<
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index cabbc3fe8a38..25311be0a06c 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -501,13 +501,7 @@ void DictionaryNeo::launchEvent(sal_Int16 nEvent,
aEvt.nEvent = nEvent;
aEvt.xDictionaryEntry = xEntry;
- cppu::OInterfaceIteratorHelper aIt( aDicEvtListeners );
- while (aIt.hasMoreElements())
- {
- uno::Reference< XDictionaryEventListener > xRef( aIt.next(), UNO_QUERY );
- if (xRef.is())
- xRef->processDictionaryEvent( aEvt );
- }
+ aDicEvtListeners.notifyEach( &XDictionaryEventListener::processDictionaryEvent, aEvt);
}
int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index e443d901273a..6b5ca473d8b4 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -25,7 +25,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/interfacecontainer.h>
+#include <comphelper/interfacecontainer2.hxx>
#include <tools/solar.h>
#include "defs.hxx"
@@ -43,7 +43,7 @@ class DictionaryNeo :
>
{
- ::cppu::OInterfaceContainerHelper aDicEvtListeners;
+ ::comphelper::OInterfaceContainerHelper2 aDicEvtListeners;
css::uno::Sequence< css::uno::Reference< css::linguistic2::XDictionaryEntry > >
aEntries;
OUString aDicName;
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 147ff86056f6..020eaf782c66 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -66,7 +66,7 @@ class DicEvtListenerHelper :
XDictionaryEventListener
>
{
- cppu::OInterfaceContainerHelper aDicListEvtListeners;
+ comphelper::OInterfaceContainerHelper2 aDicListEvtListeners;
uno::Sequence< DictionaryEvent > aCollectDicEvt;
uno::Reference< XDictionaryList > xMyDicList;
@@ -254,13 +254,7 @@ sal_Int16 DicEvtListenerHelper::FlushEvents()
DictionaryListEvent aEvent( xMyDicList, nCondensedEvt, aDicEvents );
// pass on event
- cppu::OInterfaceIteratorHelper aIt( aDicListEvtListeners );
- while (aIt.hasMoreElements())
- {
- uno::Reference< XDictionaryListEventListener > xRef( aIt.next(), UNO_QUERY );
- if (xRef.is())
- xRef->processDictionaryListEvent( aEvent );
- }
+ aDicListEvtListeners.notifyEach( &XDictionaryListEventListener::processDictionaryListEvent, aEvent );
// clear "list" of events
nCondensedEvt = 0;
diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx
index 25ad796bc815..42c395ec4745 100644
--- a/linguistic/source/dlistimp.hxx
+++ b/linguistic/source/dlistimp.hxx
@@ -54,7 +54,7 @@ class DicList :
LinguOptions aOpt;
- ::cppu::OInterfaceContainerHelper aEvtListeners;
+ ::comphelper::OInterfaceContainerHelper2 aEvtListeners;
typedef std::vector< css::uno::Reference< css::linguistic2::XDictionary > > DictionaryVec_t;
DictionaryVec_t aDicList;
diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx
index a93957931fb1..a00618da3eac 100644
--- a/linguistic/source/gciterator.hxx
+++ b/linguistic/source/gciterator.hxx
@@ -114,8 +114,8 @@ class GrammarCheckingIterator:
//! beware of initilization order !
struct MyMutex : public rtl::Static< osl::Mutex, MyMutex > {};
- cppu::OInterfaceContainerHelper m_aEventListeners;
- cppu::OInterfaceContainerHelper m_aNotifyListeners;
+ comphelper::OInterfaceContainerHelper2 m_aEventListeners;
+ comphelper::OInterfaceContainerHelper2 m_aNotifyListeners;
css::uno::Reference< css::i18n::XBreakIterator > m_xBreakIterator;
mutable css::uno::Reference< css::util::XChangesBatch > m_xUpdateAccess;
diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx
index 13a705d9fc9c..bec8f1004500 100644
--- a/linguistic/source/lngopt.hxx
+++ b/linguistic/source/lngopt.hxx
@@ -22,6 +22,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/interfacecontainer2.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
@@ -76,7 +77,7 @@ class LinguProps :
css::lang::XServiceInfo
>
{
- ::cppu::OInterfaceContainerHelper aEvtListeners;
+ ::comphelper::OInterfaceContainerHelper2 aEvtListeners;
OPropertyListenerContainerHelper aPropListeners;
SfxItemPropertyMap aPropertyMap;
diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx
index 097756c7b0ac..9dc4588cba40 100644
--- a/linguistic/source/lngprophelp.cxx
+++ b/linguistic/source/lngprophelp.cxx
@@ -254,13 +254,7 @@ void PropertyChgHelper::RemoveAsPropListener()
void PropertyChgHelper::LaunchEvent( const LinguServiceEvent &rEvt )
{
- cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtListeners );
- while (aIt.hasMoreElements())
- {
- Reference< XLinguServiceEventListener > xRef( aIt.next(), UNO_QUERY );
- if (xRef.is())
- xRef->processLinguServiceEvent( rEvt );
- }
+ aLngSvcEvtListeners.notifyEach( &XLinguServiceEventListener::processLinguServiceEvent, rEvt );
}
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 );
diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx
index 0eee0605eddd..27a7aa86a038 100644
--- a/linguistic/source/lngsvcmgr.hxx
+++ b/linguistic/source/lngsvcmgr.hxx
@@ -21,7 +21,7 @@
#define INCLUDED_LINGUISTIC_SOURCE_LNGSVCMGR_HXX
#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/interfacecontainer.h>
+#include <comphelper/interfacecontainer2.hxx>
#include <com/sun/star/uno/Reference.h>
@@ -66,7 +66,7 @@ class LngSvcMgr :
{
friend class LngSvcMgrListenerHelper;
- ::cppu::OInterfaceContainerHelper aEvtListeners;
+ ::comphelper::OInterfaceContainerHelper2 aEvtListeners;
css::uno::Reference<
css::linguistic2::XSpellChecker > xSpellDsp;