diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-27 09:31:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-30 08:22:07 +0200 |
commit | 951cf8e6cf2d5e5fc2c3c760ef5df2cadb04aea4 (patch) | |
tree | 94614814fa654607fbdd7050ac10839c69241c71 /sw/source/ui/misc/titlepage.cxx | |
parent | 133a6a877ed48f1ef778a9ff387dda1f0dbcaa7f (diff) |
loplugin:useuniqueptr in SwTitlePageDlg
Change-Id: I8e68950b311e78dd7bb71d282728a92f98bcccbb
Reviewed-on: https://gerrit.libreoffice.org/58245
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/ui/misc/titlepage.cxx')
-rw-r--r-- | sw/source/ui/misc/titlepage.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index 36034678463b..7415b6be78c3 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -28,7 +28,7 @@ namespace { - bool lcl_GetPageDesc(SwWrtShell *pSh, sal_uInt16 &rPageNo, const SwFormatPageDesc **ppPageFormatDesc) + bool lcl_GetPageDesc(SwWrtShell *pSh, sal_uInt16 &rPageNo, std::unique_ptr<const SwFormatPageDesc>* ppPageFormatDesc) { bool bRet = false; SfxItemSet aSet( pSh->GetAttrPool(), svl::Items<RES_PAGEDESC, RES_PAGEDESC>{} ); @@ -41,7 +41,7 @@ namespace if (oNumOffset) rPageNo = oNumOffset.get(); if (ppPageFormatDesc) - (*ppPageFormatDesc) = static_cast<const SwFormatPageDesc *>(pItem->Clone()); + ppPageFormatDesc->reset(static_cast<const SwFormatPageDesc *>(pItem->Clone())); bRet = true; } } @@ -54,7 +54,7 @@ namespace const size_t nCurIdx = pSh->GetCurPageDesc(); const SwPageDesc &rCurrentDesc = pSh->GetPageDesc( nCurIdx ); - const SwFormatPageDesc *pPageFormatDesc(nullptr); + std::unique_ptr<const SwFormatPageDesc> pPageFormatDesc; sal_uInt16 nDontCare; lcl_GetPageDesc(pSh, nDontCare, &pPageFormatDesc); @@ -97,8 +97,6 @@ namespace if (nPgNo) aPageFormatDesc.SetNumOffset(nPgNo); pSh->SetAttrItem(aPageFormatDesc); } - - delete pPageFormatDesc; } void lcl_PushCursor(SwWrtShell *pSh) @@ -256,7 +254,6 @@ IMPL_LINK_NOARG(SwTitlePageDlg, StartPageHdl, weld::ToggleButton&, void) SwTitlePageDlg::~SwTitlePageDlg() { - delete mpPageFormatDesc; } IMPL_LINK_NOARG(SwTitlePageDlg, EditHdl, weld::Button&, void) |