loplugin:useuniqueptr in ScSpecialFilterDlg

Change-Id: I864e09c6c86a852bc79d9e2ea6b50c568fd0155f
Reviewed-on: https://gerrit.libreoffice.org/56554
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2018-06-27 10:34:12 +02:00
parent dee73a9af5
commit 02e02fc032
2 changed files with 12 additions and 14 deletions

View File

@@ -95,7 +95,7 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc
pEdFilterArea->GrabFocus(); pEdFilterArea->GrabFocus();
// hack: control of RefInput // hack: control of RefInput
pIdle = new Idle("Special Filter Dialog"); pIdle.reset( new Idle("Special Filter Dialog") );
// FIXME: this is an abomination // FIXME: this is an abomination
pIdle->SetPriority( TaskPriority::LOWEST ); pIdle->SetPriority( TaskPriority::LOWEST );
pIdle->SetInvokeHandler( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) ); pIdle->SetInvokeHandler( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) );
@@ -114,13 +114,13 @@ void ScSpecialFilterDlg::dispose()
for ( sal_Int32 i=1; i<nEntries; ++i ) for ( sal_Int32 i=1; i<nEntries; ++i )
delete static_cast<OUString*>(pLbFilterArea->GetEntryData( i )); delete static_cast<OUString*>(pLbFilterArea->GetEntryData( i ));
delete pOptionsMgr; pOptionsMgr.reset();
delete pOutItem; pOutItem.reset();
// hack: control of RefInput // hack: control of RefInput
pIdle->Stop(); pIdle->Stop();
delete pIdle; pIdle.reset();
pLbFilterArea.clear(); pLbFilterArea.clear();
pEdFilterArea.clear(); pEdFilterArea.clear();
@@ -195,7 +195,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet )
// let options be initialized: // let options be initialized:
pOptionsMgr = new ScFilterOptionsMgr( pOptionsMgr.reset( new ScFilterOptionsMgr(
pViewData, pViewData,
theQueryData, theQueryData,
pBtnCase, pBtnCase,
@@ -209,7 +209,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet )
pRbCopyArea, pRbCopyArea,
pFtDbAreaLabel, pFtDbAreaLabel,
pFtDbArea, pFtDbArea,
aStrUndefined ); aStrUndefined ) );
// special filter always needs column headers // special filter always needs column headers
pBtnHeader->Check(); pBtnHeader->Check();
@@ -275,11 +275,9 @@ void ScSpecialFilterDlg::SetActive()
ScQueryItem* ScSpecialFilterDlg::GetOutputItem( const ScQueryParam& rParam, ScQueryItem* ScSpecialFilterDlg::GetOutputItem( const ScQueryParam& rParam,
const ScRange& rSource ) const ScRange& rSource )
{ {
if ( pOutItem ) DELETEZ( pOutItem ); pOutItem.reset(new ScQueryItem( nWhichQuery, &rParam ));
pOutItem = new ScQueryItem( nWhichQuery, &rParam );
pOutItem->SetAdvancedQuerySource( &rSource ); pOutItem->SetAdvancedQuerySource( &rSource );
return pOutItem.get();
return pOutItem;
} }
bool ScSpecialFilterDlg::IsRefInputMode() const bool ScSpecialFilterDlg::IsRefInputMode() const
@@ -402,7 +400,7 @@ IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pIdle, void )
{ {
// every 50ms check whether RefInputMode is still true // every 50ms check whether RefInputMode is still true
if( (_pIdle == pIdle) && IsActive() ) if( (_pIdle == pIdle.get()) && IsActive() )
{ {
if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() ) if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() )
{ {

View File

@@ -195,11 +195,11 @@ private:
VclPtr<OKButton> pBtnOk; VclPtr<OKButton> pBtnOk;
VclPtr<CancelButton> pBtnCancel; VclPtr<CancelButton> pBtnCancel;
ScFilterOptionsMgr* pOptionsMgr; std::unique_ptr<ScFilterOptionsMgr> pOptionsMgr;
const sal_uInt16 nWhichQuery; const sal_uInt16 nWhichQuery;
const ScQueryParam theQueryData; const ScQueryParam theQueryData;
ScQueryItem* pOutItem; std::unique_ptr<ScQueryItem> pOutItem;
ScViewData* pViewData; ScViewData* pViewData;
ScDocument* pDoc; ScDocument* pDoc;
@@ -207,7 +207,7 @@ private:
bool bRefInputMode; bool bRefInputMode;
// Hack: RefInput control // Hack: RefInput control
Idle* pIdle; std::unique_ptr<Idle> pIdle;
private: private:
void Init( const SfxItemSet& rArgSet ); void Init( const SfxItemSet& rArgSet );