[Libreoffice-commits] core.git: dbaccess/source desktop/source extensions/source framework/inc framework/source include/dbaccess include/sfx2 include/toolkit include/vcl reportdesign/source sc/source sd/inc sd/source sfx2/source svtools/source svx/source sw/inc sw/source toolkit/source vcl/inc vcl/osx vcl/source vcl/unx

Noel Grandin noel at peralex.com
Sun Sep 20 23:04:53 PDT 2015


 dbaccess/source/ui/misc/ToolBoxHelper.cxx                         |    8 -
 desktop/source/splash/splash.cxx                                  |    9 -
 extensions/source/bibliography/toolbar.cxx                        |    4 
 extensions/source/bibliography/toolbar.hxx                        |    2 
 extensions/source/update/ui/updatecheckui.cxx                     |   11 +-
 framework/inc/services/layoutmanager.hxx                          |    2 
 framework/source/layoutmanager/layoutmanager.cxx                  |   23 +---
 include/dbaccess/ToolBoxHelper.hxx                                |    4 
 include/sfx2/sidebar/FocusManager.hxx                             |    2 
 include/toolkit/awt/vclxaccessiblecomponent.hxx                   |    2 
 include/vcl/svapp.hxx                                             |    4 
 include/vcl/tabctrl.hxx                                           |    2 
 include/vcl/window.hxx                                            |    4 
 reportdesign/source/ui/inc/ReportControllerObserver.hxx           |    2 
 reportdesign/source/ui/report/ReportControllerObserver.cxx        |   11 --
 sc/source/ui/Accessibility/AccessibleDocument.cxx                 |   36 +++----
 sc/source/ui/inc/AccessibleDocument.hxx                           |    2 
 sd/inc/sdmod.hxx                                                  |    2 
 sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx         |   23 +---
 sd/source/ui/app/sdmod1.cxx                                       |    7 -
 sd/source/ui/inc/AccessibleDocumentViewBase.hxx                   |    4 
 sd/source/ui/inc/OutlineView.hxx                                  |    2 
 sd/source/ui/slideshow/slideshowimpl.cxx                          |   10 --
 sd/source/ui/slideshow/slideshowimpl.hxx                          |    2 
 sd/source/ui/slidesorter/controller/SlideSorterController.cxx     |    6 -
 sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx |    2 
 sd/source/ui/view/outlview.cxx                                    |    3 
 sfx2/source/sidebar/FocusManager.cxx                              |   21 +---
 sfx2/source/toolbox/imgmgr.cxx                                    |   40 +++-----
 svtools/source/config/colorcfg.cxx                                |   15 +--
 svtools/source/config/extcolorcfg.cxx                             |   15 +--
 svx/source/sidebar/insert/InsertPropertyPanel.cxx                 |   33 ++----
 svx/source/sidebar/insert/InsertPropertyPanel.hxx                 |    2 
 sw/inc/view.hxx                                                   |    2 
 sw/source/core/access/accdoc.cxx                                  |   50 ++++------
 sw/source/core/access/accdoc.hxx                                  |    2 
 sw/source/uibase/uiview/viewmdi.cxx                               |   41 +++-----
 toolkit/source/awt/vclxaccessiblecomponent.cxx                    |   12 +-
 toolkit/source/awt/vclxtoolkit.cxx                                |   27 ++---
 vcl/inc/osx/a11yfocustracker.hxx                                  |    2 
 vcl/inc/vcleventlisteners.hxx                                     |    8 -
 vcl/inc/window.h                                                  |    2 
 vcl/osx/a11yfocustracker.cxx                                      |   24 ++--
 vcl/source/app/svapp.cxx                                          |    8 -
 vcl/source/app/vclevent.cxx                                       |   24 ++--
 vcl/source/control/tabctrl.cxx                                    |   10 --
 vcl/source/window/event.cxx                                       |   29 ++++-
 vcl/unx/gtk/a11y/atkutil.cxx                                      |   24 ++--
 48 files changed, 254 insertions(+), 326 deletions(-)

New commits:
commit 1e67e94f1a308ca60d4934e9fe9d5c048225ebe8
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Sep 21 08:03:25 2015 +0200

    convert Link<> to typed
    
    Change-Id: If3e2b00092440ebd42ae5b73ae2b0e44c3702683

diff --git a/dbaccess/source/ui/misc/ToolBoxHelper.cxx b/dbaccess/source/ui/misc/ToolBoxHelper.cxx
index facfa72..a7baf7c 100644
--- a/dbaccess/source/ui/misc/ToolBoxHelper.cxx
+++ b/dbaccess/source/ui/misc/ToolBoxHelper.cxx
@@ -74,19 +74,17 @@ namespace dbaui
                 m_pToolBox->SetOutStyle(aOptions.GetToolboxStyle());
         }
     }
-    IMPL_LINK(OToolBoxHelper, SettingsChanged, VclWindowEvent*, _pEvt)
+    IMPL_LINK_TYPED(OToolBoxHelper, SettingsChanged, VclSimpleEvent&, _rEvt, void)
     {
-        if ( m_pToolBox && _pEvt && _pEvt->GetId() == VCLEVENT_APPLICATION_DATACHANGED )
+        if ( m_pToolBox && _rEvt.GetId() == VCLEVENT_APPLICATION_DATACHANGED )
         {
-            DataChangedEvent* pData = static_cast<DataChangedEvent*>(_pEvt->GetData());
+            DataChangedEvent* pData = static_cast<DataChangedEvent*>(static_cast<VclWindowEvent&>(_rEvt).GetData());
             if ( pData && ((( pData->GetType() == DataChangedEventType::SETTINGS  )   ||
             ( pData->GetType() == DataChangedEventType::DISPLAY   ))  &&
             ( pData->GetFlags() & AllSettingsFlags::STYLE        )))
                 // check if imagelist changed
                 checkImageList();
         }
-
-        return 0L;
     }
     void OToolBoxHelper::setToolBox(ToolBox* _pTB)
     {
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 17f07dd..7d57c0e 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -72,7 +72,7 @@ private:
 
     VclPtr<SplashScreenWindow> pWindow;
 
-    DECL_LINK( AppEventListenerHdl, VclWindowEvent * );
+    DECL_LINK_TYPED( AppEventListenerHdl, VclSimpleEvent&, void );
     virtual ~SplashScreen();
     void loadConfig();
     void updateStatus();
@@ -366,11 +366,11 @@ void SplashScreen::updateStatus()
 }
 
 // internal private methods
-IMPL_LINK( SplashScreen, AppEventListenerHdl, VclWindowEvent *, inEvent )
+IMPL_LINK_TYPED( SplashScreen, AppEventListenerHdl, VclSimpleEvent&, inEvent, void )
 {
-    if (inEvent != 0 && inEvent->GetWindow() == pWindow)
+    if (static_cast<VclWindowEvent&>(inEvent).GetWindow() == pWindow)
     {
-        switch ( inEvent->GetId() )
+        switch ( inEvent.GetId() )
         {
             case VCLEVENT_WINDOW_SHOW:
                 pWindow->Redraw();
@@ -379,7 +379,6 @@ IMPL_LINK( SplashScreen, AppEventListenerHdl, VclWindowEvent *, inEvent )
                 break;
         }
     }
-    return 0;
 }
 
 // Read keys from soffice{.ini|rc}:
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index e60e3f7..a6f7316 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -555,7 +555,7 @@ IMPL_LINK_NOARG_TYPED( BibToolBar, OptionsChanged_Impl, LinkParamNone*, void )
 
 
 
-IMPL_LINK_NOARG( BibToolBar, SettingsChanged_Impl )
+IMPL_LINK_NOARG_TYPED( BibToolBar, SettingsChanged_Impl, VclSimpleEvent&, void )
 {
     // Check if toolbar button size have changed and we have to use system settings
     sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize();
@@ -564,8 +564,6 @@ IMPL_LINK_NOARG( BibToolBar, SettingsChanged_Impl )
         nSymbolsSize = eSymbolsSize;
         RebuildToolbar();
     }
-
-    return 0L;
 }
 
 
diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx
index 341344e..5d8b514 100644
--- a/extensions/source/bibliography/toolbar.hxx
+++ b/extensions/source/bibliography/toolbar.hxx
@@ -132,7 +132,7 @@ class BibToolBar:   public ToolBox
         DECL_LINK_TYPED( SendSelHdl, Idle*, void );
         DECL_LINK_TYPED( MenuHdl, ToolBox*, void );
         DECL_LINK_TYPED( OptionsChanged_Impl, LinkParamNone*, void );
