[Libreoffice-commits] .: unotools/inc unotools/source

Joseph Powers jpowers at kemper.freedesktop.org
Wed Feb 16 07:15:09 PST 2011


 unotools/inc/unotools/options.hxx  |    5 +++--
 unotools/source/config/options.cxx |   31 ++++++++++++++++++-------------
 2 files changed, 21 insertions(+), 15 deletions(-)

New commits:
commit 165c3e24b85267b484b601e5054fd493092e78df
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Wed Feb 16 07:15:00 2011 -0800

    Remove DECLARE_LIST( IMPL_ConfigurationListenerList, ConfigurationListener* )

diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx
index 5028ef8..dd44ba9 100644
--- a/unotools/inc/unotools/options.hxx
+++ b/unotools/inc/unotools/options.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -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 d9d2a7b..5eee90d 100644
--- a/unotools/source/config/options.cxx
+++ b/unotools/source/config/options.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -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 );
+            }
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list