diff options
-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 ); |