diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-10-15 11:39:37 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-10-15 11:39:37 +0000 |
commit | 130da5cbf25fb3991c6f27f8afe51e3ca5943657 (patch) | |
tree | 299421d7430f907191128845871fd267d3270df6 /sfx2 | |
parent | 99efc0ba1f080e9d04d7c2035cb0d92d7b8e448b (diff) |
CWS-TOOLING: integrate CWS fwk122
2009-10-06 09:16:04 +0200 mav r276693 : #i10000# let be compiled on all platforms
2009-10-05 17:02:17 +0200 cd r276688 : #i105343# Fix build problems under Linux/Mac
2009-10-05 16:23:29 +0200 cd r276687 : #i105489# Remove uiconfigurationmanagerimpl.obj from makefile.mk
2009-10-05 15:17:05 +0200 cd r276680 : #i105326# Fix crash when opening file with notes
2009-10-05 11:02:22 +0200 mav r276665 : #i105343# allow the view shell to disconnect from listener
2009-10-02 11:33:45 +0200 cd r276619 : #i105489# Revert changes done to aggregate sources due to too much regressions
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/viewimp.hxx | 10 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 53 |
2 files changed, 43 insertions, 20 deletions
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index f75d68fe1413..97f86ee1f395 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -45,6 +45,8 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <svtools/acceleratorexecute.hxx> +#include <rtl/ref.hxx> + #include <queue> // forward --------------------------------------------------------------- @@ -71,6 +73,8 @@ public: void AddRequest( SfxRequest& rReq ); }; +class SfxClipboardChangeListener; + struct SfxViewShell_Impl { ::osl::Mutex aMutex; @@ -96,11 +100,9 @@ struct SfxViewShell_Impl ::svt::AcceleratorExecute* pAccExec; SfxAsyncPrintExec_Impl* pPrinterCommandQueue; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; + ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; - SfxViewShell_Impl() - : aInterceptorContainer( aMutex ) - , pAccExec(0) - {} + SfxViewShell_Impl(); }; #endif diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 299c928c748b..f6053a467ed4 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -131,6 +131,8 @@ class SfxClipboardChangeListener : public ::cppu::WeakImplHelper1< public: SfxClipboardChangeListener( SfxViewShell* pView ); virtual ~SfxClipboardChangeListener(); + + void DisconnectViewShell() { pViewShell = NULL; } }; SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView ) @@ -241,7 +243,12 @@ static ::rtl::OUString RetrieveLabelFromCommand( } //========================================================================= +SfxViewShell_Impl::SfxViewShell_Impl() +: aInterceptorContainer( aMutex ) +, pAccExec(0) +{} +//========================================================================= SFX_IMPL_INTERFACE(SfxViewShell,SfxShell,SfxResId(0)) { SFX_CHILDWINDOW_REGISTRATION( SID_MAIL_CHILDWIN ); @@ -1297,21 +1304,27 @@ SfxViewShell::~SfxViewShell() SfxViewShellArr_Impl &rViewArr = SFX_APP()->GetViewShells_Impl(); rViewArr.Remove( rViewArr.GetPos(pThis) ); + if ( pImp->xClipboardListener.is() ) + { + pImp->xClipboardListener->DisconnectViewShell(); + pImp->xClipboardListener = NULL; + } + if ( pImp->pController ) { pImp->pController->ReleaseShell_Impl(); pImp->pController->release(); + pImp->pController = NULL; } if (pImp->pAccExec) { - delete pImp->pAccExec; - pImp->pAccExec = 0; + DELETEZ( pImp->pAccExec ); } - delete pImp->pPrinterCommandQueue; - delete pImp; - delete pIPClientList; + DELETEZ( pImp->pPrinterCommandQueue ); + DELETEZ( pImp ); + DELETEZ( pIPClientList ); } //-------------------------------------------------------------------- @@ -1997,7 +2010,12 @@ void SfxViewShell::SetController( SfxBaseController* pController ) pImp->pController->acquire(); pImp->bControllerSet = TRUE; - AddRemoveClipboardListener( new SfxClipboardChangeListener( this ), TRUE ); + // there should be no old listener, but if there is one, it should be disconnected + if ( pImp->xClipboardListener.is() ) + pImp->xClipboardListener->DisconnectViewShell(); + + pImp->xClipboardListener = new SfxClipboardChangeListener( this ); + AddRemoveClipboardListener( pImp->xClipboardListener.get(), TRUE ); } Reference < XController > SfxViewShell::GetController() @@ -2205,17 +2223,20 @@ void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransf { try { - uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() ); - if( !xClipboard.is() ) - return; - - uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY ); - if( xClpbrdNtfr.is() ) + if ( GetViewFrame() ) { - if( bAdd ) - xClpbrdNtfr->addClipboardListener( rClp ); - else - xClpbrdNtfr->removeClipboardListener( rClp ); + uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() ); + if( xClipboard.is() ) + { + uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY ); + if( xClpbrdNtfr.is() ) + { + if( bAdd ) + xClpbrdNtfr->addClipboardListener( rClp ); + else + xClpbrdNtfr->removeClipboardListener( rClp ); + } + } } } catch( const uno::Exception& ) |