[Libreoffice-commits] core.git: 2 commits - cui/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Jun 25 07:12:44 UTC 2018


 cui/source/inc/autocdlg.hxx      |    6 +++---
 cui/source/options/optgdlg.cxx   |   12 ++++--------
 cui/source/options/optgdlg.hxx   |    8 ++++----
 cui/source/tabpages/autocdlg.cxx |   23 +++++++++--------------
 4 files changed, 20 insertions(+), 29 deletions(-)

New commits:
commit f287292d91012519782f0b7a698449b5eeb624b9
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jun 21 10:45:18 2018 +0200

    loplugin:useuniqueptr in OfaViewTabPage
    
    Change-Id: I0a9f7fd5738a06ac60762b3242721df1634b4264
    Reviewed-on: https://gerrit.libreoffice.org/56326
    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 5ce324c2d4e3..e4255ee55bf6 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -705,12 +705,9 @@ OfaViewTabPage::~OfaViewTabPage()
 
 void OfaViewTabPage::dispose()
 {
-    delete mpDrawinglayerOpt;
-    mpDrawinglayerOpt = nullptr;
-    delete pCanvasSettings;
-    pCanvasSettings = nullptr;
-    delete pAppearanceCfg;
-    pAppearanceCfg = nullptr;
+    mpDrawinglayerOpt.reset();
+    pCanvasSettings.reset();
+    pAppearanceCfg.reset();
     m_pIconSizeLB.clear();
     m_pSidebarIconSizeLB.clear();
     m_pNotebookbarIconSizeLB.clear();
@@ -1290,8 +1287,7 @@ OfaLanguagesTabPage::~OfaLanguagesTabPage()
 
 void OfaLanguagesTabPage::dispose()
 {
-    delete pLangConfig;
-    pLangConfig = nullptr;
+    pLangConfig.reset();
     m_pUserInterfaceLB.clear();
     m_pLocaleSettingFT.clear();
     m_pLocaleSettingLB.clear();
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index d986860b6f48..775a8cf5f63f 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -112,9 +112,9 @@ private:
     sal_Int32      nNotebookbarSizeLB_InitialSelection;
     sal_Int32      nStyleLB_InitialSelection;
 
-    SvtTabAppearanceCfg*    pAppearanceCfg;
-    CanvasSettings*         pCanvasSettings;
-    SvtOptionsDrawinglayer* mpDrawinglayerOpt;
+    std::unique_ptr<SvtTabAppearanceCfg>    pAppearanceCfg;
+    std::unique_ptr<CanvasSettings>         pCanvasSettings;
+    std::unique_ptr<SvtOptionsDrawinglayer> mpDrawinglayerOpt;
     std::unique_ptr<svt::OpenGLCfg> mpOpenGLConfig;
 
     std::vector<vcl::IconThemeInfo> mInstalledIconThemes;
@@ -160,7 +160,7 @@ class OfaLanguagesTabPage : public SfxTabPage
 
     bool        m_bOldAsian;
     bool        m_bOldCtl;
-    LanguageConfig_Impl*    pLangConfig;
+    std::unique_ptr<LanguageConfig_Impl> pLangConfig;
 
     OUString        m_sUserLocaleValue;
     OUString        m_sSystemDefaultString;
commit aac20c5b8f4a19051c0ca894eb8951150b37a8a9
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jun 21 10:26:45 2018 +0200

    loplugin:useuniqueptr in OfaAutocorrExceptPage
    
    Change-Id: If59ebc6cd5f73534e3e6c7e3765133c84d839958
    Reviewed-on: https://gerrit.libreoffice.org/56325
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index ecef0e81a0be..017909ca7433 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -254,8 +254,8 @@ private:
         std::set<OUString>      aFormatText;
         std::map<LanguageType, DoubleStringArray>
                                 aDoubleStringTable;
-        CollatorWrapper*        pCompareClass;
-        CharClass*              pCharClass;
+        std::unique_ptr<CollatorWrapper>  pCompareClass;
+        std::unique_ptr<CharClass>        pCharClass;
         LanguageType            eLang;
 
         bool bHasSelectionText;
@@ -320,7 +320,7 @@ private:
     VclPtr<CheckBox>       m_pAutoCapsCB;
 
     StringsTable    aStringsTable;
-    CollatorWrapper* pCompareClass;
+    std::unique_ptr<CollatorWrapper> pCompareClass;
     LanguageType    eLang;
 
     DECL_LINK(NewDelButtonHdl, Button*, void);
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 97444eaec472..16a92adb7d0b 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -880,9 +880,9 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage( vcl::Window* pParent,
     bSWriter = pMod == SfxModule::GetActiveModule();
 
     LanguageTag aLanguageTag( eLastDialogLanguage );
-    pCompareClass = new CollatorWrapper( comphelper::getProcessComponentContext() );
+    pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) );
     pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
-    pCharClass = new CharClass( aLanguageTag );
+    pCharClass.reset( new CharClass( aLanguageTag ) );
 
     static long const aTabs[] = { 1, 61 };
     m_pReplaceTLB->SetTabs( SAL_N_ELEMENTS(aTabs), aTabs );
@@ -913,10 +913,8 @@ void OfaAutocorrReplacePage::dispose()
     aDoubleStringTable.clear();
     aChangesTable.clear();
 
-    delete pCompareClass;
-    pCompareClass = nullptr;
-    delete pCharClass;
-    pCharClass = nullptr;
+    pCompareClass.reset();
+    pCharClass.reset();
 
     m_pTextOnlyCB.clear();
     m_pShortED.clear();
@@ -1099,13 +1097,11 @@ void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet)
     {
         RefillReplaceBox(false, eLang, eSet);
         eLastDialogLanguage = eSet;
-        delete pCompareClass;
-        delete pCharClass;
 
         LanguageTag aLanguageTag( eLastDialogLanguage );
-        pCompareClass = new CollatorWrapper( comphelper::getProcessComponentContext() );
+        pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) );
         pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
