diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-21 10:04:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-25 09:12:13 +0200 |
commit | 39e6bae2c4be24a3aad5ef8cd37d3d83c41a4abe (patch) | |
tree | 5f0ef3ed26815e2854a8dcefbbcc6d27be64800d /cui | |
parent | 592cbb6cdb1691e205d5bea3dd95d370fd119aa8 (diff) |
loplugin:useuniqueptr in cui numpages
Change-Id: I22eaeecb06bcf46cc494e8a0326922600e131cf3
Reviewed-on: https://gerrit.libreoffice.org/56324
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/numpages.hxx | 24 | ||||
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 96 |
2 files changed, 48 insertions, 72 deletions
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index d5e92dc13be8..cac9a110959c 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -89,8 +89,8 @@ class SvxSingleNumPickTabPage final : public SfxTabPage VclPtr<SvxNumValueSet> m_pExamplesVS; SvxNumSettingsArr_Impl aNumSettingsArr; - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; + std::unique_ptr<SvxNumRule> pActNum; + std::unique_ptr<SvxNumRule> pSaveNum; sal_uInt16 nActNumLvl; bool bModified : 1; bool bPreset : 1; @@ -122,8 +122,8 @@ class SvxBulletPickTabPage final : public SfxTabPage using TabPage::DeactivatePage; VclPtr<SvxNumValueSet> m_pExamplesVS; - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; + std::unique_ptr<SvxNumRule> pActNum; + std::unique_ptr<SvxNumRule> pSaveNum; sal_uInt16 nActNumLvl; bool bModified : 1; bool bPreset : 1; @@ -164,8 +164,8 @@ class SvxNumPickTabPage final : public SfxTabPage SvxNumSettingsArr_Impl aNumSettingsArrays[NUM_VALUSET_COUNT]; // is initialized with the five formats - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; + std::unique_ptr<SvxNumRule> pActNum; + std::unique_ptr<SvxNumRule> pSaveNum; sal_uInt16 nActNumLvl; sal_uInt16 nNumItemId; bool bModified : 1; @@ -207,8 +207,8 @@ class SvxBitmapPickTabPage final : public SfxTabPage std::vector<OUString> aGrfNames; - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; + std::unique_ptr<SvxNumRule> pActNum; + std::unique_ptr<SvxNumRule> pSaveNum; sal_uInt16 nActNumLvl; sal_uInt16 nNumItemId; MapUnit eCoreUnit; @@ -283,8 +283,8 @@ class SvxNumOptionsTabPage : public SfxTabPage Timer aInvalidateTimer; - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; + std::unique_ptr<SvxNumRule> pActNum; + std::unique_ptr<SvxNumRule> pSaveNum; Size aInitSize[SVX_MAX_NUM]; @@ -391,8 +391,8 @@ class SvxNumPositionTabPage : public SfxTabPage VclPtr<SvxNumberingPreview> m_pPreviewWIN; - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; + std::unique_ptr<SvxNumRule> pActNum; + std::unique_ptr<SvxNumRule> pSaveNum; sal_uInt16 nActNumLvl; sal_uInt16 nNumItemId; diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 439f1db1b656..60642f9d555f 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -220,10 +220,8 @@ SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage() void SvxSingleNumPickTabPage::dispose() { - delete pActNum; - pActNum = nullptr; - delete pSaveNum; - pSaveNum = nullptr; + pActNum.reset(); + pSaveNum.reset(); m_pExamplesVS.clear(); SfxTabPage::dispose(); } @@ -261,8 +259,7 @@ void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet) } if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem)) { - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); } if(pActNum && *pSaveNum != *pActNum) { @@ -270,7 +267,7 @@ void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet) m_pExamplesVS->SetNoSelection(); } - if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) + if(pActNum && (!lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset)) { m_pExamplesVS->SelectItem(1); NumSelectHdl_Impl(m_pExamplesVS); @@ -306,11 +303,10 @@ void SvxSingleNumPickTabPage::Reset( const SfxItemSet* rSet ) } } DBG_ASSERT(eState == SfxItemState::SET, "no item found!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); + pActNum.reset( new SvxNumRule(*pSaveNum) ); else if(*pSaveNum != *pActNum) *pActNum = *pSaveNum; } @@ -386,10 +382,8 @@ SvxBulletPickTabPage::~SvxBulletPickTabPage() void SvxBulletPickTabPage::dispose() { - delete pActNum; - pActNum = nullptr; - delete pSaveNum; - pSaveNum = nullptr; + pActNum.reset(); + pSaveNum.reset(); m_pExamplesVS.clear(); SfxTabPage::dispose(); } @@ -426,8 +420,7 @@ void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet) } if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem)) { - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); } if(pActNum && *pSaveNum != *pActNum) { @@ -435,7 +428,7 @@ void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet) m_pExamplesVS->SetNoSelection(); } - if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) + if(pActNum && (!lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset)) { m_pExamplesVS->SelectItem(1); NumSelectHdl_Impl(m_pExamplesVS); @@ -470,11 +463,10 @@ void SvxBulletPickTabPage::Reset( const SfxItemSet* rSet ) } DBG_ASSERT(eState == SfxItemState::SET, "no item found!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); + pActNum.reset( new SvxNumRule(*pSaveNum) ); else if(*pSaveNum != *pActNum) *pActNum = *pSaveNum; } @@ -585,10 +577,8 @@ SvxNumPickTabPage::~SvxNumPickTabPage() void SvxNumPickTabPage::dispose() { - delete pActNum; - pActNum = nullptr; - delete pSaveNum; - pSaveNum = nullptr; + pActNum.reset(); + pSaveNum.reset(); m_pExamplesVS.clear(); SfxTabPage::dispose(); } @@ -625,8 +615,7 @@ void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet) } if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem)) { - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); } if(pActNum && *pSaveNum != *pActNum) { @@ -634,7 +623,7 @@ void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet) m_pExamplesVS->SetNoSelection(); } - if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) + if(pActNum && (!lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset)) { m_pExamplesVS->SelectItem(1); NumSelectHdl_Impl(m_pExamplesVS); @@ -669,11 +658,10 @@ void SvxNumPickTabPage::Reset( const SfxItemSet* rSet ) } DBG_ASSERT(eState == SfxItemState::SET, "no item found!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); + pActNum.reset( new SvxNumRule(*pSaveNum) ); else if(*pSaveNum != *pActNum) *pActNum = *pSaveNum; @@ -835,10 +823,8 @@ SvxBitmapPickTabPage::~SvxBitmapPickTabPage() void SvxBitmapPickTabPage::dispose() { - delete pActNum; - pActNum = nullptr; - delete pSaveNum; - pSaveNum = nullptr; + pActNum.reset(); + pSaveNum.reset(); m_pBtBrowseFile.clear(); m_pErrorText.clear(); m_pExamplesVS.clear(); @@ -866,8 +852,7 @@ void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet) } if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem)) { - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); } if(pActNum && *pSaveNum != *pActNum) { @@ -876,7 +861,7 @@ void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet) } if(!aGrfNames.empty() && - (pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))) + (pActNum && (lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset))) { m_pExamplesVS->SelectItem(1); NumSelectHdl_Impl(m_pExamplesVS); @@ -927,11 +912,10 @@ void SvxBitmapPickTabPage::Reset( const SfxItemSet* rSet ) } DBG_ASSERT(eState == SfxItemState::SET, "no item found!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); + pActNum.reset( new SvxNumRule(*pSaveNum) ); else if(*pSaveNum != *pActNum) *pActNum = *pSaveNum; } @@ -1195,10 +1179,8 @@ SvxNumOptionsTabPage::~SvxNumOptionsTabPage() void SvxNumOptionsTabPage::dispose() { - delete pActNum; - pActNum = nullptr; - delete pSaveNum; - pSaveNum = nullptr; + pActNum.reset(); + pSaveNum.reset(); m_pLevelLB.clear(); m_pFmtLB.clear(); m_pSeparatorFT.clear(); @@ -1264,8 +1246,7 @@ void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet) } if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem)) { - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); } bModified = (!pActNum->Get( 0 ) || bPreset); @@ -1329,8 +1310,7 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet ) } DBG_ASSERT(eState == SfxItemState::SET, "no item found!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); // insert levels if(!m_pLevelLB->GetEntryCount()) @@ -1366,10 +1346,10 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet ) m_pLevelLB->SetUpdateMode(true); if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); + pActNum.reset( new SvxNumRule(*pSaveNum) ); else if(*pSaveNum != *pActNum) *pActNum = *pSaveNum; - m_pPreviewWIN->SetNumRule(pActNum); + m_pPreviewWIN->SetNumRule(pActNum.get()); m_pSameLevelCB->Check(pActNum->IsContinuousNumbering()); SfxObjectShell* pShell; @@ -2674,10 +2654,8 @@ SvxNumPositionTabPage::~SvxNumPositionTabPage() void SvxNumPositionTabPage::dispose() { - delete pActNum; - pActNum = nullptr; - delete pSaveNum; - pSaveNum = nullptr; + pActNum.reset(); + pSaveNum.reset(); m_pLevelLB.clear(); m_pDistBorderFT.clear(); m_pDistBorderMF.clear(); @@ -2935,8 +2913,7 @@ void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet) } if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem)) { - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); } bModified = (!pActNum->Get( 0 ) || bPreset); if(*pSaveNum != *pActNum || @@ -3010,8 +2987,7 @@ void SvxNumPositionTabPage::Reset( const SfxItemSet* rSet ) } DBG_ASSERT(eState == SfxItemState::SET, "no item found!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()); + pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) ); // insert levels if(!m_pLevelLB->GetEntryCount()) @@ -3048,10 +3024,10 @@ void SvxNumPositionTabPage::Reset( const SfxItemSet* rSet ) m_pLevelLB->SetUpdateMode(true); if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); + pActNum.reset( new SvxNumRule(*pSaveNum) ); else if(*pSaveNum != *pActNum) *pActNum = *pSaveNum; - m_pPreviewWIN->SetNumRule(pActNum); + m_pPreviewWIN->SetNumRule(pActNum.get()); InitPosAndSpaceMode(); ShowControlsDependingOnPosAndSpaceMode(); |