[Libreoffice-commits] core.git: accessibility/inc accessibility/source avmedia/source basctl/source chart2/source extensions/source filter/source framework/inc framework/source include/sfx2 include/svtools include/toolkit include/vcl reportdesign/source sc/source sd/source sfx2/source svtools/source svx/source sw/inc sw/source toolkit/source vcl/inc vcl/source

Noel Grandin noel at peralex.com
Sat Sep 19 23:38:09 PDT 2015


 accessibility/inc/accessibility/extended/accessibletabbarbase.hxx      |    2 
 accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx |    2 
 accessibility/inc/accessibility/extended/listboxaccessible.hxx         |    2 
 accessibility/inc/accessibility/extended/textwindowaccessibility.hxx   |    6 
 accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx     |    2 
 accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx        |   24 +--
 accessibility/source/extended/accessibletabbarbase.cxx                 |   28 +---
 accessibility/source/extended/accessibletablistboxtable.cxx            |   11 -
 accessibility/source/extended/listboxaccessible.cxx                    |   13 --
 accessibility/source/extended/textwindowaccessibility.cxx              |    5 
 accessibility/source/standard/vclxaccessiblemenubar.cxx                |   13 --
 avmedia/source/opengl/oglwindow.cxx                                    |   27 +---
 avmedia/source/opengl/oglwindow.hxx                                    |    4 
 basctl/source/accessibility/accessibledialogwindow.cxx                 |   14 --
 basctl/source/inc/accessibledialogwindow.hxx                           |    2 
 chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx            |    5 
 chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx                |    2 
 extensions/source/update/ui/updatecheckui.cxx                          |   18 +-
 filter/source/pdf/pdffilter.cxx                                        |    7 -
 framework/inc/classes/fwktabwindow.hxx                                 |    4 
 framework/source/classes/fwktabwindow.cxx                              |    4 
 framework/source/dispatch/windowcommanddispatch.cxx                    |   24 +--
 framework/source/inc/dispatch/windowcommanddispatch.hxx                |    3 
 framework/source/services/tabwindowservice.cxx                         |   24 +--
 include/sfx2/sidebar/FocusManager.hxx                                  |    2 
 include/sfx2/sidebar/SidebarController.hxx                             |    2 
 include/svtools/dialogcontrolling.hxx                                  |    2 
 include/svtools/genericunodialog.hxx                                   |    2 
 include/svtools/toolpanel/drawerlayouter.hxx                           |    2 
 include/toolkit/awt/vclxaccessiblecomponent.hxx                        |    2 
 include/toolkit/awt/vclxwindow.hxx                                     |    2 
 include/vcl/layout.hxx                                                 |    2 
 include/vcl/window.hxx                                                 |    5 
 reportdesign/source/ui/inc/ReportController.hxx                        |    2 
 reportdesign/source/ui/report/ReportController.cxx                     |    5 
 sc/source/ui/app/inputhdl.cxx                                          |   10 -
 sc/source/ui/inc/inputhdl.hxx                                          |    4 
 sd/source/ui/accessibility/AccessibleSlideSorterView.cxx               |    7 -
 sd/source/ui/annotations/annotationtag.cxx                             |   12 -
 sd/source/ui/annotations/annotationtag.hxx                             |    2 
 sd/source/ui/framework/factories/FullScreenPane.cxx                    |    9 -
 sd/source/ui/framework/factories/FullScreenPane.hxx                    |    2 
 sd/source/ui/inc/FormShellManager.hxx                                  |    2 
 sd/source/ui/sidebar/LayoutMenu.cxx                                    |   24 +--
 sd/source/ui/sidebar/LayoutMenu.hxx                                    |    2 
 sd/source/ui/slideshow/showwin.cxx                                     |    5 
 sd/source/ui/slideshow/showwindow.hxx                                  |    2 
 sd/source/ui/slidesorter/controller/SlideSorterController.cxx          |   17 +-
 sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx      |    3 
 sd/source/ui/slidesorter/shell/SlideSorter.cxx                         |    4 
 sd/source/ui/view/FormShellManager.cxx                                 |   57 ++++-----
 sd/source/ui/view/ViewShellManager.cxx                                 |   13 --
 sfx2/source/sidebar/FocusManager.cxx                                   |   25 +---
 sfx2/source/sidebar/SidebarController.cxx                              |   15 --
 sfx2/source/toolbox/tbxitem.cxx                                        |   14 --
 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 ++++-----
 svx/source/accessibility/AccessibleFrameSelector.cxx                   |   17 --
 svx/source/fmcomp/gridcell.cxx                                         |    8 -
 svx/source/form/databaselocationinput.cxx                              |   14 --
 svx/source/inc/AccessibleFrameSelector.hxx                             |    2 
 svx/source/inc/gridcell.hxx                                            |    2 
 svx/source/svdraw/sdrpaintwindow.cxx                                   |   16 --
 svx/source/tbxctrls/tbcontrl.cxx                                       |    9 -
 sw/inc/SidebarWin.hxx                                                  |    2 
 sw/source/ui/dialog/uiregionsw.cxx                                     |    5 
 sw/source/uibase/docvw/SidebarWin.cxx                                  |   61 ++++------
 sw/source/uibase/inc/regionsw.hxx                                      |    2 
 toolkit/source/awt/stylesettings.cxx                                   |   16 +-
 toolkit/source/awt/vclxaccessiblecomponent.cxx                         |   13 --
 toolkit/source/awt/vclxwindow.cxx                                      |   13 --
 vcl/inc/dndevdis.hxx                                                   |    2 
 vcl/inc/window.h                                                       |    2 
 vcl/source/window/dndevdis.cxx                                         |    5 
 vcl/source/window/event.cxx                                            |   24 +++
 vcl/source/window/layout.cxx                                           |    5 
 vcl/source/window/menubarwindow.cxx                                    |   22 +--
 vcl/source/window/menubarwindow.hxx                                    |    6 
 vcl/source/window/menufloatingwindow.cxx                               |    9 -
 vcl/source/window/menufloatingwindow.hxx                               |    8 -
 84 files changed, 371 insertions(+), 502 deletions(-)

New commits:
commit 99bfc363a6f6779d0be2284f85a9131254bce1f9
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Sep 18 15:10:41 2015 +0200

    convert Link<> to typed
    
    Change-Id: I10b050dc4aae45e646761a82520caa96969bc511
    Reviewed-on: https://gerrit.libreoffice.org/18700
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx
index ed920c8..d6603ed 100644
--- a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx
+++ b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx
@@ -45,7 +45,7 @@ public:
     virtual             ~AccessibleTabBarBase();
 
 protected:
-    DECL_LINK( WindowEventListener, VclSimpleEvent* );
+    DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
 
     virtual void        ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
 
diff --git a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
index 1db873c..53659ae 100644
--- a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
+++ b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
@@ -42,7 +42,7 @@ private:
     css::uno::Reference< css::accessibility::XAccessible >  m_xCurChild;
 
     void                    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
-    DECL_LINK(              WindowEventListener, VclSimpleEvent* );
+    DECL_LINK_TYPED(        WindowEventListener, VclWindowEvent&, void );
 
     // helpers ----------------------------------------------------------------
 
diff --git a/accessibility/inc/accessibility/extended/listboxaccessible.hxx b/accessibility/inc/accessibility/extended/listboxaccessible.hxx
index bd0b260..7affba9 100644
--- a/accessibility/inc/accessibility/extended/listboxaccessible.hxx
+++ b/accessibility/inc/accessibility/extended/listboxaccessible.hxx
@@ -68,7 +68,7 @@ namespace accessibility
         void disposing();
 
     private:
-        DECL_LINK( WindowEventListener, VclSimpleEvent* );
+        DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
 
     private:
         ListBoxAccessibleBase( const ListBoxAccessibleBase& ) SAL_DELETED_FUNCTION;
diff --git a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
index 786e2c3..d777ec0 100644
--- a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
+++ b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
@@ -86,7 +86,7 @@ private:
 class WindowListenerGuard
 {
 public:
-    inline WindowListenerGuard(::Link<> const & rListener):
+    inline WindowListenerGuard(::Link<VclWindowEvent&,void> const & rListener):
         m_aListener(rListener), m_pNotifier(0) {}
 
     inline ~WindowListenerGuard() { endListening(); }
@@ -98,7 +98,7 @@ public:
     void endListening();
 
 private:
-    ::Link<> m_aListener;
+    ::Link<VclWindowEvent&,void> m_aListener;
     VclPtr<vcl::Window> m_pNotifier;
 };
 
@@ -580,7 +580,7 @@ private:
     // Assuming that this will only be called with the external (Solar) mutex
     // locked.
     // init will already have been called.
-    DECL_LINK(WindowEventHandler, VclSimpleEvent *);
+    DECL_LINK_TYPED(WindowEventHandler, VclWindowEvent&, void);
 
     // Must be called with both the external (Solar) and internal mutex
     // locked.
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx
index 2d47a06..3d4ce1e 100644
--- a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx
@@ -39,7 +39,7 @@ protected:
 
     virtual bool            IsFocused() SAL_OVERRIDE;
 
-    DECL_LINK( WindowEventListener, VclSimpleEvent* );
+    DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
 
     void            ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
 
diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx
index 34d9e97..34b8362 100644
--- a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx
+++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx
@@ -116,7 +116,7 @@ namespace accessibility
         virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) SAL_OVERRIDE;
         virtual void Dying() SAL_OVERRIDE;
 
-        DECL_LINK( OnWindowEvent, const VclSimpleEvent* );
+        DECL_LINK_TYPED( OnWindowEvent, VclWindowEvent&, void );
 
     private:
         AccessibleToolPanelTabBar&                  m_rAntiImpl;
@@ -228,30 +228,24 @@ namespace accessibility
         m_rAntiImpl.dispose();
     }
 
-    IMPL_LINK( AccessibleToolPanelTabBar_Impl, OnWindowEvent, const VclSimpleEvent*, i_pEvent )
+    IMPL_LINK_TYPED( AccessibleToolPanelTabBar_Impl, OnWindowEvent, VclWindowEvent&, rWindowEvent, void )
     {
-        ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::OnWindowEvent: already disposed!", 0L );
+        ENSURE_OR_RETURN_VOID( !isDisposed(), "AccessibleToolPanelTabBar_Impl::OnWindowEvent: already disposed!" );
 
-        const VclWindowEvent* pWindowEvent( dynamic_cast< const VclWindowEvent* >( i_pEvent ) );
-        if ( !pWindowEvent )
-            return 0L;
+        const bool bForwardButton = ( rWindowEvent.GetWindow() == &m_pTabBar->GetScrollButton( true ) );
+        const bool bBackwardButton = ( rWindowEvent.GetWindow() == &m_pTabBar->GetScrollButton( false ) );
+        ENSURE_OR_RETURN_VOID( bForwardButton || bBackwardButton, "AccessibleToolPanelTabBar_Impl::OnWindowEvent: where does this come from?" );
 
-        const bool bForwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( true ) );
-        const bool bBackwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( false ) );
-        ENSURE_OR_RETURN( bForwardButton || bBackwardButton, "AccessibleToolPanelTabBar_Impl::OnWindowEvent: where does this come from?", 0L );
-
-        const bool bShow = ( i_pEvent->GetId() == VCLEVENT_WINDOW_SHOW );
-        const bool bHide = ( i_pEvent->GetId() == VCLEVENT_WINDOW_HIDE );
+        const bool bShow = ( rWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW );
+        const bool bHide = ( rWindowEvent.GetId() == VCLEVENT_WINDOW_HIDE );
         if ( !bShow && !bHide )
             // not interested in events other than visibility changes
-            return 0L;
+            return;
 
         const Reference< XAccessible > xButtonAccessible( m_pTabBar->GetScrollButton( bForwardButton ).GetAccessible() );
         const Any aOldChild( bHide ? xButtonAccessible : Reference< XAccessible >() );
         const Any aNewChild( bShow ? xButtonAccessible : Reference< XAccessible >() );
         m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldChild, aNewChild );
