[PATCH] * Convert usages of SV_DECL_PTRARR_DEL to boost::ptr_vector * Make typedefs private to class ScTabViewObj * rename field aSelectionListeners to aSelectionChgListeners

Noel Grandin (none) noel at ubuntu.
Tue Feb 21 23:53:08 PST 2012


---
 sc/inc/viewuno.hxx              |   63 +++++++++---------
 sc/source/ui/unoobj/viewuno.cxx |  143 +++++++++++++++++---------------------
 2 files changed, 95 insertions(+), 111 deletions(-)

diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index 723cf89..cf867b7 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -51,38 +51,13 @@
 #include <com/sun/star/datatransfer/XTransferableSupplier.hpp>
 
 #include "address.hxx"
+#include "boost/ptr_container/ptr_vector.hpp"
 
 class ScTabViewShell;
 class ScPreviewShell;
 
 #define SC_VIEWPANE_ACTIVE  0xFFFF
 
-
-typedef ::com::sun::star::uno::Reference<
-            ::com::sun::star::sheet::XRangeSelectionListener >* XRangeSelectionListenerPtr;
-SV_DECL_PTRARR_DEL( XRangeSelectionListenerArr_Impl, XRangeSelectionListenerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference<
-            ::com::sun::star::sheet::XRangeSelectionChangeListener >* XRangeSelectionChangeListenerPtr;
-SV_DECL_PTRARR_DEL( XRangeSelectionChangeListenerArr_Impl, XRangeSelectionChangeListenerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference<
-            ::com::sun::star::view::XSelectionChangeListener >* XSelectionChangeListenerPtr;
-SV_DECL_PTRARR_DEL( XSelectionChangeListenerArr_Impl, XSelectionChangeListenerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference<
-            ::com::sun::star::beans::XPropertyChangeListener >* XViewPropertyChangeListenerPtr;
-SV_DECL_PTRARR_DEL( XViewPropertyChangeListenerArr_Impl, XViewPropertyChangeListenerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference<
-            ::com::sun::star::awt::XEnhancedMouseClickHandler >* XMouseClickHandlerPtr;
-SV_DECL_PTRARR_DEL( XMouseClickHandlerArr_Impl, XMouseClickHandlerPtr, 4 )
-
-typedef ::com::sun::star::uno::Reference<
-            ::com::sun::star::sheet::XActivationEventListener >* XActivationEventListenerPtr;
-SV_DECL_PTRARR_DEL( XActivationEventListenerArr_Impl, XActivationEventListenerPtr, 4 )
-
-
 //  ScViewPaneBase not derived from OWeakObject
 //  to avoid duplicate OWeakObject in ScTabViewObj
 
@@ -194,13 +169,37 @@ class ScTabViewObj : public ScViewPaneBase,
                      public com::sun::star::sheet::XSelectedSheetsSupplier
 {
 private:
+    typedef ::com::sun::star::uno::Reference<
+            ::com::sun::star::sheet::XRangeSelectionListener > XRangeSelectionListenerUnoRef;
+    typedef boost::ptr_vector<XRangeSelectionListenerUnoRef> XRangeSelectionListenerVector;
+
+    typedef ::com::sun::star::uno::Reference<
+            ::com::sun::star::sheet::XRangeSelectionChangeListener > XRangeSelectionChangeListenerUnoRef;
+    typedef boost::ptr_vector<XRangeSelectionChangeListenerUnoRef> XRangeSelectionChangeListenerVector;
+
+    typedef ::com::sun::star::uno::Reference<
+            ::com::sun::star::view::XSelectionChangeListener > XSelectionChangeListenerUnoRef;
+    typedef boost::ptr_vector<XSelectionChangeListenerUnoRef> XSelectionChangeListenerVector;
+
+    typedef ::com::sun::star::uno::Reference<
+            ::com::sun::star::beans::XPropertyChangeListener > XViewPropertyChangeListenerUnoRef;
+    typedef boost::ptr_vector<XViewPropertyChangeListenerUnoRef> XViewPropertyChangeListenerVector;
+
+    typedef ::com::sun::star::uno::Reference<
+            ::com::sun::star::awt::XEnhancedMouseClickHandler > XMouseClickHandlerUnoRef;
+    typedef boost::ptr_vector<XMouseClickHandlerUnoRef> XMouseClickHandlerVector;
+
+    typedef ::com::sun::star::uno::Reference<
+            ::com::sun::star::sheet::XActivationEventListener > XActivationEventListenerUnoRef;
+    typedef boost::ptr_vector<XActivationEventListenerUnoRef> XActivationEventListenerVector;
+
     SfxItemPropertySet                      aPropSet;
-    XSelectionChangeListenerArr_Impl        aSelectionListeners;
-    XRangeSelectionListenerArr_Impl         aRangeSelListeners;
-    XRangeSelectionChangeListenerArr_Impl   aRangeChgListeners;
-    XViewPropertyChangeListenerArr_Impl     aPropertyChgListeners;
-    XMouseClickHandlerArr_Impl              aMouseClickHandlers;
-    XActivationEventListenerArr_Impl        aActivationListeners;
+    XSelectionChangeListenerVector          aSelectionChgListeners;
+    XRangeSelectionListenerVector           aRangeSelListeners;
+    XRangeSelectionChangeListenerVector     aRangeChgListeners;
+    XViewPropertyChangeListenerVector       aPropertyChgListeners;
+    XMouseClickHandlerVector                aMouseClickHandlers;
+    XActivationEventListenerVector          aActivationListeners;
     SCTAB                                   nPreviousTab;
     sal_Bool                                bDrawSelModeSet;
     sal_Bool                                bFilteredRangeSelection;
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index e0b0c14..e61a2d7 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -76,6 +76,7 @@
 #include "scextopt.hxx"
 #include "preview.hxx"
 #include <svx/sdrhittesthelper.hxx>
+#include <boost/foreach.hpp>
 
 using namespace com::sun::star;
 
@@ -124,13 +125,6 @@ const SfxItemPropertyMapEntry* lcl_GetViewOptPropertyMap()
 
 //------------------------------------------------------------------------
 
-SV_IMPL_PTRARR( XRangeSelectionListenerArr_Impl, XRangeSelectionListenerPtr );
-SV_IMPL_PTRARR( XRangeSelectionChangeListenerArr_Impl, XRangeSelectionChangeListenerPtr );
-SV_IMPL_PTRARR( XSelectionChangeListenerArr_Impl, XSelectionChangeListenerPtr );
-SV_IMPL_PTRARR( XViewPropertyChangeListenerArr_Impl, XViewPropertyChangeListenerPtr );
-SV_IMPL_PTRARR( XMouseClickHandlerArr_Impl, XMouseClickHandlerPtr );
-SV_IMPL_PTRARR( XActivationEventListenerArr_Impl, XActivationEventListenerPtr );
-
 #define SCTABVIEWOBJ_SERVICE        "com.sun.star.sheet.SpreadsheetView"
 #define SCVIEWSETTINGS_SERVICE      "com.sun.star.sheet.SpreadsheetViewSettings"
 
@@ -588,12 +582,12 @@ ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) :
 ScTabViewObj::~ScTabViewObj()
 {
     //! Listening oder so
-    if (aMouseClickHandlers.Count())
+    if (!aMouseClickHandlers.empty())
     {
         acquire();
         EndMouseListening();
     }
-    if (aActivationListeners.Count())
+    if (!aActivationListeners.empty())
     {
         acquire();
         EndActivationListening();
@@ -677,23 +671,22 @@ void ScTabViewObj::SheetChanged( bool bSameTabButMoved )
 
     ScViewData* pViewData = GetViewShell()->GetViewData();
     ScDocShell* pDocSh = pViewData->GetDocShell();
-    if (aActivationListeners.Count() > 0)
+    if (!aActivationListeners.empty())
     {
         sheet::ActivationEvent aEvent;
         uno::Reference< sheet::XSpreadsheetView > xView(this);
         uno::Reference< uno::XInterface > xSource(xView, uno::UNO_QUERY);
         aEvent.Source = xSource;
         aEvent.ActiveSheet = new ScTableSheetObj(pDocSh, pViewData->GetTabNo());
-        for ( sal_uInt16 n=0; n<aActivationListeners.Count(); n++ )
+        for (XActivationEventListenerVector::iterator it = aActivationListeners.begin(); it != aActivationListeners.end(); ++it)
         {
             try
             {
-                (*aActivationListeners[n])->activeSpreadsheetChanged( aEvent );
+                (*it)->activeSpreadsheetChanged( aEvent );
             }
             catch( uno::Exception& )
             {
-                aActivationListeners.DeleteAndDestroy( n );
-                --n; // because it will be increased again in the loop
+                it = aActivationListeners.erase( it);
             }
         }
     }
@@ -1300,7 +1293,7 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP
 
 bool ScTabViewObj::IsMouseListening() const
 {
-    if ( aMouseClickHandlers.Count() > 0 )
+    if ( !aMouseClickHandlers.empty() )
         return true;
 
     // also include sheet events, because MousePressed must be called for them
@@ -1318,7 +1311,7 @@ sal_Bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
     sal_Bool bReturn(false);
 
     uno::Reference< uno::XInterface > xTarget = GetClickedObject(Point(e.X, e.Y));
-    if (aMouseClickHandlers.Count() && xTarget.is())
+    if (!aMouseClickHandlers.empty() && xTarget.is())
     {
         awt::EnhancedMouseEvent aMouseEvent;
 
@@ -1329,17 +1322,16 @@ sal_Bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
         aMouseEvent.PopupTrigger = e.PopupTrigger;
         aMouseEvent.Target = xTarget;
 
-        for ( sal_uInt16 n=0; n<aMouseClickHandlers.Count(); n++ )
+        for (XMouseClickHandlerVector::iterator it = aMouseClickHandlers.begin(); it != aMouseClickHandlers.end(); ++it)
         {
             try
             {
-                if (!(*aMouseClickHandlers[n])->mousePressed( aMouseEvent ))
+                if (!(*it)->mousePressed( aMouseEvent ))
                     bReturn = sal_True;
             }
             catch ( uno::Exception& )
             {
-                aMouseClickHandlers.DeleteAndDestroy(n);
-                --n; // because it will be increased again in the loop
+                it = aMouseClickHandlers.erase(it);
             }
         }
     }
@@ -1408,7 +1400,7 @@ sal_Bool ScTabViewObj::MouseReleased( const awt::MouseEvent& e )
 {
     sal_Bool bReturn(false);
 
-    if (aMouseClickHandlers.Count())
+    if (!aMouseClickHandlers.empty())
     {
         uno::Reference< uno::XInterface > xTarget = GetClickedObject(Point(e.X, e.Y));
 
@@ -1423,17 +1415,16 @@ sal_Bool ScTabViewObj::MouseReleased( const awt::MouseEvent& e )
             aMouseEvent.PopupTrigger = e.PopupTrigger;
             aMouseEvent.Target = xTarget;
 
-            for ( sal_uInt16 n=0; n<aMouseClickHandlers.Count(); n++ )
+            for (XMouseClickHandlerVector::iterator it = aMouseClickHandlers.begin(); it != aMouseClickHandlers.end(); ++it)
             {
                 try
                 {
-                    if (!(*aMouseClickHandlers[n])->mouseReleased( aMouseEvent ))
+                    if (!(*it)->mouseReleased( aMouseEvent ))
                         bReturn = sal_True;
                 }
                 catch ( uno::Exception& )
                 {
-                    aMouseClickHandlers.DeleteAndDestroy(n);
-                    --n; // because it will be increased again in the loop
+                    it = aMouseClickHandlers.erase(it);
                 }
             }
         }
@@ -1449,20 +1440,19 @@ void ScTabViewObj::StartMouseListening()
 
 void ScTabViewObj::EndMouseListening()
 {
-    sal_uInt16 nCount(aMouseClickHandlers.Count());
     lang::EventObject aEvent;
     aEvent.Source = (cppu::OWeakObject*)this;
-    for ( sal_uInt16 n=0; n<nCount; n++ )
+    BOOST_FOREACH(const XMouseClickHandlerUnoRef rListener, aMouseClickHandlers)
     {
         try
         {
-            (*aMouseClickHandlers[n])->disposing(aEvent);
+            rListener->disposing(aEvent);
         }
         catch ( uno::Exception& )
         {
         }
     }
-    aMouseClickHandlers.DeleteAndDestroy(0, nCount);
+    aMouseClickHandlers.clear();
 }
 
 void ScTabViewObj::StartActivationListening()
@@ -1471,20 +1461,19 @@ void ScTabViewObj::StartActivationListening()
 
 void ScTabViewObj::EndActivationListening()
 {
-    sal_uInt16 nCount = aActivationListeners.Count();
     lang::EventObject aEvent;
     aEvent.Source = (cppu::OWeakObject*)this;
-    for ( sal_uInt16 n=0; n<nCount; n++ )
+    BOOST_FOREACH(const XActivationEventListenerUnoRef rListener, aActivationListeners)
     {
         try
         {
-            (*aActivationListeners[n])->disposing(aEvent);
+            rListener->disposing(aEvent);
         }
         catch ( uno::Exception& )
         {
         }
     }
-    aActivationListeners.DeleteAndDestroy(0, nCount);
+    aActivationListeners.clear();
 }
 
 void SAL_CALL ScTabViewObj::addEnhancedMouseClickHandler( const uno::Reference< awt::XEnhancedMouseClickHandler >& aListener )
@@ -1494,12 +1483,12 @@ void SAL_CALL ScTabViewObj::addEnhancedMouseClickHandler( const uno::Reference<
 
     if (aListener.is())
     {
-        sal_uInt16 nCount = aMouseClickHandlers.Count();
+        sal_uInt16 nCount = aMouseClickHandlers.size();
         uno::Reference<awt::XEnhancedMouseClickHandler> *pObj =
                 new uno::Reference<awt::XEnhancedMouseClickHandler>( aListener );
-        aMouseClickHandlers.Insert( pObj, nCount );
+        aMouseClickHandlers.push_back( pObj );
 
-        if (aMouseClickHandlers.Count() == 1 && nCount == 0) // only if a listener added
+        if (aMouseClickHandlers.size() == 1 && nCount == 0) // only if a listener added
             StartMouseListening();
     }
 }
@@ -1508,14 +1497,14 @@ void SAL_CALL ScTabViewObj::removeEnhancedMouseClickHandler( const uno::Referenc
                                     throw (uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
-    sal_uInt16 nCount = aMouseClickHandlers.Count();
-    for ( sal_uInt16 n=nCount; n--; )
+    sal_uInt16 nCount = aMouseClickHandlers.size();
+    for (XMouseClickHandlerVector::iterator it = aMouseClickHandlers.begin(); it != aMouseClickHandlers.end(); ++it)
     {
-        uno::Reference<awt::XEnhancedMouseClickHandler> *pObj = aMouseClickHandlers[n];
+        uno::Reference<awt::XEnhancedMouseClickHandler> *pObj = &(*it);
         if ( *pObj == aListener )
-            aMouseClickHandlers.DeleteAndDestroy( n );
+            it = aMouseClickHandlers.erase(it);
     }
-    if ((aMouseClickHandlers.Count() == 0) && (nCount > 0)) // only if last listener removed
+    if ((aMouseClickHandlers.size() == 0) && (nCount > 0)) // only if last listener removed
         EndMouseListening();
 }
 
@@ -1528,12 +1517,12 @@ void SAL_CALL ScTabViewObj::addActivationEventListener( const uno::Reference< sh
 
     if (aListener.is())
     {
-        sal_uInt16 nCount = aActivationListeners.Count();
+        sal_uInt16 nCount = aActivationListeners.size();
         uno::Reference<sheet::XActivationEventListener> *pObj =
                 new uno::Reference<sheet::XActivationEventListener>( aListener );
-        aActivationListeners.Insert( pObj, nCount );
+        aActivationListeners.push_back( pObj );
 
-        if (aActivationListeners.Count() == 1 && nCount == 0) // only if a listener added
+        if (aActivationListeners.size() == 1 && nCount == 0) // only if a listener added
             StartActivationListening();
     }
 }
@@ -1542,14 +1531,14 @@ void SAL_CALL ScTabViewObj::removeActivationEventListener( const uno::Reference<
                                     throw (uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
-    sal_uInt16 nCount = aActivationListeners.Count();
-    for ( sal_uInt16 n=nCount; n--; )
+    sal_uInt16 nCount = aActivationListeners.size();
+    for (XActivationEventListenerVector::iterator it = aActivationListeners.begin(); it != aActivationListeners.end(); ++it)
     {
-        uno::Reference<sheet::XActivationEventListener> *pObj = aActivationListeners[n];
+        uno::Reference<sheet::XActivationEventListener> *pObj = &(*it);
         if ( *pObj == aListener )
-            aActivationListeners.DeleteAndDestroy( n );
+            it = aActivationListeners.erase(it);
     }
-    if ((aActivationListeners.Count() == 0) && (nCount > 0)) // only if last listener removed
+    if ((aActivationListeners.size() == 0) && (nCount > 0)) // only if last listener removed
         EndActivationListening();
 }
 
@@ -1824,7 +1813,7 @@ void SAL_CALL ScTabViewObj::addSelectionChangeListener(
     SolarMutexGuard aGuard;
     uno::Reference<view::XSelectionChangeListener>* pObj =
             new uno::Reference<view::XSelectionChangeListener>( xListener );
-    aSelectionListeners.Insert( pObj, aSelectionListeners.Count() );
+    aSelectionChgListeners.push_back( pObj );
 }
 
 void SAL_CALL ScTabViewObj::removeSelectionChangeListener(
@@ -1832,13 +1821,12 @@ void SAL_CALL ScTabViewObj::removeSelectionChangeListener(
                                                     throw(uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
-    sal_uInt16 nCount = aSelectionListeners.Count();
-    for ( sal_uInt16 n=nCount; n--; )
+    for (size_t i = aSelectionChgListeners.size(); i--; )
     {
-        uno::Reference<view::XSelectionChangeListener> *pObj = aSelectionListeners[n];
+        uno::Reference<view::XSelectionChangeListener> *pObj = &aSelectionChgListeners[i];
         if ( *pObj == xListener )       //! wozu der Mumpitz mit queryInterface?
         {
-            aSelectionListeners.DeleteAndDestroy( n );
+            aSelectionChgListeners.erase(aSelectionChgListeners.begin()+i);
             break;
         }
     }
@@ -1848,8 +1836,8 @@ void ScTabViewObj::SelectionChanged()
 {
     lang::EventObject aEvent;
     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
-    for ( sal_uInt16 n=0; n<aSelectionListeners.Count(); n++ )
-        (*aSelectionListeners[n])->selectionChanged( aEvent );
+    BOOST_FOREACH(const XSelectionChangeListenerUnoRef rListener, aSelectionChgListeners)
+        rListener->selectionChanged( aEvent );
 
     // handle sheet events
     ScTabViewShell* pViewSh = GetViewShell();
@@ -2082,7 +2070,7 @@ void SAL_CALL ScTabViewObj::addPropertyChangeListener( const ::rtl::OUString& /*
     SolarMutexGuard aGuard;
     uno::Reference<beans::XPropertyChangeListener>* pObj =
             new uno::Reference<beans::XPropertyChangeListener>( xListener );
-    aPropertyChgListeners.Insert( pObj, aPropertyChgListeners.Count() );
+    aPropertyChgListeners.push_back( pObj );
 }
 
 void SAL_CALL ScTabViewObj::removePropertyChangeListener( const ::rtl::OUString& /* aPropertyName */,
@@ -2092,13 +2080,12 @@ void SAL_CALL ScTabViewObj::removePropertyChangeListener( const ::rtl::OUString&
                                     uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
-    sal_uInt16 nCount = aPropertyChgListeners.Count();
-    for ( sal_uInt16 n=nCount; n--; )
+    for (size_t i = aPropertyChgListeners.size(); i--; )
     {
-        uno::Reference<beans::XPropertyChangeListener> *pObj = aPropertyChgListeners[n];
+        uno::Reference<beans::XPropertyChangeListener> *pObj = &aPropertyChgListeners[i];
         if ( *pObj == xListener )       //! wozu der Mumpitz mit queryInterface?
         {
-            aPropertyChgListeners.DeleteAndDestroy( n );
+            aPropertyChgListeners.erase(aPropertyChgListeners.begin() + i);
             break;
         }
     }
@@ -2124,8 +2111,8 @@ void ScTabViewObj::VisAreaChanged()
 {
     beans::PropertyChangeEvent aEvent;
     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
-    for ( sal_uInt16 n=0; n<aPropertyChgListeners.Count(); n++ )
-        (*aPropertyChgListeners[n])->propertyChange( aEvent );
+    BOOST_FOREACH(const XViewPropertyChangeListenerUnoRef rListener, aPropertyChgListeners)
+        rListener->propertyChange( aEvent );
 }
 
 // XRangeSelection
@@ -2188,7 +2175,7 @@ void SAL_CALL ScTabViewObj::addRangeSelectionListener(
     SolarMutexGuard aGuard;
     uno::Reference<sheet::XRangeSelectionListener>* pObj =
             new uno::Reference<sheet::XRangeSelectionListener>( xListener );
-    aRangeSelListeners.Insert( pObj, aRangeSelListeners.Count() );
+    aRangeSelListeners.push_back( pObj );
 }
 
 void SAL_CALL ScTabViewObj::removeRangeSelectionListener(
@@ -2196,13 +2183,12 @@ void SAL_CALL ScTabViewObj::removeRangeSelectionListener(
                                     throw(uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
-    sal_uInt16 nCount = aRangeSelListeners.Count();
-    for ( sal_uInt16 n=nCount; n--; )
+    for (size_t i = aRangeSelListeners.size(); i--; )
     {
-        uno::Reference<sheet::XRangeSelectionListener> *pObj = aRangeSelListeners[n];
+        uno::Reference<sheet::XRangeSelectionListener> *pObj = &aRangeSelListeners[i];
         if ( *pObj == xListener )
         {
-            aRangeSelListeners.DeleteAndDestroy( n );
+            aRangeSelListeners.erase(aRangeSelListeners.begin() + i);
             break;
         }
     }
@@ -2215,7 +2201,7 @@ void SAL_CALL ScTabViewObj::addRangeSelectionChangeListener(
     SolarMutexGuard aGuard;
     uno::Reference<sheet::XRangeSelectionChangeListener>* pObj =
             new uno::Reference<sheet::XRangeSelectionChangeListener>( xListener );
-    aRangeChgListeners.Insert( pObj, aRangeChgListeners.Count() );
+    aRangeChgListeners.push_back( pObj );
 }
 
 void SAL_CALL ScTabViewObj::removeRangeSelectionChangeListener(
@@ -2223,13 +2209,12 @@ void SAL_CALL ScTabViewObj::removeRangeSelectionChangeListener(
                                     throw(uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
-    sal_uInt16 nCount = aRangeChgListeners.Count();
-    for ( sal_uInt16 n=nCount; n--; )
+    for (size_t i = aRangeChgListeners.size(); i--; )
     {
-        uno::Reference<sheet::XRangeSelectionChangeListener> *pObj = aRangeChgListeners[n];
+        uno::Reference<sheet::XRangeSelectionChangeListener> *pObj = &aRangeChgListeners[i];
         if ( *pObj == xListener )
         {
-            aRangeChgListeners.DeleteAndDestroy( n );
+            aRangeChgListeners.erase(aRangeChgListeners.begin() + i);
             break;
         }
     }
@@ -2241,8 +2226,8 @@ void ScTabViewObj::RangeSelDone( const String& rText )
     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
     aEvent.RangeDescriptor = rtl::OUString( rText );
 
-    for ( sal_uInt16 n=0; n<aRangeSelListeners.Count(); n++ )
-        (*aRangeSelListeners[n])->done( aEvent );
+    BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, aRangeSelListeners)
+        rListener->done( aEvent );
 }
 
 void ScTabViewObj::RangeSelAborted( const String& rText )
@@ -2251,8 +2236,8 @@ void ScTabViewObj::RangeSelAborted( const String& rText )
     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
     aEvent.RangeDescriptor = rtl::OUString( rText );
 
-    for ( sal_uInt16 n=0; n<aRangeSelListeners.Count(); n++ )
-        (*aRangeSelListeners[n])->aborted( aEvent );
+    BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, aRangeSelListeners)
+        rListener->aborted( aEvent );
 }
 
 void ScTabViewObj::RangeSelChanged( const String& rText )
@@ -2261,8 +2246,8 @@ void ScTabViewObj::RangeSelChanged( const String& rText )
     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
     aEvent.RangeDescriptor = rtl::OUString( rText );
 
-    for ( sal_uInt16 n=0; n<aRangeChgListeners.Count(); n++ )
-        (*aRangeChgListeners[n])->descriptorChanged( aEvent );
+    BOOST_FOREACH(const XRangeSelectionChangeListenerUnoRef rListener, aRangeChgListeners)
+        rListener->descriptorChanged( aEvent );
 }
 
 // XServiceInfo
-- 
1.7.5.4


--------------080607060006050304080508--


More information about the LibreOffice mailing list