diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-02-23 16:37:27 +0100 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-02-23 16:37:27 +0100 |
commit | 3bcb29437f1d91476e759f0a6d3b72d7da3ce37f (patch) | |
tree | 5f58d1540b1a94f05ed44e20108479917d5a0856 /vcl/source/helper/xconnection.cxx | |
parent | c7908996ac968e0c10e6b60590d8d54748fe4e69 (diff) | |
parent | e2a3d487efb2bd5e582eb10e4150530c3f7377c5 (diff) |
vcl119: rebase to DEV300_m101
Diffstat (limited to 'vcl/source/helper/xconnection.cxx')
-rw-r--r-- | vcl/source/helper/xconnection.cxx | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx index d35e4b30caac..a0cc8c35e5e2 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/xconnection.cxx @@ -29,11 +29,18 @@ #include "precompiled_vcl.hxx" #include "svsys.h" +#include "rtl/ref.hxx" #include "vcl/xconnection.hxx" #include "vcl/svdata.hxx" #include "vcl/salinst.hxx" #include "vcl/svapp.hxx" +namespace { + +namespace css = com::sun::star; + +} + namespace vcl { class SolarMutexReleaser @@ -62,13 +69,9 @@ using namespace com::sun::star::awt; DisplayConnection::DisplayConnection() { - ImplSVData* pSVData = ImplGetSVData(); - pSVData->mpDefInst->SetEventCallback( this, dispatchEvent ); - pSVData->mpDefInst->SetErrorEventCallback( this, dispatchErrorEvent ); - SalInstance::ConnectionIdentifierType eType; int nBytes; - void* pBytes = pSVData->mpDefInst->GetConnectionIdentifier( eType, nBytes ); + void* pBytes = ImplGetSVData()->mpDefInst->GetConnectionIdentifier( eType, nBytes ); switch( eType ) { case SalInstance::AsciiCString: @@ -81,39 +84,54 @@ DisplayConnection::DisplayConnection() } DisplayConnection::~DisplayConnection() +{} + +void DisplayConnection::start() +{ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->mpDefInst->SetEventCallback( this ); +} + +void DisplayConnection::terminate() { ImplSVData* pSVData = ImplGetSVData(); if( pSVData ) { - pSVData->mpDefInst->SetEventCallback( NULL, NULL ); - pSVData->mpDefInst->SetErrorEventCallback( NULL, NULL ); + pSVData->mpDefInst->SetEventCallback( NULL ); } -} + SolarMutexReleaser aRel; + + MutexGuard aGuard( m_aMutex ); + Any aEvent; + std::list< css::uno::Reference< XEventHandler > > aLocalList( m_aHandlers ); + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it ) + (*it)->handleEvent( aEvent ); +} -void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw() +void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw() { MutexGuard aGuard( m_aMutex ); m_aHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); m_aHandlers.remove( handler ); } -void SAL_CALL DisplayConnection::addErrorHandler( const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::addErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); m_aErrorHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeErrorHandler( const Reference< XEventHandler >& handler ) throw() +void SAL_CALL DisplayConnection::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw() { MutexGuard aGuard( m_aMutex ); @@ -125,52 +143,37 @@ Any SAL_CALL DisplayConnection::getIdentifier() throw() return m_aAny; } -void DisplayConnection::dispatchDowningEvent() -{ - SolarMutexReleaser aRel; - - MutexGuard aGuard( m_aMutex ); - Any aEvent; - std::list< Reference< XEventHandler > > aLocalList( m_aHandlers ); - for( ::std::list< Reference< XEventHandler > >::const_iterator it = aLocalList.begin(); it != aLocalList.end(); ++it ) - (*it)->handleEvent( aEvent ); -} - -bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes ) +bool DisplayConnection::dispatchEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - DisplayConnection* This = (DisplayConnection*)pThis; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - ::std::list< Reference< XEventHandler > > handlers; + ::std::list< css::uno::Reference< XEventHandler > > handlers; { - MutexGuard aGuard( This->m_aMutex ); - handlers = This->m_aHandlers; + MutexGuard aGuard( m_aMutex ); + handlers = m_aHandlers; } - for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; return false; } -bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes ) +bool DisplayConnection::dispatchErrorEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; - DisplayConnection* This = (DisplayConnection*)pThis; - Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - ::std::list< Reference< XEventHandler > > handlers; + ::std::list< css::uno::Reference< XEventHandler > > handlers; { - MutexGuard aGuard( This->m_aMutex ); - handlers = This->m_aErrorHandlers; + MutexGuard aGuard( m_aMutex ); + handlers = m_aErrorHandlers; } - for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) + for( ::std::list< css::uno::Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; |