include/sfx2/mgetempl.hxx | 3 ++- sfx2/source/appl/appdata.cxx | 1 + sfx2/source/appl/appdde.cxx | 32 ++++++++++---------------------- sfx2/source/dialog/mgetempl.cxx | 4 ++-- sfx2/source/inc/appdata.hxx | 21 +++++++++++++++++---- 5 files changed, 32 insertions(+), 29 deletions(-)
New commits: commit de0a2f6ae7fdfccc17e2b93006a3d308ac15868b Author: Noel Grandin <[email protected]> Date: Wed May 2 13:58:34 2018 +0200 loplugin:useuniqueptr in SfxManageStyleSheetPage Change-Id: Ia20be44b7a574a8afe1edbf5bf313da4391898d1 Reviewed-on: https://gerrit.libreoffice.org/53760 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx index 2a86859b17cd..ded0aab6b0ec 100644 --- a/include/sfx2/mgetempl.hxx +++ b/include/sfx2/mgetempl.hxx @@ -25,6 +25,7 @@ #include <vcl/vclmedit.hxx> #include <sfx2/styfitem.hxx> #include <sfx2/tabdlg.hxx> +#include <memory> /* expected: SID_TEMPLATE_NAME : In: StringItem, Name of Template @@ -55,7 +56,7 @@ class SfxManageStyleSheetPage final : public SfxTabPage VclPtr<FixedText> m_pDescFt; SfxStyleSheetBase *pStyle; - SfxStyleFamilies *pFamilies; + std::unique_ptr<SfxStyleFamilies> pFamilies; const SfxStyleFamilyItem *pItem; OUString aBuf; bool bModified; diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 611a7359b9f9..2b29c7e335d1 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -92,7 +92,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx else m_pEditLinkStyleBtn->Enable(); - pFamilies = SfxApplication::GetModule_Impl()->CreateStyleFamilies(); + pFamilies.reset(SfxApplication::GetModule_Impl()->CreateStyleFamilies()); SfxStyleSheetBasePool* pPool = nullptr; SfxObjectShell* pDocShell = SfxObjectShell::Current(); @@ -252,7 +252,7 @@ void SfxManageStyleSheetPage::dispose() { m_pNameRw->SetGetFocusHdl( Link<Control&,void>() ); m_pNameRw->SetLoseFocusHdl( Link<Control&,void>() ); - delete pFamilies; + pFamilies.reset(); pItem = nullptr; pStyle = nullptr; m_pNameRo.clear(); commit 49380068794fa6776cfeedf3ffeaa3677bc63f21 Author: Noel Grandin <[email protected]> Date: Wed May 2 13:11:14 2018 +0200 loplugin:useuniqueptr in SfxAppData_Impl Change-Id: I861dd9459e4c986557198b918dc099a0bb119d7d Reviewed-on: https://gerrit.libreoffice.org/53759 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index fff9997452e1..cf12b4cc1e20 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -42,6 +42,7 @@ #include "imestatuswindow.hxx" #include <appbaslib.hxx> #include <childwinimpl.hxx> +#include <svl/svdde.hxx> #include <basic/basicmanagerrepository.hxx> #include <basic/basmgr.hxx> diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 8f1ce9d8f25d..31adc8acfc2d 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -194,18 +194,6 @@ bool ImplDdeService::SysTopicExecute( const OUString* pStr ) } #endif -class SfxDdeTriggerTopic_Impl : public DdeTopic -{ -#if defined(_WIN32) -public: - SfxDdeTriggerTopic_Impl() - : DdeTopic( "TRIGGER" ) - {} - - virtual bool Execute( const OUString* ) override { return true; } -#endif -}; - class SfxDdeDocTopic_Impl : public DdeTopic { #if defined(_WIN32) @@ -426,11 +414,11 @@ bool SfxApplication::InitializeDde() DBG_ASSERT( !pImpl->pDdeService, "Dde can not be initialized multiple times" ); - pImpl->pDdeService = new ImplDdeService( Application::GetAppName() ); + pImpl->pDdeService.reset(new ImplDdeService( Application::GetAppName() )); nError = pImpl->pDdeService->GetError(); if( !nError ) { - pImpl->pDocTopics = new SfxDdeDocTopics_Impl; + pImpl->pDocTopics.reset(new SfxDdeDocTopics_Impl); // we certainly want to support RTF! pImpl->pDdeService->AddFormat( SotClipboardFormatId::RTF ); @@ -442,8 +430,8 @@ bool SfxApplication::InitializeDde() OUString aService( SfxDdeServiceName_Impl( aOfficeLockFile.GetMainURL(INetURLObject::DecodeMechanism::ToIUri) ) ); aService = aService.toAsciiUpperCase(); - pImpl->pDdeService2 = new ImplDdeService( aService ); - pImpl->pTriggerTopic = new SfxDdeTriggerTopic_Impl; + pImpl->pDdeService2.reset( new ImplDdeService( aService )); + pImpl->pTriggerTopic.reset(new SfxDdeTriggerTopic_Impl); pImpl->pDdeService2->AddTopic( *pImpl->pTriggerTopic ); } #endif @@ -452,10 +440,10 @@ bool SfxApplication::InitializeDde() void SfxAppData_Impl::DeInitDDE() { - DELETEZ( pTriggerTopic ); - DELETEZ( pDdeService2 ); - DELETEZ( pDocTopics ); - DELETEZ( pDdeService ); + pTriggerTopic.reset(); + pDdeService2.reset(); + pDocTopics.reset(); + pDdeService.reset(); } #if defined(_WIN32) @@ -514,12 +502,12 @@ void SfxApplication::RemoveDdeTopic( SfxObjectShell const * pSh ) const DdeService* SfxApplication::GetDdeService() const { - return pImpl->pDdeService; + return pImpl->pDdeService.get(); } DdeService* SfxApplication::GetDdeService() { - return pImpl->pDdeService; + return pImpl->pDdeService.get(); } #if defined(_WIN32) diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index ac5815731d82..8dffcb348d01 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -24,6 +24,7 @@ #include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <svl/lstner.hxx> +#include <svl/svdde.hxx> #include <svtools/ehdl.hxx> #include <vcl/timer.hxx> #include <sfx2/app.hxx> @@ -70,10 +71,10 @@ public: OUString aLastDir; // for IO dialog // DDE stuff - DdeService* pDdeService; - SfxDdeDocTopics_Impl* pDocTopics; - SfxDdeTriggerTopic_Impl* pTriggerTopic; - DdeService* pDdeService2; + std::unique_ptr<DdeService> pDdeService; + std::unique_ptr<SfxDdeDocTopics_Impl> pDocTopics; + std::unique_ptr<SfxDdeTriggerTopic_Impl> pTriggerTopic; + std::unique_ptr<DdeService> pDdeService2; // single instance classes SfxChildWinFactArr_Impl* pFactArr; @@ -133,6 +134,18 @@ public: void OnApplicationBasicManagerCreated( BasicManager& _rManager ); }; +class SfxDdeTriggerTopic_Impl : public DdeTopic +{ +#if defined(_WIN32) +public: + SfxDdeTriggerTopic_Impl() + : DdeTopic( "TRIGGER" ) + {} + + virtual bool Execute( const OUString* ) override { return true; } +#endif +}; + #endif // INCLUDED_SFX2_SOURCE_INC_APPDATA_HXX _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
