summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-02 13:11:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-04 08:56:28 +0200
commit49380068794fa6776cfeedf3ffeaa3677bc63f21 (patch)
tree45177688d02598302885417a709ebde95c606788
parent36ca18f70ee0bf9541bc0105c85f0a68f088c92b (diff)
loplugin:useuniqueptr in SfxAppData_Impl
Change-Id: I861dd9459e4c986557198b918dc099a0bb119d7d Reviewed-on: https://gerrit.libreoffice.org/53759 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sfx2/source/appl/appdata.cxx1
-rw-r--r--sfx2/source/appl/appdde.cxx32
-rw-r--r--sfx2/source/inc/appdata.hxx21
3 files changed, 28 insertions, 26 deletions
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