[Libreoffice-commits] core.git: 5 commits - configure.ac external/boost include/svtools include/vcl svtools/source vcl/inc vcl/source

Luboš Luňák l.lunak at collabora.com
Sun Sep 14 13:07:51 PDT 2014


 configure.ac                                          |    7 ++++
 external/boost/UnpackedTarball_boost.mk               |    1 
 external/boost/boost.signals2.unused.parameters.patch |   20 +++++++++++++
 include/svtools/inettbc.hxx                           |    3 +-
 include/vcl/combobox.hxx                              |    9 ++++--
 include/vcl/edit.hxx                                  |    5 +--
 include/vcl/lstbox.hxx                                |    6 ++--
 svtools/source/control/inettbc.cxx                    |    9 +-----
 vcl/inc/ilstbox.hxx                                   |   26 ++++++------------
 vcl/source/control/combobox.cxx                       |   25 ++++++++---------
 vcl/source/control/edit.cxx                           |   24 ++++++----------
 vcl/source/control/ilstbox.cxx                        |   10 ++++--
 vcl/source/control/lstbox.cxx                         |   15 ++++------
 13 files changed, 85 insertions(+), 75 deletions(-)

New commits:
commit 051b29e1025253f35f87a04e297760aa8b40611f
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Sun Sep 14 15:45:02 2014 +0200

    convert Edit autocomplete Hdl to boost signals2
    
    Here it also keep track of the connection, as it needs to be explicitly
    disconnected in one place.
    
    Change-Id: Id3e2882106ae55c2d880898956a36f84d3ce70ef

diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
index 82e3248..8d073a8 100644
--- a/include/svtools/inettbc.hxx
+++ b/include/svtools/inettbc.hxx
@@ -48,9 +48,10 @@ friend class SvtURLBox_Impl;
     SVT_DLLPRIVATE bool             ProcessKey( const vcl::KeyCode& rCode );
     SVT_DLLPRIVATE void             TryAutoComplete();
     SVT_DLLPRIVATE void             UpdatePicklistForSmartProtocol_Impl();
-    DECL_DLLPRIVATE_LINK(           AutoCompleteHdl_Impl, void* );
     SVT_DLLPRIVATE void             Init(bool bSetDefaultHelpID);
 
+    SAL_DLLPRIVATE void AutoCompleteHandler( Edit* );
+
 protected:
     virtual bool                    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     virtual void                    Select() SAL_OVERRIDE;
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index 95e3519..b80d088 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_VCL_COMBOBOX_HXX
 #define INCLUDED_VCL_COMBOBOX_HXX
 
+#include <boost/signals2/connection.hpp>
 #include <vcl/dllapi.h>
 #include <vcl/ctrl.hxx>
 #include <vcl/combobox.h>
@@ -50,6 +51,7 @@ private:
     sal_Int32 m_nMaxWidthChars;
     Link                        maSelectHdl;
     Link                        maDoubleClickHdl;
+    boost::signals2::scoped_connection mAutocompleteConnection;
 
     struct ComboBoxBounds
     {
@@ -71,11 +73,11 @@ private:
     DECL_DLLPRIVATE_LINK(   ImplDoubleClickHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplPopupModeEndHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplSelectionChangedHdl, void* );
-    DECL_DLLPRIVATE_LINK(   ImplAutocompleteHdl, Edit* );
     DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
 
     SAL_DLLPRIVATE void ImplClickButtonHandler( ImplBtn* );
     SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* );
+    SAL_DLLPRIVATE void ImplAutocompleteHandler( Edit* );
 
 protected:
     using Window::ImplInit;
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 391e825..5d41a1b 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_VCL_EDIT_HXX
 #define INCLUDED_VCL_EDIT_HXX
 
+#include <boost/signals2/signal.hpp>
 #include <tools/solar.h>
 #include <vcl/dllapi.h>
 #include <vcl/timer.hxx>
@@ -94,7 +95,6 @@ private:
                         mbActivePopup:1;
     Link                maModifyHdl;
     Link                maUpdateDataHdl;
-    Link                maAutocompleteHdl;
 
     css::uno::Reference < css::i18n::XExtendedInputSequenceChecker > mxISC;
 
@@ -238,8 +238,7 @@ public:
     void                SetSubEdit( Edit* pEdit );
     Edit*               GetSubEdit() const { return mpSubEdit; }
 
