diff options
-rw-r--r-- | sc/workben/result.cxx | 20 | ||||
-rw-r--r-- | sc/workben/result.hxx | 7 |
2 files changed, 12 insertions, 15 deletions
diff --git a/sc/workben/result.cxx b/sc/workben/result.cxx index 122c2c876433..0548630af8e5 100644 --- a/sc/workben/result.cxx +++ b/sc/workben/result.cxx @@ -23,7 +23,6 @@ using namespace com::sun::star; -SV_IMPL_PTRARR( XResultListenerArr_Impl, css::uno::Reference< css::sheet::XResultListener >* ); ScAddInResult::ScAddInResult(const String& rStr) : aArg( rStr ), @@ -46,8 +45,8 @@ void ScAddInResult::NewValue() sheet::ResultEvent aEvent( (cppu::OWeakObject*)this, aAny ); - for ( sal_uInt16 n=0; n<aListeners.Count(); n++ ) - (*aListeners[n])->modified( aEvent ); + for (size_t n = 0; n < m_Listeners.size(); ++n) + m_Listeners[n]->modified( aEvent ); } IMPL_LINK_TYPED( ScAddInResult, TimeoutHdl, Timer*, pT, void ) @@ -64,10 +63,9 @@ ScAddInResult::~ScAddInResult() void SAL_CALL ScAddInResult::addResultListener( const css::uno::Reference< css::sheet::XResultListener >& aListener ) throw(css::uno::RuntimeException) { - uno::Reference<sheet::XResultListener> *pObj = new uno::Reference<sheet::XResultListener>( aListener ); - aListeners.Insert( pObj, aListeners.Count() ); + m_Listeners.push_back(uno::Reference<sheet::XResultListener>(aListener)); - if ( aListeners.Count() == 1 ) + if (m_Listeners.size() == 1) { acquire(); // one Ref for all listeners @@ -79,15 +77,13 @@ void SAL_CALL ScAddInResult::removeResultListener( const css::uno::Reference< cs { acquire(); - sal_uInt16 nCount = aListeners.Count(); - for ( sal_uInt16 n=nCount; n--; ) + for (size_t n = m_Listeners.size(); --n; ) { - uno::Reference<sheet::XResultListener> *pObj = aListeners[n]; - if ( *pObj == aListener ) + if (m_Listeners[n] == aListener) { - aListeners.DeleteAndDestroy( n ); + m_Listeners.erase(m_Listeners.begin() + n); - if ( aListeners.Count() == 0 ) + if (m_Listeners.empty()) { nTickCount = 0; //! Test diff --git a/sc/workben/result.hxx b/sc/workben/result.hxx index e0f796af0b5e..140a6d15c6a9 100644 --- a/sc/workben/result.hxx +++ b/sc/workben/result.hxx @@ -22,20 +22,21 @@ #include <vcl/timer.hxx> #include <rtl/ustring.hxx> -#include <boost/ptr_container/ptr_vector.hpp> #include <com/sun/star/sheet/XVolatileResult.hpp> #include <cppuhelper/implbase.hxx> -typedef boost::ptr_vector<css::uno::Reference< css::sheet::XResultListener >*> XResultListenerArr_Impl; +#include <vector> + +typedef std::vector<css::uno::Reference<css::sheet::XResultListener>> XResultListenerArr_Impl; class ScAddInResult : public cppu::WeakImplHelper< css::sheet::XVolatileResult> { private: String aArg; long nTickCount; - XResultListenerArr_Impl aListeners; + XResultListenerArr_Impl m_Listeners; Timer aTimer; DECL_LINK( TimeoutHdl, Timer* ); |