-        DECL_LINK( SettingsChanged_Impl, void* );
+        DECL_LINK_TYPED( SettingsChanged_Impl, VclSimpleEvent&, void );
 
         void                    ApplyImageList();
         void                    RebuildToolbar();
diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx
index 9416e74..f9167e1 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -136,7 +136,7 @@ class UpdateCheckUI : public ::cppu::WeakImplHelper
     Idle                maWaitIdle;
     Timer               maTimeoutTimer;
     Link<VclWindowEvent&,void> maWindowEventHdl;
-    Link<>              maApplicationEventHdl;
+    Link<VclSimpleEvent&,void> maApplicationEventHdl;
     bool                mbShowBubble;
     bool                mbShowMenuIcon;
     bool                mbBubbleChanged;
@@ -149,7 +149,7 @@ private:
                     DECL_LINK_TYPED(TimeOutHdl, Timer *, void);
                     DECL_LINK_TYPED(UserEventHdl, void *, void);
                     DECL_LINK_TYPED(WindowEventHdl, VclWindowEvent&, void);
-                    DECL_LINK( ApplicationEventHdl, VclSimpleEvent* );
+                    DECL_LINK_TYPED(ApplicationEventHdl, VclSimpleEvent&, void);
 
     BubbleWindow*   GetBubbleWindow();
     void            RemoveBubbleWindow( bool bRemoveIcon );
@@ -712,16 +712,16 @@ IMPL_LINK_TYPED( UpdateCheckUI, WindowEventHdl, VclWindowEvent&, rEvent, void )
 }
 
 
-IMPL_LINK( UpdateCheckUI, ApplicationEventHdl, VclSimpleEvent *, pEvent)
+IMPL_LINK_TYPED( UpdateCheckUI, ApplicationEventHdl, VclSimpleEvent&, rEvent, void)
 {
-    switch (pEvent->GetId())
+    switch (rEvent.GetId())
     {
         case VCLEVENT_WINDOW_SHOW:
         case VCLEVENT_WINDOW_ACTIVATE:
         case VCLEVENT_WINDOW_GETFOCUS: {
             SolarMutexGuard aGuard;
 
-            vcl::Window *pWindow = static_cast< VclWindowEvent * >(pEvent)->GetWindow();
+            vcl::Window *pWindow = static_cast< VclWindowEvent * >(&rEvent)->GetWindow();
             if ( pWindow && pWindow->IsTopWindow() )
             {
                 SystemWindow *pSysWin = pWindow->GetSystemWindow();
@@ -734,7 +734,6 @@ IMPL_LINK( UpdateCheckUI, ApplicationEventHdl, VclSimpleEvent *, pEvent)
             break;
         }
     }
-    return 0;
 }
 
 
diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx
index c8b4e7c..76d958e 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -169,7 +169,7 @@ namespace framework
             virtual void SAL_CALL removeLayoutManagerEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManagerListener >& aLayoutManagerListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
             DECL_LINK_TYPED( MenuBarClose, void *, void);
-            DECL_LINK( WindowEventListener, VclSimpleEvent* );
+            DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
 
             //  ILayoutNotifications
 
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index f27f528..4b4b645 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -1398,25 +1398,18 @@ uno::Reference< ui::XUIElement > LayoutManager::implts_createDockingWindow( cons
     return xUIElement;
 }
 
-IMPL_LINK( LayoutManager, WindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( LayoutManager, WindowEventListener, VclWindowEvent&, rEvent, void )
 {
-    long nResult( 1 );
-
-    if ( pEvent && pEvent->ISA( VclWindowEvent ))
+    vcl::Window* pWindow = rEvent.GetWindow();
+    if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
     {
-        vcl::Window* pWindow = static_cast< VclWindowEvent* >(pEvent)->GetWindow();
-        if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
-        {
-            SolarMutexClearableGuard aReadLock;
-            ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
-            aReadLock.clear();
+        SolarMutexClearableGuard aReadLock;
+        ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
+        aReadLock.clear();
 
-            if ( pToolbarManager )
-                nResult = pToolbarManager->childWindowEvent( pEvent );
-        }
+        if ( pToolbarManager )
+            pToolbarManager->childWindowEvent( &rEvent );
     }
-
-    return nResult;
 }
 
 void SAL_CALL LayoutManager::createElement( const OUString& aName )
diff --git a/include/dbaccess/ToolBoxHelper.hxx b/include/dbaccess/ToolBoxHelper.hxx
index b64bf85..3c6ed20 100644
--- a/include/dbaccess/ToolBoxHelper.hxx
+++ b/include/dbaccess/ToolBoxHelper.hxx
@@ -28,7 +28,7 @@
 
 class SvtMiscOptions;
 class ToolBox;
-class VclWindowEvent;
+class VclSimpleEvent;
 
 namespace dbaui
 {
@@ -72,7 +72,7 @@ namespace dbaui
 
     protected:
         DECL_LINK_TYPED(ConfigOptionsChanged, LinkParamNone*, void);
-        DECL_LINK(SettingsChanged, VclWindowEvent* );
+        DECL_LINK_TYPED(SettingsChanged, VclSimpleEvent&, void );
     };
 }
 #endif // INCLUDED_DBACCESS_TOOLBOXHELPER_HXX
diff --git a/include/sfx2/sidebar/FocusManager.hxx b/include/sfx2/sidebar/FocusManager.hxx
index 93b78b8..a7ffd5e 100644
--- a/include/sfx2/sidebar/FocusManager.hxx
+++ b/include/sfx2/sidebar/FocusManager.hxx
@@ -97,7 +97,7 @@ private:
     /** Listen for key events for panels and buttons.
     */
     DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void);
-    DECL_LINK(ChildEventListener, VclSimpleEvent*);
+    DECL_LINK_TYPED(ChildEventListener, VclWindowEvent&, void);
 
     void ClearPanels();
     void ClearButtons();
diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx
index bd0c739..13233a4 100644
--- a/include/toolkit/awt/vclxaccessiblecomponent.hxx
+++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx
@@ -70,7 +70,7 @@ private:
 
 protected:
      DECL_LINK_TYPED( WindowEventListener, VclWindowEvent&, void );
-     DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
+     DECL_LINK_TYPED( WindowChildEventListener, VclWindowEvent&, void );
 
     virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
     virtual void    ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 1365215..c2b6d04 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -760,7 +760,7 @@ public:
 
      @see RemoveEventListener, AddKeyListener, RemoveKeyListener
     */
-    static void                 AddEventListener( const Link<>& rEventListener );
+    static void                 AddEventListener( const Link<VclSimpleEvent&,void>& rEventListener );
 
     /** Remove a VCL event listener from the application.
 
@@ -768,7 +768,7 @@ public:
 
      @see AddEventListener, AddKeyListener, RemoveKeyListener
     */