-
-        return 1L;
     }
 
     // MethodGuard
diff --git a/accessibility/source/extended/accessibletabbarbase.cxx b/accessibility/source/extended/accessibletabbarbase.cxx
index 18c6ae5..a8a6c87 100644
--- a/accessibility/source/extended/accessibletabbarbase.cxx
+++ b/accessibility/source/extended/accessibletabbarbase.cxx
@@ -43,26 +43,20 @@ AccessibleTabBarBase::~AccessibleTabBarBase()
     DELETEZ( m_pExternalLock );
 }
 
-IMPL_LINK( AccessibleTabBarBase, WindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( AccessibleTabBarBase, WindowEventListener, VclWindowEvent&, rEvent, void )
 {
-    VclWindowEvent* pWinEvent = dynamic_cast< VclWindowEvent* >( pEvent );
-    OSL_ENSURE( pWinEvent, "AccessibleTabBarBase::WindowEventListener - unknown window event" );
-    if( pWinEvent )
+    vcl::Window* pEventWindow = rEvent.GetWindow();
+    OSL_ENSURE( pEventWindow, "AccessibleTabBarBase::WindowEventListener: no window!" );
+
+    if( ( rEvent.GetId() == VCLEVENT_TABBAR_PAGEREMOVED ) &&
+        ( (sal_uInt16)reinterpret_cast<sal_IntPtr>(rEvent.GetData()) == TabBar::PAGE_NOT_FOUND ) &&
+        ( dynamic_cast< AccessibleTabBarPageList *> (this) != NULL ) )
     {
-        vcl::Window* pEventWindow = pWinEvent->GetWindow();
-        OSL_ENSURE( pEventWindow, "AccessibleTabBarBase::WindowEventListener: no window!" );
-
-        if( ( pWinEvent->GetId() == VCLEVENT_TABBAR_PAGEREMOVED ) &&
-            ( (sal_uInt16)reinterpret_cast<sal_IntPtr>(pWinEvent->GetData()) == TabBar::PAGE_NOT_FOUND ) &&
-            ( dynamic_cast< AccessibleTabBarPageList *> (this) != NULL ) )
-        {
-            return 0;
-        }
-
-        if ( !pEventWindow->IsAccessibilityEventsSuppressed() || (pWinEvent->GetId() == VCLEVENT_OBJECT_DYING) )
-            ProcessWindowEvent( *pWinEvent );
+        return;
     }
-    return 0;
+
+    if ( !pEventWindow->IsAccessibilityEventsSuppressed() || (rEvent.GetId() == VCLEVENT_OBJECT_DYING) )
+        ProcessWindowEvent( rEvent );
 }
 
 void AccessibleTabBarBase::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
diff --git a/accessibility/source/extended/accessibletablistboxtable.cxx b/accessibility/source/extended/accessibletablistboxtable.cxx
index d233aa6..4dc268f 100644
--- a/accessibility/source/extended/accessibletablistboxtable.cxx
+++ b/accessibility/source/extended/accessibletablistboxtable.cxx
@@ -251,15 +251,10 @@ namespace accessibility
         }
     }
 
-    IMPL_LINK( AccessibleTabListBoxTable, WindowEventListener, VclSimpleEvent*, pEvent )
+    IMPL_LINK_TYPED( AccessibleTabListBoxTable, WindowEventListener, VclWindowEvent&, rEvent, void )
     {
-        OSL_ENSURE( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
-        if ( pEvent && pEvent->ISA( VclWindowEvent ) )
-        {
-            OSL_ENSURE( static_cast<VclWindowEvent*>( pEvent )->GetWindow() && m_pTabListBox, "no event window" );
-            ProcessWindowEvent( *static_cast<VclWindowEvent*>(pEvent) );
-        }
-        return 0;
+        OSL_ENSURE( rEvent.GetWindow() && m_pTabListBox, "no event window" );
+        ProcessWindowEvent( rEvent );
     }
     // helpers --------------------------------------------------------------------
 
diff --git a/accessibility/source/extended/listboxaccessible.cxx b/accessibility/source/extended/listboxaccessible.cxx
index e7e428c..fdc340e 100644
--- a/accessibility/source/extended/listboxaccessible.cxx
+++ b/accessibility/source/extended/listboxaccessible.cxx
@@ -41,17 +41,12 @@ namespace accessibility
         }
     }
 
-    IMPL_LINK( ListBoxAccessibleBase, WindowEventListener, VclSimpleEvent*, pEvent )
+    IMPL_LINK_TYPED( ListBoxAccessibleBase, WindowEventListener, VclWindowEvent&, rEvent, void )
     {
-        OSL_ENSURE( pEvent && pEvent->ISA( VclWindowEvent ), "ListBoxAccessibleBase::WindowEventListener: unexpected WindowEvent!" );
-        if ( pEvent && pEvent->ISA( VclWindowEvent ) )
-        {
-            OSL_ENSURE( static_cast< VclWindowEvent* >( pEvent )->GetWindow() , "ListBoxAccessibleBase::WindowEventListener: no event window!" );
-            OSL_ENSURE( static_cast< VclWindowEvent* >( pEvent )->GetWindow() == m_pWindow, "ListBoxAccessibleBase::WindowEventListener: where did this come from?" );
+        OSL_ENSURE( rEvent.GetWindow() , "ListBoxAccessibleBase::WindowEventListener: no event window!" );
+        OSL_ENSURE( rEvent.GetWindow() == m_pWindow, "ListBoxAccessibleBase::WindowEventListener: where did this come from?" );
 
-            ProcessWindowEvent( *static_cast< VclWindowEvent* >( pEvent ) );
-        }
-        return 0;
+        ProcessWindowEvent( rEvent );
     }
 
     void ListBoxAccessibleBase::disposing()
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 657b4fe..b78aa7e 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -1646,9 +1646,9 @@ void Document::Notify(::SfxBroadcaster &, ::SfxHint const & rHint)
     }
 }
 
-IMPL_LINK(Document, WindowEventHandler, ::VclSimpleEvent *, pEvent)
+IMPL_LINK_TYPED(Document, WindowEventHandler, ::VclWindowEvent&, rEvent, void)
 {
-    switch (pEvent->GetId())
+    switch (rEvent.GetId())
     {
     case VCLEVENT_WINDOW_RESIZE:
         {
@@ -1750,7 +1750,6 @@ IMPL_LINK(Document, WindowEventHandler, ::VclSimpleEvent *, pEvent)
             break;
         }
     }
-    return 0;
 }
 
 void Document::init()
diff --git a/accessibility/source/standard/vclxaccessiblemenubar.cxx b/accessibility/source/standard/vclxaccessiblemenubar.cxx
index 3313f93..36209fe 100644
--- a/accessibility/source/standard/vclxaccessiblemenubar.cxx
+++ b/accessibility/source/standard/vclxaccessiblemenubar.cxx
@@ -73,18 +73,13 @@ bool VCLXAccessibleMenuBar::IsFocused()
 
 
 
-IMPL_LINK( VCLXAccessibleMenuBar, WindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( VCLXAccessibleMenuBar, WindowEventListener, VclWindowEvent&, rEvent, void )
 {
-    OSL_ENSURE( pEvent && pEvent->ISA( VclWindowEvent ), "VCLXAccessibleMenuBar::WindowEventListener: unknown window event!" );
-    if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+    OSL_ENSURE( rEvent.GetWindow(), "VCLXAccessibleMenuBar::WindowEventListener: no window!" );
+    if ( !rEvent.GetWindow()->IsAccessibilityEventsSuppressed() || ( rEvent.GetId() == VCLEVENT_OBJECT_DYING ) )
     {
-        OSL_ENSURE( static_cast<VclWindowEvent*>(pEvent)->GetWindow(), "VCLXAccessibleMenuBar::WindowEventListener: no window!" );
-        if ( !static_cast<VclWindowEvent*>(pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
-        {
-            ProcessWindowEvent( *static_cast<VclWindowEvent*>(pEvent) );
-        }
+        ProcessWindowEvent( rEvent );
     }
-    return 0;
 }
 
 
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index fe637f8..ca60b47 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -201,11 +201,11 @@ void SAL_CALL OGLWindow::removePaintListener( const uno::Reference< awt::XPaintL
 {
 }
 
-IMPL_LINK(OGLWindow, FocusGrabber, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(OGLWindow, FocusGrabber, VclWindowEvent&, rEvent, void)
 {
-    if( pEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
+    if( rEvent.GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
     {
-        MouseEvent* pMouseEvt = static_cast<MouseEvent*>(pEvent->GetData());
+        MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
         if(pMouseEvt)
         {
             const Point& rMousePos = pMouseEvt->GetPosPixel();
@@ -225,15 +225,13 @@ IMPL_LINK(OGLWindow, FocusGrabber, VclWindowEvent*, pEvent)
             }
         }
     }
-
-    return 0;
 }
 
-IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(OGLWindow, CameraHandler, VclWindowEvent&, rEvent, void)
 {
-    if( pEvent->GetId() == VCLEVENT_WINDOW_KEYINPUT )
+    if( rEvent.GetId() == VCLEVENT_WINDOW_KEYINPUT )
     {
-        KeyEvent* pKeyEvt = static_cast<KeyEvent*>(pEvent->GetData());
+        KeyEvent* pKeyEvt = static_cast<KeyEvent*>(rEvent.GetData());
         if(pKeyEvt)
         {
             const sal_uInt16 nCode = pKeyEvt->GetKeyCode().GetCode();
@@ -336,21 +334,21 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
             }
         }
     }
-    else if( pEvent->GetId() == VCLEVENT_WINDOW_MOUSEBUTTONDOWN )
+    else if( rEvent.GetId() == VCLEVENT_WINDOW_MOUSEBUTTONDOWN )
     {
-        MouseEvent* pMouseEvt = static_cast<MouseEvent*>(pEvent->GetData());
+        MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
         if(pMouseEvt && pMouseEvt->IsLeft() && pMouseEvt->GetClicks() == 1)
         {
             m_aLastMousePos = pMouseEvt->GetPosPixel();
         }
     }
-    else if( pEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
+    else if( rEvent.GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
     {
         if ( !m_rEventHandler.HasFocus() )
         {
             m_rEventHandler.GrabFocus();
         }
-        MouseEvent* pMouseEvt = static_cast<MouseEvent*>(pEvent->GetData());
+        MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
         if(pMouseEvt && pMouseEvt->IsLeft() && m_aLastMousePos != Point(0,0))
         {
             const Point& aCurPos = pMouseEvt->GetPosPixel();
@@ -378,15 +376,14 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
             m_aLastMousePos = aCurPos;
         }
     }
-    else if( pEvent->GetId() == VCLEVENT_WINDOW_MOUSEBUTTONUP )
+    else if( rEvent.GetId() == VCLEVENT_WINDOW_MOUSEBUTTONUP )
     {
-        MouseEvent* pMouseEvt = static_cast<MouseEvent*>(pEvent->GetData());
+        MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
         if(pMouseEvt && pMouseEvt->IsLeft() && pMouseEvt->GetClicks() == 1)
         {
             m_aLastMousePos = Point(0,0);
         }
     }
-    return 0;
 }
 
 } // namespace ogl
diff --git a/avmedia/source/opengl/oglwindow.hxx b/avmedia/source/opengl/oglwindow.hxx
index 71ca91a..eecd700 100644
--- a/avmedia/source/opengl/oglwindow.hxx
+++ b/avmedia/source/opengl/oglwindow.hxx
@@ -62,8 +62,8 @@ public:
     virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 private:
-    DECL_LINK( FocusGrabber, VclWindowEvent* );
-    DECL_LINK( CameraHandler, VclWindowEvent* );
+    DECL_LINK_TYPED( FocusGrabber, VclWindowEvent&, void );
+    DECL_LINK_TYPED( CameraHandler, VclWindowEvent&, void );
 
     libgltf::glTFHandle& m_rHandle;
     rtl::Reference<OpenGLContext> m_xContext;
diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx
index fee62f9..cbdf5c1 100644
--- a/basctl/source/accessibility/accessibledialogwindow.cxx
+++ b/basctl/source/accessibility/accessibledialogwindow.cxx
@@ -344,17 +344,11 @@ void AccessibleDialogWindow::SortChildren()
 
 
 
-IMPL_LINK( AccessibleDialogWindow, WindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( AccessibleDialogWindow, WindowEventListener, VclWindowEvent&, rEvent, void )
 {
-    if (VclWindowEvent* pWinEvent = dynamic_cast<VclWindowEvent*>(pEvent))
-    {
-        DBG_ASSERT(pWinEvent->GetWindow(), "AccessibleDialogWindow::WindowEventListener: no window!");
-        if (!pWinEvent->GetWindow()->IsAccessibilityEventsSuppressed() || pEvent->GetId() == VCLEVENT_OBJECT_DYING)
-            ProcessWindowEvent(*pWinEvent);
-    }
-    else
-        DBG_ASSERT(false, "AccessibleDialogWindow::WindowEventListener: unknown window event!");
-    return 0;
+    DBG_ASSERT(rEvent.GetWindow(), "AccessibleDialogWindow::WindowEventListener: no window!");
+    if (!rEvent.GetWindow()->IsAccessibilityEventsSuppressed() || rEvent.GetId() == VCLEVENT_OBJECT_DYING)
+        ProcessWindowEvent(rEvent);
 }
 
 
diff --git a/basctl/source/inc/accessibledialogwindow.hxx b/basctl/source/inc/accessibledialogwindow.hxx
index 97a7ef7..bec472a 100644
--- a/basctl/source/inc/accessibledialogwindow.hxx
+++ b/basctl/source/inc/accessibledialogwindow.hxx
@@ -98,7 +98,7 @@ protected:
     void                    UpdateChildren();
     void                    SortChildren();
 
-    DECL_LINK( WindowEventListener, VclSimpleEvent* );
+    DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
 
     void            ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
     void            FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
index f445f63..cac2042 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
@@ -217,11 +217,10 @@ void CreationWizardUnoDlg::createDialogOnDemand()
         }
     }
 }
-IMPL_LINK( CreationWizardUnoDlg, DialogEventHdl, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( CreationWizardUnoDlg, DialogEventHdl, VclWindowEvent&, rEvent, void )
 {
-    if(pEvent && (pEvent->GetId() == VCLEVENT_OBJECT_DYING) )
+    if(rEvent.GetId() == VCLEVENT_OBJECT_DYING)
         m_pDialog = 0;//avoid duplicate destruction of m_pDialog
-    return 0;
 }
 
 sal_Int16 SAL_CALL CreationWizardUnoDlg::execute(  ) throw(uno::RuntimeException, std::exception)
diff --git a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
index cb33c68..39ac29d 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
@@ -94,7 +94,7 @@ public:
     virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
-    DECL_LINK( DialogEventHdl, VclWindowEvent* );
+    DECL_LINK_TYPED( DialogEventHdl, VclWindowEvent&, void );
 
 protected:
     // ____ OComponentHelper ____
diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx
index b046ab6..9416e74 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -135,7 +135,7 @@ class UpdateCheckUI : public ::cppu::WeakImplHelper
     ResMgr*             mpSfxResMgr;
     Idle                maWaitIdle;
     Timer               maTimeoutTimer;
-    Link<>              maWindowEventHdl;
+    Link<VclWindowEvent&,void> maWindowEventHdl;
     Link<>              maApplicationEventHdl;
     bool                mbShowBubble;
     bool                mbShowMenuIcon;
@@ -148,7 +148,7 @@ private:
                     DECL_LINK_TYPED(WaitTimeOutHdl, Idle *, void);
                     DECL_LINK_TYPED(TimeOutHdl, Timer *, void);
                     DECL_LINK_TYPED(UserEventHdl, void *, void);
-                    DECL_LINK( WindowEventHdl, VclWindowEvent* );
+                    DECL_LINK_TYPED(WindowEventHdl, VclWindowEvent&, void);
                     DECL_LINK( ApplicationEventHdl, VclSimpleEvent* );
 
     BubbleWindow*   GetBubbleWindow();
@@ -662,14 +662,14 @@ IMPL_LINK_NOARG_TYPED(UpdateCheckUI, UserEventHdl, void*, void)
 }
 
 
-IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( UpdateCheckUI, WindowEventHdl, VclWindowEvent&, rEvent, void )
 {
-    sal_uLong nEventID = pEvent->GetId();
+    sal_uLong nEventID = rEvent.GetId();
 
     if ( VCLEVENT_OBJECT_DYING == nEventID )
     {
         SolarMutexGuard aGuard;
-        if ( mpIconSysWin == pEvent->GetWindow() )
+        if ( mpIconSysWin == rEvent.GetWindow() )
         {
             mpIconSysWin->RemoveEventListener( maWindowEventHdl );
             RemoveBubbleWindow( true );
@@ -678,7 +678,7 @@ IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent )
     else if ( VCLEVENT_WINDOW_MENUBARADDED == nEventID )
     {
         SolarMutexGuard aGuard;
-        vcl::Window *pWindow = pEvent->GetWindow();
+        vcl::Window *pWindow = rEvent.GetWindow();
         if ( pWindow )
         {
             SystemWindow *pSysWin = pWindow->GetSystemWindow();
@@ -691,7 +691,7 @@ IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent )
     else if ( VCLEVENT_WINDOW_MENUBARREMOVED == nEventID )
     {
         SolarMutexGuard aGuard;
-        MenuBar *pMBar = static_cast<MenuBar*>(pEvent->GetData());
+        MenuBar *pMBar = static_cast<MenuBar*>(rEvent.GetData());
         if ( pMBar && ( pMBar == mpIconMBar ) )
             RemoveBubbleWindow( true );
     }
@@ -699,7 +699,7 @@ IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent )
               ( nEventID == VCLEVENT_WINDOW_RESIZE ) )
     {
         SolarMutexGuard aGuard;
-        if ( ( mpIconSysWin == pEvent->GetWindow() ) &&
+        if ( ( mpIconSysWin == rEvent.GetWindow() ) &&
              mpBubbleWin && ( mpIconMBar != NULL ) )
         {
             Rectangle aIconRect = mpIconMBar->GetMenuBarButtonRectPixel( mnIconID );
@@ -709,8 +709,6 @@ IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent )
                 mpBubbleWin->Show();    // This will recalc the screen position of the bubble
         }
     }
-
-    return 0;
 }
 
 
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 8c342b0..9c64784 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -151,14 +151,13 @@ public:
         }
     }
 
-    DECL_LINK( DestroyedLink, VclWindowEvent* );
+    DECL_LINK_TYPED( DestroyedLink, VclWindowEvent&, void );
 };
 
-IMPL_LINK( FocusWindowWaitCursor, DestroyedLink, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( FocusWindowWaitCursor, DestroyedLink, VclWindowEvent&, rEvent, void )
 {
-    if( pEvent->GetId() == VCLEVENT_OBJECT_DYING )
+    if( rEvent.GetId() == VCLEVENT_OBJECT_DYING )
         m_pFocusWindow = NULL;
-    return 0;
 }
 
 sal_Bool SAL_CALL PDFFilter::filter( const Sequence< PropertyValue >& rDescriptor )
diff --git a/framework/inc/classes/fwktabwindow.hxx b/framework/inc/classes/fwktabwindow.hxx
index 92976b8..fc39ba2 100644
--- a/framework/inc/classes/fwktabwindow.hxx
+++ b/framework/inc/classes/fwktabwindow.hxx
@@ -112,8 +112,8 @@ public:
     virtual ~FwkTabWindow();
     virtual void    dispose() SAL_OVERRIDE;
 
-    void            AddEventListener( const Link<>& rEventListener );
-    void            RemoveEventListener( const Link<>& rEventListener );
+    void            AddEventListener( const Link<VclWindowEvent&,void>& rEventListener );
+    void            RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListener );
     FwkTabPage*     AddTabPage( sal_Int32 nIndex, const css::uno::Sequence< css::beans::NamedValue >& rProperties );
     void            ActivatePage( sal_Int32 nIndex );
     void            RemovePage( sal_Int32 nIndex );
diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx
index b74c820..7ee33f2 100644
--- a/framework/source/classes/fwktabwindow.cxx
+++ b/framework/source/classes/fwktabwindow.cxx
@@ -283,12 +283,12 @@ IMPL_LINK_NOARG_TYPED(FwkTabWindow, DeactivatePageHdl, TabControl *, bool)
     return true;
 }
 
-void FwkTabWindow::AddEventListener( const Link<>& rEventListener )
+void FwkTabWindow::AddEventListener( const Link<VclWindowEvent&,void>& rEventListener )
 {
     m_aTabCtrl->AddEventListener( rEventListener );
 }
 
-void FwkTabWindow::RemoveEventListener( const Link<>& rEventListener )
+void FwkTabWindow::RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListener )
 {
     m_aTabCtrl->RemoveEventListener( rEventListener );
 }
diff --git a/framework/source/dispatch/windowcommanddispatch.cxx b/framework/source/dispatch/windowcommanddispatch.cxx
index dcdc465..e3bd9bd 100644
--- a/framework/source/dispatch/windowcommanddispatch.cxx
+++ b/framework/source/dispatch/windowcommanddispatch.cxx
@@ -92,27 +92,23 @@ void WindowCommandDispatch::impl_stopListening()
     }
 }
 
-IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, void*, pParam)
+IMPL_LINK_TYPED(WindowCommandDispatch, impl_notifyCommand, VclWindowEvent&, rEvent, void)
 {
-    if ( ! pParam)
-        return 0L;
-
-    const VclWindowEvent* pEvent = static_cast<VclWindowEvent*>(pParam);
-    if (pEvent->GetId() == VCLEVENT_OBJECT_DYING)
+    if (rEvent.GetId() == VCLEVENT_OBJECT_DYING)
     {
         impl_stopListening();
-        return 0L;
+        return;
     }
-    if (pEvent->GetId() != VCLEVENT_WINDOW_COMMAND)
-        return 0L;
+    if (rEvent.GetId() != VCLEVENT_WINDOW_COMMAND)
+        return;
 
-    const CommandEvent* pCommand = static_cast<CommandEvent*>(pEvent->GetData());
+    const CommandEvent* pCommand = static_cast<CommandEvent*>(rEvent.GetData());
     if (pCommand->GetCommand() != CommandEventId::ShowDialog)
-        return 0L;
+        return;
 
     const CommandDialogData* pData = pCommand->GetDialogData();
     if ( ! pData)
-        return 0L;
+        return;
 
     const ShowDialogId nCommand = pData->GetDialogId();
     OUString sCommand;
@@ -128,12 +124,10 @@ IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, void*, pParam)
                 break;
 
         default :
-                return 0L;
+                return;
     }
 
     impl_dispatchCommand(sCommand);
-
-    return 0L;
 }
 
 void WindowCommandDispatch::impl_dispatchCommand(const OUString& sCommand)
diff --git a/framework/source/inc/dispatch/windowcommanddispatch.hxx b/framework/source/inc/dispatch/windowcommanddispatch.hxx
index 95c239d..f3f6392 100644
--- a/framework/source/inc/dispatch/windowcommanddispatch.hxx
+++ b/framework/source/inc/dispatch/windowcommanddispatch.hxx
@@ -31,6 +31,7 @@
 namespace com { namespace sun { namespace star { namespace uno {
     class XComponentContext;
 } } } }
+class VclWindowEvent;
 
 namespace framework{
 
@@ -101,7 +102,7 @@ class WindowCommandDispatch
 
         /** @short  callback from VCL to notify new commands
          */
-        DECL_LINK( impl_notifyCommand, void* );
+        DECL_LINK_TYPED( impl_notifyCommand, VclWindowEvent&, void );
 
         /** @short  dispatch right command URLs into our frame context.
 
diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx
index 2f8bd08..f15fc6b 100644
--- a/framework/source/services/tabwindowservice.cxx
+++ b/framework/source/services/tabwindowservice.cxx
@@ -147,7 +147,7 @@ private:
     virtual css::uno::Any SAL_CALL impl_getPropertyValue(const OUString& sProperty,
                                                                sal_Int32        nHandle  ) SAL_OVERRIDE;
 
-    DECL_DLLPRIVATE_LINK( EventListener, VclSimpleEvent * );
+    DECL_DLLPRIVATE_LINK_TYPED( EventListener, VclWindowEvent&, void );
 
     void impl_checkTabIndex (::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
     TTabPageInfoHash::iterator impl_getTabPageInfo(::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
@@ -418,13 +418,9 @@ css::uno::Any SAL_CALL TabWindowService::impl_getPropertyValue(const OUString& /
 }
 
 //  TabWindowService
-IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( TabWindowService, EventListener, VclWindowEvent&, rEvent, void )
 {
-    if (!pEvent || !pEvent->ISA(VclWindowEvent))
-        return 0;
-
-    sal_uLong           nEventId = pEvent->GetId();
-    VclWindowEvent* pWinEvt  = static_cast< VclWindowEvent* >(pEvent);
+    sal_uLong           nEventId = rEvent.GetId();
 
     css::uno::Reference< css::uno::XInterface > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
     css::lang::EventObject aEvent( xThis );
@@ -437,12 +433,12 @@ IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent )
         m_pTabWin = NULL;
         m_xTabWin.clear();
 
-        return 0;
+        return;
     }
 
     ::cppu::OInterfaceContainerHelper* pContainer = m_lListener.getContainer(cppu::UnoType<css::awt::XTabListener>::get());
     if ( ! pContainer)
-        return 0;
+        return;
 
     ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
     while (pIterator.hasMoreElements())
@@ -454,19 +450,19 @@ IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent )
             switch (nEventId)
             {
                 case VCLEVENT_TABPAGE_ACTIVATE :
-                    pListener->activated( (sal_Int32)reinterpret_cast<sal_uLong>(pWinEvt->GetData()) );
+                    pListener->activated( (sal_Int32)reinterpret_cast<sal_uLong>(rEvent.GetData()) );
                     break;
 
                 case VCLEVENT_TABPAGE_DEACTIVATE :
-                    pListener->deactivated( (sal_Int32)reinterpret_cast<sal_uLong>(pWinEvt->GetData()) );
+                    pListener->deactivated( (sal_Int32)reinterpret_cast<sal_uLong>(rEvent.GetData()) );
                     break;
 
                 case VCLEVENT_TABPAGE_INSERTED :
-                    pListener->inserted( (sal_Int32)reinterpret_cast<sal_uLong>(pWinEvt->GetData()) );
+                    pListener->inserted( (sal_Int32)reinterpret_cast<sal_uLong>(rEvent.GetData()) );
                     break;
 
                 case VCLEVENT_TABPAGE_REMOVED :
-                    pListener->removed( (sal_Int32)reinterpret_cast<sal_uLong>(pWinEvt->GetData()) );
+                    pListener->removed( (sal_Int32)reinterpret_cast<sal_uLong>(rEvent.GetData()) );
                     break;
 
                 case VCLEVENT_TABPAGE_PAGETEXTCHANGED :
@@ -479,8 +475,6 @@ IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent )
             pIterator.remove();
         }
     }
-
-    return 0;
 }
 
 //  TabWindowService
diff --git a/include/sfx2/sidebar/FocusManager.hxx b/include/sfx2/sidebar/FocusManager.hxx
index f93f9e8..93b78b8 100644
--- a/include/sfx2/sidebar/FocusManager.hxx
+++ b/include/sfx2/sidebar/FocusManager.hxx
@@ -96,7 +96,7 @@ private:
 
     /** Listen for key events for panels and buttons.
     */
-    DECL_LINK(WindowEventListener, VclSimpleEvent*);
+    DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void);
     DECL_LINK(ChildEventListener, VclSimpleEvent*);
 
     void ClearPanels();
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 4501903..0c88901 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -206,7 +206,7 @@ private:
     */
     VclPtr<vcl::Window> mpCloseIndicator;
 
-    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+    DECL_LINK_TYPED(WindowEventHandler, VclWindowEvent&, void);
     /** Make maRequestedContext the current context.
     */
     void UpdateConfigurations();
diff --git a/include/svtools/dialogcontrolling.hxx b/include/svtools/dialogcontrolling.hxx
index c0841f1..47ef749 100644
--- a/include/svtools/dialogcontrolling.hxx
+++ b/include/svtools/dialogcontrolling.hxx
@@ -115,7 +115,7 @@ namespace svt
         void    impl_updateAll( const VclWindowEvent& _rTriggerEvent );
         void    impl_update( const VclWindowEvent& _rTriggerEvent, vcl::Window& _rWindow );
 
-        DECL_LINK( OnWindowEvent, const VclWindowEvent* );
+        DECL_LINK_TYPED( OnWindowEvent, VclWindowEvent&, void );
 
     private:
         DialogController( const DialogController& ) SAL_DELETED_FUNCTION;
diff --git a/include/svtools/genericunodialog.hxx b/include/svtools/genericunodialog.hxx
index a8ef263..5765e65 100644
--- a/include/svtools/genericunodialog.hxx
+++ b/include/svtools/genericunodialog.hxx
@@ -144,7 +144,7 @@ namespace svt
         virtual void implInitialize(const com::sun::star::uno::Any& _rValue);
 
     private:
-        DECL_LINK( OnDialogDying, VclWindowEvent* );
+        DECL_LINK_TYPED( OnDialogDying, VclWindowEvent&, void );
 
         /** ensures that m_pDialog is not <NULL/>
 
diff --git a/include/svtools/toolpanel/drawerlayouter.hxx b/include/svtools/toolpanel/drawerlayouter.hxx
index 6306e7b..45665b6 100644
--- a/include/svtools/toolpanel/drawerlayouter.hxx
+++ b/include/svtools/toolpanel/drawerlayouter.hxx
@@ -70,7 +70,7 @@ namespace svt
         size_t  impl_getPanelPositionFromWindow( const vcl::Window* i_pDrawerWindow ) const;
         void    impl_removeDrawer( const size_t i_nPosition );
 
-        DECL_LINK( OnWindowEvent, VclSimpleEvent* );
+        DECL_LINK_TYPED( OnWindowEvent, VclWindowEvent&, void );
 
 private:
         vcl::Window&                             m_rParentWindow;
diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx
index 0fdc2a8..bd0c739 100644
--- a/include/toolkit/awt/vclxaccessiblecomponent.hxx
+++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx
@@ -69,7 +69,7 @@ private:
     VCLExternalSolarLock*           m_pSolarLock;
 
 protected:
-     DECL_LINK( WindowEventListener, VclSimpleEvent* );
+     DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
      DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
 
     virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx
index dab9b8e..d9cae37 100644
--- a/include/toolkit/awt/vclxwindow.hxx
+++ b/include/toolkit/awt/vclxwindow.hxx
@@ -82,7 +82,7 @@ private:
 
 protected:
     Size            ImplCalcWindowSize( const Size& rOutSz ) const;
-    DECL_LINK(      WindowEventListener, VclSimpleEvent* );
+    DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void );
 
     virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 3dab30b..ac6f44f 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -418,7 +418,7 @@ private:
 private:
     friend class VclBuilder;
     void designate_label(vcl::Window *pWindow);
-    DECL_LINK(WindowEventListener, VclSimpleEvent*);
+    DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void);
 public:
     VclFrame(vcl::Window *pParent)
         : VclBin(pParent)
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 13eb1db..0ea1042 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -68,6 +68,7 @@ class SystemWindow;
 class SalFrame;
 class MenuFloatingWindow;
 class VCLXWindow;
+class VclWindowEvent;
 
 namespace com { namespace sun { namespace star {
 namespace accessibility {
@@ -879,8 +880,8 @@ public:
     bool                                CompatPreNotify( NotifyEvent& rNEvt );
     bool                                CompatNotify( NotifyEvent& rNEvt );
 
-    void                                AddEventListener( const Link<>& rEventListener );
-    void                                RemoveEventListener( const Link<>& rEventListener );
+    void                                AddEventListener( const Link<VclWindowEvent&,void>& rEventListener );
+    void                                RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListener );
     void                                AddChildEventListener( const Link<>& rEventListener );
     void                                RemoveChildEventListener( const Link<>& rEventListener );
 
diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx
index ca891e6..e48f9cc 100644
--- a/reportdesign/source/ui/inc/ReportController.hxx
+++ b/reportdesign/source/ui/inc/ReportController.hxx
@@ -334,7 +334,7 @@ namespace rptui
     public:
         OReportController(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context);
 
-        DECL_LINK( EventLstHdl, VclWindowEvent* );
+        DECL_LINK_TYPED( EventLstHdl, VclWindowEvent&, void );
         DECL_LINK_TYPED( OnCreateHdl, OAddFieldWindow&, void);
 
         DECLARE_XINTERFACE( )
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 864b5da..c333423 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -2590,15 +2590,14 @@ sal_Int32 OReportController::getGroupPosition(const uno::Reference< report::XGro
 }
 
 
-IMPL_LINK( OReportController, EventLstHdl, VclWindowEvent*, _pEvent )
+IMPL_LINK_TYPED( OReportController, EventLstHdl, VclWindowEvent&, _rEvent, void )
 {
-    if ( _pEvent && _pEvent->GetId() == VCLEVENT_WINDOW_CLOSE )
+    if ( _rEvent.GetId() == VCLEVENT_WINDOW_CLOSE )
     {
         InvalidateFeature(SID_SORTINGANDGROUPING);
         InvalidateFeature(SID_FM_ADD_FIELD);
         InvalidateFeature(SID_RPT_SHOWREPORTEXPLORER);
     }
-    return 1L;
 }
 
 void OReportController::Notify(SfxBroadcaster & /* _rBc */, SfxHint const & _rHint)
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 9e4b8ac..1abcbf3 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -765,18 +765,16 @@ void ScInputHandler::GetFormulaData()
     }
 }
 
-IMPL_LINK( ScInputHandler, ShowHideTipVisibleParentListener, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( ScInputHandler, ShowHideTipVisibleParentListener, VclWindowEvent&, rEvent, void )
 {
-    if( pEvent->GetId() == VCLEVENT_OBJECT_DYING || pEvent->GetId() == VCLEVENT_WINDOW_HIDE )
+    if( rEvent.GetId() == VCLEVENT_OBJECT_DYING || rEvent.GetId() == VCLEVENT_WINDOW_HIDE )
         HideTip();
-    return 0;
 }
 
-IMPL_LINK( ScInputHandler, ShowHideTipVisibleSecParentListener, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( ScInputHandler, ShowHideTipVisibleSecParentListener, VclWindowEvent&, rEvent, void )
 {
-    if( pEvent->GetId() == VCLEVENT_OBJECT_DYING || pEvent->GetId() == VCLEVENT_WINDOW_HIDE )
+    if( rEvent.GetId() == VCLEVENT_OBJECT_DYING || rEvent.GetId() == VCLEVENT_WINDOW_HIDE )
         HideTipBelow();
-    return 0;
 }
 
 void ScInputHandler::HideTip()
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 581cee9..effbc4c 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -159,8 +159,8 @@ private:
     bool            GetFuncName( OUString& aStart, OUString& aResult );  // fdo75264
     void            ShowArgumentsTip( OUString& rSelText );
     DECL_LINK_TYPED( ModifyHdl, LinkParamNone*, void );
-    DECL_LINK( ShowHideTipVisibleParentListener, VclWindowEvent* );
-    DECL_LINK( ShowHideTipVisibleSecParentListener, VclWindowEvent* );
+    DECL_LINK_TYPED( ShowHideTipVisibleParentListener, VclWindowEvent&, void );
+    DECL_LINK_TYPED( ShowHideTipVisibleSecParentListener, VclWindowEvent&, void );
 
 public:
                     ScInputHandler();
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index d8dc832..b8bf84f 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -80,7 +80,7 @@ public:
     void ConnectListeners();
     void ReleaseListeners();
     void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint) SAL_OVERRIDE;
-    DECL_LINK(WindowEventListener, VclWindowEvent*);
+    DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void);
     DECL_LINK(SelectionChangeListener, void*);
     DECL_LINK_TYPED(BroadcastSelectionChange, void*, void);
     DECL_LINK_TYPED(FocusChangeListener, LinkParamNone*, void);
@@ -898,9 +898,9 @@ void AccessibleSlideSorterView::Implementation::Activated()
 
 }
 
-IMPL_LINK(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWindowEvent&, rEvent, void)
 {
-    switch (pEvent->GetId())
+    switch (rEvent.GetId())
     {
         case VCLEVENT_WINDOW_MOVE:
         case VCLEVENT_WINDOW_RESIZE:
@@ -917,7 +917,6 @@ IMPL_LINK(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWin
         default:
             break;
     }
-    return 1;
 }
 
 IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, SelectionChangeListener)
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 10c9274..4d1e788 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -608,17 +608,15 @@ void AnnotationTag::ClosePopup()
     }
 }
 
-IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(AnnotationTag, WindowEventHandler, VclWindowEvent&, rEvent, void)
 {
-    if( pEvent != NULL )
-    {
-        vcl::Window* pWindow = pEvent->GetWindow();
+        vcl::Window* pWindow = rEvent.GetWindow();
 
         if( pWindow )
         {
             if( pWindow == mpAnnotationWindow.get() )
             {
-                if( pEvent->GetId() == VCLEVENT_WINDOW_DEACTIVATE )
+                if( rEvent.GetId() == VCLEVENT_WINDOW_DEACTIVATE )
                 {
                     if( mnClosePopupEvent )
                         Application::RemoveUserEvent( mnClosePopupEvent );
@@ -628,7 +626,7 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent*, pEvent)
             }
             else if( pWindow == mpListenWindow )
             {
-                switch( pEvent->GetId() )
+                switch( rEvent.GetId() )
                 {
                 case VCLEVENT_WINDOW_MOUSEBUTTONUP:
                     {
@@ -664,8 +662,6 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent*, pEvent)
                 }
             }
         }
-    }
-    return sal_IntPtr(true);
 }
 
 IMPL_LINK_NOARG_TYPED(AnnotationTag, ClosePopupHdl, void*, void)
diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx
index 043708b..024555b 100644
--- a/sd/source/ui/annotations/annotationtag.hxx
+++ b/sd/source/ui/annotations/annotationtag.hxx
@@ -73,7 +73,7 @@ protected:
     virtual void select() SAL_OVERRIDE;
     virtual void deselect() SAL_OVERRIDE;
 
-    DECL_LINK( WindowEventHandler, VclWindowEvent* );
+    DECL_LINK_TYPED( WindowEventHandler, VclWindowEvent&, void );
     DECL_LINK_TYPED( ClosePopupHdl, void*, void );
 
 private:
diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx
index 731de22..aa05a31 100644
--- a/sd/source/ui/framework/factories/FullScreenPane.cxx
+++ b/sd/source/ui/framework/factories/FullScreenPane.cxx
@@ -71,7 +71,7 @@ FullScreenPane::FullScreenPane (
     // afterwards may or may not work.
 
     // Add resize listener at the work window.
-    Link<> aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
+    Link<VclWindowEvent&,void> aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
     mpWorkWindow->AddEventListener(aWindowEventHandler);
 
     // Set title and icon of the new window to those of the current window
@@ -107,7 +107,7 @@ void SAL_CALL FullScreenPane::disposing()
 
     if (mpWorkWindow.get() != NULL)
     {
-        Link<> aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
+        Link<VclWindowEvent&,void> aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
         mpWorkWindow->RemoveEventListener(aWindowEventHandler);
         mpWorkWindow.disposeAndClear();
     }
@@ -173,9 +173,9 @@ void SAL_CALL FullScreenPane::setAccessible (
     }
 }
 
-IMPL_LINK(FullScreenPane, WindowEventHandler, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(FullScreenPane, WindowEventHandler, VclWindowEvent&, rEvent, void)
 {
-    switch (pEvent->GetId())
+    switch (rEvent.GetId())
     {
         case VCLEVENT_WINDOW_RESIZE:
             GetWindow()->SetPosPixel(Point(0,0));
@@ -188,7 +188,6 @@ IMPL_LINK(FullScreenPane, WindowEventHandler, VclWindowEvent*, pEvent)
             mpWorkWindow.disposeAndClear();
             break;
     }
-    return 1;
 }
 
 Reference<rendering::XCanvas> FullScreenPane::CreateCanvas()
diff --git a/sd/source/ui/framework/factories/FullScreenPane.hxx b/sd/source/ui/framework/factories/FullScreenPane.hxx
index f2a9631..02d1670 100644
--- a/sd/source/ui/framework/factories/FullScreenPane.hxx
+++ b/sd/source/ui/framework/factories/FullScreenPane.hxx
@@ -71,7 +71,7 @@ public:
         const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible)
         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
-    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+    DECL_LINK_TYPED(WindowEventHandler, VclWindowEvent&, void);
 
 protected:
     virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
diff --git a/sd/source/ui/inc/FormShellManager.hxx b/sd/source/ui/inc/FormShellManager.hxx
index f8870c7..a97d161 100644
--- a/sd/source/ui/inc/FormShellManager.hxx
+++ b/sd/source/ui/inc/FormShellManager.hxx
@@ -108,7 +108,7 @@ private:
         when the window gets the focus.  In this case the form shell is
         moved to the bottom of the shell stack.
     */
-    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+    DECL_LINK_TYPED(WindowEventHandler, VclWindowEvent&, void);
 
     /** This call back is called when view in the center pane is replaced.
         When this happens then we unregister at the window of the old and
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index 38e9fea1..67861e7 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -188,7 +188,7 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell )
         ".uno:VerticalTextState");
 
     SetSizePixel(GetParent()->GetSizePixel());
-    Link<> aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler));
+    Link<VclWindowEvent&,void> aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler));
     GetParent()->AddEventListener(aWindowEventHandlerLink);
 }
 
@@ -221,7 +221,7 @@ void LayoutMenu::Dispose()
     Link<tools::EventMultiplexerEvent&,void> aLink (LINK(this,LayoutMenu,EventMultiplexerListener));
     mrBase.GetEventMultiplexer()->RemoveEventListener (aLink);
 
-    Link<> aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler));
+    Link<VclWindowEvent&,void> aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler));
     GetParent()->RemoveEventListener(aWindowEventHandlerLink);
 }
 
@@ -736,23 +736,17 @@ IMPL_LINK_TYPED(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiple
     }
 }
 
-IMPL_LINK(LayoutMenu, WindowEventHandler, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(LayoutMenu, WindowEventHandler, VclWindowEvent&, rEvent, void)
 {
-    if (pEvent != NULL)
+    switch (rEvent.GetId())
     {
-        switch (pEvent->GetId())
-        {
-            case VCLEVENT_WINDOW_SHOW:
-            case VCLEVENT_WINDOW_RESIZE:
-                SetSizePixel(GetParent()->GetSizePixel());
-                return sal_IntPtr(true);
+        case VCLEVENT_WINDOW_SHOW:
+        case VCLEVENT_WINDOW_RESIZE:
+            SetSizePixel(GetParent()->GetSizePixel());
+            break;
 
-            default:
-                return sal_IntPtr(false);
-        }
+        default: break;
     }
-
-    return sal_IntPtr(false);
 }
 
 void LayoutMenu::DataChanged (const DataChangedEvent& rEvent)
diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx
index adef23a..0969de6 100644
--- a/sd/source/ui/sidebar/LayoutMenu.hxx
+++ b/sd/source/ui/sidebar/LayoutMenu.hxx
@@ -192,7 +192,7 @@ private:
     DECL_LINK_TYPED(RightClickHandler, const MouseEvent&, void);
     DECL_LINK_TYPED(StateChangeHandler, const OUString&, void);
     DECL_LINK_TYPED(EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent&, void);
-    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+    DECL_LINK_TYPED(WindowEventHandler, VclWindowEvent&, void);
     DECL_LINK_TYPED(OnMenuItemSelected, Menu*, bool);
 };
 
diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx
index 6bac403..2854779 100644
--- a/sd/source/ui/slideshow/showwin.cxx
+++ b/sd/source/ui/slideshow/showwin.cxx
@@ -583,17 +583,16 @@ IMPL_LINK_NOARG_TYPED(ShowWindow, MouseTimeoutHdl, Timer *, void)
     }
 }
 
-IMPL_LINK( ShowWindow, EventHdl, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( ShowWindow, EventHdl, VclWindowEvent&, rEvent, void )
 {
     if( mbMouseAutoHide )
     {
-        if (pEvent->GetId() == VCLEVENT_WINDOW_SHOW)
+        if (rEvent.GetId() == VCLEVENT_WINDOW_SHOW)
         {
             maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
             maMouseTimer.Start();
         }
     }
-    return 0L;
 }
 
 void ShowWindow::SetPresentationArea( const Rectangle& rPresArea )
diff --git a/sd/source/ui/slideshow/showwindow.hxx b/sd/source/ui/slideshow/showwindow.hxx
index ab7aac7..6a39b2e 100644
--- a/sd/source/ui/slideshow/showwindow.hxx
+++ b/sd/source/ui/slideshow/showwindow.hxx
@@ -109,7 +109,7 @@ private:
 
                     DECL_LINK_TYPED( PauseTimeoutHdl, Timer*, void );
                     DECL_LINK_TYPED(MouseTimeoutHdl, Timer *, void);
-                    DECL_LINK( EventHdl, VclWindowEvent* );
+                    DECL_LINK_TYPED( EventHdl, VclWindowEvent&, void );
 
     ::rtl::Reference< SlideshowImpl > mxController;
 };
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 1aaae26..3b34246 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -540,13 +540,17 @@ void SlideSorterController::HandleModelChange()
     }
 }
 
-IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)
+IMPL_LINK(SlideSorterController, ApplicationEventHandler, VclWindowEvent*, pEvent)
 {
-    if (pEvent != NULL)
-    {
-        vcl::Window* pWindow = pEvent->GetWindow();
+    if (pEvent)
+        WindowEventHandler(*pEvent);
+    return 1;
+}
+IMPL_LINK_TYPED(SlideSorterController, WindowEventHandler, VclWindowEvent&, rEvent, void)
+{
+        vcl::Window* pWindow = rEvent.GetWindow();
         sd::Window *pActiveWindow (mrSlideSorter.GetContentWindow());
-        switch (pEvent->GetId())
+        switch (rEvent.GetId())
         {
             case VCLEVENT_WINDOW_ACTIVATE:
             case VCLEVENT_WINDOW_SHOW:
@@ -606,9 +610,6 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)
             default:
                 break;
         }
-    }
-
-    return sal_IntPtr(true);
 }
 
 void SlideSorterController::GetCtrlState (SfxItemSet& rSet)
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index 8d1d378..e47ed18 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -160,7 +160,8 @@ public:
     */
     void HandleModelChange();
 
-    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+    DECL_LINK_TYPED(WindowEventHandler, VclWindowEvent&, void);
+    DECL_LINK(ApplicationEventHandler, VclWindowEvent*);
 
     /** Update the display of all pages.  This involves a redraw and
         releasing previews and caches.
diff --git a/sd/source/ui/slidesorter/shell/SlideSorter.cxx b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
index fd45631..91db811 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorter.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
@@ -271,7 +271,7 @@ void SlideSorter::SetupListeners()
         LINK(
             mpSlideSorterController.get(),
             controller::SlideSorterController,
-            WindowEventHandler));
+            ApplicationEventHandler));
 
     mpSlideSorterController->GetScrollBarManager().Connect();
 }
@@ -298,7 +298,7 @@ void SlideSorter::ReleaseListeners()
     Application::RemoveEventListener(
         LINK(mpSlideSorterController.get(),
             controller::SlideSorterController,
-            WindowEventHandler));
+            ApplicationEventHandler));
 }
 
 void SlideSorter::CreateModelViewController()
diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx
index 02ffc9f..44ecdfe 100644
--- a/sd/source/ui/view/FormShellManager.cxx
+++ b/sd/source/ui/view/FormShellManager.cxx
@@ -223,45 +223,40 @@ IMPL_LINK_TYPED(FormShellManager, ConfigurationUpdateHandler, sd::tools::EventMu
     }
 }
 
-IMPL_LINK(FormShellManager, WindowEventHandler, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(FormShellManager, WindowEventHandler, VclWindowEvent&, rEvent, void)
 {
-    if (pEvent != NULL)
+    switch (rEvent.GetId())
     {
-        switch (pEvent->GetId())
+        case VCLEVENT_WINDOW_GETFOCUS:
         {
-            case VCLEVENT_WINDOW_GETFOCUS:
+            // The window of the center pane got the focus.  Therefore
+            // the form shell is moved to the bottom of the object bar
+            // stack.
+            ViewShell* pShell = mrBase.GetMainViewShell().get();
+            if (pShell!=NULL && mbFormShellAboveViewShell)
             {
-                // The window of the center pane got the focus.  Therefore
-                // the form shell is moved to the bottom of the object bar
-                // stack.
-                ViewShell* pShell = mrBase.GetMainViewShell().get();
-                if (pShell!=NULL && mbFormShellAboveViewShell)
-                {
-                    mbFormShellAboveViewShell = false;
-                    ViewShellManager::UpdateLock aLock (mrBase.GetViewShellManager());
-                    mrBase.GetViewShellManager()->SetFormShell(
-                        pShell,
-                        mpFormShell,
-                        mbFormShellAboveViewShell);
-                }
+                mbFormShellAboveViewShell = false;
+                ViewShellManager::UpdateLock aLock (mrBase.GetViewShellManager());
+                mrBase.GetViewShellManager()->SetFormShell(
+                    pShell,
+                    mpFormShell,
+                    mbFormShellAboveViewShell);
             }
+        }
+        break;
+
+        case VCLEVENT_WINDOW_LOSEFOCUS:
+            // We follow the sloppy focus policy.  Losing the focus is
+            // ignored.  We wait for the focus to be placed either in
+            // the window or the form shell.  The later, however, is
+            // notified over the FormControlActivated handler, not this
+            // one.
             break;
 
-            case VCLEVENT_WINDOW_LOSEFOCUS:
-                // We follow the sloppy focus policy.  Losing the focus is
-                // ignored.  We wait for the focus to be placed either in
-                // the window or the form shell.  The later, however, is
-                // notified over the FormControlActivated handler, not this
-                // one.
-                break;
-
-            case VCLEVENT_OBJECT_DYING:
-                mpMainViewShellWindow = NULL;
-                break;
-        }
+        case VCLEVENT_OBJECT_DYING:
+            mpMainViewShellWindow = NULL;
+           break;
     }
-
-    return 0;
 }
 
 void FormShellManager::Notify(SfxBroadcaster&, const SfxHint& rHint)
diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx
index 72b10b3..5c015b3 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -204,7 +204,7 @@ private:
     */
     void CreateTargetStack (ShellStack& rStack) const;
 
-    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+    DECL_LINK_TYPED(WindowEventHandler, VclWindowEvent&, void);
 
 #if OSL_DEBUG_LEVEL >= 2
     void DumpShellStack (const ShellStack& rStack);
@@ -984,14 +984,11 @@ void ViewShellManager::Implementation::CreateTargetStack (ShellStack& rStack) co
     }
 }
 
-IMPL_LINK(ViewShellManager::Implementation, WindowEventHandler, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(ViewShellManager::Implementation, WindowEventHandler, VclWindowEvent&, rEvent, void)
 {
-    if (pEvent != NULL)
-    {
-        vcl::Window* pEventWindow
-            = static_cast<VclWindowEvent*>(pEvent)->GetWindow();
+        vcl::Window* pEventWindow = rEvent.GetWindow();
 
-        switch (pEvent->GetId())
+        switch (rEvent.GetId())
         {
             case VCLEVENT_WINDOW_GETFOCUS:
             {
@@ -1028,8 +1025,6 @@ IMPL_LINK(ViewShellManager::Implementation, WindowEventHandler, VclWindowEvent*,
                 }
                 break;
         }
-    }
-    return sal_IntPtr(true);
 }
 
 ShellDescriptor ViewShellManager::Implementation::CreateSubShell (
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index fbb326f..d36b7ac 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -508,42 +508,33 @@ void FocusManager::HandleKeyEvent (
     }
 }
 
-IMPL_LINK(FocusManager, WindowEventListener, VclSimpleEvent*, pEvent)
+IMPL_LINK_TYPED(FocusManager, WindowEventListener, VclWindowEvent&, rWindowEvent, void)
 {
-    if (pEvent == NULL)
-        return 0;
-
-    if ( ! pEvent->ISA(VclWindowEvent))
-        return 0;
-
-    VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
-    vcl::Window* pSource = pWindowEvent->GetWindow();
+    vcl::Window* pSource = rWindowEvent.GetWindow();
     if (pSource == NULL)
-        return 0;
+        return;
 
-    switch (pWindowEvent->GetId())
+    switch (rWindowEvent.GetId())
     {
         case VCLEVENT_WINDOW_KEYINPUT:
         {
-            KeyEvent* pKeyEvent = static_cast<KeyEvent*>(pWindowEvent->GetData());
+            KeyEvent* pKeyEvent = static_cast<KeyEvent*>(rWindowEvent.GetData());
             HandleKeyEvent(pKeyEvent->GetKeyCode(), *pSource);
-            return 1;
+            break;
         }
 
         case VCLEVENT_OBJECT_DYING:
             RemoveWindow(*pSource);
-            return 1;
+            break;
 
         case VCLEVENT_WINDOW_GETFOCUS:
         case VCLEVENT_WINDOW_LOSEFOCUS:
             pSource->Invalidate();
-            return 1;
+            break;
 
         default:
             break;
     }
-
-    return 0;
 }
 
 IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent)
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 08279d7..3d0f16f 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -820,14 +820,11 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
     }
 }
 
-IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(SidebarController, WindowEventHandler, VclWindowEvent&, rEvent, void)
 {
-    if (pEvent==NULL)
-        return sal_IntPtr(false);
-
-    if (pEvent->GetWindow() == mpParentWindow)
+    if (rEvent.GetWindow() == mpParentWindow)
     {
-        switch (pEvent->GetId())
+        switch (rEvent.GetId())
         {
             case VCLEVENT_WINDOW_SHOW:
             case VCLEVENT_WINDOW_RESIZE:
@@ -857,9 +854,9 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
                 break;
         }
     }
-    else if (pEvent->GetWindow()==mpSplitWindow && mpSplitWindow!=nullptr)
+    else if (rEvent.GetWindow()==mpSplitWindow && mpSplitWindow!=nullptr)
     {
-        switch (pEvent->GetId())
+        switch (rEvent.GetId())
         {
             case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
                 mnWidthOnSplitterButtonDown = mpParentWindow->GetSizePixel().Width();
@@ -877,8 +874,6 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
                 break;
          }
     }
-
-    return sal_IntPtr(true);
 }
 
 void SidebarController::ShowPopupMenu (
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 3ca799d..e3940f1 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -193,25 +193,21 @@ struct SfxToolBoxControl_Impl
     sal_uInt16              nSlotId;
     VclPtr<SfxPopupWindow>  mpFloatingWindow;
     VclPtr<SfxPopupWindow>  mpPopupWindow;
-    DECL_LINK( WindowEventListener, VclSimpleEvent* );
+    DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
 };
 
-IMPL_LINK( SfxToolBoxControl_Impl, WindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( SfxToolBoxControl_Impl, WindowEventListener, VclWindowEvent&, rEvent, void )
 {
-    if ( pEvent &&
-         pEvent->ISA( VclWindowEvent ) &&
-         (( pEvent->GetId() == VCLEVENT_WINDOW_MOVE ) ||
-          ( pEvent->GetId() == VCLEVENT_WINDOW_ACTIVATE )))
+    if ( ( rEvent.GetId() == VCLEVENT_WINDOW_MOVE ) ||
+         ( rEvent.GetId() == VCLEVENT_WINDOW_ACTIVATE ))
     {
-        vcl::Window* pWindow( static_cast<VclWindowEvent*>(pEvent)->GetWindow() );
+        vcl::Window* pWindow( rEvent.GetWindow() );
         if (( pWindow == mpFloatingWindow ) &&
             ( mpPopupWindow != nullptr ))
         {
             mpPopupWindow.disposeAndClear();
         }
     }
-
-    return 1;
 }
 
 
diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx
index da71f3e..5bfc821 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<VclWindowEvent*>(pEvent)->GetWindow(), "Window???" );
-        if( !static_cast<VclWindowEvent*>(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<VclWindowEvent*>(pEvent) );
+            ProcessWindowEvent( rEvent );
         }
     }
-    return 0;
 }
 
 
diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx
index 951bc74..8a385f2 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 ca62804..12219e4 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 a2042d8..55be1a2 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 64e9656..bb4f086 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 e6d2ac0..a0d7ec6 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<vcl::Window> 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<void*>(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<void*>(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<void*>(mpPopupWindow) );
-            }
-            break;
-        }
+            mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS, 0 );
+            if( mpToolBox )
+                mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_CLOSE, static_cast<void*>(mpPopupWindow) );
         }
+        break;
+    }
     }
-    return 1;
 }
 
 
diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx
index 2667be3..9cc6b77 100644
--- a/svx/source/accessibility/AccessibleFrameSelector.cxx
+++ b/svx/source/accessibility/AccessibleFrameSelector.cxx
@@ -488,21 +488,14 @@ void AccFrameSelector::NotifyFocusListeners(bool bGetFocus)
 
 
 
-IMPL_LINK( AccFrameSelector, WindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( AccFrameSelector, WindowEventListener, VclWindowEvent&, rEvent, void )
 {
-    VclWindowEvent* pWinEvent = dynamic_cast< VclWindowEvent* >( pEvent );
-    DBG_ASSERT( pWinEvent, "AccFrameSelector::WindowEventListener - unknown window event" );
-    if ( pWinEvent )
+    vcl::Window* pWindow = rEvent.GetWindow();
+    DBG_ASSERT( pWindow, "AccFrameSelector::WindowEventListener: no window!" );
+    if ( !pWindow->IsAccessibilityEventsSuppressed() || ( rEvent.GetId() == VCLEVENT_OBJECT_DYING ) )
     {
-        vcl::Window* pWindow = pWinEvent->GetWindow();
-        DBG_ASSERT( pWindow, "AccFrameSelector::WindowEventListener: no window!" );
-        if ( !pWindow->IsAccessibilityEventsSuppressed() || ( pWinEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
-        {
-            ProcessWindowEvent( *pWinEvent );
-        }
+        ProcessWindowEvent( rEvent );
     }
-
-    return 0;
 }
 
 
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 04b8c2b..b73b821 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3406,12 +3406,10 @@ void SAL_CALL FmXGridCell::removePaintListener( const Reference< awt::XPaintList
 }
 
 
-IMPL_LINK( FmXGridCell, OnWindowEvent, VclWindowEvent*, _pEvent )
+IMPL_LINK_TYPED( FmXGridCell, OnWindowEvent, VclWindowEvent&, _rEvent, void )
 {
-    ENSURE_OR_THROW( _pEvent, "illegal event pointer" );
-    ENSURE_OR_THROW( _pEvent->GetWindow(), "illegal window" );
-    onWindowEvent( _pEvent->GetId(), *_pEvent->GetWindow(), _pEvent->GetData() );
-    return 1L;
+    ENSURE_OR_THROW( _rEvent.GetWindow(), "illegal window" );
+    onWindowEvent( _rEvent.GetId(), *_rEvent.GetWindow(), _rEvent.GetData() );
 }
 
 
diff --git a/svx/source/form/databaselocationinput.cxx b/svx/source/form/databaselocationinput.cxx
index 54ab8fc..ede20e8 100644
--- a/svx/source/form/databaselocationinput.cxx
+++ b/svx/source/form/databaselocationinput.cxx
@@ -70,7 +70,7 @@ namespace svx
         void     impl_onLocationModified();
         OUString impl_getCurrentURL() const;
 
-        DECL_LINK( OnControlAction, VclWindowEvent* );
+        DECL_LINK_TYPED( OnControlAction, VclWindowEvent&, void );
 
     private:
         const Reference<XComponentContext>      m_xContext;
@@ -196,23 +196,21 @@ namespace svx
     }
 
 
-    IMPL_LINK( DatabaseLocationInputController_Impl, OnControlAction, VclWindowEvent*, _pEvent )
+    IMPL_LINK_TYPED( DatabaseLocationInputController_Impl, OnControlAction, VclWindowEvent&, _rEvent, void )
     {
-        if  (   ( _pEvent->GetWindow() == &m_rBrowseButton )
-            &&  ( _pEvent->GetId() == VCLEVENT_BUTTON_CLICK )
+        if  (   ( _rEvent.GetWindow() == &m_rBrowseButton )
+            &&  ( _rEvent.GetId() == VCLEVENT_BUTTON_CLICK )
             )
         {
             impl_onBrowseButtonClicked();
         }
 
-        if  (   ( _pEvent->GetWindow() == &m_rLocationInput )
-            &&  ( _pEvent->GetId() == VCLEVENT_EDIT_MODIFY )
+        if  (   ( _rEvent.GetWindow() == &m_rLocationInput )
+            &&  ( _rEvent.GetId() == VCLEVENT_EDIT_MODIFY )
             )
         {
             impl_onLocationModified();
         }
-
-        return 0L;
     }
 
 
diff --git a/svx/source/inc/AccessibleFrameSelector.hxx b/svx/source/inc/AccessibleFrameSelector.hxx
index 3c20eec..a058576 100644
--- a/svx/source/inc/AccessibleFrameSelector.hxx
+++ b/svx/source/inc/AccessibleFrameSelector.hxx
@@ -102,7 +102,7 @@ public:
     void    NotifyAccessibleEvent( const sal_Int16 _nEventId, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Any& _rNewValue );
 
 protected:
-    DECL_LINK( WindowEventListener, VclSimpleEvent* );
+    DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
 
     void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
 
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index 812c5d4..b341397 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -817,7 +817,7 @@ protected:
     virtual void onFocusLost( const ::com::sun::star::awt::FocusEvent& _rEvent );
 
 private:
-    DECL_LINK( OnWindowEvent, VclWindowEvent* );
+    DECL_LINK_TYPED( OnWindowEvent, VclWindowEvent&, void );
 };
 
 
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index b0f3f7f..dea8e6c 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -35,25 +35,19 @@ class CandidateMgr
 {
     std::vector<VclPtr<vcl::Window> > m_aCandidates;
     std::set<VclPtr<vcl::Window> > m_aDeletedCandidates;
-    DECL_LINK(WindowEventListener, VclSimpleEvent*);
+    DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void);
 public:
     void PaintTransparentChildren(vcl::Window & rWindow, Rectangle const& rPixelRect);
     ~CandidateMgr();
 };
 
-IMPL_LINK(CandidateMgr, WindowEventListener, VclSimpleEvent*, pEvent)
+IMPL_LINK_TYPED(CandidateMgr, WindowEventListener, VclWindowEvent&, rEvent, void)
 {
-    VclWindowEvent* pWinEvent = dynamic_cast< VclWindowEvent* >( pEvent );
-    if (pWinEvent)
+    vcl::Window* pWindow = rEvent.GetWindow();
+    if (rEvent.GetId() == VCLEVENT_OBJECT_DYING)
     {
-        vcl::Window* pWindow = pWinEvent->GetWindow();
-        if (pWinEvent->GetId() == VCLEVENT_OBJECT_DYING)
-        {
-            m_aDeletedCandidates.insert(pWindow);
-        }
+        m_aDeletedCandidates.insert(pWindow);
     }
-
-    return 0;
 }
 
 CandidateMgr::~CandidateMgr()
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index fda39c5..6a94bce 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -193,7 +193,7 @@ private:
                                          OUString( ".uno:CharEndPreviewFontName" ),
                                          aArgs );
     }
-    DECL_DLLPRIVATE_LINK( CheckAndMarkUnknownFont, VclWindowEvent* );
+    DECL_DLLPRIVATE_LINK_TYPED( CheckAndMarkUnknownFont, VclWindowEvent&, void );
 
     void            SetOptimalSize();
 
@@ -960,10 +960,10 @@ void SvxFontNameBox_Impl::FillList()
     SetSelection( aOldSel );
 }
 
-IMPL_LINK( SvxFontNameBox_Impl, CheckAndMarkUnknownFont, VclWindowEvent*, event )
+IMPL_LINK_TYPED( SvxFontNameBox_Impl, CheckAndMarkUnknownFont, VclWindowEvent&, event, void )
 {
-    if( event->GetId() != VCLEVENT_EDIT_MODIFY )
-        return 0;
+    if( event.GetId() != VCLEVENT_EDIT_MODIFY )
+        return;
     OUString fontname = GetSubEdit()->GetText();
     lcl_GetDocFontList( &pFontList, this );
     // If the font is unknown, show it in italic.
@@ -986,7 +986,6 @@ IMPL_LINK( SvxFontNameBox_Impl, CheckAndMarkUnknownFont, VclWindowEvent*, event
             SetQuickHelpText( SVX_RESSTR( RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE ));
         }
     }
-    return 0;
 }
 
 void SvxFontNameBox_Impl::Update( const SvxFontItem* pFontItem )
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
index ff90443..93d5b22 100644
--- a/sw/inc/SidebarWin.hxx
+++ b/sw/inc/SidebarWin.hxx
@@ -168,7 +168,7 @@ class SwSidebarWin : public vcl::Window
             return mbReadonly;
         }
 
-        DECL_LINK( WindowEventListener, VclSimpleEvent* );
+        DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
         inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
 
         void SetLanguage(const SvxLanguageItem& rNewItem);
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 48ca34d..a03d382 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -1349,9 +1349,9 @@ IMPL_LINK_TYPED( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFile
     Application::SetDefDialogParent( m_pOldDefDlgParent );
 }
 
-IMPL_LINK( SwEditRegionDlg, SubRegionEventHdl, VclWindowEvent *, pEvent )
+IMPL_LINK_TYPED( SwEditRegionDlg, SubRegionEventHdl, VclWindowEvent&, rEvent, void )
 {
-    if( !m_bSubRegionsFilled && pEvent && pEvent->GetId() == VCLEVENT_DROPDOWN_PRE_OPEN )
+    if( !m_bSubRegionsFilled && rEvent.GetId() == VCLEVENT_DROPDOWN_PRE_OPEN )
     {
         //if necessary fill the names bookmarks/sections/tables now
 
@@ -1374,7 +1374,6 @@ IMPL_LINK( SwEditRegionDlg, SubRegionEventHdl, VclWindowEvent *, pEvent )
             lcl_FillSubRegionList(rSh, *m_pSubRegionED, 0);
         m_bSubRegionsFilled = true;
     }
-    return 0;
 }
 
 Image SwEditRegionDlg::BuildBitmap( bool bProtect, bool bHidden )
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index c82e10f..4cfc515 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -1114,52 +1114,47 @@ void SwSidebarWin::SwitchToPostIt(sal_uInt16 aDirection)
         pPostIt->GrabFocus();
 }
 
