diff options
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/inc/drtxtob.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/editsh.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/datauno.cxx | 46 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 16 |
5 files changed, 31 insertions, 51 deletions
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index ee4d1ec01480..2709e613240b 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -113,7 +113,6 @@ void ScDrawTextObjectBar::StateDisableItems( SfxItemSet &rSet ) ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) : SfxShell(pData->GetViewShell()), pViewData(pData), - pClipEvtLstnr(nullptr), bPastePossible(false) { SetPool( pViewData->GetScDrawView()->GetDefaultAttr().GetPool() ); @@ -133,15 +132,13 @@ ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) : ScDrawTextObjectBar::~ScDrawTextObjectBar() { - if ( pClipEvtLstnr ) + if ( mxClipEvtLstnr.is() ) { - pClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false ); + mxClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false ); // 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. - pClipEvtLstnr->ClearCallbackLink(); - - pClipEvtLstnr->release(); + mxClipEvtLstnr->ClearCallbackLink(); } } @@ -492,13 +489,12 @@ void ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet ) return; } - if ( !pClipEvtLstnr ) + if ( !mxClipEvtLstnr.is() ) { // create listener - pClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScDrawTextObjectBar, ClipboardChanged ) ); - pClipEvtLstnr->acquire(); + mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScDrawTextObjectBar, ClipboardChanged ) ); vcl::Window* pWin = pViewData->GetActiveWin(); - pClipEvtLstnr->AddRemoveListener( pWin, true ); + mxClipEvtLstnr->AddRemoveListener( pWin, true ); // get initial state TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); diff --git a/sc/source/ui/inc/drtxtob.hxx b/sc/source/ui/inc/drtxtob.hxx index 09c1d94d4bfa..7b40147ddff4 100644 --- a/sc/source/ui/inc/drtxtob.hxx +++ b/sc/source/ui/inc/drtxtob.hxx @@ -35,7 +35,7 @@ class TransferableClipboardListener; class ScDrawTextObjectBar : public SfxShell { ScViewData* pViewData; - TransferableClipboardListener* pClipEvtLstnr; + css::uno::Reference<TransferableClipboardListener> mxClipEvtLstnr; bool bPastePossible; DECL_LINK_TYPED( ClipboardChanged, TransferableDataHelper*, void ); diff --git a/sc/source/ui/inc/editsh.hxx b/sc/source/ui/inc/editsh.hxx index 85d5fdfc1ccf..77b3e8b24480 100644 --- a/sc/source/ui/inc/editsh.hxx +++ b/sc/source/ui/inc/editsh.hxx @@ -39,7 +39,7 @@ class ScEditShell : public SfxShell private: EditView* pEditView; ScViewData* pViewData; - TransferableClipboardListener* pClipEvtLstnr; + css::uno::Reference<TransferableClipboardListener> mxClipEvtLstnr; bool bPastePossible; bool bIsInsertMode; diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 2772aa2cb536..9c03c5c1e7bd 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -806,28 +806,24 @@ void ScSubTotalDescriptor::SetParam( const ScSubTotalParam& rNew ) } ScRangeSubTotalDescriptor::ScRangeSubTotalDescriptor(ScDatabaseRangeObj* pPar) : - pParent(pPar) + mxParent(pPar) { - if (pParent) - pParent->acquire(); } ScRangeSubTotalDescriptor::~ScRangeSubTotalDescriptor() { - if (pParent) - pParent->release(); } void ScRangeSubTotalDescriptor::GetData( ScSubTotalParam& rParam ) const { - if (pParent) - pParent->GetSubTotalParam( rParam ); + if (mxParent.is()) + mxParent->GetSubTotalParam( rParam ); } void ScRangeSubTotalDescriptor::PutData( const ScSubTotalParam& rParam ) { - if (pParent) - pParent->SetSubTotalParam( rParam ); + if (mxParent.is()) + mxParent->SetSubTotalParam( rParam ); } ScConsolidationDescriptor::ScConsolidationDescriptor() @@ -1544,49 +1540,41 @@ void ScFilterDescriptor::SetParam( const ScQueryParam& rNew ) ScRangeFilterDescriptor::ScRangeFilterDescriptor(ScDocShell* pDocShell, ScDatabaseRangeObj* pPar) : ScFilterDescriptorBase(pDocShell), - pParent(pPar) + mxParent(pPar) { - if (pParent) - pParent->acquire(); } ScRangeFilterDescriptor::~ScRangeFilterDescriptor() { - if (pParent) - pParent->release(); } void ScRangeFilterDescriptor::GetData( ScQueryParam& rParam ) const { - if (pParent) - pParent->GetQueryParam( rParam ); + if (mxParent.is()) + mxParent->GetQueryParam( rParam ); } void ScRangeFilterDescriptor::PutData( const ScQueryParam& rParam ) { - if (pParent) - pParent->SetQueryParam( rParam ); + if (mxParent.is()) + mxParent->SetQueryParam( rParam ); } ScDataPilotFilterDescriptor::ScDataPilotFilterDescriptor(ScDocShell* pDocShell, ScDataPilotDescriptorBase* pPar) : ScFilterDescriptorBase(pDocShell), - pParent(pPar) + mxParent(pPar) { - if (pParent) - pParent->acquire(); } ScDataPilotFilterDescriptor::~ScDataPilotFilterDescriptor() { - if (pParent) - pParent->release(); } void ScDataPilotFilterDescriptor::GetData( ScQueryParam& rParam ) const { - if (pParent) + if (mxParent.is()) { - ScDPObject* pDPObj = pParent->GetDPObject(); + ScDPObject* pDPObj = mxParent->GetDPObject(); if (pDPObj && pDPObj->IsSheetData()) rParam = pDPObj->GetSheetDesc()->GetQueryParam(); } @@ -1594,17 +1582,17 @@ void ScDataPilotFilterDescriptor::GetData( ScQueryParam& rParam ) const void ScDataPilotFilterDescriptor::PutData( const ScQueryParam& rParam ) { - if (pParent) + if (mxParent.is()) { - ScDPObject* pDPObj = pParent->GetDPObject(); + ScDPObject* pDPObj = mxParent->GetDPObject(); if (pDPObj) { - ScSheetSourceDesc aSheetDesc(&pParent->GetDocShell()->GetDocument()); + ScSheetSourceDesc aSheetDesc(&mxParent->GetDocShell()->GetDocument()); if (pDPObj->IsSheetData()) aSheetDesc = *pDPObj->GetSheetDesc(); aSheetDesc.SetQueryParam(rParam); pDPObj->SetSheetDesc(aSheetDesc); - pParent->SetDPObject(pDPObj); + mxParent->SetDPObject(pDPObj); } } } diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 92f211e13d71..622989308f44 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -93,7 +93,6 @@ void ScEditShell::InitInterface_Impl() ScEditShell::ScEditShell(EditView* pView, ScViewData* pData) : pEditView (pView), pViewData (pData), - pClipEvtLstnr (nullptr), bPastePossible (false), bIsInsertMode (true) { @@ -105,15 +104,13 @@ ScEditShell::ScEditShell(EditView* pView, ScViewData* pData) : ScEditShell::~ScEditShell() { - if ( pClipEvtLstnr ) + if ( mxClipEvtLstnr.is() ) { - pClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false ); + mxClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false ); // 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. - pClipEvtLstnr->ClearCallbackLink(); - - pClipEvtLstnr->release(); + mxClipEvtLstnr->ClearCallbackLink(); } } @@ -809,13 +806,12 @@ IMPL_LINK_TYPED( ScEditShell, ClipboardChanged, TransferableDataHelper*, pDataHe void ScEditShell::GetClipState( SfxItemSet& rSet ) { - if ( !pClipEvtLstnr ) + if ( !mxClipEvtLstnr.is() ) { // create listener - pClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScEditShell, ClipboardChanged ) ); - pClipEvtLstnr->acquire(); + mxClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScEditShell, ClipboardChanged ) ); vcl::Window* pWin = pViewData->GetActiveWin(); - pClipEvtLstnr->AddRemoveListener( pWin, true ); + mxClipEvtLstnr->AddRemoveListener( pWin, true ); // get initial state TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); |