[Libreoffice-commits] core.git: cui/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Sep 26 06:59:32 UTC 2018
cui/source/options/optgdlg.cxx | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
New commits:
commit 08730055c9baed59e8efd825fc593bb39b0ab49c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Sep 25 15:25:29 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 26 08:59:09 2018 +0200
loplugin:useuniqueptr in OfaLanguagesTabPage
Change-Id: I9fcbac58f1b0a13b83dc24c8e2f256016b5f31b8
Reviewed-on: https://gerrit.libreoffice.org/60973
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 9c6bec7b1c0d..212995580787 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1313,7 +1313,7 @@ VclPtr<SfxTabPage> OfaLanguagesTabPage::Create( TabPageParent pParent, const Sfx
return VclPtr<OfaLanguagesTabPage>::Create(pParent.pParent, *rAttrSet);
}
-static void lcl_UpdateAndDelete(SfxVoidItem* pInvalidItems[], SfxBoolItem* pBoolItems[], sal_uInt16 nCount)
+static void lcl_Update(std::unique_ptr<SfxVoidItem> pInvalidItems[], std::unique_ptr<SfxBoolItem> pBoolItems[], sal_uInt16 nCount)
{
SfxViewFrame* pCurrentFrm = SfxViewFrame::Current();
SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst();
@@ -1329,11 +1329,6 @@ static void lcl_UpdateAndDelete(SfxVoidItem* pInvalidItems[], SfxBoolItem* pBool
}
pViewFrm = SfxViewFrame::GetNext(*pViewFrm);
}
- for(sal_Int16 i = 0; i < nCount; i++)
- {
- delete pInvalidItems[i];
- delete pBoolItems[i] ;
- }
}
bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
@@ -1533,15 +1528,15 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
//iterate over all bindings to invalidate vertical text direction
const sal_uInt16 STATE_COUNT = 2;
- SfxBoolItem* pBoolItems[STATE_COUNT];
- pBoolItems[0] = new SfxBoolItem(SID_VERTICALTEXT_STATE, false);
- pBoolItems[1] = new SfxBoolItem(SID_TEXT_FITTOSIZE_VERTICAL, false);
+ std::unique_ptr<SfxBoolItem> pBoolItems[STATE_COUNT];
+ pBoolItems[0].reset(new SfxBoolItem(SID_VERTICALTEXT_STATE, false));
+ pBoolItems[1].reset(new SfxBoolItem(SID_TEXT_FITTOSIZE_VERTICAL, false));
- SfxVoidItem* pInvalidItems[STATE_COUNT];
- pInvalidItems[0] = new SfxVoidItem(SID_VERTICALTEXT_STATE);
- pInvalidItems[1] = new SfxVoidItem(SID_TEXT_FITTOSIZE_VERTICAL);
+ std::unique_ptr<SfxVoidItem> pInvalidItems[STATE_COUNT];
+ pInvalidItems[0].reset(new SfxVoidItem(SID_VERTICALTEXT_STATE));
+ pInvalidItems[1].reset(new SfxVoidItem(SID_TEXT_FITTOSIZE_VERTICAL));
- lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT);
+ lcl_Update(pInvalidItems, pBoolItems, STATE_COUNT);
}
if ( m_pCTLSupportCB->IsValueChangedFromSaved() )
@@ -1553,11 +1548,11 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
pLangConfig->aLanguageOptions.SetCTLFontEnabled( m_pCTLSupportCB->IsChecked() );
const sal_uInt16 STATE_COUNT = 1;
- SfxBoolItem* pBoolItems[STATE_COUNT];
- pBoolItems[0] = new SfxBoolItem(SID_CTLFONT_STATE, false);
- SfxVoidItem* pInvalidItems[STATE_COUNT];
- pInvalidItems[0] = new SfxVoidItem(SID_CTLFONT_STATE);
- lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT);
+ std::unique_ptr<SfxBoolItem> pBoolItems[STATE_COUNT];
+ pBoolItems[0].reset(new SfxBoolItem(SID_CTLFONT_STATE, false));
+ std::unique_ptr<SfxVoidItem> pInvalidItems[STATE_COUNT];
+ pInvalidItems[0].reset(new SfxVoidItem(SID_CTLFONT_STATE));
+ lcl_Update(pInvalidItems, pBoolItems, STATE_COUNT);
}
if ( pLangConfig->aSysLocaleOptions.IsModified() )
More information about the Libreoffice-commits
mailing list