-    static void                 RemoveEventListener( const Link<>& rEventListener );
+    static void                 RemoveEventListener( const Link<VclSimpleEvent&,void>& rEventListener );
 
     /** Add a keypress listener to the application. If keypress listener exists,
      then initialize the application's keypress event listener with a new one, then
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 69e4886..fa5b947 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -78,7 +78,7 @@ private:
     SAL_DLLPRIVATE bool         ImplHandleKeyEvent( const KeyEvent& rKeyEvent );
 
     DECL_DLLPRIVATE_LINK(       ImplListBoxSelectHdl, void* );
-    DECL_DLLPRIVATE_LINK(       ImplWindowEventListener, VclSimpleEvent* );
+    DECL_DLLPRIVATE_LINK_TYPED( ImplWindowEventListener, VclWindowEvent&, void );
 
 
 protected:
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 0ea1042..9c968f5 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -882,8 +882,8 @@ public:
 
     void                                AddEventListener( const Link<VclWindowEvent&,void>& rEventListener );
     void                                RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListener );
-    void                                AddChildEventListener( const Link<>& rEventListener );
-    void                                RemoveChildEventListener( const Link<>& rEventListener );
+    void                                AddChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
+    void                                RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventListener );
 
     ImplSVEvent *                       PostUserEvent( const Link<void*,void>& rLink, void* pCaller = NULL, bool bReferenceLink = false );
     void                                RemoveUserEvent( ImplSVEvent * nUserEvent );
diff --git a/reportdesign/source/ui/inc/ReportControllerObserver.hxx b/reportdesign/source/ui/inc/ReportControllerObserver.hxx
index ea440d3..735a149 100644
--- a/reportdesign/source/ui/inc/ReportControllerObserver.hxx
+++ b/reportdesign/source/ui/inc/ReportControllerObserver.hxx
@@ -103,7 +103,7 @@ namespace rptui
         void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer, bool _bStartListening );
         void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening );
 
-        DECL_LINK(SettingsChanged, VclWindowEvent* );
+        DECL_LINK_TYPED(SettingsChanged, VclSimpleEvent&, void );
     private:
 
         ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild> >::const_iterator getSection(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild>& _xContainer) const;
diff --git a/reportdesign/source/ui/report/ReportControllerObserver.cxx b/reportdesign/source/ui/report/ReportControllerObserver.cxx
index b93f49f..52c67e3 100644
--- a/reportdesign/source/ui/report/ReportControllerObserver.cxx
+++ b/reportdesign/source/ui/report/ReportControllerObserver.cxx
@@ -94,15 +94,13 @@ public:
     }
 
 
-    IMPL_LINK(OXReportControllerObserver, SettingsChanged, VclWindowEvent*, _pEvt)
+    IMPL_LINK_TYPED(OXReportControllerObserver, SettingsChanged, VclSimpleEvent&, _rEvt, void)
     {
-        if ( _pEvt )
-        {
-            sal_Int32 nEvent = _pEvt->GetId();
+            sal_Int32 nEvent = _rEvt.GetId();
 
             if (nEvent == VCLEVENT_APPLICATION_DATACHANGED )
             {
-                DataChangedEvent* pData = static_cast<DataChangedEvent*>(_pEvt->GetData());
+                DataChangedEvent* pData = static_cast<DataChangedEvent*>(static_cast<VclWindowEvent&>(_rEvt).GetData());
                 if ( pData && ((( pData->GetType() == DataChangedEventType::SETTINGS  )   ||
                                 ( pData->GetType() == DataChangedEventType::DISPLAY   ))  &&
                                ( pData->GetFlags() & AllSettingsFlags::STYLE     )))
@@ -137,9 +135,6 @@ public:
                     }
                 }
             }
-        }
-
-        return 0L;
     }
 
     // XEventListener
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index f94d6b2..9fe0208 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1483,36 +1483,30 @@ void SAL_CALL ScAccessibleDocument::disposing( const lang::EventObject& /* Sourc
 
     //=====  SfxListener  =====================================================
 
-IMPL_LINK( ScAccessibleDocument, WindowChildEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( ScAccessibleDocument, WindowChildEventListener, VclWindowEvent&, rEvent, void )
 {
-    OSL_ENSURE( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
-    if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+    OSL_ENSURE( rEvent.GetWindow(), "Window???" );
+    switch ( rEvent.GetId() )
     {
-        VclWindowEvent *pVclEvent = static_cast< VclWindowEvent * >( pEvent );
-        OSL_ENSURE( pVclEvent->GetWindow(), "Window???" );
-        switch ( pVclEvent->GetId() )
+    case VCLEVENT_WINDOW_SHOW:  // send create on show for direct accessible children
         {
-        case VCLEVENT_WINDOW_SHOW:  // send create on show for direct accessible children
+            vcl::Window* pChildWin = static_cast < vcl::Window * >( rEvent.GetData() );
+            if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
             {
-                vcl::Window* pChildWin = static_cast < vcl::Window * >( pVclEvent->GetData() );
-                if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
-                {
-                    AddChild( pChildWin->GetAccessible(), true );
-                }
+                AddChild( pChildWin->GetAccessible(), true );
             }
-            break;
-        case VCLEVENT_WINDOW_HIDE:  // send destroy on hide for direct accessible children
+        }
+        break;
+    case VCLEVENT_WINDOW_HIDE:  // send destroy on hide for direct accessible children
+        {
+            vcl::Window* pChildWin = static_cast < vcl::Window * >( rEvent.GetData() );
+            if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
             {
-                vcl::Window* pChildWin = static_cast < vcl::Window * >( pVclEvent->GetData() );
-                if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
-                {
-                    RemoveChild( pChildWin->GetAccessible(), true );
-                }
+                RemoveChild( pChildWin->GetAccessible(), true );
             }
-            break;
         }
+        break;
     }
-    return 0;
 }
 
 void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
diff --git a/sc/source/ui/inc/AccessibleDocument.hxx b/sc/source/ui/inc/AccessibleDocument.hxx
index 3e1d94f..ff153b0 100644
--- a/sc/source/ui/inc/AccessibleDocument.hxx
+++ b/sc/source/ui/inc/AccessibleDocument.hxx
@@ -65,7 +65,7 @@ public:
 
     virtual void Init() SAL_OVERRIDE;
 
-    DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
+    DECL_LINK_TYPED( WindowChildEventListener, VclWindowEvent&, void );
 protected:
     virtual ~ScAccessibleDocument();
 
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index a113a00..0ca3765 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -189,7 +189,7 @@ private:
         @VclSimpleEvent *
             a pointer to a VCLSimpleEvent (see vcl/vclevent.hxx )
     */
-    DECL_STATIC_LINK( SdModule, EventListenerHdl, VclSimpleEvent* );
+    DECL_STATIC_LINK_TYPED( SdModule, EventListenerHdl, VclSimpleEvent&, void );
 
 };
 
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
index bc21e83..afd2626 100644
--- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
+++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -160,15 +160,11 @@ void AccessibleDocumentViewBase::Init()
         SetState(AccessibleStateType::EDITABLE);
 }
 
-IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener,
-    VclSimpleEvent*, pEvent)
+IMPL_LINK_TYPED(AccessibleDocumentViewBase, WindowChildEventListener,
+    VclWindowEvent&, rEvent, void)
 {
-    OSL_ASSERT(pEvent!=NULL && pEvent->ISA(VclWindowEvent));
-    if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
-    {
-        VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
         //      DBG_ASSERT( pVclEvent->GetWindow(), "Window???" );
-        switch (pWindowEvent->GetId())
+        switch (rEvent.GetId())
         {
             case VCLEVENT_OBJECT_DYING:
             {
@@ -176,11 +172,11 @@ IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener,
                 // This is also attempted in the disposing() method.
                 vcl::Window* pWindow = maShapeTreeInfo.GetWindow();
                 vcl::Window* pDyingWindow = static_cast<vcl::Window*>(
-                    pWindowEvent->GetWindow());
+                    rEvent.GetWindow());
                 if (pWindow==pDyingWindow && pWindow!=NULL && maWindowLink.IsSet())
                 {
                     pWindow->RemoveChildEventListener (maWindowLink);
-                    maWindowLink = Link<>();
+                    maWindowLink = Link<VclWindowEvent&,void>();
                 }
             }
             break;
@@ -189,7 +185,7 @@ IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener,
             {
                 // A new window has been created.  Is it an OLE object?
                 vcl::Window* pChildWindow = static_cast<vcl::Window*>(
-                    pWindowEvent->GetData());
+                    rEvent.GetData());
                 if (pChildWindow!=NULL
                     && (pChildWindow->GetAccessibleRole()
                         == AccessibleRole::EMBEDDED_OBJECT))
@@ -204,7 +200,7 @@ IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener,
                 // A window has been destroyed.  Has that been an OLE
                 // object?
                 vcl::Window* pChildWindow = static_cast<vcl::Window*>(
-                    pWindowEvent->GetData());
+                    rEvent.GetData());
                 if (pChildWindow!=NULL
                     && (pChildWindow->GetAccessibleRole()
                         == AccessibleRole::EMBEDDED_OBJECT))
@@ -214,9 +210,6 @@ IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener,
             }
             break;
         }
-    }
-
-    return 0;
 }
 
 //=====  IAccessibleViewForwarderListener  ====================================
@@ -487,7 +480,7 @@ void AccessibleDocumentViewBase::impl_dispose()
     {
         if (pWindow)
             pWindow->RemoveChildEventListener (maWindowLink);
-        maWindowLink = Link<>();
+        maWindowLink = Link<VclWindowEvent&,void>();
     }
     else
     {
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 9613ea6..83e5f40 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -416,11 +416,11 @@ void SdModule::GetState(SfxItemSet& rItemSet)
     }
 }
 
-IMPL_STATIC_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent )
+IMPL_STATIC_LINK_TYPED( SdModule, EventListenerHdl, VclSimpleEvent&, rSimpleEvent, void )
 {
-    if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() )
+    if( (rSimpleEvent.GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData() )
     {
-        const CommandEvent& rEvent = *static_cast<const CommandEvent*>(static_cast<VclWindowEvent*>(pEvent)->GetData());
+        const CommandEvent& rEvent = *static_cast<const CommandEvent*>(static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData());
 
         if( rEvent.GetCommand() == CommandEventId::Media )
         {
@@ -447,7 +447,6 @@ IMPL_STATIC_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent )
             }
         }
     }
-    return 0;
 }
 
 void SdModule::AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument)
