Kaydet (Commit) 49380068 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SfxAppData_Impl

Change-Id: I861dd9459e4c986557198b918dc099a0bb119d7d
Reviewed-on: https://gerrit.libreoffice.org/53759Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 36ca18f7
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "imestatuswindow.hxx" #include "imestatuswindow.hxx"
#include <appbaslib.hxx> #include <appbaslib.hxx>
#include <childwinimpl.hxx> #include <childwinimpl.hxx>
#include <svl/svdde.hxx>
#include <basic/basicmanagerrepository.hxx> #include <basic/basicmanagerrepository.hxx>
#include <basic/basmgr.hxx> #include <basic/basmgr.hxx>
......
...@@ -194,18 +194,6 @@ bool ImplDdeService::SysTopicExecute( const OUString* pStr ) ...@@ -194,18 +194,6 @@ bool ImplDdeService::SysTopicExecute( const OUString* pStr )
} }
#endif #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 class SfxDdeDocTopic_Impl : public DdeTopic
{ {
#if defined(_WIN32) #if defined(_WIN32)
...@@ -426,11 +414,11 @@ bool SfxApplication::InitializeDde() ...@@ -426,11 +414,11 @@ bool SfxApplication::InitializeDde()
DBG_ASSERT( !pImpl->pDdeService, DBG_ASSERT( !pImpl->pDdeService,
"Dde can not be initialized multiple times" ); "Dde can not be initialized multiple times" );
pImpl->pDdeService = new ImplDdeService( Application::GetAppName() ); pImpl->pDdeService.reset(new ImplDdeService( Application::GetAppName() ));
nError = pImpl->pDdeService->GetError(); nError = pImpl->pDdeService->GetError();
if( !nError ) if( !nError )
{ {
pImpl->pDocTopics = new SfxDdeDocTopics_Impl; pImpl->pDocTopics.reset(new SfxDdeDocTopics_Impl);
// we certainly want to support RTF! // we certainly want to support RTF!
pImpl->pDdeService->AddFormat( SotClipboardFormatId::RTF ); pImpl->pDdeService->AddFormat( SotClipboardFormatId::RTF );
...@@ -442,8 +430,8 @@ bool SfxApplication::InitializeDde() ...@@ -442,8 +430,8 @@ bool SfxApplication::InitializeDde()
OUString aService( SfxDdeServiceName_Impl( OUString aService( SfxDdeServiceName_Impl(
aOfficeLockFile.GetMainURL(INetURLObject::DecodeMechanism::ToIUri) ) ); aOfficeLockFile.GetMainURL(INetURLObject::DecodeMechanism::ToIUri) ) );
aService = aService.toAsciiUpperCase(); aService = aService.toAsciiUpperCase();
pImpl->pDdeService2 = new ImplDdeService( aService ); pImpl->pDdeService2.reset( new ImplDdeService( aService ));
pImpl->pTriggerTopic = new SfxDdeTriggerTopic_Impl; pImpl->pTriggerTopic.reset(new SfxDdeTriggerTopic_Impl);
pImpl->pDdeService2->AddTopic( *pImpl->pTriggerTopic ); pImpl->pDdeService2->AddTopic( *pImpl->pTriggerTopic );
} }
#endif #endif
...@@ -452,10 +440,10 @@ bool SfxApplication::InitializeDde() ...@@ -452,10 +440,10 @@ bool SfxApplication::InitializeDde()
void SfxAppData_Impl::DeInitDDE() void SfxAppData_Impl::DeInitDDE()
{ {
DELETEZ( pTriggerTopic ); pTriggerTopic.reset();
DELETEZ( pDdeService2 ); pDdeService2.reset();
DELETEZ( pDocTopics ); pDocTopics.reset();
DELETEZ( pDdeService ); pDdeService.reset();
} }
#if defined(_WIN32) #if defined(_WIN32)
...@@ -514,12 +502,12 @@ void SfxApplication::RemoveDdeTopic( SfxObjectShell const * pSh ) ...@@ -514,12 +502,12 @@ void SfxApplication::RemoveDdeTopic( SfxObjectShell const * pSh )
const DdeService* SfxApplication::GetDdeService() const const DdeService* SfxApplication::GetDdeService() const
{ {
return pImpl->pDdeService; return pImpl->pDdeService.get();
} }
DdeService* SfxApplication::GetDdeService() DdeService* SfxApplication::GetDdeService()
{ {
return pImpl->pDdeService; return pImpl->pDdeService.get();
} }
#if defined(_WIN32) #if defined(_WIN32)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <svl/lstner.hxx> #include <svl/lstner.hxx>
#include <svl/svdde.hxx>
#include <svtools/ehdl.hxx> #include <svtools/ehdl.hxx>
#include <vcl/timer.hxx> #include <vcl/timer.hxx>
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
...@@ -70,10 +71,10 @@ public: ...@@ -70,10 +71,10 @@ public:
OUString aLastDir; // for IO dialog OUString aLastDir; // for IO dialog
// DDE stuff // DDE stuff
DdeService* pDdeService; std::unique_ptr<DdeService> pDdeService;
SfxDdeDocTopics_Impl* pDocTopics; std::unique_ptr<SfxDdeDocTopics_Impl> pDocTopics;
SfxDdeTriggerTopic_Impl* pTriggerTopic; std::unique_ptr<SfxDdeTriggerTopic_Impl> pTriggerTopic;
DdeService* pDdeService2; std::unique_ptr<DdeService> pDdeService2;
// single instance classes // single instance classes
SfxChildWinFactArr_Impl* pFactArr; SfxChildWinFactArr_Impl* pFactArr;
...@@ -133,6 +134,18 @@ public: ...@@ -133,6 +134,18 @@ public:
void OnApplicationBasicManagerCreated( BasicManager& _rManager ); 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 #endif // INCLUDED_SFX2_SOURCE_INC_APPDATA_HXX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment