diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-02 10:18:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-02 15:38:19 +0200 |
commit | e1f87cb067a058f34caaf61d86c79958eebfd0e4 (patch) | |
tree | 18a251ff654e8797be765d42c25ed1bb6d91f167 /cui | |
parent | ed01e23aeb08addc9ac7d74014483b5af57b15d9 (diff) |
consistently apply std::unique_ptr to SvLBoxButtonData
Change-Id: I307c9095aa562348ce1b9338203995d9d62eebb4
Reviewed-on: https://gerrit.libreoffice.org/43037
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/autocdlg.hxx | 30 | ||||
-rw-r--r-- | cui/source/inc/optlingu.hxx | 4 | ||||
-rw-r--r-- | cui/source/options/fontsubs.cxx | 12 | ||||
-rw-r--r-- | cui/source/options/fontsubs.hxx | 2 | ||||
-rw-r--r-- | cui/source/options/optfltr.cxx | 14 | ||||
-rw-r--r-- | cui/source/options/optfltr.hxx | 2 | ||||
-rw-r--r-- | cui/source/options/optlingu.cxx | 16 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 28 |
8 files changed, 49 insertions, 59 deletions
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx index 372e0b99aa8c..14915f691c2f 100644 --- a/cui/source/inc/autocdlg.hxx +++ b/cui/source/inc/autocdlg.hxx @@ -158,25 +158,25 @@ class OfaSwAutoFmtOptionsPage : public SfxTabPage vcl::Font aByInputBulletFont; sal_uInt16 nPercent; - SvLBoxButtonData* pCheckButtonData; + std::unique_ptr<SvLBoxButtonData> m_xCheckButtonData; - DECL_LINK(SelectHdl, SvTreeListBox*, void); - DECL_LINK(EditHdl, Button*, void); - DECL_LINK(DoubleClickEditHdl, SvTreeListBox*, bool); - SvTreeListEntry* CreateEntry(OUString& rTxt, sal_uInt16 nCol); + DECL_LINK(SelectHdl, SvTreeListBox*, void); + DECL_LINK(EditHdl, Button*, void); + DECL_LINK(DoubleClickEditHdl, SvTreeListBox*, bool); + SvTreeListEntry* CreateEntry(OUString& rTxt, sal_uInt16 nCol); - OfaSwAutoFmtOptionsPage( vcl::Window* pParent, - const SfxItemSet& rSet ); - virtual ~OfaSwAutoFmtOptionsPage() override; - virtual void dispose() override; + OfaSwAutoFmtOptionsPage( vcl::Window* pParent, + const SfxItemSet& rSet ); + virtual ~OfaSwAutoFmtOptionsPage() override; + virtual void dispose() override; public: - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); - virtual bool FillItemSet( SfxItemSet* rSet ) override; - virtual void Reset( const SfxItemSet* rSet ) override; - virtual void ActivatePage( const SfxItemSet& ) override; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet); + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; + virtual void ActivatePage( const SfxItemSet& ) override; }; // class AutoCorrEdit ---------------------------------------------------- @@ -365,7 +365,7 @@ private: OUString sNonBrkSpace; OUString sOrdinal; - SvLBoxButtonData* pCheckButtonData; + std::unique_ptr<SvLBoxButtonData> m_xCheckButtonData; VclPtr<CheckBox> m_pSingleTypoCB; VclPtr<PushButton> m_pSglStartQuotePB; diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx index 66017664c93b..477006de3bc8 100644 --- a/cui/source/inc/optlingu.hxx +++ b/cui/source/inc/optlingu.hxx @@ -70,7 +70,7 @@ class SvxEditModulesDlg : public ModalDialog SvxLinguData_Impl* pDefaultLinguData; SvxLinguData_Impl& rLinguData; - std::unique_ptr<SvLBoxButtonData> pCheckButtonData; + std::unique_ptr<SvLBoxButtonData> m_xCheckButtonData; SvTreeListEntry* CreateEntry(OUString& rTxt, sal_uInt16 nCol); @@ -127,7 +127,7 @@ private: css::uno::Reference< css::linguistic2::XDictionary > > aDics; - std::unique_ptr<SvLBoxButtonData> pCheckButtonData; + std::unique_ptr<SvLBoxButtonData> m_xCheckButtonData; SvxLinguData_Impl* pLinguData; diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx index 79c0e9f32f8f..b1ef2241f17b 100644 --- a/cui/source/options/fontsubs.cxx +++ b/cui/source/options/fontsubs.cxx @@ -40,7 +40,6 @@ SvxFontSubstTabPage::SvxFontSubstTabPage( vcl::Window* pParent, const SfxItemSet& rSet ) : SfxTabPage(pParent, "OptFontsPage", "cui/ui/optfontspage.ui", &rSet) , pConfig(new SvtFontSubstConfig) - , pCheckButtonData(nullptr) { get(m_pUseTableCB, "usetable"); get(m_pReplacements, "replacements"); @@ -119,13 +118,13 @@ SvTreeListEntry* SvxFontSubstTabPage::CreateEntry(OUString& rFont1, OUString& rF { SvTreeListEntry* pEntry = new SvTreeListEntry; - if( !pCheckButtonData ) - pCheckButtonData = new SvLBoxButtonData( m_pCheckLB ); + if (!m_xCheckButtonData) + m_xCheckButtonData.reset(new SvLBoxButtonData(m_pCheckLB)); pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>(Image(), Image(), false)); // otherwise boom! - pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, pCheckButtonData)); - pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, m_xCheckButtonData.get())); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, m_xCheckButtonData.get())); pEntry->AddItem(o3tl::make_unique<SvLBoxString>(rFont1)); pEntry->AddItem(o3tl::make_unique<SvLBoxString>(rFont2)); @@ -140,8 +139,7 @@ SvxFontSubstTabPage::~SvxFontSubstTabPage() void SvxFontSubstTabPage::dispose() { - delete pCheckButtonData; - pCheckButtonData = nullptr; + m_xCheckButtonData.reset(); delete pConfig; pConfig = nullptr; m_pCheckLB.disposeAndClear(); diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx index 22ba5caa861b..e016bf880188 100644 --- a/cui/source/options/fontsubs.hxx +++ b/cui/source/options/fontsubs.hxx @@ -79,7 +79,7 @@ class SvxFontSubstTabPage : public SfxTabPage Color aTextColor; - SvLBoxButtonData* pCheckButtonData; + std::unique_ptr<SvLBoxButtonData> m_xCheckButtonData; DECL_LINK(SelectEditHdl, Edit&, void); DECL_LINK(SelectComboBoxHdl, ComboBox&, void); diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx index cd39dcac4e54..067cb331cebd 100644 --- a/cui/source/options/optfltr.cxx +++ b/cui/source/options/optfltr.cxx @@ -149,8 +149,7 @@ OfaMSFilterTabPage2::OfaMSFilterTabPage2( vcl::Window* pParent, const SfxItemSet sChgToFromWriter(CuiResId(RID_SVXSTR_CHG_WRITER)), sChgToFromCalc(CuiResId(RID_SVXSTR_CHG_CALC)), sChgToFromImpress(CuiResId(RID_SVXSTR_CHG_IMPRESS)), - sChgToFromSmartArt(CuiResId(RID_SVXSTR_CHG_SMARTART)), - pCheckButtonData(nullptr) + sChgToFromSmartArt(CuiResId(RID_SVXSTR_CHG_SMARTART)) { get(m_pCheckLBContainer, "checklbcontainer"); @@ -181,8 +180,7 @@ OfaMSFilterTabPage2::~OfaMSFilterTabPage2() void OfaMSFilterTabPage2::dispose() { - delete pCheckButtonData; - pCheckButtonData = nullptr; + m_xCheckButtonData.reset(); m_pCheckLB.disposeAndClear(); m_pCheckLBContainer.clear(); aHighlightingRB.clear(); @@ -334,18 +332,18 @@ void OfaMSFilterTabPage2::InsertEntry( const OUString& _rTxt, sal_IntPtr _nType, { SvTreeListEntry* pEntry = new SvTreeListEntry; - if( !pCheckButtonData ) - pCheckButtonData = new SvLBoxButtonData( m_pCheckLB ); + if (!m_xCheckButtonData) + m_xCheckButtonData.reset(new SvLBoxButtonData(m_pCheckLB)); pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>( Image(), Image(), false)); pEntry->AddItem(o3tl::make_unique<SvLBoxButton>( SvLBoxButtonKind::EnabledCheckbox, - pCheckButtonData)); + m_xCheckButtonData.get())); pEntry->AddItem(o3tl::make_unique<SvLBoxButton>( saveEnabled ? SvLBoxButtonKind::EnabledCheckbox : SvLBoxButtonKind::DisabledCheckbox, - pCheckButtonData)); + m_xCheckButtonData.get())); pEntry->AddItem(o3tl::make_unique<SvLBoxString>(_rTxt)); pEntry->SetUserData( reinterpret_cast<void*>(_nType) ); diff --git a/cui/source/options/optfltr.hxx b/cui/source/options/optfltr.hxx index 4e28a04ad883..4ef6cf3a63c0 100644 --- a/cui/source/options/optfltr.hxx +++ b/cui/source/options/optfltr.hxx @@ -82,7 +82,7 @@ class OfaMSFilterTabPage2 : public SfxTabPage sChgToFromCalc, sChgToFromImpress, sChgToFromSmartArt; - SvLBoxButtonData* pCheckButtonData; + std::unique_ptr<SvLBoxButtonData> m_xCheckButtonData; VclPtr<RadioButton> aHighlightingRB; VclPtr<RadioButton> aShadingRB; diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index efde456a95b6..6a7ddc081831 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -1715,11 +1715,11 @@ SvTreeListEntry* SvxLinguTabPage::CreateEntry( OUString& rTxt, sal_uInt16 nCol ) { SvTreeListEntry* pEntry = new SvTreeListEntry; - if( !pCheckButtonData ) - pCheckButtonData.reset(new SvLBoxButtonData(m_pLinguOptionsCLB)); + if (!m_xCheckButtonData) + m_xCheckButtonData.reset(new SvLBoxButtonData(m_pLinguOptionsCLB)); if (CBCOL_FIRST == nCol) - pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, pCheckButtonData.get())); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, m_xCheckButtonData.get())); if (CBCOL_SECOND == nCol) pEntry->AddItem(o3tl::make_unique<SvLBoxString>("")); // empty column pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>(Image(), Image(), false)); @@ -1766,8 +1766,6 @@ SvxEditModulesDlg::SvxEditModulesDlg(vcl::Window* pParent, SvxLinguData_Impl& rD get(m_pLanguageLB, "language"); m_pLanguageLB->SetStyle(m_pLanguageLB->GetStyle() | WB_SORT); - pCheckButtonData = nullptr; - pDefaultLinguData = new SvxLinguData_Impl( rLinguData ); m_pModulesCLB->SetStyle( m_pModulesCLB->GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL ); @@ -1837,14 +1835,14 @@ void SvxEditModulesDlg::dispose() SvTreeListEntry* SvxEditModulesDlg::CreateEntry( OUString& rTxt, sal_uInt16 nCol ) { SvTreeListEntry* pEntry = new SvTreeListEntry; - if( !pCheckButtonData ) + if (!m_xCheckButtonData ) { - pCheckButtonData.reset(new SvLBoxButtonData(m_pModulesCLB)); - pCheckButtonData->SetLink( LINK( this, SvxEditModulesDlg, BoxCheckButtonHdl_Impl2 ) ); + m_xCheckButtonData.reset(new SvLBoxButtonData(m_pModulesCLB)); + m_xCheckButtonData->SetLink( LINK( this, SvxEditModulesDlg, BoxCheckButtonHdl_Impl2 ) ); } if (CBCOL_FIRST == nCol) - pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, pCheckButtonData.get())); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, m_xCheckButtonData.get())); if (CBCOL_SECOND == nCol) pEntry->AddItem(o3tl::make_unique<SvLBoxString>("")); // empty column pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>(Image(), Image(), false)); diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 8477210c98a3..65edb0fc84f2 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -432,7 +432,6 @@ OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( vcl::Window* pParent, , sDelSpaceAtSttEnd(CuiResId(RID_SVXSTR_DEL_SPACES_AT_STT_END)) , sDelSpaceBetweenLines(CuiResId(RID_SVXSTR_DEL_SPACES_BETWEEN_LINES)) , nPercent(50) - , pCheckButtonData(nullptr) { get(m_pEditPB, "edit"); @@ -468,10 +467,10 @@ SvTreeListEntry* OfaSwAutoFmtOptionsPage::CreateEntry(OUString& rTxt, sal_uInt16 { SvTreeListEntry* pEntry = new SvTreeListEntry; - if ( !pCheckButtonData ) + if (!m_xCheckButtonData) { - pCheckButtonData = new SvLBoxButtonData( m_pCheckLB ); - m_pCheckLB->SetCheckButtonData( pCheckButtonData ); + m_xCheckButtonData.reset(new SvLBoxButtonData(m_pCheckLB)); + m_pCheckLB->SetCheckButtonData(m_xCheckButtonData.get()); } pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>(Image(), Image(), false)); @@ -479,12 +478,12 @@ SvTreeListEntry* OfaSwAutoFmtOptionsPage::CreateEntry(OUString& rTxt, sal_uInt16 if (nCol == CBCOL_SECOND) pEntry->AddItem(o3tl::make_unique<SvLBoxString>("")); else - pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, m_xCheckButtonData.get())); if (nCol == CBCOL_FIRST) pEntry->AddItem(o3tl::make_unique<SvLBoxString>("")); else - pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, m_xCheckButtonData.get())); pEntry->AddItem(o3tl::make_unique<OfaImpBrwString>(rTxt)); return pEntry; @@ -502,8 +501,7 @@ void OfaSwAutoFmtOptionsPage::dispose() delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( REPLACE_BULLETS )); delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( APPLY_NUMBERING )); delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( MERGE_SINGLE_LINE_PARA )); - delete pCheckButtonData; - pCheckButtonData = nullptr; + m_xCheckButtonData.reset(); } m_pCheckLB.disposeAndClear(); m_pEditPB.clear(); @@ -1787,10 +1785,10 @@ SvTreeListEntry* OfaQuoteTabPage::CreateEntry(OUString& rTxt, sal_uInt16 nCol) { SvTreeListEntry* pEntry = new SvTreeListEntry; - if ( !pCheckButtonData ) + if (!m_xCheckButtonData) { - pCheckButtonData = new SvLBoxButtonData(m_pSwCheckLB); - m_pSwCheckLB->SetCheckButtonData(pCheckButtonData); + m_xCheckButtonData.reset(new SvLBoxButtonData(m_pSwCheckLB)); + m_pSwCheckLB->SetCheckButtonData(m_xCheckButtonData.get()); } pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>(Image(), Image(), false)); @@ -1798,12 +1796,12 @@ SvTreeListEntry* OfaQuoteTabPage::CreateEntry(OUString& rTxt, sal_uInt16 nCol) if (nCol == CBCOL_SECOND) pEntry->AddItem(o3tl::make_unique<SvLBoxString>("")); else - pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, m_xCheckButtonData.get())); if (nCol == CBCOL_FIRST) pEntry->AddItem(o3tl::make_unique<SvLBoxString>("")); else - pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>(SvLBoxButtonKind::EnabledCheckbox, m_xCheckButtonData.get())); pEntry->AddItem(o3tl::make_unique<OfaImpBrwString>(rTxt)); @@ -1814,7 +1812,6 @@ OfaQuoteTabPage::OfaQuoteTabPage(vcl::Window* pParent, const SfxItemSet& rSet) : SfxTabPage(pParent, "ApplyLocalizedPage", "cui/ui/applylocalizedpage.ui", &rSet) , sNonBrkSpace(CuiResId(RID_SVXSTR_NON_BREAK_SPACE)) , sOrdinal(CuiResId(RID_SVXSTR_ORDINAL)) - , pCheckButtonData(nullptr) , cSglStartQuote(0) , cSglEndQuote(0) , cStartQuote(0) @@ -1886,8 +1883,7 @@ OfaQuoteTabPage::~OfaQuoteTabPage() void OfaQuoteTabPage::dispose() { - delete pCheckButtonData; - pCheckButtonData = nullptr; + m_xCheckButtonData.reset(); m_pSwCheckLB.disposeAndClear(); m_pCheckLB.disposeAndClear(); m_pSingleTypoCB.clear(); |