diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-27 09:37:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-30 08:22:26 +0200 |
commit | 818b837790c0807e508fc1246df3d2e07520529f (patch) | |
tree | ffdd0c99a18ced2e6dc864a9347b96f50a1a6584 | |
parent | 15e7509e6781957bc82bc7ce7d0619179b126256 (diff) |
loplugin:useuniqueptr in SwInsertDBColAutoPilot
Change-Id: Ida2be4abdeb6788ec9074a81c927e99e633ce394
Reviewed-on: https://gerrit.libreoffice.org/58247
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 23 | ||||
-rw-r--r-- | sw/source/uibase/inc/dbinsdlg.hxx | 4 |
2 files changed, 12 insertions, 15 deletions
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 42d6728c880c..33ab1ede2128 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -416,8 +416,8 @@ SwInsertDBColAutoPilot::~SwInsertDBColAutoPilot() void SwInsertDBColAutoPilot::dispose() { - delete pTableSet; - delete pRep; + pTableSet.reset(); + pRep.reset(); m_xTAutoFormat.reset(); m_pRbAsTable.clear(); @@ -659,7 +659,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, TableFormatHdl, Button*, pButton, void ) if( !pTableSet ) { bNewSet = true; - pTableSet = new SfxItemSet( rSh.GetAttrPool(), SwuiGetUITableAttrRange() ); + pTableSet.reset(new SfxItemSet( rSh.GetAttrPool(), SwuiGetUITableAttrRange() )); // At first acquire the simple attributes pTableSet->Put( SfxStringItem( FN_PARAM_TABLE_NAME, rSh.GetUniqueTableName() )); @@ -721,12 +721,12 @@ IMPL_LINK( SwInsertDBColAutoPilot, TableFormatHdl, Button*, pButton, void ) SwTabCols aTabCols; aTabCols.SetRight( nWidth ); aTabCols.SetRightMax( nWidth ); - pRep = new SwTableRep( aTabCols ); + pRep.reset(new SwTableRep( aTabCols )); pRep->SetAlign( text::HoriOrientation::NONE ); pRep->SetSpace( nWidth ); pRep->SetWidth( nWidth ); pRep->SetWidthPercent( 100 ); - pTableSet->Put( SwPtrItem( FN_TABLE_REP, pRep )); + pTableSet->Put( SwPtrItem( FN_TABLE_REP, pRep.get() )); pTableSet->Put( SfxUInt16Item( SID_HTML_MODE, ::GetHtmlMode( pView->GetDocShell() ))); @@ -749,27 +749,24 @@ IMPL_LINK( SwInsertDBColAutoPilot, TableFormatHdl, Button*, pButton, void ) aTabCols.Insert( nStep*(n+1), false, n ); } } - delete pRep; - pRep = new SwTableRep( aTabCols ); + pRep.reset(new SwTableRep( aTabCols )); pRep->SetAlign( text::HoriOrientation::NONE ); pRep->SetSpace( nWidth ); pRep->SetWidth( nWidth ); pRep->SetWidthPercent( 100 ); - pTableSet->Put( SwPtrItem( FN_TABLE_REP, pRep )); + pTableSet->Put( SwPtrItem( FN_TABLE_REP, pRep.get() )); } SwAbstractDialogFactory* pFact = swui::GetFactory(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTableTabDlg(pButton, pTableSet, &rSh)); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTableTabDlg(pButton, pTableSet.get(), &rSh)); if( RET_OK == pDlg->Execute() ) pTableSet->Put( *pDlg->GetOutputItemSet() ); else if( bNewSet ) { - delete pTableSet; - pTableSet = nullptr; - delete pRep; - pRep = nullptr; + pTableSet.reset(); + pRep.reset(); } } diff --git a/sw/source/uibase/inc/dbinsdlg.hxx b/sw/source/uibase/inc/dbinsdlg.hxx index 2ed40956a68d..c3362a52686c 100644 --- a/sw/source/uibase/inc/dbinsdlg.hxx +++ b/sw/source/uibase/inc/dbinsdlg.hxx @@ -128,8 +128,8 @@ class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem SwView* pView; std::unique_ptr<SwTableAutoFormat> m_xTAutoFormat; - SfxItemSet* pTableSet; - SwTableRep* pRep; + std::unique_ptr<SfxItemSet> pTableSet; + std::unique_ptr<SwTableRep> pRep; sal_Int32 nGBFormatLen; DECL_LINK( PageHdl, Button*, void ); |