diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-20 15:41:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-21 08:25:19 +0200 |
commit | 48c4460d414dd6f60c630af2fc13e1c3db2c3653 (patch) | |
tree | da784f8ddad0b4caf2cf3e0285275719ec147c5f /cui | |
parent | e1b922a2b302879747ffb93d3a463f2e4d8eca71 (diff) |
loplugin:useuniqueptr in SvxNumberFormatTabPage
Change-Id: If0fefe4a1e7af7331c708e7e944483ec3ce07614
Reviewed-on: https://gerrit.libreoffice.org/56190
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/numfmt.hxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/numfmt.cxx | 20 |
2 files changed, 11 insertions, 13 deletions
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx index 80a3f296cba2..a3ff4a070e40 100644 --- a/cui/source/inc/numfmt.hxx +++ b/cui/source/inc/numfmt.hxx @@ -115,8 +115,8 @@ private: Timer aResetWinTimer; - SvxNumberInfoItem* pNumItem; - SvxNumberFormatShell* pNumFmtShell; + std::unique_ptr<SvxNumberInfoItem> pNumItem; + std::unique_ptr<SvxNumberFormatShell> pNumFmtShell; sal_uLong nInitFormat; Link<SfxPoolItem const *,void> fnOkHdl; diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index ecfa8ff6f7ab..2aa9505507e6 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -286,10 +286,8 @@ SvxNumberFormatTabPage::~SvxNumberFormatTabPage() void SvxNumberFormatTabPage::dispose() { - delete pNumFmtShell; - pNumFmtShell = nullptr; - delete pNumItem; - pNumItem = nullptr; + pNumFmtShell.reset(); + pNumItem.reset(); m_pFtCategory.clear(); m_pLbCategory.clear(); m_pFtFormat.clear(); @@ -430,7 +428,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet ) if(pNumItem==nullptr) { bNumItemFlag=true; - pNumItem= static_cast<SvxNumberInfoItem *>(pItem->Clone()); + pNumItem.reset( static_cast<SvxNumberInfoItem *>(pItem->Clone()) ); } else { @@ -502,7 +500,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet ) break; } - delete pNumFmtShell; // delete old shell if applicable (== reset) + pNumFmtShell.reset(); // delete old shell if applicable (== reset) nInitFormat = pValFmtAttr // memorize init key ? pValFmtAttr->GetValue() // (for FillItemSet()) @@ -510,18 +508,18 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet ) if ( eValType == SvxNumberValueType::String ) - pNumFmtShell =SvxNumberFormatShell::Create( + pNumFmtShell.reset( SvxNumberFormatShell::Create( pNumItem->GetNumberFormatter(), pValFmtAttr ? nInitFormat : 0, eValType, - aValString ); + aValString ) ); else - pNumFmtShell =SvxNumberFormatShell::Create( + pNumFmtShell.reset( SvxNumberFormatShell::Create( pNumItem->GetNumberFormatter(), pValFmtAttr ? nInitFormat : 0, eValType, nValDouble, - &aValString ); + &aValString ) ); bool bUseStarFormat = false; @@ -1822,7 +1820,7 @@ void SvxNumberFormatTabPage::PageCreated(const SfxAllItemSet& aSet) const SvxNumberInfoItem* pNumberInfoItem = aSet.GetItem<SvxNumberInfoItem>(SID_ATTR_NUMBERFORMAT_INFO, false); const SfxLinkItem* pLinkItem = aSet.GetItem<SfxLinkItem>(SID_LINK_TYPE, false); if (pNumberInfoItem && !pNumItem) - pNumItem = static_cast<SvxNumberInfoItem*>(pNumberInfoItem->Clone()); + pNumItem.reset( static_cast<SvxNumberInfoItem*>(pNumberInfoItem->Clone()) ); if (pLinkItem) fnOkHdl = pLinkItem->GetValue(); } |