diff options
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/inc/unotools/options.hxx | 3 | ||||
-rw-r--r-- | unotools/source/config/options.cxx | 29 |
2 files changed, 19 insertions, 13 deletions
diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx index 56f877e03fe7..d743e9571524 100644 --- a/unotools/inc/unotools/options.hxx +++ b/unotools/inc/unotools/options.hxx @@ -31,6 +31,7 @@ #include "sal/config.h" #include "unotools/unotoolsdllapi.h" +#include <vector> /* The class utl::detail::Options provides a kind of multiplexer. It implements a ConfigurationListener @@ -44,7 +45,6 @@ namespace utl { class ConfigurationBroadcaster; - class IMPL_ConfigurationListenerList; // interface for configuration listener class UNOTOOLS_DLLPUBLIC ConfigurationListener @@ -52,6 +52,7 @@ namespace utl { public: virtual void ConfigurationChanged( ConfigurationBroadcaster* p, sal_uInt32 nHint=0 ) = 0; }; + typedef ::std::vector< ConfigurationListener* > IMPL_ConfigurationListenerList; // complete broadcasting implementation class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx index e8b5ad40bebd..5eee90dd28d9 100644 --- a/unotools/source/config/options.cxx +++ b/unotools/source/config/options.cxx @@ -30,14 +30,8 @@ #include "precompiled_unotools.hxx" #include "sal/config.h" -#include <tools/list.hxx> #include <unotools/options.hxx> -namespace utl -{ - DECLARE_LIST( IMPL_ConfigurationListenerList, ConfigurationListener* ) -} - using utl::detail::Options; using utl::ConfigurationBroadcaster; @@ -57,13 +51,22 @@ void ConfigurationBroadcaster::AddListener( utl::ConfigurationListener* pListene { if ( !mpList ) mpList = new IMPL_ConfigurationListenerList; - mpList->Insert( pListener ); + mpList->push_back( pListener ); } void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener* pListener ) { - if ( mpList ) - mpList->Remove( pListener ); + if ( mpList ) { + for ( IMPL_ConfigurationListenerList::iterator it = mpList->begin(); + it < mpList->end(); + ++it + ) { + if ( *it == pListener ) { + mpList->erase( it ); + break; + } + } + } } void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint ) @@ -74,9 +77,11 @@ void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint ) { nHint |= m_nBlockedHint; m_nBlockedHint = 0; - if ( mpList ) - for ( sal_uInt32 n=0; n<mpList->Count(); n++ ) - mpList->GetObject(n)->ConfigurationChanged( this, nHint ); + if ( mpList ) { + for ( size_t n = 0; n < mpList->size(); n++ ) { + (*mpList)[ n ]->ConfigurationChanged( this, nHint ); + } + } } } |