-    void                SetAutocompleteHdl( const Link& rHdl );
-    const Link&         GetAutocompleteHdl() const { return maAutocompleteHdl; }
+    boost::signals2::signal< void ( Edit* ) > autocompleteSignal;
     AutocompleteAction  GetAutocompleteAction() const { return meAutocompleteAction; }
 
     virtual Size        CalcMinimumSize() const;
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index e8e4d1c..a585053 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -899,7 +899,7 @@ void SvtURLBox::Init(bool bSetDefaultHelpID)
 
     SetText( OUString() );
 
-    GetSubEdit()->SetAutocompleteHdl( LINK( this, SvtURLBox, AutoCompleteHdl_Impl ) );
+    GetSubEdit()->autocompleteSignal.connect( boost::bind( &SvtURLBox::AutoCompleteHandler, this, _1 ) );
     UpdatePicklistForSmartProtocol_Impl();
 
     EnableAutoSize(GetStyle() & WB_AUTOSIZE);
@@ -1127,15 +1127,10 @@ bool SvtURLBox::PreNotify( NotifyEvent& rNEvt )
 }
 
 
-IMPL_LINK_NOARG(SvtURLBox, AutoCompleteHdl_Impl)
+void SvtURLBox::AutoCompleteHandler( Edit* )
 {
     if ( GetSubEdit()->GetAutocompleteAction() == AUTOCOMPLETE_KEYINPUT )
-    {
         TryAutoComplete();
-        return 1L;
-    }
-
-    return 0L;
 }
 
 
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 700fe04..93d6c29 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -224,14 +224,18 @@ void ComboBox::EnableAutocomplete( bool bEnable, bool bMatchCase )
     mbMatchCase = bMatchCase;
 
     if ( bEnable )
-        mpSubEdit->SetAutocompleteHdl( LINK( this, ComboBox, ImplAutocompleteHdl ) );
+    {
+        if( !mAutocompleteConnection.connected())
+            mAutocompleteConnection = mpSubEdit->autocompleteSignal.connect(
+                boost::bind( &ComboBox::ImplAutocompleteHandler, this, _1 ) );
+    }
     else
-        mpSubEdit->SetAutocompleteHdl( Link() );
+        mAutocompleteConnection.disconnect();
 }
 
 bool ComboBox::IsAutocompleteEnabled() const
 {
-    return mpSubEdit->GetAutocompleteHdl().IsSet();
+    return mAutocompleteConnection.connected();
 }
 
 void ComboBox::ImplClickButtonHandler( ImplBtn* )
@@ -275,7 +279,7 @@ IMPL_LINK_NOARG(ComboBox, ImplPopupModeEndHdl)
     return 0;
 }
 
-IMPL_LINK( ComboBox, ImplAutocompleteHdl, Edit*, pEdit )
+void ComboBox::ImplAutocompleteHandler( Edit* pEdit )
 {
     Selection           aSel = pEdit->GetSelection();
     AutocompleteAction  eAction = pEdit->GetAutocompleteAction();
@@ -326,8 +330,6 @@ IMPL_LINK( ComboBox, ImplAutocompleteHdl, Edit*, pEdit )
             pEdit->SetText( aText, aSelection );
         }
     }
-
-    return 0;
 }
 
 IMPL_LINK_NOARG(ComboBox, ImplSelectHdl)
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 287339c..404a0a0 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1615,12 +1615,12 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
                         ImplCopyToSelectionClipboard();
                     }
 
-                    if ( bGoEnd && maAutocompleteHdl.IsSet() && !rKEvt.GetKeyCode().GetModifier() )
+                    if ( bGoEnd && !autocompleteSignal.empty() && !rKEvt.GetKeyCode().GetModifier() )
                     {
                         if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) )
                         {
                             meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
-                            maAutocompleteHdl.Call( this );
+                            autocompleteSignal( this );
                         }
                     }
 
