diff options
-rw-r--r-- | include/vcl/ctrl.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlgentry.cxx | 2 | ||||
-rw-r--r-- | svtools/source/table/tablecontrol.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 8 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/ctrl.cxx | 8 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/fixedhyper.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/lstbox.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/scrbar.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/spinbtn.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/spinfld.cxx | 8 |
12 files changed, 27 insertions, 29 deletions
diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx index 0f689d04ebe6..115d9dd87ea5 100644 --- a/include/vcl/ctrl.hxx +++ b/include/vcl/ctrl.hxx @@ -69,15 +69,13 @@ protected: @param nEvent the event to notify to our event listeners - @param rHandler - the handler to call - @param pCaller - the parameter to pass to the handler call + @param callHandler + the lambda function that calls the handler @return if the Control instance has been destroyed in any of the call */ bool ImplCallEventListenersAndHandler( - sal_uLong nEvent, const Link<>& rHandler, void* pCaller + sal_uLong nEvent, std::function<void()> callHandler ); /** draws the given text onto the given device diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index b48a82b0e866..4365f946938e 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -78,7 +78,7 @@ bool ScCondFrmtEntry::Notify( NotifyEvent& rNEvt ) { if( rNEvt.GetType() == MouseNotifyEvent::MOUSEBUTTONDOWN ) { - ImplCallEventListenersAndHandler( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, maClickHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, [this] () { maClickHdl.Call(this); } ); } return Control::Notify(rNEvt); } diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index d9092aacad49..4a9632cc8405 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -652,7 +652,7 @@ namespace svt { namespace table void TableControl::Select() { - ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_pImpl->getSelectHandler(), this ); + ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, [this] () { m_pImpl->getSelectHandler().Call(this); } ); if ( m_pImpl->isAccessibleAlive() ) { diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 0157b7ddd589..a1c0dea3ccae 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -114,7 +114,7 @@ void Button::SetCommandHandler(const OUString& aCommand) void Button::Click() { - ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, maClickHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, [this] () { maClickHdl.Call(this); } ); } OUString Button::GetStandardText( StandardButtonType eButton ) @@ -1548,7 +1548,7 @@ bool PushButton::PreNotify( NotifyEvent& rNEvt ) void PushButton::Toggle() { - ImplCallEventListenersAndHandler( VCLEVENT_PUSHBUTTON_TOGGLE, maToggleHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_PUSHBUTTON_TOGGLE, [this] () { maToggleHdl.Call(this); } ); } void PushButton::SetSymbol( SymbolType eSymbol ) @@ -2640,7 +2640,7 @@ bool RadioButton::PreNotify( NotifyEvent& rNEvt ) void RadioButton::Toggle() { - ImplCallEventListenersAndHandler( VCLEVENT_RADIOBUTTON_TOGGLE, maToggleHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_RADIOBUTTON_TOGGLE, [this] () { maToggleHdl.Call(this); } ); } bool RadioButton::SetModeRadioImage( const Image& rImage ) @@ -3595,7 +3595,7 @@ bool CheckBox::PreNotify( NotifyEvent& rNEvt ) void CheckBox::Toggle() { - ImplCallEventListenersAndHandler( VCLEVENT_CHECKBOX_TOGGLE, maToggleHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_CHECKBOX_TOGGLE, [this] () { maToggleHdl.Call(this); } ); } void CheckBox::SetState( TriState eState ) diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 7703b30676a1..f7409eb1799b 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -556,12 +556,12 @@ void ComboBox::ToggleDropDown() void ComboBox::Select() { - ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_SELECT, m_pImpl->m_SelectHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_SELECT, [this] () { m_pImpl->m_SelectHdl.Call(this); } ); } void ComboBox::DoubleClick() { - ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_DOUBLECLICK, m_pImpl->m_DoubleClickHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_DOUBLECLICK, [this] () { m_pImpl->m_DoubleClickHdl.Call(this); } ); } bool ComboBox::IsAutoSizeEnabled() const { return m_pImpl->m_isDDAutoSize; } diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 6062d1a49d4d..7eafeb3393e2 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -258,7 +258,7 @@ bool Control::Notify( NotifyEvent& rNEvt ) { mbHasControlFocus = true; CompatStateChanged( StateChangedType::ControlFocus ); - if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, maGetFocusHdl, this ) ) + if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, [this] () { maGetFocusHdl.Call(this); } ) ) // been destroyed within the handler return true; } @@ -272,7 +272,7 @@ bool Control::Notify( NotifyEvent& rNEvt ) { mbHasControlFocus = false; CompatStateChanged( StateChangedType::ControlFocus ); - if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, maLoseFocusHdl, this ) ) + if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, [this] () { maLoseFocusHdl.Call(this); } ) ) // been destroyed within the handler return true; } @@ -320,7 +320,7 @@ void Control::AppendLayoutData( const Control& rSubControl ) const } } -bool Control::ImplCallEventListenersAndHandler( sal_uLong nEvent, const Link<>& rHandler, void* pCaller ) +bool Control::ImplCallEventListenersAndHandler( sal_uLong nEvent, std::function<void()> callHandler ) { VclPtr<Control> xThis(this); @@ -328,7 +328,7 @@ bool Control::ImplCallEventListenersAndHandler( sal_uLong nEvent, const Link<>& if ( !xThis->IsDisposed() ) { - rHandler.Call( pCaller ); + callHandler(); if ( !xThis->IsDisposed() ) return false; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index b4e56f47fa86..8461583c1413 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2416,7 +2416,7 @@ void Edit::Modify() if ( mpUpdateDataTimer ) mpUpdateDataTimer->Start(); - if ( ImplCallEventListenersAndHandler( VCLEVENT_EDIT_MODIFY, maModifyHdl, this ) ) + if ( ImplCallEventListenersAndHandler( VCLEVENT_EDIT_MODIFY, [this] () { maModifyHdl.Call(this); } ) ) // have been destroyed while calling into the handlers return; diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx index 4fb5af42c491..b7a27592ea16 100644 --- a/vcl/source/control/fixedhyper.cxx +++ b/vcl/source/control/fixedhyper.cxx @@ -77,7 +77,7 @@ void FixedHyperlink::MouseButtonUp( const MouseEvent& ) { // calls the link if the control is enabled and the mouse is over the text. if ( IsEnabled() && ImplIsOverText(GetPointerPosPixel()) ) - ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, m_aClickHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, [this] () { m_aClickHdl.Call(this); } ); } void FixedHyperlink::RequestHelp( const HelpEvent& rHEvt ) diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index ba085d718425..b89f7f3a524d 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -972,12 +972,12 @@ bool ListBox::PreNotify( NotifyEvent& rNEvt ) void ListBox::Select() { - ImplCallEventListenersAndHandler( VCLEVENT_LISTBOX_SELECT, maSelectHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_LISTBOX_SELECT, [this] () { maSelectHdl.Call(this); } ); } void ListBox::DoubleClick() { - ImplCallEventListenersAndHandler( VCLEVENT_LISTBOX_DOUBLECLICK, maDoubleClickHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_LISTBOX_DOUBLECLICK, [this] () { maDoubleClickHdl.Call(this); } ); } void ListBox::Clear() diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 8a4345fe399f..0246276470fe 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -1323,12 +1323,12 @@ bool ScrollBar::PreNotify( NotifyEvent& rNEvt ) void ScrollBar::Scroll() { - ImplCallEventListenersAndHandler( VCLEVENT_SCROLLBAR_SCROLL, maScrollHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_SCROLLBAR_SCROLL, [this] () { maScrollHdl.Call(this); } ); } void ScrollBar::EndScroll() { - ImplCallEventListenersAndHandler( VCLEVENT_SCROLLBAR_ENDSCROLL, maEndScrollHdl, this ); + ImplCallEventListenersAndHandler( VCLEVENT_SCROLLBAR_ENDSCROLL, [this] () { maEndScrollHdl.Call(this); } ); } long ScrollBar::DoScroll( long nNewPos ) diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx index ad47e9fc4bcb..4651f9b13bb0 100644 --- a/vcl/source/control/spinbtn.cxx +++ b/vcl/source/control/spinbtn.cxx @@ -81,7 +81,7 @@ void SpinButton::Up() ImplMoveFocus(true); } - ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_UP, maUpHdlLink, this); + ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_UP, [this] () { maUpHdlLink.Call(this); } ); } void SpinButton::Down() @@ -94,7 +94,7 @@ void SpinButton::Down() ImplMoveFocus(false); } - ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_DOWN, maDownHdlLink, this); + ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_DOWN, [this] () { maDownHdlLink.Call(this); } ); } void SpinButton::Resize() diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 7541eef3e16a..e7058f88970e 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -383,22 +383,22 @@ void SpinField::dispose() void SpinField::Up() { - ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_UP, maUpHdlLink, this ); + ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_UP, [this] () { maUpHdlLink.Call(this); } ); } void SpinField::Down() { - ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_DOWN, maDownHdlLink, this ); + ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_DOWN, [this] () { maDownHdlLink.Call(this); } ); } void SpinField::First() { - ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_FIRST, maFirstHdlLink, this ); + ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_FIRST, [this] () { maFirstHdlLink.Call(this); } ); } void SpinField::Last() { - ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_LAST, maLastHdlLink, this ); + ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_LAST, [this] () { maLastHdlLink.Call(this); } ); } void SpinField::MouseButtonDown( const MouseEvent& rMEvt ) |