diff --git a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
index 6c44a3a..ceb9a50 100644
--- a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
+++ b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
@@ -127,7 +127,7 @@ public:
     /** Define callback for listening to window child events of VCL.
         Listen for creation or destruction of OLE objects.
     */
-    DECL_LINK (WindowChildEventListener, VclSimpleEvent*);
+    DECL_LINK_TYPED( WindowChildEventListener, VclWindowEvent&, void );
 
     //=====  IAccessibleViewForwarderListener  ================================
 
@@ -305,7 +305,7 @@ protected:
         ::com::sun::star::accessibility::XAccessible>
         mxAccessibleOLEObject;
 
-    Link<> maWindowLink;
+    Link<VclWindowEvent&,void> maWindowLink;
 
     // This method is called from the component helper base class while
     // disposing.
diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx
index 60b54ac..e888837 100644
--- a/sd/source/ui/inc/OutlineView.hxx
+++ b/sd/source/ui/inc/OutlineView.hxx
@@ -200,7 +200,7 @@ private:
     /** this link is called from the vcl application when the stylesettings
         change. Its only purpose is to call onUpdateStyleSettings() then.
     */
-    DECL_LINK( AppEventListenerHdl, void * );
+    DECL_LINK_TYPED( AppEventListenerHdl, VclSimpleEvent&, void );
 
     DECL_LINK_TYPED(EventMultiplexerListener, sd::tools::EventMultiplexerEvent&, void);
 
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 25a0a1f..0b3f79d 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -2003,14 +2003,14 @@ bool SlideshowImpl::keyInput(const KeyEvent& rKEvt)
     return bRet;
 }
 
-IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( SlideshowImpl, EventListenerHdl, VclSimpleEvent&, rSimpleEvent, void )
 {
     if( !mxShow.is() || mbInputFreeze )
-        return 0;
+        return;
 
-    if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() )
+    if( (rSimpleEvent.GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData() )
     {
-        const CommandEvent& rEvent = *static_cast<const CommandEvent*>(static_cast<VclWindowEvent*>(pEvent)->GetData());
+        const CommandEvent& rEvent = *static_cast<const CommandEvent*>(static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData());
 
         if( rEvent.GetCommand() == CommandEventId::Media )
         {
@@ -2078,8 +2078,6 @@ IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent*, pEvent )
             }
         }
     }
-
-    return 0;
 }
 
 void SlideshowImpl::mouseButtonUp(const MouseEvent& rMEvt)
diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx
index 06ac09e..9d0b342 100644
--- a/sd/source/ui/slideshow/slideshowimpl.hxx
+++ b/sd/source/ui/slideshow/slideshowimpl.hxx
@@ -281,7 +281,7 @@ private:
     DECL_LINK_TYPED( ContextMenuSelectHdl, Menu *, bool );
     DECL_LINK_TYPED( ContextMenuHdl, void*, void );
     DECL_LINK_TYPED( deactivateHdl, Timer *, void );
-    DECL_LINK( EventListenerHdl, VclSimpleEvent* );
+    DECL_LINK_TYPED( EventListenerHdl, VclSimpleEvent&, void );
 
     // helper
     void receiveRequest(SfxRequest& rReq);
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 3b34246..845f4b8 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -540,11 +540,9 @@ void SlideSorterController::HandleModelChange()
     }
 }
 
-IMPL_LINK(SlideSorterController, ApplicationEventHandler, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED(SlideSorterController, ApplicationEventHandler, VclSimpleEvent&, rEvent, void)
 {
-    if (pEvent)
-        WindowEventHandler(*pEvent);
-    return 1;
+    WindowEventHandler(static_cast<VclWindowEvent&>(rEvent));
 }
 IMPL_LINK_TYPED(SlideSorterController, WindowEventHandler, VclWindowEvent&, rEvent, void)
 {
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index e47ed18..2127793 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -161,7 +161,7 @@ public:
     void HandleModelChange();
 
     DECL_LINK_TYPED(WindowEventHandler, VclWindowEvent&, void);
-    DECL_LINK(ApplicationEventHandler, VclWindowEvent*);
+    DECL_LINK_TYPED(ApplicationEventHandler, VclSimpleEvent&, void);
 
     /** Update the display of all pages.  This involves a redraw and
         releasing previews and caches.
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index d1117bd..12deaea 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -1425,10 +1425,9 @@ void OutlineView::onUpdateStyleSettings( bool bForceUpdate /* = false */ )
     }
 }
 
-IMPL_LINK_NOARG(OutlineView, AppEventListenerHdl)
+IMPL_LINK_NOARG_TYPED(OutlineView, AppEventListenerHdl, VclSimpleEvent&, void)
 {
     onUpdateStyleSettings();
-    return 0;
 }
 
 IMPL_LINK_TYPED(OutlineView, EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent&, rEvent, void)
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index d36b7ac..d44f0b1 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -537,24 +537,17 @@ IMPL_LINK_TYPED(FocusManager, WindowEventListener, VclWindowEvent&, rWindowEvent
     }
 }
 
-IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent)
+IMPL_LINK_TYPED(FocusManager, ChildEventListener, VclWindowEvent&, rEvent, 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 = rEvent.GetWindow();
     if (pSource == NULL)
-        return 0;
+        return;
 
-    switch (pWindowEvent->GetId())
+    switch (rEvent.GetId())
     {
         case VCLEVENT_WINDOW_KEYINPUT:
         {
-            KeyEvent* pKeyEvent = static_cast<KeyEvent*>(pWindowEvent->GetData());
+            KeyEvent* pKeyEvent = static_cast<KeyEvent*>(rEvent.GetData());
 
             // Go up the window hierarchy to find out whether the
             // parent of the event source is known to us.
@@ -593,7 +586,7 @@ IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent)
                         break;
                 }
             }
-            return 1;
+            return;
         }
 
         case VCLEVENT_WINDOW_GETFOCUS:
@@ -609,8 +602,6 @@ IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent)
         default:
             break;
     }
-
-    return 0;
 }
 
 } } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/toolbox/imgmgr.cxx b/sfx2/source/toolbox/imgmgr.cxx
index f6bc338..a873ea9 100644
--- a/sfx2/source/toolbox/imgmgr.cxx
+++ b/sfx2/source/toolbox/imgmgr.cxx
@@ -63,7 +63,7 @@ public:
     void                    SetSymbolsSize_Impl( sal_Int16 );
 
     DECL_LINK_TYPED( OptionsChanged_Impl, LinkParamNone*, void );
-    DECL_LINK( SettingsChanged_Impl, VclWindowEvent* );
+    DECL_LINK_TYPED( SettingsChanged_Impl, VclSimpleEvent&, void );
 
     explicit SfxImageManager_Impl(SfxModule& rModule);
     ~SfxImageManager_Impl();
@@ -207,32 +207,28 @@ IMPL_LINK_NOARG_TYPED(SfxImageManager_Impl, OptionsChanged_Impl, LinkParamNone*,
 
 
 
-IMPL_LINK( SfxImageManager_Impl, SettingsChanged_Impl, VclWindowEvent*, pEvent)
+IMPL_LINK_TYPED( SfxImageManager_Impl, SettingsChanged_Impl, VclSimpleEvent&, rEvent, void)
 {
-    if (pEvent)
+    switch (rEvent.GetId())
     {
-        switch (pEvent->GetId())
+    case VCLEVENT_OBJECT_DYING:
+        if (m_bAppEventListener)
         {
-            case VCLEVENT_OBJECT_DYING:
-                if (m_bAppEventListener)
-                {
-                    Application::RemoveEventListener( LINK( this, SfxImageManager_Impl, SettingsChanged_Impl ) );
-                    m_bAppEventListener = false;
-                }
-                break;
-            case VCLEVENT_APPLICATION_DATACHANGED:
-                // Check if toolbar button size have changed and we have to use system settings
-                {
-                    sal_Int16 nSymbolsSize = m_aOpt.GetCurrentSymbolsSize();
-                    if (m_nSymbolsSize != nSymbolsSize)
-                        SetSymbolsSize_Impl(nSymbolsSize);
-                }
-                break;
-            default:
-                break;
+            Application::RemoveEventListener( LINK( this, SfxImageManager_Impl, SettingsChanged_Impl ) );
+            m_bAppEventListener = false;
+        }
+        break;
+    case VCLEVENT_APPLICATION_DATACHANGED:
+        // Check if toolbar button size have changed and we have to use system settings
+        {
+            sal_Int16 nSymbolsSize = m_aOpt.GetCurrentSymbolsSize();
+            if (m_nSymbolsSize != nSymbolsSize)
+                SetSymbolsSize_Impl(nSymbolsSize);
         }
+        break;
+    default:
+        break;
     }
-    return 0L;
 }
 
 SfxImageManager::SfxImageManager(SfxModule& rModule)
diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx
index 5408aa1..e54f896 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -101,7 +101,7 @@ public:
     bool GetAutoDetectSystemHC() {return m_bAutoDetectSystemHC;}
 
     // #100822#
-    DECL_LINK( DataChangedEventListener, VclWindowEvent* );
+    DECL_LINK_TYPED( DataChangedEventListener, VclSimpleEvent&, void );
 
     void ImplUpdateApplicationSettings();
 };
