diff options
-rw-r--r-- | sc/source/ui/inc/cellsh.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 5 |
3 files changed, 16 insertions, 14 deletions
diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx index 5b0c7d1a4ddd..5a3ee9ed6f37 100644 --- a/sc/source/ui/inc/cellsh.hxx +++ b/sc/source/ui/inc/cellsh.hxx @@ -30,6 +30,7 @@ #include "formatsh.hxx" #include "address.hxx" #include <vcl/window.hxx> +#include <rtl/ref.hxx> class SvxClipboardFormatItem; class TransferableDataHelper; @@ -38,15 +39,12 @@ class AbstractScLinkedAreaDlg; struct CellShell_Impl { - TransferableClipboardListener* m_pClipEvtLstnr; + rtl::Reference<TransferableClipboardListener> + m_xClipEvtLstnr; VclPtr<AbstractScLinkedAreaDlg> m_pLinkedDlg; SfxRequest* m_pRequest; - CellShell_Impl() : - m_pClipEvtLstnr( nullptr ), - m_pLinkedDlg(), - m_pRequest( nullptr ) {} - + CellShell_Impl(); ~CellShell_Impl(); }; diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index b0a49e259b0e..c82c3808e66c 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -87,15 +87,15 @@ ScCellShell::ScCellShell(ScViewData* pData, VclPtr<vcl::Window> frameWin) : ScCellShell::~ScCellShell() { - if ( pImpl->m_pClipEvtLstnr ) + if ( pImpl->m_xClipEvtLstnr.is() ) { - pImpl->m_pClipEvtLstnr->RemoveListener( GetViewData()->GetActiveWin() ); + pImpl->m_xClipEvtLstnr->RemoveListener( GetViewData()->GetActiveWin() ); // The listener may just now be waiting for the SolarMutex and call the link // afterwards, in spite of RemoveListener. So the link has to be reset, too. - pImpl->m_pClipEvtLstnr->ClearCallbackLink(); + pImpl->m_xClipEvtLstnr->ClearCallbackLink(); - pImpl->m_pClipEvtLstnr->release(); + pImpl->m_xClipEvtLstnr.clear(); } pImpl->m_pLinkedDlg.disposeAndClear(); @@ -556,13 +556,12 @@ void ScCellShell::GetClipState( SfxItemSet& rSet ) // SID_PASTE_SPECIAL // SID_CLIPBOARD_FORMAT_ITEMS - if ( !pImpl->m_pClipEvtLstnr ) + if ( !pImpl->m_xClipEvtLstnr.is() ) { // create listener - pImpl->m_pClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScCellShell, ClipboardChanged ) ); - pImpl->m_pClipEvtLstnr->acquire(); + pImpl->m_xClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScCellShell, ClipboardChanged ) ); vcl::Window* pWin = GetViewData()->GetActiveWin(); - pImpl->m_pClipEvtLstnr->AddListener( pWin ); + pImpl->m_xClipEvtLstnr->AddListener( pWin ); // get initial state TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) ); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index f661f347a54f..c0d4d4f03bdc 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -45,6 +45,7 @@ #include <vcl/builderfactory.hxx> #include <unotools/localedatawrapper.hxx> #include <editeng/editview.hxx> +#include <svtools/cliplistener.hxx> #include "cellsh.hxx" #include "sc.hrc" @@ -2986,6 +2987,10 @@ IMPL_LINK_NOARG(ScCellShell, DialogClosed, Dialog&, void) ExecuteExternalSource( sFile, sFilter, sOptions, sSource, nRefresh, *(pImpl->m_pRequest) ); } +CellShell_Impl::CellShell_Impl() : + m_pLinkedDlg(), + m_pRequest( nullptr ) {} + CellShell_Impl::~CellShell_Impl() { } |