From 6f4a024b88ef99a44b78ab9d387dcf950c4d5677 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 22 Sep 2015 16:40:35 +0200 Subject: convert Link<> to typed Change-Id: I6f17e073c50e28f40e3df4e557a63f0bcdc502de Reviewed-on: https://gerrit.libreoffice.org/18778 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- sd/source/ui/accessibility/AccessibleSlideSorterView.cxx | 5 ++--- sd/source/ui/inc/SlideSorterViewShell.hxx | 4 ++-- sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx | 10 ++++------ .../ui/slidesorter/inc/controller/SlsSelectionManager.hxx | 6 +++--- sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 4 ++-- sd/source/ui/tools/EventMultiplexer.cxx | 7 +++---- 6 files changed, 16 insertions(+), 20 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index b8bf84ff9856..155d83cae952 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -81,7 +81,7 @@ public: void ReleaseListeners(); void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint) SAL_OVERRIDE; DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void); - DECL_LINK(SelectionChangeListener, void*); + DECL_LINK_TYPED(SelectionChangeListener, LinkParamNone*, void); DECL_LINK_TYPED(BroadcastSelectionChange, void*, void); DECL_LINK_TYPED(FocusChangeListener, LinkParamNone*, void); DECL_LINK_TYPED(VisibilityChangeListener, LinkParamNone*, void); @@ -919,12 +919,11 @@ IMPL_LINK_TYPED(AccessibleSlideSorterView::Implementation, WindowEventListener, } } -IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, SelectionChangeListener) +IMPL_LINK_NOARG_TYPED(AccessibleSlideSorterView::Implementation, SelectionChangeListener, LinkParamNone*, void) { if (mnSelectionChangeUserEventId == 0) mnSelectionChangeUserEventId = Application::PostUserEvent( LINK(this, AccessibleSlideSorterView::Implementation, BroadcastSelectionChange)); - return 1; } IMPL_LINK_NOARG_TYPED(AccessibleSlideSorterView::Implementation, BroadcastSelectionChange, void*, void) diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx index cd590d8869b9..1b38842cb3f6 100644 --- a/sd/source/ui/inc/SlideSorterViewShell.hxx +++ b/sd/source/ui/inc/SlideSorterViewShell.hxx @@ -162,7 +162,7 @@ public: the second and all following calls are ignored. Each listener is added only once. */ - void AddSelectionChangeListener (const Link<>& rListener); + void AddSelectionChangeListener (const Link& rListener); /** Remove a listener that was called when the selection of the slide sorter changes. @@ -170,7 +170,7 @@ public: It is save to pass a listener that was not added are has been removed previously. Such calls are ignored. */ - void RemoveSelectionChangeListener (const Link<>& rListener); + void RemoveSelectionChangeListener (const Link& rListener); virtual css::uno::Reference CreateSubController() SAL_OVERRIDE; diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx index 0768a1e62903..4d7e7d7480d5 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx @@ -236,11 +236,9 @@ void SelectionManager::SelectionHasChanged (const bool bMakeSelectionVisible) pViewShell->UpdatePreview(pDescriptor->GetPage()); // Tell the selection change listeners that the selection has changed. - ::std::vector>::iterator iListener (maSelectionChangeListeners.begin()); - ::std::vector>::iterator iEnd (maSelectionChangeListeners.end()); - for (; iListener!=iEnd; ++iListener) + for (auto& rLink : maSelectionChangeListeners) { - iListener->Call(NULL); + rLink.Call(NULL); } // Reset the insertion position: until set again it is calculated from @@ -249,7 +247,7 @@ void SelectionManager::SelectionHasChanged (const bool bMakeSelectionVisible) } } -void SelectionManager::AddSelectionChangeListener (const Link<>& rListener) +void SelectionManager::AddSelectionChangeListener (const Link& rListener) { if (::std::find ( maSelectionChangeListeners.begin(), @@ -260,7 +258,7 @@ void SelectionManager::AddSelectionChangeListener (const Link<>& rListener) } } -void SelectionManager::RemoveSelectionChangeListener(const Link<>&rListener) +void SelectionManager::RemoveSelectionChangeListener(const Link& rListener) { maSelectionChangeListeners.erase ( ::std::find ( diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx index eddbf63c0e00..9c9404120fc6 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx @@ -78,7 +78,7 @@ public: the second and all following calls are ignored. Each listener is added only once. */ - void AddSelectionChangeListener (const Link<>& rListener); + void AddSelectionChangeListener (const Link& rListener); /** Remove a listener that was called when the selection of the slide sorter changes. @@ -86,7 +86,7 @@ public: It is save to pass a listener that was not added are has been removed previously. Such calls are ignored. */ - void RemoveSelectionChangeListener (const Link<>& rListener); + void RemoveSelectionChangeListener (const Link& rListener); /** Return the position where to insert pasted slides based on the current selection. When there is a selection then the insert @@ -109,7 +109,7 @@ private: SlideSorter& mrSlideSorter; SlideSorterController& mrController; - ::std::vector> maSelectionChangeListeners; + ::std::vector> maSelectionChangeListeners; /** This array stores the indices of the selected page descriptors at the time when the edit mode is switched to EM_MASTERPAGE. With this diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 4adcc1ffdcd4..6e82689c5aaa 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -693,14 +693,14 @@ void SlideSorterViewShell::SetPageSelection ( } void SlideSorterViewShell::AddSelectionChangeListener ( - const Link<>& rCallback) + const Link& rCallback) { OSL_ASSERT(mpSlideSorter.get()!=NULL); mpSlideSorter->GetController().GetSelectionManager()->AddSelectionChangeListener(rCallback); } void SlideSorterViewShell::RemoveSelectionChangeListener ( - const Link<>& rCallback) + const Link& rCallback) { OSL_ASSERT(mpSlideSorter.get()!=NULL); mpSlideSorter->GetController().GetSelectionManager()->RemoveSelectionChangeListener(rCallback); diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx index b776c71c191a..91419735e892 100644 --- a/sd/source/ui/tools/EventMultiplexer.cxx +++ b/sd/source/ui/tools/EventMultiplexer.cxx @@ -155,7 +155,7 @@ private: void ThrowIfDisposed() throw (::com::sun::star::lang::DisposedException); - DECL_LINK(SlideSorterSelectionChangeListener, void*); + DECL_LINK_TYPED(SlideSorterSelectionChangeListener, LinkParamNone*, void); }; const char aCurrentPagePropertyName[] = "CurrentPage"; @@ -704,10 +704,9 @@ void EventMultiplexer::Implementation::CallListeners (EventMultiplexerEvent& rEv } } -IMPL_LINK_NOARG(EventMultiplexer::Implementation, SlideSorterSelectionChangeListener) +IMPL_LINK_NOARG_TYPED(EventMultiplexer::Implementation, SlideSorterSelectionChangeListener, LinkParamNone*, void) { - CallListeners (EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION); - return 0; + CallListeners(EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION); } //===== EventMultiplexerEvent ================================================= -- cgit