diff options
-rw-r--r-- | include/sfx2/dispatch.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/inc/hintpost.hxx | 7 | ||||
-rw-r--r-- | sfx2/source/notify/hintpost.cxx | 11 |
4 files changed, 11 insertions, 12 deletions
diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx index 7216fc92badc..eea69d2a5abc 100644 --- a/include/sfx2/dispatch.hxx +++ b/include/sfx2/dispatch.hxx @@ -80,6 +80,7 @@ friend class SfxBindings; friend class SfxStateCache; friend class SfxPopupMenuManager; friend class SfxHelp; +friend class SfxHintPoster; DECL_DLLPRIVATE_LINK( EventHdl_Impl, Timer *, void ); void PostMsgHandler(std::unique_ptr<SfxRequest>); diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index ccb0b0802f42..a780892b6940 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -303,7 +303,7 @@ void SfxDispatcher::Construct_Impl() for (SfxObjectBars_Impl & rObjBar : xImp->aObjBars) rObjBar.eId = ToolbarId::None; - xImp->xPoster = new SfxHintPoster(std::bind(&SfxDispatcher::PostMsgHandler, this, std::placeholders::_1)); + xImp->xPoster = new SfxHintPoster(this); xImp->aIdle.SetPriority(TaskPriority::HIGH_IDLE ); xImp->aIdle.SetInvokeHandler( LINK(this, SfxDispatcher, EventHdl_Impl ) ); @@ -335,7 +335,7 @@ SfxDispatcher::~SfxDispatcher() // So that no timer by Reschedule in PlugComm strikes the LeaveRegistrations xImp->aIdle.Stop(); - xImp->xPoster->SetEventHdl( std::function<void (std::unique_ptr<SfxRequest>)>() ); + xImp->xPoster->ClearLink(); // Notify the stack variables in Call_Impl if ( xImp->pInCallAliveFlag ) diff --git a/sfx2/source/inc/hintpost.hxx b/sfx2/source/inc/hintpost.hxx index ac37fde446ed..cca12647a283 100644 --- a/sfx2/source/inc/hintpost.hxx +++ b/sfx2/source/inc/hintpost.hxx @@ -23,6 +23,7 @@ #include <tools/ref.hxx> #include <functional> #include <memory> +#include <sfx2/dispatch.hxx> class SfxRequest; @@ -41,17 +42,17 @@ class SfxRequest; class SfxHintPoster final : public SvRefBase { private: - std::function<void (std::unique_ptr<SfxRequest>)> m_Link; + class SfxDispatcher *m_Link; DECL_LINK( DoEvent_Impl, void*, void ); virtual ~SfxHintPoster() override; public: - SfxHintPoster(std::function<void (std::unique_ptr<SfxRequest>)> aLink); + SfxHintPoster(SfxDispatcher *aLink); void Post( std::unique_ptr<SfxRequest> pHint ); - void SetEventHdl(const std::function<void (std::unique_ptr<SfxRequest>)>& rLink); + void ClearLink(); }; #endif diff --git a/sfx2/source/notify/hintpost.cxx b/sfx2/source/notify/hintpost.cxx index 78c8c0499099..25d650de8ef2 100644 --- a/sfx2/source/notify/hintpost.cxx +++ b/sfx2/source/notify/hintpost.cxx @@ -25,8 +25,8 @@ #include <vcl/svapp.hxx> #include <comphelper/lok.hxx> -SfxHintPoster::SfxHintPoster(std::function<void(std::unique_ptr<SfxRequest>)> aLink) - : m_Link(std::move(aLink)) +SfxHintPoster::SfxHintPoster(SfxDispatcher* aLink) + : m_Link(aLink) { } @@ -71,7 +71,7 @@ IMPL_LINK(SfxHintPoster, DoEvent_Impl, void*, pPostedHint, void) } } - m_Link(std::unique_ptr<SfxRequest>(pRequest)); + m_Link->PostMsgHandler(std::unique_ptr<SfxRequest>(pRequest)); if (bSetView) { @@ -83,9 +83,6 @@ IMPL_LINK(SfxHintPoster, DoEvent_Impl, void*, pPostedHint, void) ReleaseRef(); } -void SfxHintPoster::SetEventHdl(const std::function<void(std::unique_ptr<SfxRequest>)>& rLink) -{ - m_Link = rLink; -} +void SfxHintPoster::ClearLink() { m_Link = nullptr; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |