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();
// 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<nEntries; ++i )
delete static_cast<OUString*>(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() )
{

View File

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