From 3ead3ad52f9bb2f9d1d6cf8dfc73a0a25e6778ed Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 30 Apr 2015 10:20:00 +0200 Subject: 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 --- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 2 +- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 2 +- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 2 +- desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 6 +++--- desktop/source/deployment/gui/dp_gui_updatedialog.cxx | 2 +- desktop/source/deployment/gui/license_dialog.cxx | 12 ++++++------ 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'desktop') diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 60c9db1ee306..976481251c19 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -659,7 +659,7 @@ bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const return true; } -void DialogHelper::PostUserEvent( const Link& rLink, void* pCaller ) +void DialogHelper::PostUserEvent( const Link<>& rLink, void* pCaller ) { if ( m_nEventID ) Application::RemoveUserEvent( m_nEventID ); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 2f6052be71af..8a130ff8ee8d 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -66,7 +66,7 @@ public: void openWebBrowser( const OUString & sURL, const OUString & sTitle ) const; Dialog* getWindow() const { return m_pVCLWindow; }; - void PostUserEvent( const Link& rLink, void* pCaller ); + void PostUserEvent( const Link<>& rLink, void* pCaller ); void clearEventID() { m_nEventID = 0; } virtual void showProgress( bool bStart ) = 0; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index f669ac129d3c..85b9e41d7c27 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -1234,7 +1234,7 @@ void ExtensionBox_Impl::checkEntries() } -void ExtensionBox_Impl::SetScrollHdl( const Link& rLink ) +void ExtensionBox_Impl::SetScrollHdl( const Link<>& rLink ) { if ( m_pScrollBar ) m_pScrollBar->SetScrollHdl( rLink ); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 0a9a204a1ed3..d1a634203bb1 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -132,7 +132,7 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox Image m_aLockedImage; Image m_aWarningImage; Image m_aDefaultImage; - Link m_aClickHdl; + Link<> m_aClickHdl; VclPtr m_pScrollBar; @@ -196,9 +196,9 @@ public: Rectangle GetEntryRect( const long nPos ) const; bool HasActive() { return m_bHasActive; } long PointToPos( const Point& rPos ); - void SetScrollHdl( const Link& rLink ); + void SetScrollHdl( const Link<>& rLink ); void DoScroll( long nDelta ); - void SetHyperlinkHdl( const Link& rLink ){ m_aClickHdl = rLink; } + void SetHyperlinkHdl( const Link<>& rLink ){ m_aClickHdl = rLink; } virtual void RecalcAll(); void RemoveUnlocked(); diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 8e75bd04b42a..2663e22a56fd 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -925,7 +925,7 @@ void UpdateDialog::initDescription() m_pReleaseNotesLabel->Hide(); m_pReleaseNotesLink->Hide(); - Link aLink = LINK( this, UpdateDialog, hyperlink_clicked ); + Link<> aLink = LINK( this, UpdateDialog, hyperlink_clicked ); m_pPublisherLink->SetClickHdl( aLink ); m_pReleaseNotesLink->SetClickHdl( aLink ); } diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index 710052f3180f..45074279813c 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -51,8 +51,8 @@ namespace dp_gui { class LicenseView : public MultiLineEdit, public SfxListener { bool mbEndReached; - Link maEndReachedHdl; - Link maScrolledHdl; + Link<> maEndReachedHdl; + Link<> maScrolledHdl; public: LicenseView( vcl::Window* pParent, WinBits nStyle ); @@ -64,9 +64,9 @@ public: bool IsEndReached() const; bool EndReached() const { return mbEndReached; } - void SetEndReachedHdl( const Link& rHdl ) { maEndReachedHdl = rHdl; } + void SetEndReachedHdl( const Link<>& rHdl ) { maEndReachedHdl = rHdl; } - void SetScrolledHdl( const Link& rHdl ) { maScrolledHdl = rHdl; } + void SetScrolledHdl( const Link<>& rHdl ) { maScrolledHdl = rHdl; } virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; @@ -143,8 +143,8 @@ LicenseView::~LicenseView() void LicenseView::dispose() { - maEndReachedHdl = Link(); - maScrolledHdl = Link(); + maEndReachedHdl = Link<>(); + maScrolledHdl = Link<>(); EndListeningAll(); MultiLineEdit::dispose(); } -- cgit