@@ -349,20 +349,17 @@ void ColorConfig_Impl::SettingsChanged()
     NotifyListeners(0);
 }
 
-IMPL_LINK( ColorConfig_Impl, DataChangedEventListener, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( ColorConfig_Impl, DataChangedEventListener, VclSimpleEvent&, rEvent, void )
 {
-    if ( pEvent->GetId() == VCLEVENT_APPLICATION_DATACHANGED )
+    if ( rEvent.GetId() == VCLEVENT_APPLICATION_DATACHANGED )
     {
-        DataChangedEvent* pData = static_cast<DataChangedEvent*>(pEvent->GetData());
+        DataChangedEvent* pData = static_cast<DataChangedEvent*>(static_cast<VclWindowEvent&>(rEvent).GetData());
         if ( (pData->GetType() == DataChangedEventType::SETTINGS) &&
              (pData->GetFlags() & AllSettingsFlags::STYLE) )
         {
             SettingsChanged();
-            return 1L;
-        } else
-            return 0L;
-    } else
-        return 0L;
+        }
+    }
 }
 
 
diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx
index 812dcd7..62eba20 100644
--- a/svtools/source/config/extcolorcfg.cxx
+++ b/svtools/source/config/extcolorcfg.cxx
@@ -132,7 +132,7 @@ public:
     static void                     UnlockBroadcast();
 
     // #100822#
-    DECL_LINK( DataChangedEventListener, VclWindowEvent* );
+    DECL_LINK_TYPED( DataChangedEventListener, VclSimpleEvent&, void );
 };
 
 uno::Sequence< OUString> ExtendedColorConfig_Impl::GetPropertyNames(const OUString& rScheme)
@@ -542,20 +542,17 @@ void ExtendedColorConfig_Impl::UnlockBroadcast()
     m_bLockBroadcast = false;
 }
 
-IMPL_LINK( ExtendedColorConfig_Impl, DataChangedEventListener, VclWindowEvent*, pEvent )
+IMPL_LINK_TYPED( ExtendedColorConfig_Impl, DataChangedEventListener, VclSimpleEvent&, rEvent, void )
 {
-    if ( pEvent->GetId() == VCLEVENT_APPLICATION_DATACHANGED )
+    if ( rEvent.GetId() == VCLEVENT_APPLICATION_DATACHANGED )
     {
-        DataChangedEvent* pData = static_cast<DataChangedEvent*>(pEvent->GetData());
+        DataChangedEvent* pData = static_cast<DataChangedEvent*>(static_cast<VclWindowEvent&>(rEvent).GetData());
         if ( (pData->GetType() == DataChangedEventType::SETTINGS) &&
              (pData->GetFlags() & AllSettingsFlags::STYLE) )
         {
             SettingsChanged();
-            return 1L;
-        } else
-            return 0L;
-    } else
-        return 0L;
+        }
+    }
 }
 
 
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.cxx b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
index df89146..ff120dc 100644
--- a/svx/source/sidebar/insert/InsertPropertyPanel.cxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
@@ -91,59 +91,52 @@ void InsertPropertyPanel::dispose()
 
 
 
-IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent)
+IMPL_LINK_TYPED(InsertPropertyPanel, WindowEventListener, VclWindowEvent&, rEvent, void)
 {
     // We will be getting a lot of window events (well, basically all
     // of them), so reject early everything that is not connected to
     // toolbox selection.
-    if (pEvent == NULL)
-        return 1;
-    if ( ! pEvent->ISA(VclWindowEvent))
-        return 1;
-    if (pEvent->GetId() != VCLEVENT_TOOLBOX_SELECT)
-        return 1;
-
-    VclWindowEvent* pWindowEvent = dynamic_cast<VclWindowEvent*>(pEvent);
-    vcl::Window* pWindow = pWindowEvent ? pWindowEvent->GetWindow() : NULL;
+    if (rEvent.GetId() != VCLEVENT_TOOLBOX_SELECT)
+        return;
+
+    vcl::Window* pWindow = rEvent.GetWindow();
     ToolBox* pToolBox = dynamic_cast<ToolBox*>(pWindow);
     if (pToolBox == NULL)
-        return 1;
+        return;
 
     // Extract name of (sub)toolbar from help id.
     OUString sToolbarName (rtl::OStringToOUString(pToolBox->GetHelpId(), RTL_TEXTENCODING_UTF8));
     if (sToolbarName.getLength() == 0)
-        return 1;
+        return;
     const util::URL aURL (sfx2::sidebar::Tools::GetURL(sToolbarName));
     if (aURL.Path.getLength() == 0)
-        return 1;
+        return;
 
     // Get item id.
     sal_uInt16 nId = pToolBox->GetCurItemId();
     if (nId == 0)
-        return 1;
+        return;
 
     SidebarToolBox* pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpStandardShapesToolBox.get());
     if (pSidebarToolBox == NULL)
-        return 1;
+        return;
     sal_uInt16 nItemId (pSidebarToolBox->GetItemIdForSubToolbarName(aURL.Path));
     if (nItemId == 0)
     {
         pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpCustomShapesToolBox.get());
         if (pSidebarToolBox == NULL)
-            return 1;
+            return;
         nItemId = pSidebarToolBox->GetItemIdForSubToolbarName(aURL.Path);
         if (nItemId == 0)
-            return 1;
+            return;
     }
 
     Reference<frame::XSubToolbarController> xController (pSidebarToolBox->GetControllerForItemId(nItemId), UNO_QUERY);
     if ( ! xController.is() )
-        return 1;
+        return;
 
     const OUString sCommand (pToolBox->GetItemCommand(nId));
     xController->functionSelected(sCommand);
-
-    return 1;
 }
 
 
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.hxx b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
index 01ce363..f8feaf7 100644
--- a/svx/source/sidebar/insert/InsertPropertyPanel.hxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
@@ -49,7 +49,7 @@ private:
     VclPtr<ToolBox>        mpCustomShapesToolBox;
     const css::uno::Reference<css::frame::XFrame> mxFrame;
 
-    DECL_LINK(WindowEventListener, VclSimpleEvent*);
+    DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void);
 };
 
 
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index a718591..d4227e2 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -295,7 +295,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
     DECL_DLLPRIVATE_LINK_TYPED(  ScrollHdl, ScrollBar*, void );
     DECL_DLLPRIVATE_LINK_TYPED(  EndScrollHdl, ScrollBar*, void );
     SAL_DLLPRIVATE bool          UpdateScrollbars();
-    DECL_DLLPRIVATE_LINK( WindowChildEventListener, VclSimpleEvent* );
+    DECL_DLLPRIVATE_LINK_TYPED( WindowChildEventListener, VclWindowEvent&, void );
     SAL_DLLPRIVATE void          CalcVisArea( const Size &rPixelSz );
 
     // linguistics functions
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index d31a6f3..fbfdde8 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -390,45 +390,39 @@ void SwAccessibleDocument::Dispose( bool bRecursive )
     SwAccessibleContext::Dispose( bRecursive );
 }
 
