Kaydet (Commit) aad3b3b0 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in IconChoiceDialog

Change-Id: I3c39782cdbb332627e33ecb85c8d447a40ea0fea
Reviewed-on: https://gerrit.libreoffice.org/59026
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 13ec3a1d
...@@ -198,11 +198,10 @@ void IconChoiceDialog::dispose() ...@@ -198,11 +198,10 @@ void IconChoiceDialog::dispose()
//aTabDlgOpt.SetWindowState(OStringToOUString(GetWindowState((WindowStateMask::X | WindowStateMask::Y | WindowStateMask::State | WindowStateMask::Minimized)), RTL_TEXTENCODING_ASCII_US)); //aTabDlgOpt.SetWindowState(OStringToOUString(GetWindowState((WindowStateMask::X | WindowStateMask::Y | WindowStateMask::State | WindowStateMask::Minimized)), RTL_TEXTENCODING_ASCII_US));
//aTabDlgOpt.SetPageID( mnCurrentPageId ); //aTabDlgOpt.SetPageID( mnCurrentPageId );
for (IconChoicePageData* pData : maPageList) for (std::unique_ptr<IconChoicePageData> & pData : maPageList)
{ {
if ( pData->pPage ) if ( pData->pPage )
pData->pPage.disposeAndClear(); pData->pPage.disposeAndClear();
delete pData;
} }
maPageList.clear(); maPageList.clear();
...@@ -232,8 +231,7 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( ...@@ -232,8 +231,7 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage(
CreatePage pCreateFunc /* != 0 */ CreatePage pCreateFunc /* != 0 */
) )
{ {
IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc ); maPageList.emplace_back( new IconChoicePageData ( nId, pCreateFunc ) );
maPageList.push_back( pData );
SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->InsertEntry( rIconText, rChoiceIcon ); SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->InsertEntry( rIconText, rChoiceIcon );
pEntry->SetUserData ( reinterpret_cast<void*>(nId) ); pEntry->SetUserData ( reinterpret_cast<void*>(nId) );
...@@ -431,7 +429,7 @@ void IconChoiceDialog::DeActivatePageImpl () ...@@ -431,7 +429,7 @@ void IconChoiceDialog::DeActivatePageImpl ()
{ {
// TODO refresh input set // TODO refresh input set
// flag all pages to be newly initialized // flag all pages to be newly initialized
for (IconChoicePageData* pObj : maPageList) for (auto & pObj : maPageList)
{ {
if ( pObj->pPage.get() != pPage ) if ( pObj->pPage.get() != pPage )
pObj->bRefresh = true; pObj->bRefresh = true;
...@@ -540,7 +538,7 @@ void IconChoiceDialog::Start() ...@@ -540,7 +538,7 @@ void IconChoiceDialog::Start()
bool IconChoiceDialog::QueryClose() bool IconChoiceDialog::QueryClose()
{ {
bool bRet = true; bool bRet = true;
for (IconChoicePageData* pData : maPageList) for (auto & pData : maPageList)
{ {
if ( pData->pPage && !pData->pPage->QueryClose() ) if ( pData->pPage && !pData->pPage->QueryClose() )
{ {
...@@ -566,11 +564,11 @@ void IconChoiceDialog::Start_Impl() ...@@ -566,11 +564,11 @@ void IconChoiceDialog::Start_Impl()
IconChoicePageData* IconChoiceDialog::GetPageData ( HyperLinkPageType nId ) IconChoicePageData* IconChoiceDialog::GetPageData ( HyperLinkPageType nId )
{ {
IconChoicePageData *pRet = nullptr; IconChoicePageData *pRet = nullptr;
for (IconChoicePageData* pData : maPageList) for (auto & pData : maPageList)
{ {
if ( pData->nId == nId ) if ( pData->nId == nId )
{ {
pRet = pData; pRet = pData.get();
break; break;
} }
} }
......
...@@ -96,7 +96,7 @@ class IconChoiceDialog : public SfxModalDialog ...@@ -96,7 +96,7 @@ class IconChoiceDialog : public SfxModalDialog
private: private:
friend class IconChoicePage; friend class IconChoicePage;
std::vector< IconChoicePageData* > maPageList; std::vector< std::unique_ptr<IconChoicePageData> > maPageList;
VclPtr<SvtIconChoiceCtrl> m_pIconCtrl; VclPtr<SvtIconChoiceCtrl> m_pIconCtrl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment