From c026b936404bd052fc74283d3cc2e0727ec4edb9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 28 Feb 2023 13:52:19 +0200 Subject: no need to allocate SfxDdeDocTopics_Impl separately it is just a vector, only 2 words big Change-Id: I88ca1befea1fc3dba05f7628e4319aedb3250751 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147968 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sfx2/source/appl/appdde.cxx | 22 ++++++++++------------ sfx2/source/inc/appdata.hxx | 4 +--- 2 files changed, 11 insertions(+), 15 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 39b72e6eb0b3..6fe5888009dc 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -414,8 +414,6 @@ bool SfxApplication::InitializeDde() nError = pImpl->pDdeService->GetError(); if( !nError ) { - pImpl->pDocTopics.reset(new SfxDdeDocTopics_Impl); - // we certainly want to support RTF! pImpl->pDdeService->AddFormat( SotClipboardFormatId::RTF ); pImpl->pDdeService->AddFormat( SotClipboardFormatId::RICHTEXT ); @@ -438,7 +436,7 @@ void SfxAppData_Impl::DeInitDDE() { pTriggerTopic.reset(); pDdeService2.reset(); - pDocTopics.reset(); + maDocTopics.clear(); pDdeService.reset(); } @@ -446,15 +444,15 @@ void SfxAppData_Impl::DeInitDDE() void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) { //OV: DDE is disconnected in server mode! - if( !pImpl->pDocTopics ) + if( pImpl->maDocTopics.empty() ) return; // prevent double submit OUString sShellNm; bool bFnd = false; - for (size_t n = pImpl->pDocTopics->size(); n;) + for (size_t n = pImpl->maDocTopics.size(); n;) { - if( (*pImpl->pDocTopics)[ --n ]->pSh == pSh ) + if( pImpl->maDocTopics[ --n ]->pSh == pSh ) { // If the document is untitled, is still a new Topic is created! if( !bFnd ) @@ -462,14 +460,14 @@ void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) bFnd = true; sShellNm = pSh->GetTitle(SFX_TITLE_FULLNAME).toAsciiLowerCase(); } - OUString sNm( (*pImpl->pDocTopics)[ n ]->GetName() ); + OUString sNm( pImpl->maDocTopics[ n ]->GetName() ); if( sShellNm == sNm.toAsciiLowerCase() ) return ; } } SfxDdeDocTopic_Impl *const pTopic = new SfxDdeDocTopic_Impl(pSh); - pImpl->pDocTopics->push_back(pTopic); + pImpl->maDocTopics.push_back(pTopic); pImpl->pDdeService->AddTopic( *pTopic ); } #endif @@ -478,17 +476,17 @@ void SfxApplication::RemoveDdeTopic( SfxObjectShell const * pSh ) { #if defined(_WIN32) //OV: DDE is disconnected in server mode! - if( !pImpl->pDocTopics ) + if( pImpl->maDocTopics.empty() ) return; - for (size_t n = pImpl->pDocTopics->size(); n; ) + for (size_t n = pImpl->maDocTopics.size(); n; ) { - SfxDdeDocTopic_Impl *const pTopic = (*pImpl->pDocTopics)[ --n ]; + SfxDdeDocTopic_Impl *const pTopic = pImpl->maDocTopics[ --n ]; if (pTopic->pSh == pSh) { pImpl->pDdeService->RemoveTopic( *pTopic ); delete pTopic; - pImpl->pDocTopics->erase( pImpl->pDocTopics->begin() + n ); + pImpl->maDocTopics.erase( pImpl->maDocTopics.begin() + n ); } } #else diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 121ba43f5581..7f2c99d6332a 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -56,8 +56,6 @@ namespace sfx2::sidebar { class Theme; } -typedef std::vector SfxDdeDocTopics_Impl; - class SfxAppData_Impl { public: @@ -66,7 +64,7 @@ public: // DDE stuff std::unique_ptr pDdeService; - std::unique_ptr pDocTopics; + std::vector maDocTopics; std::unique_ptr pTriggerTopic; std::unique_ptr pDdeService2; -- cgit