-IMPL_LINK( SwAccessibleDocument, WindowChildEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( SwAccessibleDocument, WindowChildEventListener, VclWindowEvent&, rEvent, void )
 {
-    OSL_ENSURE( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
-    if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+    OSL_ENSURE( rEvent.GetWindow(), "Window???" );
+    switch ( rEvent.GetId() )
     {
-        VclWindowEvent *pVclEvent = static_cast< VclWindowEvent * >( pEvent );
-        OSL_ENSURE( pVclEvent->GetWindow(), "Window???" );
-        switch ( pVclEvent->GetId() )
+    case VCLEVENT_WINDOW_SHOW:  // send create on show for direct accessible children
         {
-        case VCLEVENT_WINDOW_SHOW:  // send create on show for direct accessible children
+            vcl::Window* pChildWin = static_cast< vcl::Window* >( rEvent.GetData() );
+            if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
             {
-                vcl::Window* pChildWin = static_cast< vcl::Window* >( pVclEvent->GetData() );
-                if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
-                {
-                    AddChild( pChildWin );
-                }
+                AddChild( pChildWin );
             }
-            break;
-        case VCLEVENT_WINDOW_HIDE:  // send destroy on hide for direct accessible children
+        }
+        break;
+    case VCLEVENT_WINDOW_HIDE:  // send destroy on hide for direct accessible children
+        {
+            vcl::Window* pChildWin = static_cast< vcl::Window* >( rEvent.GetData() );
+            if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
             {
-                vcl::Window* pChildWin = static_cast< vcl::Window* >( pVclEvent->GetData() );
-                if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
-                {
-                    RemoveChild( pChildWin );
-                }
+                RemoveChild( pChildWin );
             }
-            break;
-        case VCLEVENT_OBJECT_DYING:  // send destroy on hide for direct accessible children
+        }
+        break;
+    case VCLEVENT_OBJECT_DYING:  // send destroy on hide for direct accessible children
+        {
+            vcl::Window* pChildWin = rEvent.GetWindow();
+            if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
             {
-                vcl::Window* pChildWin = pVclEvent->GetWindow();
-                if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
-                {
-                    RemoveChild( pChildWin );
-                }
+                RemoveChild( pChildWin );
             }
-            break;
         }
+        break;
     }
-    return 0;
 }
 
 OUString SAL_CALL SwAccessibleDocument::getImplementationName()
diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx
index c31d294..98fc056 100644
--- a/sw/source/core/access/accdoc.hxx
+++ b/sw/source/core/access/accdoc.hxx
@@ -123,7 +123,7 @@ protected:
 public:
     SwAccessibleDocument( SwAccessibleMap* pInitMap );
 
-    DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
+    DECL_LINK_TYPED( WindowChildEventListener, VclWindowEvent&, void );
 
     // XServiceInfo
 
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 3674f78..4782528 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -258,33 +258,26 @@ void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly
 
 // Scrollbar - Handler
 
-IMPL_LINK( SwView, WindowChildEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( SwView, WindowChildEventListener, VclWindowEvent&, rEvent, void )
 {
-    OSL_ENSURE( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
-    if ( pEvent && pEvent->ISA( VclWindowEvent ) )
-    {
-        VclWindowEvent *pVclEvent = static_cast< VclWindowEvent * >( pEvent );
-        OSL_ENSURE( pVclEvent->GetWindow(), "Window???" );
-        vcl::Window* pChildWin = static_cast< vcl::Window* >( pVclEvent->GetData() );
+    OSL_ENSURE( rEvent.GetWindow(), "Window???" );
+    vcl::Window* pChildWin = static_cast< vcl::Window* >( rEvent.GetData() );
 
-        switch ( pVclEvent->GetId() )
-        {
-            case VCLEVENT_WINDOW_HIDE:
-                if( pChildWin == m_pHScrollbar )
-                    ShowHScrollbar( false );
-                else if( pChildWin == m_pVScrollbar )
-                    ShowVScrollbar( false );
-                break;
-            case VCLEVENT_WINDOW_SHOW:
-                if( pChildWin == m_pHScrollbar )
-                    ShowHScrollbar( true );
-                else if( pChildWin == m_pVScrollbar )
-                    ShowVScrollbar( true );
-                break;
-        }
+    switch ( rEvent.GetId() )
+    {
+        case VCLEVENT_WINDOW_HIDE:
+            if( pChildWin == m_pHScrollbar )
+                ShowHScrollbar( false );
+            else if( pChildWin == m_pVScrollbar )
+                ShowVScrollbar( false );
+            break;
+        case VCLEVENT_WINDOW_SHOW:
+            if( pChildWin == m_pHScrollbar )
+                ShowHScrollbar( true );
+            else if( pChildWin == m_pVScrollbar )
+                ShowVScrollbar( true );
+            break;
     }
-
-    return 0;
 }
 
 int SwView::_CreateScrollbar( bool bHori )
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index 61098cd..b83169d 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -118,21 +118,19 @@ IMPL_LINK_TYPED( VCLXAccessibleComponent, WindowEventListener, VclWindowEvent&,
     }
 }
 
-IMPL_LINK( VCLXAccessibleComponent, WindowChildEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( VCLXAccessibleComponent, WindowChildEventListener, VclWindowEvent&, rEvent, void )
 {
-    DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
-    if ( pEvent && pEvent->ISA( VclWindowEvent ) && mxWindow.is() /* #i68079# */ )
+    if ( mxWindow.is() /* #i68079# */ )
     {
-        DBG_ASSERT( static_cast<VclWindowEvent*>(pEvent)->GetWindow(), "Window???" );
-        if( !static_cast<VclWindowEvent*>(pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() )
+        DBG_ASSERT( rEvent.GetWindow(), "Window???" );
+        if( !rEvent.GetWindow()->IsAccessibilityEventsSuppressed() )
         {
             // #103087# to prevent an early release of the component
             uno::Reference< accessibility::XAccessibleContext > xTmp = this;
 
-            ProcessWindowChildEvent( *static_cast<VclWindowEvent*>(pEvent) );
+            ProcessWindowChildEvent( rEvent );
         }
     }
-    return 0;
 }
 
 uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::GetChildAccessible( const VclWindowEvent& rVclWindowEvent )
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 00f7999..09751da 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -160,12 +160,12 @@ class VCLXToolkit : public VCLXToolkit_Impl,
     ::cppu::OInterfaceContainerHelper m_aTopWindowListeners;
     ::cppu::OInterfaceContainerHelper m_aKeyHandlers;
     ::cppu::OInterfaceContainerHelper m_aFocusListeners;
-    ::Link<> m_aEventListenerLink;
+    ::Link<VclSimpleEvent&,void> m_aEventListenerLink;
     ::Link<VclWindowEvent&,bool> m_aKeyListenerLink;
     bool m_bEventListener;
     bool m_bKeyListener;
 
-    DECL_LINK(eventListenerHandler, ::VclSimpleEvent const *);
+    DECL_LINK_TYPED(eventListenerHandler, ::VclSimpleEvent&, void);
 
     DECL_LINK_TYPED(keyListenerHandler, ::VclWindowEvent&, bool);
 
@@ -1695,46 +1695,45 @@ void SAL_CALL VCLXToolkit::fireFocusLost(
 }
 
 
-IMPL_LINK(VCLXToolkit, eventListenerHandler, ::VclSimpleEvent const *, pEvent)
+IMPL_LINK_TYPED(VCLXToolkit, eventListenerHandler, ::VclSimpleEvent&, rEvent, void)
 {
-    switch (pEvent->GetId())
+    switch (rEvent.GetId())
     {
     case VCLEVENT_WINDOW_SHOW:
         callTopWindowListeners(
-            pEvent, &css::awt::XTopWindowListener::windowOpened);
+            &rEvent, &css::awt::XTopWindowListener::windowOpened);
         break;
     case VCLEVENT_WINDOW_HIDE:
         callTopWindowListeners(
-            pEvent, &css::awt::XTopWindowListener::windowClosed);
+            &rEvent, &css::awt::XTopWindowListener::windowClosed);
         break;
     case VCLEVENT_WINDOW_ACTIVATE:
         callTopWindowListeners(
-            pEvent, &css::awt::XTopWindowListener::windowActivated);
+            &rEvent, &css::awt::XTopWindowListener::windowActivated);
         break;
     case VCLEVENT_WINDOW_DEACTIVATE:
         callTopWindowListeners(
-            pEvent, &css::awt::XTopWindowListener::windowDeactivated);
+            &rEvent, &css::awt::XTopWindowListener::windowDeactivated);
         break;
     case VCLEVENT_WINDOW_CLOSE:
         callTopWindowListeners(
-            pEvent, &css::awt::XTopWindowListener::windowClosing);
+            &rEvent, &css::awt::XTopWindowListener::windowClosing);
         break;
     case VCLEVENT_WINDOW_GETFOCUS:
-        callFocusListeners(pEvent, true);
+        callFocusListeners(&rEvent, true);
         break;
     case VCLEVENT_WINDOW_LOSEFOCUS:
-        callFocusListeners(pEvent, false);
+        callFocusListeners(&rEvent, false);
         break;
     case VCLEVENT_WINDOW_MINIMIZE:
         callTopWindowListeners(
-            pEvent, &css::awt::XTopWindowListener::windowMinimized);
+            &rEvent, &css::awt::XTopWindowListener::windowMinimized);
         break;
     case VCLEVENT_WINDOW_NORMALIZE:
         callTopWindowListeners(
-            pEvent, &css::awt::XTopWindowListener::windowNormalized);
+            &rEvent, &css::awt::XTopWindowListener::windowNormalized);
         break;
     }