-IMPL_LINK( SwSidebarWin, WindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( SwSidebarWin, WindowEventListener, VclWindowEvent&, rEvent, void )
 {
-    VclWindowEvent* pWinEvent = dynamic_cast<VclWindowEvent*>(pEvent);
-    if ( pWinEvent )
+    if ( rEvent.GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
     {
-        if ( pWinEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
+        MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
+        if ( pMouseEvt->IsEnterWindow() )
         {
-            MouseEvent* pMouseEvt = static_cast<MouseEvent*>(pWinEvent->GetData());
-            if ( pMouseEvt->IsEnterWindow() )
+            mbMouseOver = true;
+            if ( !HasFocus() )
             {
-                mbMouseOver = true;
-                if ( !HasFocus() )
-                {
-                    SetViewState(ViewState::VIEW);
-                    Invalidate();
-                }
+                SetViewState(ViewState::VIEW);
+                Invalidate();
             }
-            else if ( pMouseEvt->IsLeaveWindow())
+        }
+        else if ( pMouseEvt->IsLeaveWindow())
+        {
+            if (!IsPreview())
             {
-                if (!IsPreview())
+                mbMouseOver = false;
+                if ( !HasFocus() )
                 {
-                    mbMouseOver = false;
-                    if ( !HasFocus() )
-                    {
-                        SetViewState(ViewState::NORMAL);
-                        Invalidate();
-                    }
+                    SetViewState(ViewState::NORMAL);
+                    Invalidate();
                 }
             }
         }
-        else if ( pWinEvent->GetId() == VCLEVENT_WINDOW_ACTIVATE &&
-                  pWinEvent->GetWindow() == mpSidebarTextControl )
-        {
-            const bool bLockView = mrView.GetWrtShell().IsViewLocked();
-            mrView.GetWrtShell().LockView( true );
-
-            if ( !IsPreview() )
-            {
-                mrMgr.SetActiveSidebarWin( this );
-            }
+    }
+    else if ( rEvent.GetId() == VCLEVENT_WINDOW_ACTIVATE &&
+              rEvent.GetWindow() == mpSidebarTextControl )
+    {
+        const bool bLockView = mrView.GetWrtShell().IsViewLocked();
+        mrView.GetWrtShell().LockView( true );
 
-            mrView.GetWrtShell().LockView( bLockView );
-            mrMgr.MakeVisible( this );
+        if ( !IsPreview() )
+        {
+            mrMgr.SetActiveSidebarWin( this );
         }
+
+        mrView.GetWrtShell().LockView( bLockView );
+        mrMgr.MakeVisible( this );
     }
-    return sal_IntPtr(true);
 }
 
 void SwSidebarWin::Delete()
diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx
index 605dba5..22b9460 100644
--- a/sw/source/uibase/inc/regionsw.hxx
+++ b/sw/source/uibase/inc/regionsw.hxx
@@ -124,7 +124,7 @@ class SwEditRegionDlg : public SfxModalDialog
     DECL_LINK( FileNameHdl, Edit* );
     DECL_LINK_TYPED( DDEHdl, Button*, void );
     DECL_LINK_TYPED( DlgClosedHdl, sfx2::FileDialogHelper*, void );
-    DECL_LINK( SubRegionEventHdl, VclWindowEvent * );
+    DECL_LINK_TYPED( SubRegionEventHdl, VclWindowEvent&, void );
 
     bool CheckPasswd(CheckBox* pBox = 0);
 
diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
index c3553d5..844d36a 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -65,23 +65,23 @@ namespace toolkit
         {
         }
 
-        DECL_LINK( OnWindowEvent, const VclWindowEvent* );
+        DECL_LINK_TYPED( OnWindowEvent, VclWindowEvent&, void );
     };
 
 
-    IMPL_LINK( WindowStyleSettings_Data, OnWindowEvent, const VclWindowEvent*, i_pEvent )
+    IMPL_LINK_TYPED( WindowStyleSettings_Data, OnWindowEvent, VclWindowEvent&, rEvent, void )
     {
-        if ( !i_pEvent || ( i_pEvent->GetId() != VCLEVENT_WINDOW_DATACHANGED ) )
-            return 0L;
-        const DataChangedEvent* pDataChangedEvent = static_cast< const DataChangedEvent* >( i_pEvent->GetData() );
+        if ( rEvent.GetId() != VCLEVENT_WINDOW_DATACHANGED )
+            return;
+        const DataChangedEvent* pDataChangedEvent = static_cast< const DataChangedEvent* >( rEvent.GetData() );
         if ( !pDataChangedEvent || ( pDataChangedEvent->GetType() != DataChangedEventType::SETTINGS ) )
-            return 0L;
+            return;
         if ( !( pDataChangedEvent->GetFlags() & AllSettingsFlags::STYLE ) )
-            return 0L;
+            return;
 
         EventObject aEvent( *pOwningWindow );
         aStyleChangeListeners.notifyEach( &XStyleChangeListener::styleSettingsChanged, aEvent );
-        return 1L;
+        return;
     }
 
 
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index e5addcb..61098cd 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -102,23 +102,20 @@ uno::Sequence< OUString > VCLXAccessibleComponent::getSupportedServiceNames() th
     return aNames;
 }
 
-IMPL_LINK( VCLXAccessibleComponent, WindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( VCLXAccessibleComponent, 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 ( pEvent && pEvent->ISA( VclWindowEvent ) && mxWindow.is() /* #122218# */ && (pEvent->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) )
+    if ( mxWindow.is() /* #122218# */ && (rEvent.GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) )
     {
-        DBG_ASSERT( static_cast<VclWindowEvent*>(pEvent)->GetWindow(), "Window???" );
-        if( !static_cast<VclWindowEvent*>(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<VclWindowEvent*>(pEvent) );
+            ProcessWindowEvent( rEvent );
         }
     }
-    return 0;
 }
 
 IMPL_LINK( VCLXAccessibleComponent, WindowChildEventListener, VclSimpleEvent*, pEvent )
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 2d50217..866fef2 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -403,18 +403,13 @@ void VCLXWindow::notifyWindowRemoved( vcl::Window& _rWindow )
     }
 }
 
-IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( VCLXWindow, WindowEventListener, VclWindowEvent&, rEvent, void )
 {
     if ( mpImpl->mnListenerLockLevel )
-        return 0L;
+        return;
 
-    DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
-    if ( pEvent && pEvent->ISA( VclWindowEvent ) )
-    {
-        DBG_ASSERT( static_cast<VclWindowEvent*>(pEvent)->GetWindow() && GetWindow(), "Window???" );
-        ProcessWindowEvent( *static_cast<VclWindowEvent*>(pEvent) );
-    }
-    return 0;
+    DBG_ASSERT( rEvent.GetWindow() && GetWindow(), "Window???" );
+    ProcessWindowEvent( rEvent );
 }
 
 namespace
diff --git a/vcl/inc/dndevdis.hxx b/vcl/inc/dndevdis.hxx
index 4d5df39..915f83b 100644
--- a/vcl/inc/dndevdis.hxx
+++ b/vcl/inc/dndevdis.hxx
@@ -36,7 +36,7 @@ class DNDEventDispatcher: public ::cppu::WeakImplHelper<
 
     VclPtr<vcl::Window> m_pCurrentWindow;
     void designate_currentwindow(vcl::Window *pWindow);
-    DECL_LINK(WindowEventListener, VclSimpleEvent*);
+    DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void);
 
     ::osl::Mutex m_aMutex;
     ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_aDataFlavorList;
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 4745bf6..00c1785 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -229,7 +229,7 @@ public:
     VclPtr<vcl::Window> mpNextOverlap;
     VclPtr<vcl::Window> mpLastFocusWindow;
     VclPtr<vcl::Window> mpDlgCtrlDownWindow;
-    VclEventListeners   maEventListeners;
+    std::vector<Link<VclWindowEvent&,void>> maEventListeners;
     VclEventListeners   maChildEventListeners;
 
     // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx
index 94d6ae7..33dfbc4 100644
--- a/vcl/source/window/dndevdis.cxx
+++ b/vcl/source/window/dndevdis.cxx
@@ -70,13 +70,12 @@ vcl::Window* DNDEventDispatcher::findTopLevelWindow(Point location)
     return pChildWindow;
 }
 
-IMPL_LINK(DNDEventDispatcher, WindowEventListener, VclSimpleEvent*, pEvent)
+IMPL_LINK_TYPED(DNDEventDispatcher, WindowEventListener, VclWindowEvent&, rEvent, void)
 {
-    if (pEvent && pEvent->GetId() == VCLEVENT_OBJECT_DYING)
+    if (rEvent.GetId() == VCLEVENT_OBJECT_DYING)
     {
         designate_currentwindow(NULL);
     }
-    return 0;
 }
 
 void DNDEventDispatcher::designate_currentwindow(vcl::Window *pWindow)
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index 5bef687..20ee616 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -212,7 +212,18 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
     if ( aDelData.IsDead() )
         return;
 
-    mpWindowImpl->maEventListeners.Call( &aEvent );
+    if (!mpWindowImpl->maEventListeners.empty())
+    {
+         // Copy the list, because this can be destroyed when calling a Link...
+         std::vector<Link<VclWindowEvent&,void>> aCopy( mpWindowImpl->maEventListeners );
+        for ( Link<VclWindowEvent&,void>& rLink : aCopy )
+        {
+            if (aDelData.IsDead()) break;
+            // check this hasn't been removed in some re-enterancy scenario fdo#47368
+            if( std::find(mpWindowImpl->maEventListeners.begin(), mpWindowImpl->maEventListeners.end(), rLink) != mpWindowImpl->maEventListeners.end() )
+                rLink.Call( aEvent );
+        }
+    }
 
     if ( aDelData.IsDead() )
         return;
@@ -243,15 +254,18 @@ void Window::FireVclEvent( VclSimpleEvent& rEvent )
     Application::ImplCallEventListeners(rEvent);
 }
 
-void Window::AddEventListener( const Link<>& rEventListener )
+void Window::AddEventListener( const Link<VclWindowEvent&,void>& rEventListener )
 {
-    mpWindowImpl->maEventListeners.addListener( rEventListener );
+    mpWindowImpl->maEventListeners.push_back( rEventListener );
 }
 
-void Window::RemoveEventListener( const Link<>& rEventListener )
+void Window::RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListener )
 {
     if (mpWindowImpl)
-        mpWindowImpl->maEventListeners.removeListener( rEventListener );
+    {
+        auto& rListeners = mpWindowImpl->maEventListeners;
+        rListeners.erase( std::remove(rListeners.begin(), rListeners.end(), rEventListener ), rListeners.end() );
+    }
 }
 
 void Window::AddChildEventListener( const Link<>& rEventListener )
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 08692cc..532a681 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1351,11 +1351,10 @@ void VclFrame::setAllocation(const Size &rAllocation)
         setLayoutAllocation(*pChild, aChildPos, aAllocation);
 }
 
-IMPL_LINK(VclFrame, WindowEventListener, VclSimpleEvent*, pEvent)
+IMPL_LINK_TYPED(VclFrame, WindowEventListener, VclWindowEvent&, rEvent, void)
 {
-    if (pEvent && pEvent->GetId() == VCLEVENT_OBJECT_DYING)
+    if (rEvent.GetId() == VCLEVENT_OBJECT_DYING)
         designate_label(NULL);
-    return 0;
 }
 
 void VclFrame::designate_label(vcl::Window *pWindow)
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 5380b05..ae6c6b8 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -251,20 +251,20 @@ IMPL_LINK_NOARG_TYPED(MenuBarWindow, CloseHdl, ToolBox *, void)
     }
 }
 
-IMPL_LINK( MenuBarWindow, ToolboxEventHdl, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( MenuBarWindow, ToolboxEventHdl, VclWindowEvent&, rEvent, void )
 {
     if( ! pMenu )
-        return 0;
+        return;
 
     MenuBar::MenuBarButtonCallbackArg aArg;
     aArg.nId = 0xffff;
-    aArg.bHighlight = (pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT);
+    aArg.bHighlight = (rEvent.GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT);
     aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
-    if( pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT )
+    if( rEvent.GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT )
         aArg.nId = aCloseBtn->GetHighlightItemId();
-    else if( pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHTOFF )
+    else if( rEvent.GetId() == VCLEVENT_TOOLBOX_HIGHLIGHTOFF )
     {
-        sal_uInt16 nPos = static_cast< sal_uInt16 >(reinterpret_cast<sal_IntPtr>(pEvent->GetData()));
+        sal_uInt16 nPos = static_cast< sal_uInt16 >(reinterpret_cast<sal_IntPtr>(rEvent.GetData()));
         aArg.nId = aCloseBtn->GetItemId(nPos);
     }
     std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( aArg.nId );
@@ -272,19 +272,17 @@ IMPL_LINK( MenuBarWindow, ToolboxEventHdl, VclWindowEvent*, pEvent )
     {
         it->second.m_aHighlightLink.Call( aArg );
     }
-    return 0;
 }
 
-IMPL_LINK( MenuBarWindow, ShowHideListener, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( MenuBarWindow, ShowHideListener, VclWindowEvent&, rEvent, void )
 {
     if( ! pMenu )
-        return 0;
+        return;
 
-    if( pEvent->GetId() == VCLEVENT_WINDOW_SHOW )
+    if( rEvent.GetId() == VCLEVENT_WINDOW_SHOW )
         pMenu->ImplCallEventListeners( VCLEVENT_MENU_SHOW, ITEMPOS_INVALID );
-    else if( pEvent->GetId() == VCLEVENT_WINDOW_HIDE )
+    else if( rEvent.GetId() == VCLEVENT_WINDOW_HIDE )
         pMenu->ImplCallEventListeners( VCLEVENT_MENU_HIDE, ITEMPOS_INVALID );
-    return 0;
 }
 
 void MenuBarWindow::ImplCreatePopup( bool bPreSelectFirst )
diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx
index f460a77..7621faf 100644
--- a/vcl/source/window/menubarwindow.hxx
+++ b/vcl/source/window/menubarwindow.hxx
@@ -103,9 +103,9 @@ private:
 
     virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
 
-    DECL_LINK_TYPED(CloseHdl, ToolBox*, void);
-    DECL_LINK( ToolboxEventHdl, VclWindowEvent* );
-    DECL_LINK( ShowHideListener, VclWindowEvent* );
+    DECL_LINK_TYPED( CloseHdl, ToolBox*, void );
+    DECL_LINK_TYPED( ToolboxEventHdl, VclWindowEvent&, void );
+    DECL_LINK_TYPED( ShowHideListener, VclWindowEvent&, void );
 
     void            StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     void            DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 33d33e0..1a2fb4c 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -363,16 +363,15 @@ IMPL_LINK_NOARG_TYPED(MenuFloatingWindow, SubmenuClose, Timer *, void)
     }
 }
 
-IMPL_LINK( MenuFloatingWindow, ShowHideListener, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( MenuFloatingWindow, ShowHideListener, VclWindowEvent&, rEvent, void )
 {
     if( ! pMenu )

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list