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 @@
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
......
......@@ -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* );
......
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