From 99bfc363a6f6779d0be2284f85a9131254bce1f9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 18 Sep 2015 15:10:41 +0200 Subject: convert Link<> to typed Change-Id: I10b050dc4aae45e646761a82520caa96969bc511 Reviewed-on: https://gerrit.libreoffice.org/18700 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svtools/source/control/toolbarmenuacc.cxx | 13 +++--- svtools/source/control/toolbarmenuimp.hxx | 2 +- svtools/source/misc/dialogcontrolling.cxx | 7 ++-- svtools/source/toolpanel/drawerlayouter.cxx | 19 ++++----- svtools/source/uno/genericunodialog.cxx | 7 ++-- svtools/source/uno/popupwindowcontroller.cxx | 59 +++++++++++++--------------- 6 files changed, 46 insertions(+), 61 deletions(-) (limited to 'svtools') diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx index da71f3e3d122..5bfc82116f33 100644 --- a/svtools/source/control/toolbarmenuacc.cxx +++ b/svtools/source/control/toolbarmenuacc.cxx @@ -61,23 +61,20 @@ ToolbarMenuAcc::~ToolbarMenuAcc() -IMPL_LINK( ToolbarMenuAcc, WindowEventListener, VclSimpleEvent*, pEvent ) +IMPL_LINK_TYPED( ToolbarMenuAcc, WindowEventListener, VclWindowEvent&, rEvent, void ) { - DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); - /* Ignore VCLEVENT_WINDOW_ENDPOPUPMODE, because the UNO accessibility wrapper * might have been destroyed by the previous VCLEventListener (if no AT tool * is running), e.g. sub-toolbars in impress. */ - if ( mpParent && pEvent && pEvent->ISA( VclWindowEvent ) && (pEvent->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) ) + if ( mpParent && (rEvent.GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) ) { - DBG_ASSERT( static_cast(pEvent)->GetWindow(), "Window???" ); - if( !static_cast(pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) ) + DBG_ASSERT( rEvent.GetWindow(), "Window???" ); + if( !rEvent.GetWindow()->IsAccessibilityEventsSuppressed() || ( rEvent.GetId() == VCLEVENT_OBJECT_DYING ) ) { - ProcessWindowEvent( *static_cast(pEvent) ); + ProcessWindowEvent( rEvent ); } } - return 0; } diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx index 951bc746142b..8a385f2fd6c7 100644 --- a/svtools/source/control/toolbarmenuimp.hxx +++ b/svtools/source/control/toolbarmenuimp.hxx @@ -164,7 +164,7 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - DECL_LINK( WindowEventListener, VclSimpleEvent* ); + DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void ); private: EventListenerVector mxEventListeners; diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx index ca6280410007..12219e4f0e94 100644 --- a/svtools/source/misc/dialogcontrolling.cxx +++ b/svtools/source/misc/dialogcontrolling.cxx @@ -103,11 +103,10 @@ namespace svt } - IMPL_LINK( DialogController, OnWindowEvent, const VclWindowEvent*, _pEvent ) + IMPL_LINK_TYPED( DialogController, OnWindowEvent, VclWindowEvent&, _rEvent, void ) { - if ( m_pImpl->pEventFilter->payAttentionTo( *_pEvent ) ) - impl_updateAll( *_pEvent ); - return 0L; + if ( m_pImpl->pEventFilter->payAttentionTo( _rEvent ) ) + impl_updateAll( _rEvent ); } diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx index a2042d81489a..55be1a2a35aa 100644 --- a/svtools/source/toolpanel/drawerlayouter.cxx +++ b/svtools/source/toolpanel/drawerlayouter.cxx @@ -230,18 +230,15 @@ namespace svt } - IMPL_LINK( DrawerDeckLayouter, OnWindowEvent, VclSimpleEvent*, i_pEvent ) + IMPL_LINK_TYPED( DrawerDeckLayouter, OnWindowEvent, VclWindowEvent&, rWindowEvent, void ) { - const VclWindowEvent* pWindowEvent = PTR_CAST( VclWindowEvent, i_pEvent ); - ENSURE_OR_RETURN( pWindowEvent, "no WindowEvent", 0L ); - bool bActivatePanel = false; - switch ( pWindowEvent->GetId() ) + switch ( rWindowEvent.GetId() ) { case VCLEVENT_WINDOW_MOUSEBUTTONUP: { - const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( pWindowEvent->GetData() ); - ENSURE_OR_RETURN( pMouseEvent, "no mouse event with MouseButtonUp", 0L ); + const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( rWindowEvent.GetData() ); + ENSURE_OR_RETURN_VOID( pMouseEvent, "no mouse event with MouseButtonUp" ); if ( pMouseEvent->GetButtons() == MOUSE_LEFT ) { bActivatePanel = true; @@ -250,8 +247,8 @@ namespace svt break; case VCLEVENT_WINDOW_KEYINPUT: { - const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( pWindowEvent->GetData() ); - ENSURE_OR_RETURN( pKeyEvent, "no key event with KeyInput", 0L ); + const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( rWindowEvent.GetData() ); + ENSURE_OR_RETURN_VOID( pKeyEvent, "no key event with KeyInput" ); const vcl::KeyCode& rKeyCode( pKeyEvent->GetKeyCode() ); if ( ( rKeyCode.GetModifier() == 0 ) && ( rKeyCode.GetCode() == KEY_RETURN ) ) { @@ -262,7 +259,7 @@ namespace svt } if ( bActivatePanel ) { - const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() ); + const size_t nPanelPos = impl_getPanelPositionFromWindow( rWindowEvent.GetWindow() ); if ( nPanelPos != m_rPanelDeck.GetActivePanel() ) { m_rPanelDeck.ActivatePanel( nPanelPos ); @@ -272,9 +269,7 @@ namespace svt PToolPanel pPanel( m_rPanelDeck.GetPanel( nPanelPos ) ); pPanel->GrabFocus(); } - return 1L; } - return 0L; } diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx index 64e965674878..bb4f08654f34 100644 --- a/svtools/source/uno/genericunodialog.cxx +++ b/svtools/source/uno/genericunodialog.cxx @@ -318,12 +318,11 @@ void OGenericUnoDialog::destroyDialog() } -IMPL_LINK( OGenericUnoDialog, OnDialogDying, VclWindowEvent*, _pEvent ) +IMPL_LINK_TYPED( OGenericUnoDialog, OnDialogDying, VclWindowEvent&, _rEvent, void ) { - OSL_ENSURE( _pEvent->GetWindow() == m_pDialog, "OGenericUnoDialog::OnDialogDying: where does this come from?" ); - if ( _pEvent->GetId() == VCLEVENT_OBJECT_DYING ) + OSL_ENSURE( _rEvent.GetWindow() == m_pDialog, "OGenericUnoDialog::OnDialogDying: where does this come from?" ); + if ( _rEvent.GetId() == VCLEVENT_OBJECT_DYING ) m_pDialog = NULL; - return 0L; } diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index e6d2ac08f257..a0d7ec634679 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -42,7 +42,7 @@ public: ~PopupWindowControllerImpl(); void SetPopupWindow( vcl::Window* pPopupWindow, ToolBox* pToolBox ); - DECL_LINK( WindowEventListener, VclSimpleEvent* ); + DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void ); private: VclPtr mpPopupWindow; @@ -77,46 +77,41 @@ void PopupWindowControllerImpl::SetPopupWindow( vcl::Window* pPopupWindow, ToolB } } -IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEvent ) +IMPL_LINK_TYPED( PopupWindowControllerImpl, WindowEventListener, VclWindowEvent&, rWindowEvent, void ) { - VclWindowEvent* pWindowEvent = dynamic_cast< VclWindowEvent* >( pEvent ); - if( pWindowEvent ) + switch( rWindowEvent.GetId() ) { - switch( pWindowEvent->GetId() ) - { - case VCLEVENT_WINDOW_CLOSE: - case VCLEVENT_WINDOW_ENDPOPUPMODE: - SetPopupWindow(0,0); - break; + case VCLEVENT_WINDOW_CLOSE: + case VCLEVENT_WINDOW_ENDPOPUPMODE: + SetPopupWindow(0,0); + break; - case VCLEVENT_WINDOW_SHOW: + case VCLEVENT_WINDOW_SHOW: + { + if( mpPopupWindow ) { - if( mpPopupWindow ) - { - if( mpToolBox ) - mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_OPEN, static_cast(mpPopupWindow) ); - mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_GETFOCUS, 0 ); - - svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow.get() ); - if( pToolbarMenu ) - pToolbarMenu->highlightFirstEntry(); - break; - } + if( mpToolBox ) + mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_OPEN, static_cast(mpPopupWindow) ); + mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_GETFOCUS, 0 ); + + svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow.get() ); + if( pToolbarMenu ) + pToolbarMenu->highlightFirstEntry(); break; } - case VCLEVENT_WINDOW_HIDE: + break; + } + case VCLEVENT_WINDOW_HIDE: + { + if( mpPopupWindow ) { - if( mpPopupWindow ) - { - mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS, 0 ); - if( mpToolBox ) - mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_CLOSE, static_cast(mpPopupWindow) ); - } - break; - } + mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS, 0 ); + if( mpToolBox ) + mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_CLOSE, static_cast(mpPopupWindow) ); } + break; + } } - return 1; } -- cgit