From 02e02fc032ee43d49cfda05eb0a30e5a21dc3ec2 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 27 Jun 2018 10:34:12 +0200 Subject: [PATCH] loplugin:useuniqueptr in ScSpecialFilterDlg Change-Id: I864e09c6c86a852bc79d9e2ea6b50c568fd0155f Reviewed-on: https://gerrit.libreoffice.org/56554 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/ui/dbgui/sfiltdlg.cxx | 20 +++++++++----------- sc/source/ui/inc/filtdlg.hxx | 6 +++--- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index a1bff449513d..8a8cfc91ee9c 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -95,7 +95,7 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc pEdFilterArea->GrabFocus(); // hack: control of RefInput - pIdle = new Idle("Special Filter Dialog"); + pIdle.reset( new Idle("Special Filter Dialog") ); // FIXME: this is an abomination pIdle->SetPriority( TaskPriority::LOWEST ); pIdle->SetInvokeHandler( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) ); @@ -114,13 +114,13 @@ void ScSpecialFilterDlg::dispose() for ( sal_Int32 i=1; i(pLbFilterArea->GetEntryData( i )); - delete pOptionsMgr; + pOptionsMgr.reset(); - delete pOutItem; + pOutItem.reset(); // hack: control of RefInput pIdle->Stop(); - delete pIdle; + pIdle.reset(); pLbFilterArea.clear(); pEdFilterArea.clear(); @@ -195,7 +195,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) // let options be initialized: - pOptionsMgr = new ScFilterOptionsMgr( + pOptionsMgr.reset( new ScFilterOptionsMgr( pViewData, theQueryData, pBtnCase, @@ -209,7 +209,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) pRbCopyArea, pFtDbAreaLabel, pFtDbArea, - aStrUndefined ); + aStrUndefined ) ); // special filter always needs column headers pBtnHeader->Check(); @@ -275,11 +275,9 @@ void ScSpecialFilterDlg::SetActive() ScQueryItem* ScSpecialFilterDlg::GetOutputItem( const ScQueryParam& rParam, const ScRange& rSource ) { - if ( pOutItem ) DELETEZ( pOutItem ); - pOutItem = new ScQueryItem( nWhichQuery, &rParam ); + pOutItem.reset(new ScQueryItem( nWhichQuery, &rParam )); pOutItem->SetAdvancedQuerySource( &rSource ); - - return pOutItem; + return pOutItem.get(); } bool ScSpecialFilterDlg::IsRefInputMode() const @@ -402,7 +400,7 @@ IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pIdle, void ) { // every 50ms check whether RefInputMode is still true - if( (_pIdle == pIdle) && IsActive() ) + if( (_pIdle == pIdle.get()) && IsActive() ) { if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() ) { diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx index 1505a0bec22f..c257236e8e40 100644 --- a/sc/source/ui/inc/filtdlg.hxx +++ b/sc/source/ui/inc/filtdlg.hxx @@ -195,11 +195,11 @@ private: VclPtr pBtnOk; VclPtr pBtnCancel; - ScFilterOptionsMgr* pOptionsMgr; + std::unique_ptr pOptionsMgr; const sal_uInt16 nWhichQuery; const ScQueryParam theQueryData; - ScQueryItem* pOutItem; + std::unique_ptr pOutItem; ScViewData* pViewData; ScDocument* pDoc; @@ -207,7 +207,7 @@ private: bool bRefInputMode; // Hack: RefInput control - Idle* pIdle; + std::unique_ptr pIdle; private: void Init( const SfxItemSet& rArgSet );