Kaydet (Commit) f3e148bd authored tarafından Michael Stahl's avatar Michael Stahl

sc: replace that boost::ptr_vector<Reference<T>*> abomination

This looks like dead code anyway? Evidently it didnt' compile like that.

Change-Id: Id6500c18d66c6932b24c15b653d992c449e260c4
üst c0f48981
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
using namespace com::sun::star; using namespace com::sun::star;
SV_IMPL_PTRARR( XResultListenerArr_Impl, css::uno::Reference< css::sheet::XResultListener >* );
ScAddInResult::ScAddInResult(const String& rStr) : ScAddInResult::ScAddInResult(const String& rStr) :
aArg( rStr ), aArg( rStr ),
...@@ -46,8 +45,8 @@ void ScAddInResult::NewValue() ...@@ -46,8 +45,8 @@ void ScAddInResult::NewValue()
sheet::ResultEvent aEvent( (cppu::OWeakObject*)this, aAny ); sheet::ResultEvent aEvent( (cppu::OWeakObject*)this, aAny );
for ( sal_uInt16 n=0; n<aListeners.Count(); n++ ) for (size_t n = 0; n < m_Listeners.size(); ++n)
(*aListeners[n])->modified( aEvent ); m_Listeners[n]->modified( aEvent );
} }
IMPL_LINK_TYPED( ScAddInResult, TimeoutHdl, Timer*, pT, void ) IMPL_LINK_TYPED( ScAddInResult, TimeoutHdl, Timer*, pT, void )
...@@ -64,10 +63,9 @@ ScAddInResult::~ScAddInResult() ...@@ -64,10 +63,9 @@ ScAddInResult::~ScAddInResult()
void SAL_CALL ScAddInResult::addResultListener( const css::uno::Reference< css::sheet::XResultListener >& aListener ) throw(css::uno::RuntimeException) 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 ); m_Listeners.push_back(uno::Reference<sheet::XResultListener>(aListener));
aListeners.Insert( pObj, aListeners.Count() );
if ( aListeners.Count() == 1 ) if (m_Listeners.size() == 1)
{ {
acquire(); // one Ref for all listeners acquire(); // one Ref for all listeners
...@@ -79,15 +77,13 @@ void SAL_CALL ScAddInResult::removeResultListener( const css::uno::Reference< cs ...@@ -79,15 +77,13 @@ void SAL_CALL ScAddInResult::removeResultListener( const css::uno::Reference< cs
{ {
acquire(); acquire();
sal_uInt16 nCount = aListeners.Count(); for (size_t n = m_Listeners.size(); --n; )
for ( sal_uInt16 n=nCount; n--; )
{ {
uno::Reference<sheet::XResultListener> *pObj = aListeners[n]; if (m_Listeners[n] == aListener)
if ( *pObj == aListener )
{ {
aListeners.DeleteAndDestroy( n ); m_Listeners.erase(m_Listeners.begin() + n);
if ( aListeners.Count() == 0 ) if (m_Listeners.empty())
{ {
nTickCount = 0; //! Test nTickCount = 0; //! Test
......
...@@ -22,20 +22,21 @@ ...@@ -22,20 +22,21 @@
#include <vcl/timer.hxx> #include <vcl/timer.hxx>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <com/sun/star/sheet/XVolatileResult.hpp> #include <com/sun/star/sheet/XVolatileResult.hpp>
#include <cppuhelper/implbase.hxx> #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> class ScAddInResult : public cppu::WeakImplHelper< css::sheet::XVolatileResult>
{ {
private: private:
String aArg; String aArg;
long nTickCount; long nTickCount;
XResultListenerArr_Impl aListeners; XResultListenerArr_Impl m_Listeners;
Timer aTimer; Timer aTimer;
DECL_LINK( TimeoutHdl, Timer* ); DECL_LINK( TimeoutHdl, Timer* );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment