diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appdata.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/appl/appinit.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/sfxpicklist.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/inc/appdata.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/inc/sfxpicklist.hxx | 11 |
5 files changed, 12 insertions, 21 deletions
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index cf12b4cc1e20..fa3413c95ced 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -30,6 +30,7 @@ #include <appdata.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/event.hxx> +#include <sfxpicklist.hxx> #include <sfxtypes.hxx> #include <sfx2/doctempl.hxx> #include <arrdecl.hxx> diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 3771047e805e..c2a91d51283d 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -218,7 +218,7 @@ void SfxApplication::Initialize_Impl() SolarMutexGuard aGuard; //ensure instantiation of listener that manages the internal recently-used //list - SfxPickList::ensure(); + pImpl->mxAppPickList.reset(new SfxPickList(*this)); } DBG_ASSERT( !pImpl->pAppDispat, "AppDispatcher already exists" ); diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index e95daa5a82cf..451afe95cf8a 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -78,7 +78,7 @@ class SfxPickListImpl : public SfxListener static void AddDocumentToPickList( SfxObjectShell* pDocShell ); public: - SfxPickListImpl(); + SfxPickListImpl(SfxApplication& rApp); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; }; @@ -161,25 +161,18 @@ void SfxPickListImpl::AddDocumentToPickList( SfxObjectShell* pDocSh ) pFilter ? pFilter->GetServiceName() : OUString() ); } -SfxPickList::SfxPickList() - : mxImpl(new SfxPickListImpl()) +SfxPickList::SfxPickList(SfxApplication& rApp) + : mxImpl(new SfxPickListImpl(rApp)) { } SfxPickList::~SfxPickList() { - std::unique_ptr<SolarMutexGuard> xGuard(comphelper::SolarMutex::get() ? new SolarMutexGuard : nullptr); - mxImpl.reset(); } -void SfxPickList::ensure() +SfxPickListImpl::SfxPickListImpl(SfxApplication& rApp) { - static SfxPickList aUniqueInstance; -} - -SfxPickListImpl::SfxPickListImpl() -{ - StartListening( *SfxGetpApp() ); + StartListening(rApp); } void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 8dffcb348d01..aa3bed3e121d 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -35,6 +35,7 @@ #include <vector> class SfxApplication; +class SfxPickList; class SfxProgress; class SfxDdeDocTopic_Impl; class DdeService; @@ -88,6 +89,7 @@ public: SfxErrorHandler *m_pSbxErrorHdl; #endif rtl::Reference<SfxStatusDispatcher> mxAppDispatch; + std::unique_ptr<SfxPickList> mxAppPickList; SfxDocumentTemplates* pTemplates; // global pointers diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx index bce382461c7d..6a6e818a613b 100644 --- a/sfx2/source/inc/sfxpicklist.hxx +++ b/sfx2/source/inc/sfxpicklist.hxx @@ -20,14 +20,11 @@ #ifndef INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX #define INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX -#include <vcl/menu.hxx> -#include <svl/lstner.hxx> -#include <com/sun/star/util/XStringWidth.hpp> - -#include <vector> +#include <memory> #define PICKLIST_MAXSIZE 100 +class SfxApplication; class SfxPickListImpl; class SfxPickList @@ -35,9 +32,7 @@ class SfxPickList private: std::unique_ptr<SfxPickListImpl> mxImpl; public: - SfxPickList(); - /// Ensure instantiation of listener that manages the internal recently-used list - static void ensure(); + SfxPickList(SfxApplication& rApp); ~SfxPickList(); }; |