-    return 0;
 }
 
 IMPL_LINK_TYPED(VCLXToolkit, keyListenerHandler, ::VclWindowEvent&, rEvent, bool)
diff --git a/vcl/inc/osx/a11yfocustracker.hxx b/vcl/inc/osx/a11yfocustracker.hxx
index 2dc3d82..3dc3926 100644
--- a/vcl/inc/osx/a11yfocustracker.hxx
+++ b/vcl/inc/osx/a11yfocustracker.hxx
@@ -74,7 +74,7 @@ protected:
     void toolbox_open_floater(vcl::Window *pWindow);
 
     // callback function for Application::addEventListener
-    static sal_IntPtr WindowEventHandler(void * pThis, void * pCaller);
+    static void WindowEventHandler(void * pThis, VclSimpleEvent&);
 
 private:
     // the accessible object that has the keyboard focus (if any)
diff --git a/vcl/inc/vcleventlisteners.hxx b/vcl/inc/vcleventlisteners.hxx
index 5be40e8..e2f72bf 100644
--- a/vcl/inc/vcleventlisteners.hxx
+++ b/vcl/inc/vcleventlisteners.hxx
@@ -34,11 +34,11 @@
 class VCL_DLLPUBLIC VclEventListeners
 {
 public:
-    void Call( VclSimpleEvent* pEvent ) const;
-    void addListener( const Link<>& rListener );
-    void removeListener( const Link<>& rListener );
+    void Call( VclSimpleEvent& rEvent ) const;
+    void addListener( const Link<VclSimpleEvent&,void>& rListener );
+    void removeListener( const Link<VclSimpleEvent&,void>& rListener );
 private:
-    std::vector<Link<>> m_aListeners;
+    std::vector<Link<VclSimpleEvent&,void>> m_aListeners;
 };
 
 #endif // INCLUDED_VCL_INC_VCLEVENTLISTENERS_HXX
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 00c1785..4eebb76 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -230,7 +230,7 @@ public:
     VclPtr<vcl::Window> mpLastFocusWindow;
     VclPtr<vcl::Window> mpDlgCtrlDownWindow;
     std::vector<Link<VclWindowEvent&,void>> maEventListeners;
-    VclEventListeners   maChildEventListeners;
+    std::vector<Link<VclWindowEvent&,void>> maChildEventListeners;
 
     // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
     ::com::sun::star::uno::WeakReference< ::com::sun::star::rendering::XCanvas >    mxCanvas;
diff --git a/vcl/osx/a11yfocustracker.cxx b/vcl/osx/a11yfocustracker.cxx
index 0f3182d..8823ba8 100644
--- a/vcl/osx/a11yfocustracker.cxx
+++ b/vcl/osx/a11yfocustracker.cxx
@@ -43,42 +43,40 @@ getWindow(const ::VclSimpleEvent *pEvent)
 
 // callback function for Application::addEventListener
 
-sal_IntPtr AquaA11yFocusTracker::WindowEventHandler(
-    void * pThis, void * pCaller)
+void AquaA11yFocusTracker::WindowEventHandler(void * pThis, VclSimpleEvent& rEvent)
 {
     AquaA11yFocusTracker *pFocusTracker = static_cast<AquaA11yFocusTracker *>(
         pThis);
-    VclSimpleEvent const *pEvent = static_cast<VclSimpleEvent const *>(pCaller);
-    switch (pEvent->GetId())
+    switch (rEvent.GetId())
     {
     case VCLEVENT_WINDOW_PAINT:
-        pFocusTracker-> toolbox_open_floater( getWindow(pEvent) );
+        pFocusTracker-> toolbox_open_floater( getWindow(&rEvent) );
         break;
     case VCLEVENT_WINDOW_GETFOCUS:
-        pFocusTracker->window_got_focus( getWindow(pEvent) );
+        pFocusTracker->window_got_focus( getWindow(&rEvent) );
         break;
     case VCLEVENT_OBJECT_DYING:
-        pFocusTracker->m_aDocumentWindowList.erase( getWindow(pEvent) );
+        pFocusTracker->m_aDocumentWindowList.erase( getWindow(&rEvent) );
         // intentional pass through ..
     case VCLEVENT_TOOLBOX_HIGHLIGHTOFF:
-        pFocusTracker->toolbox_highlight_off( getWindow(pEvent) );
+        pFocusTracker->toolbox_highlight_off( getWindow(&rEvent) );
         break;
     case VCLEVENT_TOOLBOX_HIGHLIGHT:
-        pFocusTracker->toolbox_highlight_on( getWindow(pEvent) );
+        pFocusTracker->toolbox_highlight_on( getWindow(&rEvent) );
         break;
     case VCLEVENT_TABPAGE_ACTIVATE:
-        pFocusTracker->tabpage_activated( getWindow(pEvent) );
+        pFocusTracker->tabpage_activated( getWindow(&rEvent) );
         break;
     case VCLEVENT_MENU_HIGHLIGHT:
         // Inspired by code in WindowEventHandler in
         // vcl/unx/gtk/a11y/atkutil.cxx, find out what kind of event
         // it is to avoid blindly using a static_cast and crash,
         // fdo#47275.
-        if( const VclMenuEvent* pMenuEvent = dynamic_cast < const VclMenuEvent* > (pEvent) )
+        if( const VclMenuEvent* pMenuEvent = dynamic_cast < const VclMenuEvent* > (&rEvent) )
         {
             pFocusTracker->menu_highlighted( pMenuEvent );
         }
-        else if( const VclAccessibleEvent* pAccEvent = dynamic_cast < const VclAccessibleEvent* > (pEvent) )
+        else if( const VclAccessibleEvent* pAccEvent = dynamic_cast < const VclAccessibleEvent* > (&rEvent) )
         {
             Reference< XAccessible > xAccessible = pAccEvent->GetAccessible();
             if( xAccessible.is() )
@@ -88,8 +86,6 @@ sal_IntPtr AquaA11yFocusTracker::WindowEventHandler(
     default:
         break;
     };
-
-    return 0;
 }
 
 AquaA11yFocusTracker::AquaA11yFocusTracker() :
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index c57ca13..b25b738 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -674,7 +674,7 @@ void Application::ImplCallEventListeners( sal_uLong nEvent, vcl::Window *pWin, v
     VclWindowEvent aEvent( pWin, nEvent, pData );
 
     if ( pSVData->maAppData.mpEventListeners )
-        pSVData->maAppData.mpEventListeners->Call( &aEvent );
+        pSVData->maAppData.mpEventListeners->Call( aEvent );
 }
 
 void Application::ImplCallEventListeners( VclSimpleEvent& rEvent )
@@ -682,10 +682,10 @@ void Application::ImplCallEventListeners( VclSimpleEvent& rEvent )
     ImplSVData* pSVData = ImplGetSVData();
 
     if ( pSVData->maAppData.mpEventListeners )
-        pSVData->maAppData.mpEventListeners->Call( &rEvent );
+        pSVData->maAppData.mpEventListeners->Call( rEvent );
 }
 
-void Application::AddEventListener( const Link<>& rEventListener )
+void Application::AddEventListener( const Link<VclSimpleEvent&,void>& rEventListener )
 {
     ImplSVData* pSVData = ImplGetSVData();
     if( !pSVData->maAppData.mpEventListeners )
@@ -693,7 +693,7 @@ void Application::AddEventListener( const Link<>& rEventListener )
     pSVData->maAppData.mpEventListeners->addListener( rEventListener );
 }
 
-void Application::RemoveEventListener( const Link<>& rEventListener )
+void Application::RemoveEventListener( const Link<VclSimpleEvent&,void>& rEventListener )
 {
     ImplSVData* pSVData = ImplGetSVData();
     if( pSVData->maAppData.mpEventListeners )
diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx
index 6cc4523..bcbe518 100644
--- a/vcl/source/app/vclevent.cxx
+++ b/vcl/source/app/vclevent.cxx
@@ -43,25 +43,25 @@ VclAccessibleEvent::~VclAccessibleEvent()
 }
 
 
-void VclEventListeners::Call( VclSimpleEvent* pEvent ) const
+void VclEventListeners::Call( VclSimpleEvent& rEvent ) const
 {
     if ( m_aListeners.empty() )
         return;
 
     // Copy the list, because this can be destroyed when calling a Link...
-    std::vector<Link<>> aCopy( m_aListeners );
-    std::vector<Link<>>::iterator aIter( aCopy.begin() );
-    std::vector<Link<>>::const_iterator aEnd( aCopy.end() );
-    if( pEvent->IsA( VclWindowEvent::StaticType() ) )
+    std::vector<Link<VclSimpleEvent&,void>> aCopy( m_aListeners );
+    std::vector<Link<VclSimpleEvent&,void>>::iterator aIter( aCopy.begin() );
+    std::vector<Link<VclSimpleEvent&,void>>::const_iterator aEnd( aCopy.end() );
+    if( rEvent.IsA( VclWindowEvent::StaticType() ) )
     {
-        VclWindowEvent* pWinEvent = static_cast<VclWindowEvent*>(pEvent);
+        VclWindowEvent* pWinEvent = static_cast<VclWindowEvent*>(&rEvent);
         ImplDelData aDel( pWinEvent->GetWindow() );
         while ( aIter != aEnd && ! aDel.IsDead() )
         {
-            Link<> &rLink = *aIter;
+            Link<VclSimpleEvent&,void> &rLink = *aIter;
             // check this hasn't been removed in some re-enterancy scenario fdo#47368
             if( std::find(m_aListeners.begin(), m_aListeners.end(), rLink) != m_aListeners.end() )
-                rLink.Call( pEvent );
+                rLink.Call( rEvent );
             ++aIter;
         }
     }
@@ -69,20 +69,20 @@ void VclEventListeners::Call( VclSimpleEvent* pEvent ) const
     {
         while ( aIter != aEnd )
         {
-            Link<> &rLink = *aIter;
+            Link<VclSimpleEvent&,void> &rLink = *aIter;
             if( std::find(m_aListeners.begin(), m_aListeners.end(), rLink) != m_aListeners.end() )
-                rLink.Call( pEvent );
+                rLink.Call( rEvent );
             ++aIter;
         }
     }
 }
 
-void VclEventListeners::addListener( const Link<>& rListener )
+void VclEventListeners::addListener( const Link<VclSimpleEvent&,void>& rListener )
 {
     m_aListeners.push_back( rListener );
 }
 
-void VclEventListeners::removeListener( const Link<>& rListener )
+void VclEventListeners::removeListener( const Link<VclSimpleEvent&,void>& rListener )
 {
     m_aListeners.erase( std::remove(m_aListeners.begin(), m_aListeners.end(), rListener ), m_aListeners.end() );
 }
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 2cda79c..a8f7a51 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -1008,19 +1008,17 @@ IMPL_LINK_NOARG(TabControl, ImplListBoxSelectHdl)
     return 0;
 }
 