@@ -1686,7 +1686,7 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
                not suddenly to cycle the autocompletion
             case KEY_TAB:
             {
-                if ( !mbReadOnly && maAutocompleteHdl.IsSet() &&
+                if ( !mbReadOnly && !autocompleteSignal.empty() &&
                      maSelection.Min() && (maSelection.Min() == maText.Len()) &&
                      !rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsMod2() )
                 {
@@ -1697,7 +1697,7 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
                     else
                         meAutocompleteAction = AUTOCOMPLETE_TABFORWARD;
 
-                    maAutocompleteHdl.Call( this );
+                    autocompleteSignal( this );
 
                     // Wurde nichts veraendert, dann TAB fuer DialogControl
                     if ( GetSelection().Len() )
@@ -1715,12 +1715,12 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
                     if ( !mbReadOnly )
                     {
                         ImplInsertText(OUString(rKEvt.GetCharCode()), 0, true);
-                        if ( maAutocompleteHdl.IsSet() )
+                        if ( !autocompleteSignal.empty() )
                         {
                             if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) )
                             {
                                 meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
-                                maAutocompleteHdl.Call( this );
+                                autocompleteSignal( this );
                             }
                         }
                     }
@@ -2080,12 +2080,12 @@ void Edit::Command( const CommandEvent& rCEvt )
         ImplModified();
 
         // #i25161# call auto complete handler for ext text commit also
-        if ( maAutocompleteHdl.IsSet() )
+        if ( autocompleteSignal.empty() )
         {
             if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) )
             {
                 meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
-                maAutocompleteHdl.Call( this );
+                autocompleteSignal( this );
             }
         }
     }
@@ -2446,13 +2446,6 @@ void Edit::SetReadOnly( bool bReadOnly )
     }
 }
 
-void Edit::SetAutocompleteHdl( const Link& rHdl )
-{
-    maAutocompleteHdl = rHdl;
-    if ( mpSubEdit )
-        mpSubEdit->SetAutocompleteHdl( rHdl );
-}
-
 void Edit::SetInsertMode( bool bInsert )
 {
     if ( bInsert != mbInsertMode )
@@ -2709,6 +2702,7 @@ void Edit::SetSubEdit( Edit* pEdit )
         mpSubEdit->mbIsSubEdit = true;
 
         mpSubEdit->SetReadOnly( mbReadOnly );
+        mpSubEdit->autocompleteSignal.connect( autocompleteSignal );
     }
 }
 
commit d6a83d3f91336e23b51bfc3b3d58da799760829f
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Sun Sep 14 13:36:10 2014 +0200

    convert UserDrawHdl to boost signals2
    
    Note that ImplListBox::userDrawSignal is connected to
    ImplListBoxWindow::userDrawSignal to forward the signal, just like
    the Link was previously forwarded.
    
    Change-Id: Ic8fc6f51e309bc34fb4e39c13745302649991d0a

diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index c82239d..95e3519 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -71,11 +71,11 @@ private:
     DECL_DLLPRIVATE_LINK(   ImplDoubleClickHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplPopupModeEndHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplSelectionChangedHdl, void* );
-    DECL_DLLPRIVATE_LINK(   ImplUserDrawHdl, UserDrawEvent* );
     DECL_DLLPRIVATE_LINK(   ImplAutocompleteHdl, Edit* );
     DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
 
     SAL_DLLPRIVATE void ImplClickButtonHandler( ImplBtn* );
+    SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* );
 
 protected:
     using Window::ImplInit;
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 4307888..29bf86d 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -61,11 +61,12 @@ private:
     DECL_DLLPRIVATE_LINK(  ImplDoubleClickHdl, void* );
     DECL_DLLPRIVATE_LINK(  ImplPopupModeEndHdl, void* );
     DECL_DLLPRIVATE_LINK(  ImplSelectionChangedHdl, void* );
-    DECL_DLLPRIVATE_LINK(  ImplUserDrawHdl, UserDrawEvent* );
     DECL_DLLPRIVATE_LINK(  ImplFocusHdl, void* );
     DECL_DLLPRIVATE_LINK(  ImplListItemSelectHdl, void* );
 
     SAL_DLLPRIVATE void ImplClickButtonHandler( Control* );
+    SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* );
+
 protected:
     using Window::ImplInit;
     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index c8a49a4..2b04935 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -233,7 +233,6 @@ private:
     Link            maSelectHdl;
     Link            maCancelHdl;
     Link            maDoubleClickHdl;
-    Link            maUserDrawHdl;
     Link            maMRUChangedHdl;
     Link            maFocusHdl;
     Link            maListItemSelectHdl;
