diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2010-08-30 09:45:08 +0200 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2010-08-30 09:45:08 +0200 |
commit | e20d0e3eb6dbd05da364c8ec3b71ff4f118dbf48 (patch) | |
tree | 0ce41d7bb4a27d6f909fc7379e8c93f68de898a0 /basic/source/sbx | |
parent | c211b684d02ef787f38a1e419bc0c9ed10244ef8 (diff) |
mib19: #163217# let the basic listeners stop listening on termination, patch from AB
Diffstat (limited to 'basic/source/sbx')
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 58e3c1ae92c2..45342a015194 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -59,13 +59,17 @@ class SbxVariableImpl friend class SbxVariable; String m_aDeclareClassName; Reference< XInterface > m_xComListener; + StarBASIC* m_pComListenerParentBasic; SbxVariableImpl( void ) + : m_pComListenerParentBasic( NULL ) {} SbxVariableImpl( const SbxVariableImpl& r ) : m_aDeclareClassName( r.m_aDeclareClassName ) , m_xComListener( r.m_xComListener ) - {} + , m_pComListenerParentBasic( r.m_pComListenerParentBasic ) + { + } }; @@ -84,12 +88,18 @@ SbxVariable::SbxVariable() : SbxValue() #endif } +void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic ); + SbxVariable::SbxVariable( const SbxVariable& r ) : SvRefBase( r ), SbxValue( r ), mpPar( r.mpPar ), pInfo( r.pInfo ) { mpSbxVariableImpl = NULL; if( r.mpSbxVariableImpl != NULL ) + { mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); + if( mpSbxVariableImpl->m_xComListener.is() ) + registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic ); + } pCst = NULL; if( r.CanRead() ) { @@ -315,7 +325,11 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r ) SbxValue::operator=( r ); delete mpSbxVariableImpl; if( r.mpSbxVariableImpl != NULL ) + { mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); + if( mpSbxVariableImpl->m_xComListener.is() ) + registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic ); + } else mpSbxVariableImpl = NULL; return *this; @@ -396,10 +410,19 @@ void SbxVariable::SetDeclareClassName( const String& rDeclareClassName ) pImpl->m_aDeclareClassName = rDeclareClassName; } -void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener ) +void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener, + StarBASIC* pParentBasic ) { SbxVariableImpl* pImpl = getImpl(); pImpl->m_xComListener = xComListener; + pImpl->m_pComListenerParentBasic = pParentBasic; + registerComListenerVariableForBasic( this, pParentBasic ); +} + +void SbxVariable::ClearComListener( void ) +{ + SbxVariableImpl* pImpl = getImpl(); + pImpl->m_xComListener.clear(); } |