-        pCharClass = new CharClass( aLanguageTag );
+        pCharClass.reset( new CharClass( aLanguageTag ) );
         ModifyHdl(*m_pShortED);
     }
 }
@@ -1399,7 +1395,7 @@ OfaAutocorrExceptPage::OfaAutocorrExceptPage(vcl::Window* pParent, const SfxItem
     get(m_pAutoCapsCB, "autodouble");
 
     css::lang::Locale aLcl( LanguageTag::convertToLocale(eLastDialogLanguage ));
-    pCompareClass = new CollatorWrapper( comphelper::getProcessComponentContext() );
+    pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) );
     pCompareClass->loadDefaultCollator( aLcl, 0 );
 
     m_pNewAbbrevPB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl));
@@ -1424,7 +1420,7 @@ OfaAutocorrExceptPage::~OfaAutocorrExceptPage()
 void OfaAutocorrExceptPage::dispose()
 {
     aStringsTable.clear();
-    delete pCompareClass;
+    pCompareClass.reset();
     m_pAbbrevED.clear();
     m_pAbbrevLB.clear();
     m_pNewAbbrevPB.clear();
@@ -1570,8 +1566,7 @@ void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet)
         // save old settings and fill anew
         RefillReplaceBoxes(false, eLang, eSet);
         eLastDialogLanguage = eSet;
-        delete pCompareClass;
-        pCompareClass = new CollatorWrapper( comphelper::getProcessComponentContext() );
+        pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) );
         pCompareClass->loadDefaultCollator( LanguageTag::convertToLocale( eLastDialogLanguage ), 0 );
         ModifyHdl(*m_pAbbrevED);
         ModifyHdl(*m_pDoubleCapsED);


More information about the Libreoffice-commits mailing list