@@ -342,13 +341,13 @@ public:
     const Link&     GetCancelHdl() const                { return maCancelHdl; }
     void            SetDoubleClickHdl( const Link& rLink )  { maDoubleClickHdl = rLink; }
     const Link&     GetDoubleClickHdl() const               { return maDoubleClickHdl; }
-    void            SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; }
-    const Link&     GetUserDrawHdl() const              { return maUserDrawHdl; }
     void            SetMRUChangedHdl( const Link& rLink )   { maMRUChangedHdl = rLink; }
     const Link&     GetMRUChangedHdl() const                { return maMRUChangedHdl; }
     void            SetFocusHdl( const Link& rLink )    { maFocusHdl = rLink ; }
     const Link&     GetFocusHdl() const             { return maFocusHdl; }
 
+    boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal;
+
     void            SetListItemSelectHdl( const Link& rLink )   { maListItemSelectHdl = rLink ; }
     const Link&     GetListItemSelectHdl() const                { return maListItemSelectHdl; }
     bool            IsSelectionChanged() const { return mbSelectionChanged; }
@@ -478,8 +477,8 @@ public:
     const Link&     GetCancelHdl() const                { return maLBWindow.GetCancelHdl(); }
     void            SetDoubleClickHdl( const Link& rLink )  { maLBWindow.SetDoubleClickHdl( rLink ); }
     const Link&     GetDoubleClickHdl() const               { return maLBWindow.GetDoubleClickHdl(); }
-    void            SetUserDrawHdl( const Link& rLink ) { maLBWindow.SetUserDrawHdl( rLink ); }
-    const Link&     GetUserDrawHdl() const              { return maLBWindow.GetUserDrawHdl(); }
+
+    boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal;
 
     void            SetFocusHdl( const Link& rLink )    { maLBWindow.SetFocusHdl( rLink ); }
     const Link&     GetFocusHdl() const             { return maLBWindow.GetFocusHdl(); }
@@ -555,8 +554,6 @@ private:
     Rectangle       maFocusRect;
     Size            maUserItemSize;
 
-    Link            maUserDrawHdl;
-
     /// bitfield
     bool            mbUserDrawEnabled : 1;
     bool            mbInUserDraw : 1;
@@ -589,9 +586,7 @@ public:
     virtual void    MBDown();
 
     boost::signals2::signal< void ( ImplWin* ) > buttonDownSignal;
-
-    void            SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; }
-    const Link&     GetUserDrawHdl() const              { return maUserDrawHdl; }
+    boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal;
 
     void            SetUserItemSize( const Size& rSz )  { maUserItemSize = rSz; }
     const Size&     GetUserItemSize() const             { return maUserItemSize; }
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 0ac87c7..700fe04 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -180,7 +180,7 @@ void ComboBox::ImplInit( Window* pParent, WinBits nStyle )
     mpImplLB->SetSelectHdl( LINK( this, ComboBox, ImplSelectHdl ) );
     mpImplLB->SetCancelHdl( LINK( this, ComboBox, ImplCancelHdl ) );
     mpImplLB->SetDoubleClickHdl( LINK( this, ComboBox, ImplDoubleClickHdl ) );
-    mpImplLB->SetUserDrawHdl( LINK( this, ComboBox, ImplUserDrawHdl ) );
+    mpImplLB->userDrawSignal.connect( boost::bind( &ComboBox::ImplUserDrawHandler, this, _1 ) );
     mpImplLB->SetSelectionChangedHdl( LINK( this, ComboBox, ImplSelectionChangedHdl ) );
     mpImplLB->SetListItemSelectHdl( LINK( this, ComboBox, ImplListItemSelectHdl ) );
     mpImplLB->Show();
@@ -1221,10 +1221,9 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, s
 
 }
 
-IMPL_LINK( ComboBox, ImplUserDrawHdl, UserDrawEvent*, pEvent )
+void::ComboBox::ImplUserDrawHandler( UserDrawEvent* pEvent )
 {
     UserDraw( *pEvent );
-    return 1;
 }
 
 void ComboBox::UserDraw( const UserDrawEvent& )
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index bbc1f2a..75c7d2c 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1739,7 +1739,7 @@ void ImplListBoxWindow::ImplPaint( sal_Int32 nPos, bool bErase, bool bLayout )
         nCurr = sal::static_int_cast<sal_Int32>( nCurr - GetEntryList()->GetMRUCount());
 
         UserDrawEvent aUDEvt( this, aRect, nPos, nCurr );
