summaryrefslogtreecommitdiff
path: root/sd/source/ui/slidesorter
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-04-30 10:20:00 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-04-30 10:20:00 +0200
commit3ead3ad52f9bb2f9d1d6cf8dfc73a0a25e6778ed (patch)
treebdfd28afe5a452060e3d985c5f01b45f4b7bc2cd /sd/source/ui/slidesorter
parent57d254d42b6e1d836bd21e6fb2e968af2b511c7d (diff)
Gradually typed Link
Turn the Link class into a template abstracting over the link's argument and return types, but provide default template arguments that keep the generic, unsafe "void* in, sal_IntPtr out" behvior. That way, individual uses of the Link class can be updated over time. All the related macros are duplicated with ..._TYPED counterparts, that additionally take the RetType (except for LINK_TYPED, which manages to infer the relevant types from the supplied Member). (It would have been attractive to change the "untyped" LinkStubs from taking a void* to a properly typed ArgType parameter, too, but that would cause -fsanitize=function to flag uses of "untyped" Link::Call.) Change-Id: I3b0140378bad99abbf240140ebb4a46a05d2d2f8
Diffstat (limited to 'sd/source/ui/slidesorter')
-rw-r--r--sd/source/ui/slidesorter/controller/SlsFocusManager.cxx10
-rw-r--r--sd/source/ui/slidesorter/controller/SlsListener.cxx4
-rw-r--r--sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx4
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx8
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx2
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx6
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx8
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx6
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx4
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx8
10 files changed, 30 insertions, 30 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
index b0acdd6ed90f..aff6a5e1727c 100644
--- a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
@@ -243,7 +243,7 @@ void FocusManager::ShowFocusIndicator (
}
}
-void FocusManager::AddFocusChangeListener (const Link& rListener)
+void FocusManager::AddFocusChangeListener (const Link<>& rListener)
{
if (::std::find (maFocusChangeListeners.begin(), maFocusChangeListeners.end(), rListener)
== maFocusChangeListeners.end())
@@ -252,7 +252,7 @@ void FocusManager::AddFocusChangeListener (const Link& rListener)
}
}
-void FocusManager::RemoveFocusChangeListener (const Link& rListener)
+void FocusManager::RemoveFocusChangeListener (const Link<>& rListener)
{
maFocusChangeListeners.erase (
::std::find (maFocusChangeListeners.begin(), maFocusChangeListeners.end(), rListener));
@@ -261,11 +261,11 @@ void FocusManager::RemoveFocusChangeListener (const Link& rListener)
void FocusManager::NotifyFocusChangeListeners() const
{
// Create a copy of the listener list to be safe when that is modified.
- ::std::vector<Link> aListeners (maFocusChangeListeners);
+ ::std::vector<Link<>> aListeners (maFocusChangeListeners);
// Tell the selection change listeners that the selection has changed.
- ::std::vector<Link>::iterator iListener (aListeners.begin());
- ::std::vector<Link>::iterator iEnd (aListeners.end());
+ ::std::vector<Link<>>::iterator iListener (aListeners.begin());
+ ::std::vector<Link<>>::iterator iEnd (aListeners.end());
for (; iListener!=iEnd; ++iListener)
{
iListener->Call(NULL);
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index 149edf879839..4e64787c997d 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -125,7 +125,7 @@ Listener::Listener (
StartListening(*pMainViewShell);
}
- Link aLink (LINK(this, Listener, EventMultiplexerCallback));
+ Link<> aLink (LINK(this, Listener, EventMultiplexerCallback));
mpBase->GetEventMultiplexer()->AddEventListener(
aLink,
tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
@@ -185,7 +185,7 @@ void Listener::ReleaseListeners()
if (mpBase != NULL)
{
- Link aLink (LINK(this, Listener, EventMultiplexerCallback));
+ Link<> aLink (LINK(this, Listener, EventMultiplexerCallback));
mpBase->GetEventMultiplexer()->RemoveEventListener(
aLink,
tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
index ccf32ce708e5..eaa64571cf63 100644
--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -88,11 +88,11 @@ void ScrollBarManager::Disconnect()
{
if (mpVerticalScrollBar != nullptr)
{
- mpVerticalScrollBar->SetScrollHdl (Link());
+ mpVerticalScrollBar->SetScrollHdl (Link<>());
}
if (mpHorizontalScrollBar != nullptr)
{
- mpHorizontalScrollBar->SetScrollHdl (Link());
+ mpHorizontalScrollBar->SetScrollHdl (Link<>());
}
}
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
index 889e3510c940..0768a1e62903 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
@@ -236,8 +236,8 @@ void SelectionManager::SelectionHasChanged (const bool bMakeSelectionVisible)
pViewShell->UpdatePreview(pDescriptor->GetPage());
// Tell the selection change listeners that the selection has changed.
- ::std::vector<Link>::iterator iListener (maSelectionChangeListeners.begin());
- ::std::vector<Link>::iterator iEnd (maSelectionChangeListeners.end());
+ ::std::vector<Link<>>::iterator iListener (maSelectionChangeListeners.begin());
+ ::std::vector<Link<>>::iterator iEnd (maSelectionChangeListeners.end());
for (; iListener!=iEnd; ++iListener)
{
iListener->Call(NULL);
@@ -249,7 +249,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 +260,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/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index 3658db1f3854..62818dc4ebc3 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -246,7 +246,7 @@ private:
bool mbPreModelChangeDone;
bool mbPostModelChangePending;
- ::std::vector<Link> maSelectionChangeListeners;
+ ::std::vector<Link<>> 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/inc/controller/SlsFocusManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
index c67fdf3e74bb..e6bdfffa8a34 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
@@ -143,14 +143,14 @@ public:
the second and all following calls are ignored. Each listener
is added only once.
*/
- void AddFocusChangeListener (const Link& rListener);
+ void AddFocusChangeListener (const Link<>& rListener);
/** Remove a focus change listener.
@param rListener
It is save to pass a listener that was not added are has been
removed previously. Such calls are ignored.
*/
- void RemoveFocusChangeListener (const Link& rListener);
+ void RemoveFocusChangeListener (const Link<>& rListener);
/** Create an instance of this class to temporarily hide the focus
indicator. It is restored to its former visibility state when the
@@ -179,7 +179,7 @@ private:
*/
bool mbPageIsFocused;
- ::std::vector<Link> maFocusChangeListeners;
+ ::std::vector<Link<>> maFocusChangeListeners;
/** When vertical wrap is active then pressing UP in the top row moves
the focus to the bottom row, DOWN in the bottom row moves the focus
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
index 1d63ead4c585..84a95942c0f0 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
@@ -24,10 +24,10 @@
#include "controller/SlsAnimator.hxx"
#include <sal/types.h>
#include <tools/gen.hxx>
+#include <tools/link.hxx>
#include <basegfx/range/b2irectangle.hxx>
#include <vector>
-class Link;
class SdPage;
namespace sd { namespace slidesorter {
@@ -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<Link> maSelectionChangeListeners;
+ ::std::vector<Link<>> 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/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
index 3d7a2bd4e60d..9ec37e4546e0 100644
--- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
@@ -190,14 +190,14 @@ public:
the second and all following calls are ignored. Each listener
is added only once.
*/
- void AddVisibilityChangeListener (const Link& rListener);
+ void AddVisibilityChangeListener (const Link<>& rListener);
/** Remove a listener that is called when the set of visible slides changes.
@param rListener
It is save to pass a listener that was not added or has been
removed previously. Such calls are ignored.
*/
- void RemoveVisibilityChangeListener (const Link& rListener);
+ void RemoveVisibilityChangeListener (const Link<>& rListener);
/** The page under the mouse is not highlighted in some contexts. Call
this method on context changes.
@@ -259,7 +259,7 @@ private:
SharedILayerPainter mpBackgroundPainter;
::boost::scoped_ptr<ToolTip> mpToolTip;
bool mbIsRearrangePending;
- ::std::vector<Link> maVisibilityChangeListeners;
+ ::std::vector<Link<>> maVisibilityChangeListeners;
/** Determine the visibility of all page objects.
*/
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index d58ac87098d6..bd2d1aee49ef 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/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index 33b9643073de..51565b02101d 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -486,8 +486,8 @@ void SlideSorterView::DeterminePageObjectVisibilities()
// Tell the listeners that the visibility of some objects has
// changed.
- ::std::vector<Link>& aChangeListeners (maVisibilityChangeListeners);
- for (::std::vector<Link>::const_iterator
+ ::std::vector<Link<>>& aChangeListeners (maVisibilityChangeListeners);
+ for (::std::vector<Link<>>::const_iterator
iLink(aChangeListeners.begin()),
iEnd(aChangeListeners.end());
iLink!=iEnd;
@@ -720,7 +720,7 @@ Pair SlideSorterView::GetVisiblePageRange()
return maVisiblePageRange;
}
-void SlideSorterView::AddVisibilityChangeListener (const Link& rListener)
+void SlideSorterView::AddVisibilityChangeListener (const Link<>& rListener)
{
if (::std::find (
maVisibilityChangeListeners.begin(),
@@ -731,7 +731,7 @@ void SlideSorterView::AddVisibilityChangeListener (const Link& rListener)
}
}
-void SlideSorterView::RemoveVisibilityChangeListener(const Link&rListener)
+void SlideSorterView::RemoveVisibilityChangeListener(const Link<>&rListener)
{
maVisibilityChangeListeners.erase (
::std::find (