diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-02-18 13:38:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-02-18 15:48:31 +0000 |
commit | 548c2274c9ba7542d6bcae5fefd1400ee4e22fc3 (patch) | |
tree | 7963bec49ed00b89090bd213a7db36a85bc88f87 | |
parent | 423b79e7366203db3f57dea75b8cb9eb852b5614 (diff) |
move from boost::signal to typed Link
it doesn't really gain us much to have a handful of
boost::signal use in a sea of Links
This also fixes a regression in
commit 051b29e1025253f35f87a04e297760aa8b40611f
Author: Luboš Luňák <l.lunak@collabora.com>
Date: Sun Sep 14 15:45:02 2014 +0200
convert Edit autocomplete Hdl to boost signals2
where the conversion was...
- if ( maAutocompleteHdl.IsSet() )
+ if ( autocompleteSignal.empty() )
instead of the correct
+ if ( !autocompleteSignal.empty() )
Change-Id: I27270d94c782485c0a7e929bc4980af4527fe82b
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | include/svtools/autocmpledit.hxx | 2 | ||||
-rw-r--r-- | include/svtools/inettbc.hxx | 3 | ||||
-rw-r--r-- | include/vcl/edit.hxx | 11 | ||||
-rw-r--r-- | include/vcl/lstbox.hxx | 4 | ||||
-rw-r--r-- | starmath/inc/ElementsDockingWindow.hxx | 6 | ||||
-rw-r--r-- | starmath/inc/pch/precompiled_sm.hxx | 1 | ||||
-rw-r--r-- | starmath/source/ElementsDockingWindow.cxx | 10 | ||||
-rw-r--r-- | svtools/source/control/autocmpledit.cxx | 5 | ||||
-rw-r--r-- | svtools/source/control/inettbc.cxx | 7 | ||||
-rw-r--r-- | vcl/inc/listbox.hxx | 21 | ||||
-rw-r--r-- | vcl/inc/pch/precompiled_vcl.hxx | 2 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 44 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 34 | ||||
-rw-r--r-- | vcl/source/control/imp_listbox.cxx | 14 | ||||
-rw-r--r-- | vcl/source/control/listbox.cxx | 16 |
16 files changed, 63 insertions, 122 deletions
diff --git a/configure.ac b/configure.ac index 315bffaf9ae6..daa1810cd6a6 100644 --- a/configure.ac +++ b/configure.ac @@ -8761,11 +8761,6 @@ if test "$with_system_boost" = "yes"; then [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], []) AC_CHECK_HEADER(boost/function.hpp, [], [AC_MSG_ERROR(boost/function.hpp not found. install boost)], []) - AC_MSG_CHECKING([whether boost signals2 works]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/signals2/signal.hpp>]], - [[ boost::signals2::signal<void()> s; s(); ]])], - [AC_MSG_RESULT([yes])], - [AC_MSG_ERROR([no, install boost >= 1.55 or use --without-system-boost])]) CXXFLAGS="$CXXFLAGS -fno-exceptions" AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp> diff --git a/include/svtools/autocmpledit.hxx b/include/svtools/autocmpledit.hxx index 56df6e03e14c..79e36016380e 100644 --- a/include/svtools/autocmpledit.hxx +++ b/include/svtools/autocmpledit.hxx @@ -23,7 +23,7 @@ private: std::vector< OUString > m_aMatching; std::vector< OUString >::size_type m_nCurrent; - void AutoCompleteHandler( Edit* ); + DECL_DLLPRIVATE_LINK_TYPED(AutoCompleteHdl_Impl, Edit&, void); bool Match( const OUString& rText ); bool PreNotify( NotifyEvent& rNEvt ) override; diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx index daef69bec7a3..e6435f1a2ce6 100644 --- a/include/svtools/inettbc.hxx +++ b/include/svtools/inettbc.hxx @@ -48,10 +48,9 @@ friend class SvtURLBox_Impl; SVT_DLLPRIVATE bool ProcessKey( const vcl::KeyCode& rCode ); SVT_DLLPRIVATE void TryAutoComplete(); SVT_DLLPRIVATE void UpdatePicklistForSmartProtocol_Impl(); + DECL_DLLPRIVATE_LINK_TYPED( AutoCompleteHdl_Impl, Edit&, void ); SVT_DLLPRIVATE void Init(bool bSetDefaultHelpID); - SAL_DLLPRIVATE void AutoCompleteHandler( Edit* ); - protected: virtual bool Notify( NotifyEvent& rNEvt ) override; virtual void Select() override; diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx index 30741d517d33..628ada5870b4 100644 --- a/include/vcl/edit.hxx +++ b/include/vcl/edit.hxx @@ -32,9 +32,6 @@ #include <vcl/vclptr.hxx> #include <com/sun/star/uno/Reference.h> -// forward declare signals stuff - those headers are staggeringly expensive -namespace boost { namespace signals2 { class connection; } } - namespace com { namespace sun { namespace star { @@ -72,9 +69,6 @@ class Timer; class VCL_DLLPUBLIC Edit : public Control, public vcl::unohelper::DragAndDropClient { private: - struct Impl; - ::std::unique_ptr<Impl> m_pImpl; - VclPtr<Edit> mpSubEdit; Timer* mpUpdateDataTimer; TextFilter* mpFilterText; @@ -102,6 +96,7 @@ private: mbActivePopup:1; Link<Edit&,void> maModifyHdl; Link<Edit&,void> maUpdateDataHdl; + Link<Edit&,void> maAutocompleteHdl; css::uno::Reference<css::i18n::XExtendedInputSequenceChecker> mxISC; @@ -253,8 +248,8 @@ public: void SetSubEdit( Edit* pEdit ); Edit* GetSubEdit() const { return mpSubEdit; } - void SignalConnectAutocomplete(::boost::signals2::connection * pConnection, - ::std::function<void (Edit *)>); + void SetAutocompleteHdl( const Link<Edit&,void>& rLink ) { maAutocompleteHdl = rLink; } + const Link<Edit&,void>& GetAutocompleteHdl() const { return maAutocompleteHdl; } AutocompleteAction GetAutocompleteAction() const { return meAutocompleteAction; } virtual Size CalcMinimumSize() const; diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index e2050cf7ef47..5a5bc4dadd2c 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -98,11 +98,11 @@ private: DECL_DLLPRIVATE_LINK_TYPED( ImplDoubleClickHdl, ImplListBoxWindow*, void ); DECL_DLLPRIVATE_LINK_TYPED( ImplPopupModeEndHdl, FloatingWindow*, void ); DECL_DLLPRIVATE_LINK_TYPED( ImplSelectionChangedHdl, sal_Int32, void ); + DECL_DLLPRIVATE_LINK_TYPED( ImplUserDrawHdl, UserDrawEvent*, void ); DECL_DLLPRIVATE_LINK_TYPED( ImplFocusHdl, sal_Int32, void ); DECL_DLLPRIVATE_LINK_TYPED( ImplListItemSelectHdl, LinkParamNone*, void ); - SAL_DLLPRIVATE void ImplClickButtonHandler( Control* ); - SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* ); + DECL_DLLPRIVATE_LINK_TYPED( ImplClickBtnHdl, void*, void ); protected: using Window::ImplInit; diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index a458d9d20359..6518326ed693 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX #define INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX -#include <boost/signals2/signal.hpp> #include <sfx2/dockwin.hxx> #include <svx/dlgctrl.hxx> #include <vcl/scrbar.hxx> @@ -90,6 +89,7 @@ class SmElementsControl : public Control SmFormat maFormat; sal_uInt16 maCurrentSetId; SmElement* mpCurrentElement; + Link<SmElement&,void> maSelectHdlLink; std::vector< std::unique_ptr<SmElement> > maElementList; Size maMaxElementDimensions; @@ -122,7 +122,7 @@ public: DECL_LINK_TYPED( ScrollHdl, ScrollBar*, void ); void DoScroll(long nDelta); - boost::signals2::signal< void ( SmElement* ) > selectedSignal; + void SetSelectHdl(const Link<SmElement&,void>& rLink) { maSelectHdlLink = rLink; } }; class SmElementsDockingWindow : public SfxDockingWindow @@ -135,7 +135,7 @@ class SmElementsDockingWindow : public SfxDockingWindow virtual void Resize() override; SmViewShell* GetView(); - void SelectClickHandler(SmElement* pElement); + DECL_LINK_TYPED(SelectClickHandler, SmElement&, void); DECL_LINK_TYPED(ElementSelectedHandle, ListBox&, void); public: diff --git a/starmath/inc/pch/precompiled_sm.hxx b/starmath/inc/pch/precompiled_sm.hxx index 2d3175ac0cef..7decc8c2dae5 100644 --- a/starmath/inc/pch/precompiled_sm.hxx +++ b/starmath/inc/pch/precompiled_sm.hxx @@ -41,7 +41,6 @@ #include <boost/checked_delete.hpp> #include <boost/intrusive_ptr.hpp> #include <boost/optional/optional.hpp> -#include <boost/signals2/signal.hpp> #include <osl/diagnose.h> #include <osl/module.hxx> #include <osl/mutex.hxx> diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 1fca973e12f7..ea1fde843517 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -463,7 +463,7 @@ void SmElementsControl::MouseButtonDown(const MouseEvent& rMouseEvent) { GrabFocus(); - if (rMouseEvent.IsLeft() && Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel())) + if (rMouseEvent.IsLeft() && Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel()) && maSelectHdlLink.IsSet()) { for (size_t i = 0; i < maElementList.size() ; i++) { @@ -471,7 +471,7 @@ void SmElementsControl::MouseButtonDown(const MouseEvent& rMouseEvent) Rectangle rect(element->mBoxLocation, element->mBoxSize); if (rect.IsInside(rMouseEvent.GetPosPixel())) { - selectedSignal(element); + maSelectHdlLink.Call(*element); return; } } @@ -720,7 +720,7 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf mpElementsControl->SetBackground( Color( COL_WHITE ) ); mpElementsControl->SetTextColor( Color( COL_BLACK ) ); mpElementsControl->setElementSetId(RID_CATEGORY_UNARY_BINARY_OPERATORS); - mpElementsControl->selectedSignal.connect( boost::bind( &SmElementsDockingWindow::SelectClickHandler, this, _1 ) ); + mpElementsControl->SetSelectHdl(LINK(this, SmElementsDockingWindow, SelectClickHandler)); } SmElementsDockingWindow::~SmElementsDockingWindow () @@ -752,7 +752,7 @@ void SmElementsDockingWindow::EndDocking( const Rectangle& rReactangle, bool bFl mpElementsControl->setVerticalMode(bVertical); } -void SmElementsDockingWindow::SelectClickHandler( SmElement* pElement ) +IMPL_LINK_TYPED(SmElementsDockingWindow, SelectClickHandler, SmElement&, rElement, void) { SmViewShell* pViewSh = GetView(); @@ -760,7 +760,7 @@ void SmElementsDockingWindow::SelectClickHandler( SmElement* pElement ) { pViewSh->GetViewFrame()->GetDispatcher()->Execute( SID_INSERTCOMMANDTEXT, SfxCallMode::RECORD, - new SfxStringItem(SID_INSERTCOMMANDTEXT, pElement->getText()), 0L); + new SfxStringItem(SID_INSERTCOMMANDTEXT, rElement.getText()), 0L); } } diff --git a/svtools/source/control/autocmpledit.cxx b/svtools/source/control/autocmpledit.cxx index 8032b6e9c7c3..737f14056345 100644 --- a/svtools/source/control/autocmpledit.cxx +++ b/svtools/source/control/autocmpledit.cxx @@ -14,8 +14,7 @@ AutocompleteEdit::AutocompleteEdit( vcl::Window* pParent ) : Edit( pParent ) , m_nCurrent( 0 ) { - SignalConnectAutocomplete( nullptr, - [this] ( Edit *const pEdit ) { this->AutoCompleteHandler( pEdit ); } ); + SetAutocompleteHdl(LINK(this, AutocompleteEdit, AutoCompleteHdl_Impl)); } void AutocompleteEdit::AddEntry( const OUString& rEntry ) @@ -29,7 +28,7 @@ void AutocompleteEdit::ClearEntries() m_aMatching.clear(); } -void AutocompleteEdit::AutoCompleteHandler( Edit* ) +IMPL_LINK_NOARG_TYPED(AutocompleteEdit, AutoCompleteHdl_Impl, Edit&, void) { if( GetAutocompleteAction() != AUTOCOMPLETE_KEYINPUT ) return; diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index ad7162407709..98555b7b0db1 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -883,8 +883,7 @@ void SvtURLBox::Init(bool bSetDefaultHelpID) SetText( OUString() ); - GetSubEdit()->SignalConnectAutocomplete(nullptr, - [this] (Edit *const pEdit) { this->AutoCompleteHandler(pEdit); } ); + GetSubEdit()->SetAutocompleteHdl(LINK(this, SvtURLBox, AutoCompleteHdl_Impl)); UpdatePicklistForSmartProtocol_Impl(); EnableAutoSize(GetStyle() & WB_AUTOSIZE); @@ -1114,14 +1113,12 @@ bool SvtURLBox::PreNotify( NotifyEvent& rNEvt ) return ComboBox::PreNotify( rNEvt ); } - -void SvtURLBox::AutoCompleteHandler( Edit* ) +IMPL_LINK_NOARG_TYPED(SvtURLBox, AutoCompleteHdl_Impl, Edit&, void) { if ( GetSubEdit()->GetAutocompleteAction() == AUTOCOMPLETE_KEYINPUT ) TryAutoComplete(); } - bool SvtURLBox::Notify( NotifyEvent &rEvt ) { if ( MouseNotifyEvent::GETFOCUS == rEvt.GetType() ) diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx index 611f6b07dfde..f316e8f7501d 100644 --- a/vcl/inc/listbox.hxx +++ b/vcl/inc/listbox.hxx @@ -24,8 +24,6 @@ #include <vcl/floatwin.hxx> #include <vcl/quickselectionengine.hxx> -#include <boost/signals2/signal.hpp> - #include <vector> #include <memory> @@ -231,6 +229,7 @@ private: Link<LinkParamNone*,void> maSelectHdl; Link<LinkParamNone*,void> maCancelHdl; Link<ImplListBoxWindow*,void> maDoubleClickHdl; + Link<UserDrawEvent*, void> maUserDrawHdl; Link<LinkParamNone*,void> maMRUChangedHdl; Link<sal_Int32,void> maFocusHdl; Link<LinkParamNone*,void> maListItemSelectHdl; @@ -332,11 +331,10 @@ public: void SetSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maSelectHdl = rLink; } void SetCancelHdl( const Link<LinkParamNone*,void>& rLink ) { maCancelHdl = rLink; } void SetDoubleClickHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maDoubleClickHdl = rLink; } + void SetUserDrawHdl( const Link<UserDrawEvent*, void>& rLink ) { maUserDrawHdl = rLink; } void SetMRUChangedHdl( const Link<LinkParamNone*,void>& rLink ) { maMRUChangedHdl = rLink; } void SetFocusHdl( const Link<sal_Int32,void>& rLink ) { maFocusHdl = rLink ; } - boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal; - void SetListItemSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maListItemSelectHdl = rLink ; } bool IsSelectionChanged() const { return mbSelectionChanged; } sal_uInt16 GetSelectModifier() const { return mnSelectModifier; } @@ -460,9 +458,7 @@ public: void SetSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maLBWindow->SetSelectHdl( rLink ); } void SetCancelHdl( const Link<LinkParamNone*,void>& rLink ) { maLBWindow->SetCancelHdl( rLink ); } void SetDoubleClickHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maLBWindow->SetDoubleClickHdl( rLink ); } - - boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal; - + void SetUserDrawHdl( const Link<UserDrawEvent*, void>& rLink ) { maLBWindow->SetUserDrawHdl( rLink ); } void SetFocusHdl( const Link<sal_Int32,void>& rLink ) { maLBWindow->SetFocusHdl( rLink ); } void SetListItemSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maLBWindow->SetListItemSelectHdl( rLink ); } void SetSelectionChangedHdl( const Link<sal_Int32,void>& rLnk ) { maLBWindow->GetEntryList()->SetSelectionChangedHdl( rLnk ); } @@ -535,6 +531,9 @@ private: Rectangle maFocusRect; Size maUserItemSize; + Link<void*,void> maMBDownHdl; + Link<UserDrawEvent*, void> maUserDrawHdl; + /// bitfield bool mbUserDrawEnabled : 1; bool mbInUserDraw : 1; @@ -563,8 +562,8 @@ public: void MBDown(); - boost::signals2::signal< void ( ImplWin* ) > buttonDownSignal; - boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal; + void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; } + void SetUserDrawHdl( const Link<UserDrawEvent*, void>& rLink ) { maUserDrawHdl = rLink; } void SetUserItemSize( const Size& rSz ) { maUserItemSize = rSz; } @@ -588,14 +587,14 @@ class ImplBtn : public PushButton { private: bool mbDown; + Link<void*,void> maMBDownHdl; public: ImplBtn( vcl::Window* pParent, WinBits nWinStyle = 0 ); virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; void MBDown(); - - boost::signals2::signal< void ( ImplBtn* ) > buttonDownSignal; + void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; } }; void ImplInitDropDownButton( PushButton* pButton ); diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index 4d79b7caac3b..d3ef8195580e 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -59,8 +59,6 @@ #include <boost/multi_array.hpp> #include <boost/optional.hpp> #include <boost/shared_array.hpp> -#include <boost/signals2/connection.hpp> -#include <boost/signals2/signal.hpp> #include <osl/conditn.hxx> #include <osl/diagnose.h> #include <osl/diagnose.hxx> diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 9d0bc7e1dc5b..c474cd350a9d 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -21,8 +21,6 @@ #include <set> -#include <boost/signals2/connection.hpp> - #include <comphelper/string.hxx> #include <tools/debug.hxx> #include <tools/rc.h> @@ -61,7 +59,6 @@ struct ComboBox::Impl sal_Int32 m_nMaxWidthChars; Link<ComboBox&,void> m_SelectHdl; Link<ComboBox&,void> m_DoubleClickHdl; - boost::signals2::scoped_connection m_AutocompleteConnection; explicit Impl(ComboBox & rThis) : m_rThis(rThis) @@ -82,13 +79,12 @@ struct ComboBox::Impl DECL_DLLPRIVATE_LINK_TYPED( ImplSelectHdl, LinkParamNone*, void ); DECL_DLLPRIVATE_LINK_TYPED( ImplCancelHdl, LinkParamNone*, void ); DECL_DLLPRIVATE_LINK_TYPED( ImplDoubleClickHdl, ImplListBoxWindow*, void ); + DECL_DLLPRIVATE_LINK_TYPED( ImplClickBtnHdl, void*, void ); DECL_DLLPRIVATE_LINK_TYPED( ImplPopupModeEndHdl, FloatingWindow*, void ); DECL_DLLPRIVATE_LINK_TYPED( ImplSelectionChangedHdl, sal_Int32, void ); + DECL_DLLPRIVATE_LINK_TYPED( ImplUserDrawHdl, UserDrawEvent*, void ); + DECL_DLLPRIVATE_LINK_TYPED( ImplAutocompleteHdl, Edit&, void ); DECL_DLLPRIVATE_LINK_TYPED( ImplListItemSelectHdl , LinkParamNone*, void ); - - void ImplClickButtonHandler( ImplBtn* ); - void ImplUserDrawHandler( UserDrawEvent* ); - void ImplAutocompleteHandler( Edit* ); }; @@ -215,8 +211,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) m_pImpl->m_pBtn = VclPtr<ImplBtn>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE ); ImplInitDropDownButton( m_pImpl->m_pBtn ); - m_pImpl->m_pBtn->buttonDownSignal.connect( [this]( ImplBtn* pImplBtn ) - { this->m_pImpl->ImplClickButtonHandler( pImplBtn ); } ); + m_pImpl->m_pBtn->SetMBDownHdl( LINK( m_pImpl.get(), ComboBox::Impl, ImplClickBtnHdl ) ); m_pImpl->m_pBtn->Show(); nEditStyle |= WB_NOBORDER; @@ -248,8 +243,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) m_pImpl->m_pImplLB->SetSelectHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplSelectHdl) ); m_pImpl->m_pImplLB->SetCancelHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplCancelHdl) ); m_pImpl->m_pImplLB->SetDoubleClickHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplDoubleClickHdl) ); - m_pImpl->m_pImplLB->userDrawSignal.connect( [this]( UserDrawEvent* pUserDrawEvent ) - { this->m_pImpl->ImplUserDrawHandler( pUserDrawEvent ); } ); + m_pImpl->m_pImplLB->SetUserDrawHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplUserDrawHdl) ); m_pImpl->m_pImplLB->SetSelectionChangedHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplSelectionChangedHdl) ); m_pImpl->m_pImplLB->SetListItemSelectHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplListItemSelectHdl) ); m_pImpl->m_pImplLB->Show(); @@ -293,25 +287,17 @@ void ComboBox::EnableAutocomplete( bool bEnable, bool bMatchCase ) m_pImpl->m_isMatchCase = bMatchCase; if ( bEnable ) - { - if( !m_pImpl->m_AutocompleteConnection.connected()) - { - m_pImpl->m_pSubEdit->SignalConnectAutocomplete( - &m_pImpl->m_AutocompleteConnection, - [this] (Edit *const pEdit) { m_pImpl->ImplAutocompleteHandler(pEdit); } - ); - } - } + m_pImpl->m_pSubEdit->SetAutocompleteHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplAutocompleteHdl) ); else - m_pImpl->m_AutocompleteConnection.disconnect(); + m_pImpl->m_pSubEdit->SetAutocompleteHdl( Link<Edit&,void>() ); } bool ComboBox::IsAutocompleteEnabled() const { - return m_pImpl->m_AutocompleteConnection.connected(); + return m_pImpl->m_pSubEdit->GetAutocompleteHdl().IsSet(); } -void ComboBox::Impl::ImplClickButtonHandler( ImplBtn* ) +IMPL_LINK_NOARG_TYPED(ComboBox::Impl, ImplClickBtnHdl, void*, void) { m_rThis.CallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN ); m_pSubEdit->GrabFocus(); @@ -352,10 +338,10 @@ IMPL_LINK_NOARG_TYPED(ComboBox::Impl, ImplPopupModeEndHdl, FloatingWindow*, void m_rThis.CallEventListeners( VCLEVENT_DROPDOWN_CLOSE ); } -void ComboBox::Impl::ImplAutocompleteHandler( Edit* pEdit ) +IMPL_LINK_TYPED(ComboBox::Impl, ImplAutocompleteHdl, Edit&, rEdit, void) { - Selection aSel = pEdit->GetSelection(); - AutocompleteAction eAction = pEdit->GetAutocompleteAction(); + Selection aSel = rEdit.GetSelection(); + AutocompleteAction eAction = rEdit.GetAutocompleteAction(); /* If there is no current selection do not auto complete on Tab/Shift-Tab since then we would not cycle to the next field. @@ -363,7 +349,7 @@ void ComboBox::Impl::ImplAutocompleteHandler( Edit* pEdit ) if ( aSel.Len() || ((eAction != AUTOCOMPLETE_TABFORWARD) && (eAction != AUTOCOMPLETE_TABBACKWARD)) ) { - OUString aFullText = pEdit->GetText(); + OUString aFullText = rEdit.GetText(); OUString aStartText = aFullText.copy( 0, (sal_Int32)aSel.Max() ); sal_Int32 nStart = m_pImplLB->GetCurrentPos(); @@ -407,7 +393,7 @@ void ComboBox::Impl::ImplAutocompleteHandler( Edit* pEdit ) { OUString aText = m_pImplLB->GetEntryList()->GetEntryText( nPos ); Selection aSelection( aText.getLength(), aStartText.getLength() ); - pEdit->SetText( aText, aSelection ); + rEdit.SetText( aText, aSelection ); } } } @@ -1319,7 +1305,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, D } -void ComboBox::Impl::ImplUserDrawHandler( UserDrawEvent* pEvent ) +IMPL_LINK_TYPED(ComboBox::Impl, ImplUserDrawHdl, UserDrawEvent*, pEvent, void) { m_rThis.UserDraw(*pEvent); } diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 7520cb416d0d..5af9723e181c 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -66,8 +66,6 @@ #include <officecfg/Office/Common.hxx> -#include <boost/signals2/signal.hpp> - #include <memory> using namespace ::com::sun::star; @@ -157,21 +155,14 @@ void Impl_IMEInfos::DestroyAttribs() nLen = 0; } -struct Edit::Impl -{ - boost::signals2::signal< void (Edit *) > m_AutocompleteSignal; -}; - Edit::Edit( WindowType nType ) : Control( nType ) - , m_pImpl(new Impl) { ImplInitEditData(); } Edit::Edit( vcl::Window* pParent, WinBits nStyle ) : Control( WINDOW_EDIT ) - , m_pImpl(new Impl) { ImplInitEditData(); ImplInit( pParent, nStyle ); @@ -179,7 +170,6 @@ Edit::Edit( vcl::Window* pParent, WinBits nStyle ) Edit::Edit( vcl::Window* pParent, const ResId& rResId ) : Control( WINDOW_EDIT ) - , m_pImpl(new Impl) { rResId.SetRT( RSC_EDIT ); WinBits nStyle = ImplInitRes( rResId ); @@ -1659,12 +1649,12 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) ImplCopyToSelectionClipboard(); } - if (bGoEnd && !m_pImpl->m_AutocompleteSignal.empty() && !rKEvt.GetKeyCode().GetModifier()) + if (bGoEnd && maAutocompleteHdl.IsSet() && !rKEvt.GetKeyCode().GetModifier()) { if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) ) { meAutocompleteAction = AUTOCOMPLETE_KEYINPUT; - m_pImpl->m_AutocompleteSignal( this ); + maAutocompleteHdl.Call(*this); } } @@ -1759,12 +1749,12 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) if ( !mbReadOnly ) { ImplInsertText(OUString(rKEvt.GetCharCode()), nullptr, true); - if (!m_pImpl->m_AutocompleteSignal.empty()) + if (maAutocompleteHdl.IsSet()) { if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) ) { meAutocompleteAction = AUTOCOMPLETE_KEYINPUT; - m_pImpl->m_AutocompleteSignal( this ); + maAutocompleteHdl.Call(*this); } } } @@ -2125,12 +2115,12 @@ void Edit::Command( const CommandEvent& rCEvt ) Invalidate(); // #i25161# call auto complete handler for ext text commit also - if (m_pImpl->m_AutocompleteSignal.empty()) + if (maAutocompleteHdl.IsSet()) { if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) ) { meAutocompleteAction = AUTOCOMPLETE_KEYINPUT; - m_pImpl->m_AutocompleteSignal( this ); + maAutocompleteHdl.Call(*this); } } } @@ -2752,7 +2742,7 @@ void Edit::SetSubEdit(Edit* pEdit) mpSubEdit->mbIsSubEdit = true; mpSubEdit->SetReadOnly(mbReadOnly); - mpSubEdit->m_pImpl->m_AutocompleteSignal.connect(m_pImpl->m_AutocompleteSignal); + mpSubEdit->maAutocompleteHdl = maAutocompleteHdl; } } @@ -3079,14 +3069,4 @@ Selection Edit::GetSurroundingTextSelection() const return GetSelection(); } -void Edit::SignalConnectAutocomplete( - boost::signals2::connection *const pConnection, - std::function<void (Edit *)> slot) -{ - boost::signals2::connection const& rConnection( - m_pImpl->m_AutocompleteSignal.connect(slot)); - if (pConnection) - *pConnection = rConnection; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 65fd57a0bd61..ed3d39cbd8fd 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -1745,7 +1745,7 @@ void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nCurr = sal::static_int_cast<sal_Int32>(nCurr - GetEntryList()->GetMRUCount()); UserDrawEvent aUDEvt(this, &rRenderContext, aRect, nPos, nCurr); - userDrawSignal(&aUDEvt); + maUserDrawHdl.Call( &aUDEvt ); mbInUserDraw = false; } else @@ -2136,8 +2136,6 @@ ImplListBox::ImplListBox( vcl::Window* pParent, WinBits nWinStyle ) : Control( pParent, nWinStyle ), maLBWindow(VclPtr<ImplListBoxWindow>::Create( this, nWinStyle&(~WB_BORDER) )) { - maLBWindow->userDrawSignal.connect( userDrawSignal ); - // for native widget rendering we must be able to detect this window type SetType( WINDOW_LISTBOXWINDOW ); @@ -2611,8 +2609,8 @@ ImplWin::ImplWin( vcl::Window* pParent, WinBits nWinStyle ) : void ImplWin::MBDown() { - if( IsEnabled() ) - buttonDownSignal( this ); + if (IsEnabled()) + maMBDownHdl.Call(this); } void ImplWin::MouseButtonDown( const MouseEvent& ) @@ -2751,7 +2749,7 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout) { mbInUserDraw = true; UserDrawEvent aUDEvt(this, &rRenderContext, maFocusRect, mnItemPos, 0); - userDrawSignal( &aUDEvt ); + maUserDrawHdl.Call( &aUDEvt ); mbInUserDraw = false; } else @@ -2921,8 +2919,8 @@ ImplBtn::ImplBtn( vcl::Window* pParent, WinBits nWinStyle ) : void ImplBtn::MBDown() { - if( IsEnabled() ) - buttonDownSignal( this ); + if (IsEnabled()) + maMBDownHdl.Call(this); } void ImplBtn::MouseButtonDown( const MouseEvent& ) diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index e7cc02617fe6..ba78bc64647b 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -137,18 +137,15 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) mpFloatWin->GetDropTarget()->addDropTargetListener(xDrop); mpImplWin = VclPtr<ImplWin>::Create( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER ); - mpImplWin->buttonDownSignal.connect( [this]( Control* pControl ) - { this->ImplClickButtonHandler( pControl ); } ); - mpImplWin->userDrawSignal.connect( [this]( UserDrawEvent* pUserDrawEvent ) - { this->ImplUserDrawHandler( pUserDrawEvent ); } ); + mpImplWin->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) ); + mpImplWin->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) ); mpImplWin->Show(); mpImplWin->GetDropTarget()->addDropTargetListener(xDrop); mpImplWin->SetEdgeBlending(GetEdgeBlending()); mpBtn = VclPtr<ImplBtn>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE ); ImplInitDropDownButton( mpBtn ); - mpBtn->buttonDownSignal.connect( [this]( Control* pControl ) - { this->ImplClickButtonHandler( pControl ); } ); + mpBtn->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) ); mpBtn->Show(); mpBtn->GetDropTarget()->addDropTargetListener(xDrop); } @@ -161,8 +158,7 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) mpImplLB->SetScrollHdl( LINK( this, ListBox, ImplScrollHdl ) ); mpImplLB->SetCancelHdl( LINK( this, ListBox, ImplCancelHdl ) ); mpImplLB->SetDoubleClickHdl( LINK( this, ListBox, ImplDoubleClickHdl ) ); - mpImplLB->userDrawSignal.connect( [this]( UserDrawEvent* pUserDrawEvent ) - { this->ImplUserDrawHandler( pUserDrawEvent ); } ); + mpImplLB->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) ); mpImplLB->SetFocusHdl( LINK( this, ListBox, ImplFocusHdl ) ); mpImplLB->SetListItemSelectHdl( LINK( this, ListBox, ImplListItemSelectHdl ) ); mpImplLB->SetPosPixel( Point() ); @@ -294,7 +290,7 @@ IMPL_LINK_NOARG_TYPED(ListBox, ImplDoubleClickHdl, ImplListBoxWindow*, void) DoubleClick(); } -void ListBox::ImplClickButtonHandler( Control* ) +IMPL_LINK_NOARG_TYPED(ListBox, ImplClickBtnHdl, void*, void) { if( !mpFloatWin->IsInPopupMode() ) { @@ -1381,7 +1377,7 @@ void ListBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines } } -void ListBox::ImplUserDrawHandler( UserDrawEvent* pEvent ) +IMPL_LINK_TYPED( ListBox, ImplUserDrawHdl, UserDrawEvent*, pEvent, void ) { UserDraw( *pEvent ); } |