-        maUserDrawHdl.Call( &aUDEvt );
+        userDrawSignal( &aUDEvt );
         mbInUserDraw = false;
     }
     else
@@ -2132,6 +2132,8 @@ ImplListBox::ImplListBox( Window* pParent, WinBits nWinStyle ) :
     Control( pParent, nWinStyle ),
     maLBWindow( this, nWinStyle&(~WB_BORDER) )
 {
+    maLBWindow.userDrawSignal.connect( userDrawSignal );
+
     // for native widget rendering we must be able to detect this window type
     SetType( WINDOW_LISTBOXWINDOW );
 
@@ -2737,7 +2739,7 @@ void ImplWin::ImplDraw( bool bLayout )
     {
         mbInUserDraw = true;
         UserDrawEvent aUDEvt( this, maFocusRect, mnItemPos, 0 );
-        maUserDrawHdl.Call( &aUDEvt );
+        userDrawSignal( &aUDEvt );
         mbInUserDraw = false;
     }
     else
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index ef18971..02a54ba 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -137,7 +137,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle )
 
         mpImplWin = new ImplWin( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER );
         mpImplWin->buttonDownSignal.connect( boost::bind( &ListBox::ImplClickButtonHandler, this, _1 ));
-        mpImplWin->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) );
+        mpImplWin->userDrawSignal.connect( boost::bind( &ListBox::ImplUserDrawHandler, this, _1 ) );
         mpImplWin->Show();
         mpImplWin->GetDropTarget()->addDropTargetListener(xDrop);
         mpImplWin->SetEdgeBlending(GetEdgeBlending());
@@ -157,7 +157,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle )
     mpImplLB->SetScrollHdl( LINK( this, ListBox, ImplScrollHdl ) );
     mpImplLB->SetCancelHdl( LINK( this, ListBox, ImplCancelHdl ) );
     mpImplLB->SetDoubleClickHdl( LINK( this, ListBox, ImplDoubleClickHdl ) );
-    mpImplLB->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) );
+    mpImplLB->userDrawSignal.connect( boost::bind( &ListBox::ImplUserDrawHandler, this, _1 ) );
     mpImplLB->SetFocusHdl( LINK( this, ListBox, ImplFocusHdl ) );
     mpImplLB->SetListItemSelectHdl( LINK( this, ListBox, ImplListItemSelectHdl ) );
     mpImplLB->SetPosPixel( Point() );
@@ -1360,10 +1360,9 @@ void ListBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines
     }
 }
 
-IMPL_LINK( ListBox, ImplUserDrawHdl, UserDrawEvent*, pEvent )
+void ListBox::ImplUserDrawHandler( UserDrawEvent* pEvent )
 {
     UserDraw( *pEvent );
-    return 1;
 }
 
 void ListBox::UserDraw( const UserDrawEvent& )
commit 96369e97a014a279db61b8e37bc54270f7beaccb
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Sun Sep 14 13:07:31 2014 +0200

    convert ListBox's ImplBtn to use boost signal2
    
    Change-Id: I18680e47688da02c9e211bf7f8d861622735e749

diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index f0dd459..c82239d 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -69,13 +69,14 @@ private:
     DECL_DLLPRIVATE_LINK(   ImplSelectHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplCancelHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplDoubleClickHdl, void* );
-    DECL_DLLPRIVATE_LINK(   ImplClickBtnHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplPopupModeEndHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplSelectionChangedHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplUserDrawHdl, UserDrawEvent* );
     DECL_DLLPRIVATE_LINK(   ImplAutocompleteHdl, Edit* );
     DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
 
+    SAL_DLLPRIVATE void ImplClickButtonHandler( ImplBtn* );
+
 protected:
     using Window::ImplInit;
     SAL_DLLPRIVATE void     ImplInit( Window* pParent, WinBits nStyle );
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index e0dbf93..4307888 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -59,12 +59,13 @@ private:
     DECL_DLLPRIVATE_LINK(  ImplScrollHdl, void* );
     DECL_DLLPRIVATE_LINK(  ImplCancelHdl, void* );
     DECL_DLLPRIVATE_LINK(  ImplDoubleClickHdl, void* );
