diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-28 13:52:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-28 16:57:52 +0000 |
commit | c026b936404bd052fc74283d3cc2e0727ec4edb9 (patch) | |
tree | 04938255d1802c19dbbe4ce0c0af80c0960ff805 /sfx2 | |
parent | d7182c36be4b606a02cddeacb44c1b63387bd368 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appdde.cxx | 22 | ||||
-rw-r--r-- | sfx2/source/inc/appdata.hxx | 4 |
2 files changed, 11 insertions, 15 deletions
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<SfxDdeDocTopic_Impl*> SfxDdeDocTopics_Impl; - class SfxAppData_Impl { public: @@ -66,7 +64,7 @@ public: // DDE stuff std::unique_ptr<DdeService> pDdeService; - std::unique_ptr<SfxDdeDocTopics_Impl> pDocTopics; + std::vector<SfxDdeDocTopic_Impl*> maDocTopics; std::unique_ptr<SfxDdeTriggerTopic_Impl> pTriggerTopic; std::unique_ptr<DdeService> pDdeService2; |