-IMPL_LINK( TabControl, ImplWindowEventListener, VclSimpleEvent*, pEvent )
+IMPL_LINK_TYPED( TabControl, ImplWindowEventListener, VclWindowEvent&, rEvent, void )
 {
-    if ( pEvent && pEvent->ISA( VclWindowEvent ) && (pEvent->GetId() == VCLEVENT_WINDOW_KEYINPUT) )
+    if ( rEvent.GetId() == VCLEVENT_WINDOW_KEYINPUT )
     {
-        VclWindowEvent* pWindowEvent = static_cast< VclWindowEvent* >(pEvent);
         // Do not handle events from TabControl or its children, which is done in Notify(), where the events can be consumed.
-        if ( !IsWindowOrChild( pWindowEvent->GetWindow() ) )
+        if ( !IsWindowOrChild( rEvent.GetWindow() ) )
         {
-            KeyEvent* pKeyEvent = static_cast< KeyEvent* >(pWindowEvent->GetData());
+            KeyEvent* pKeyEvent = static_cast< KeyEvent* >(rEvent.GetData());
             ImplHandleKeyEvent( *pKeyEvent );
         }
     }
-    return 0;
 }
 
 void TabControl::MouseButtonDown( const MouseEvent& rMEvt )
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index 20ee616..fbbf245 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -214,8 +214,8 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
 
     if (!mpWindowImpl->maEventListeners.empty())
     {
-         // Copy the list, because this can be destroyed when calling a Link...
-         std::vector<Link<VclWindowEvent&,void>> aCopy( mpWindowImpl->maEventListeners );
+        // 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;
@@ -238,7 +238,19 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
         if ( aDelData.IsDead() )
             return;
 
-        pWindow->mpWindowImpl->maChildEventListeners.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->maChildEventListeners );
+            for ( Link<VclWindowEvent&,void>& rLink : aCopy )
+            {
+                if (aDelData.IsDead())
+                    return;
+                // check this hasn't been removed in some re-enterancy scenario fdo#47368
+                if( std::find(mpWindowImpl->maChildEventListeners.begin(), mpWindowImpl->maChildEventListeners.end(), rLink) != mpWindowImpl->maChildEventListeners.end() )
+                    rLink.Call( aEvent );
+            }
+        }
 
         if ( aDelData.IsDead() )
             return;
@@ -268,15 +280,18 @@ void Window::RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListen
     }
 }
 
-void Window::AddChildEventListener( const Link<>& rEventListener )
+void Window::AddChildEventListener( const Link<VclWindowEvent&,void>& rEventListener )
 {
-    mpWindowImpl->maChildEventListeners.addListener( rEventListener );
+    mpWindowImpl->maChildEventListeners.push_back( rEventListener );
 }
 
-void Window::RemoveChildEventListener( const Link<>& rEventListener )
+void Window::RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventListener )
 {
     if (mpWindowImpl)
-        mpWindowImpl->maChildEventListeners.removeListener( rEventListener );
+    {
+        auto& rListeners = mpWindowImpl->maChildEventListeners;
+        rListeners.erase( std::remove(rListeners.begin(), rListeners.end(), rEventListener ), rListeners.end() );
+    }
 }
 
 ImplSVEvent * Window::PostUserEvent( const Link<void*,void>& rLink, void* pCaller, bool bReferenceLink )
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index c3eb4a5..d77b4a9 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -577,12 +577,11 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent)
 
 /*****************************************************************************/
 
-sal_IntPtr WindowEventHandler(void *, void * p)
+void WindowEventHandler(void *, VclSimpleEvent& rEvent)
 {
-    VclSimpleEvent * pEvent = static_cast<VclSimpleEvent *>(p);
     try
     {
-        switch (pEvent->GetId())
+        switch (rEvent.GetId())
         {
         case VCLEVENT_WINDOW_SHOW:
             break;
@@ -591,7 +590,7 @@ sal_IntPtr WindowEventHandler(void *, void * p)
         case VCLEVENT_WINDOW_CLOSE:
             break;
         case VCLEVENT_WINDOW_GETFOCUS:
-            handle_get_focus(static_cast< ::VclWindowEvent const * >(pEvent));
+            handle_get_focus(static_cast< ::VclWindowEvent const * >(&rEvent));
             break;
         case VCLEVENT_WINDOW_LOSEFOCUS:
             break;
@@ -606,11 +605,11 @@ sal_IntPtr WindowEventHandler(void *, void * p)
             break;
 
         case VCLEVENT_MENU_HIGHLIGHT:
-            if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(pEvent))
+            if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(&rEvent))
             {
                 handle_menu_highlighted(pMenuEvent);
             }
-            else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(pEvent))
+            else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(&rEvent))
             {
                 uno::Reference< accessibility::XAccessible > xAccessible = pAccEvent->GetAccessible();
                 if (xAccessible.is())
@@ -619,22 +618,22 @@ sal_IntPtr WindowEventHandler(void *, void * p)
             break;
 
         case VCLEVENT_TOOLBOX_HIGHLIGHT:
-            handle_toolbox_highlight(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
+            handle_toolbox_highlight(static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow());
             break;
 
         case VCLEVENT_TOOLBOX_BUTTONSTATECHANGED:
-            handle_toolbox_buttonchange(static_cast< ::VclWindowEvent const * >(pEvent));
+            handle_toolbox_buttonchange(static_cast< ::VclWindowEvent const * >(&rEvent));
             break;
 
         case VCLEVENT_OBJECT_DYING:
-            g_aWindowList.erase( static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow() );
+            g_aWindowList.erase( static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow() );
             // fallthrough intentional !
         case VCLEVENT_TOOLBOX_HIGHLIGHTOFF:
-            handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
+            handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow());
             break;
 
         case VCLEVENT_TABPAGE_ACTIVATE:
-            handle_tabpage_activated(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
+            handle_tabpage_activated(static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow());
             break;
 
         case VCLEVENT_COMBOBOX_SETTEXT:
@@ -653,10 +652,9 @@ sal_IntPtr WindowEventHandler(void *, void * p)
     {
         g_warning("Focused object has invalid index in parent");
     }
-    return 0;
 }
 
-static Link<> g_aEventListenerLink( NULL, WindowEventHandler );
+static Link<VclSimpleEvent&,void> g_aEventListenerLink( NULL, WindowEventHandler );
 
 /*****************************************************************************/
 


More information about the Libreoffice-commits mailing list