-    DECL_DLLPRIVATE_LINK(  ImplClickBtnHdl, void* );
     DECL_DLLPRIVATE_LINK(  ImplPopupModeEndHdl, void* );
     DECL_DLLPRIVATE_LINK(  ImplSelectionChangedHdl, void* );
     DECL_DLLPRIVATE_LINK(  ImplUserDrawHdl, UserDrawEvent* );
     DECL_DLLPRIVATE_LINK(  ImplFocusHdl, void* );
     DECL_DLLPRIVATE_LINK(  ImplListItemSelectHdl, void* );
+
+    SAL_DLLPRIVATE void ImplClickButtonHandler( Control* );
 protected:
     using Window::ImplInit;
     SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index d9f943f..c8a49a4 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_VCL_INC_ILSTBOX_HXX
 
 #include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/signals2/signal.hpp>
 #include <vcl/image.hxx>
 #include <vcl/ctrl.hxx>
 #include <vcl/button.hxx>
@@ -554,7 +555,6 @@ private:
     Rectangle       maFocusRect;
     Size            maUserItemSize;
 
-    Link            maMBDownHdl;
     Link            maUserDrawHdl;
 
     /// bitfield
@@ -587,8 +587,8 @@ public:
     void            SetImage( const Image& rImg ) { maImage = rImg; }
 
     virtual void    MBDown();
-    void            SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; }
-    const Link&     GetMBDownHdl() const { return maMBDownHdl; }
+
+    boost::signals2::signal< void ( ImplWin* ) > buttonDownSignal;
 
     void            SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; }
     const Link&     GetUserDrawHdl() const              { return maUserDrawHdl; }
@@ -610,17 +610,14 @@ class ImplBtn : public PushButton
 private:
     bool            mbDown;
 
-    Link            maMBDownHdl;
-
 public:
                     ImplBtn( Window* pParent, WinBits nWinStyle = 0 );
                     virtual ~ImplBtn() {};
 
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
-
     virtual void    MBDown();
-    void            SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; }
-    const Link&     GetMBDownHdl() const { return maMBDownHdl; }
+
+    boost::signals2::signal< void ( ImplBtn* ) > buttonDownSignal;
 };
 
 void ImplInitFieldSettings( Window* pWin, bool bFont, bool bForeground, bool bBackground );
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index a5d619f..0ac87c7 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -148,7 +148,7 @@ void ComboBox::ImplInit( Window* pParent, WinBits nStyle )
 
         mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
         ImplInitDropDownButton( mpBtn );
-        mpBtn->SetMBDownHdl( LINK( this, ComboBox, ImplClickBtnHdl ) );
+        mpBtn->buttonDownSignal.connect( boost::bind( &ComboBox::ImplClickButtonHandler, this, _1 ));
         mpBtn->Show();
 
         nEditStyle |= WB_NOBORDER;
@@ -234,7 +234,7 @@ bool ComboBox::IsAutocompleteEnabled() const
     return mpSubEdit->GetAutocompleteHdl().IsSet();
 }
 
-IMPL_LINK_NOARG(ComboBox, ImplClickBtnHdl)
+void ComboBox::ImplClickButtonHandler( ImplBtn* )
 {
     ImplCallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN );
     mpSubEdit->GrabFocus();
@@ -250,8 +250,6 @@ IMPL_LINK_NOARG(ComboBox, ImplClickBtnHdl)
     ImplClearLayoutData();
     if( mpImplLB )
         mpImplLB->GetMainWindow().ImplClearLayoutData();
-
-    return 0;
 }
 
 IMPL_LINK_NOARG(ComboBox, ImplPopupModeEndHdl)
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index b1f02fc..bbc1f2a 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2599,7 +2599,7 @@ ImplWin::ImplWin( Window* pParent, WinBits nWinStyle ) :
 void ImplWin::MBDown()
 {
     if( IsEnabled() )
-        maMBDownHdl.Call( this );
+        buttonDownSignal( this );
 }
 
 void ImplWin::MouseButtonDown( const MouseEvent& )
@@ -2874,7 +2874,7 @@ ImplBtn::ImplBtn( Window* pParent, WinBits nWinStyle ) :
 void ImplBtn::MBDown()
 {
     if( IsEnabled() )
-       maMBDownHdl.Call( this );
+       buttonDownSignal( this );
 }
 
 void ImplBtn::MouseButtonDown( const MouseEvent& )
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index d6c6764..ef18971 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -136,7 +136,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle )
         mpFloatWin->GetDropTarget()->addDropTargetListener(xDrop);
 
         mpImplWin = new ImplWin( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER );
-        mpImplWin->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
+        mpImplWin->buttonDownSignal.connect( boost::bind( &ListBox::ImplClickButtonHandler, this, _1 ));
         mpImplWin->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) );
         mpImplWin->Show();
         mpImplWin->GetDropTarget()->addDropTargetListener(xDrop);
@@ -144,7 +144,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle )
 
         mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
         ImplInitDropDownButton( mpBtn );
-        mpBtn->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
+        mpBtn->buttonDownSignal.connect( boost::bind( &ListBox::ImplClickButtonHandler, this, _1 ));
         mpBtn->Show();
         mpBtn->GetDropTarget()->addDropTargetListener(xDrop);
     }
@@ -299,7 +299,7 @@ IMPL_LINK_NOARG(ListBox, ImplDoubleClickHdl)
     return 1;
 }
 
-IMPL_LINK_NOARG(ListBox, ImplClickBtnHdl)
+void ListBox::ImplClickButtonHandler( Control* )
 {
     if( !mpFloatWin->IsInPopupMode() )
     {
@@ -315,8 +315,6 @@ IMPL_LINK_NOARG(ListBox, ImplClickBtnHdl)
         if( mpImplWin )
             mpImplWin->ImplClearLayoutData();
     }
-
-    return 0;
 }
 
 IMPL_LINK_NOARG(ListBox, ImplPopupModeEndHdl)
commit 4443993c06ec323088644414e0c064565952bca2
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Sun Sep 14 00:11:23 2014 +0200

    avoid warnings with boost signals2
    
    Change-Id: I003f4f951d3b4007bc11ac957ac88bf92d87aab3

diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk
index 237d97d..e57a4bd 100644
--- a/external/boost/UnpackedTarball_boost.mk
+++ b/external/boost/UnpackedTarball_boost.mk
@@ -93,6 +93,7 @@ boost_patches += boost.transform_width.patch
 # Help static analysis tools (see SAL_UNUSED_PARAMETER in sal/types.h):
 ifeq (GCC,$(COM))
 boost_patches += boost_1_44_0-unused-parameters.patch
+boost_patches += boost.signals2.unused.parameters.patch
 endif
 
 # Clang warnings:
diff --git a/external/boost/boost.signals2.unused.parameters.patch b/external/boost/boost.signals2.unused.parameters.patch
new file mode 100644
index 0000000..342f830
--- /dev/null
+++ b/external/boost/boost.signals2.unused.parameters.patch
@@ -0,0 +1,20 @@
+--- a/b/boost/boost/signals2/detail/auto_buffer.hpp.sav	2011-12-21 04:05:37.000000000 +0100
++++ a/b/boost/boost/signals2/detail/auto_buffer.hpp	2014-09-13 23:58:51.221215911 +0200
+@@ -99,7 +99,7 @@ namespace detail
+         }
+ 
+         template< class SizeType >
+-        static bool should_shrink( SizeType size, SizeType capacity )
++        static bool should_shrink( __attribute__ ((unused)) SizeType size, __attribute__ ((unused)) SizeType capacity )
+         {
+             //
+             // @remark: when defining a new grow policy, one might
+@@ -258,7 +258,7 @@ namespace detail
+                 auto_buffer_destroy( buffer );
+         }
+ 
+-        void destroy_back_n( size_type n, const boost::true_type& )
++        void destroy_back_n( __attribute__ ((unused)) size_type n, const boost::true_type& )
+         { }
+ 
+         void destroy_back_n( size_type n )
commit be048935c5e9e5d98a349d2fa25e7c2dfbe757dc
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Sat Sep 13 23:47:46 2014 +0200

    boost signals2 with clang and C++11 require at least boost 1.55
    
    https://svn.boost.org/trac/boost/ticket/8260
    
    Change-Id: I06b4d45b91c99d1152fa79e419346c0668573bca

diff --git a/configure.ac b/configure.ac
index 1f5a794..c2d602e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8527,13 +8527,18 @@ if test "$with_system_boost" = "yes"; then
     fi
     AC_LANG_PUSH([C++])
     save_CXXFLAGS=$CXXFLAGS
-    CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
+    CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
        [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>


More information about the Libreoffice-commits mailing list