[Libreoffice-commits] core.git: vcl/source

Fabio Buso dev.siroibaf at gmail.com
Wed Nov 11 02:11:31 PST 2015


 vcl/source/control/combobox.cxx  |    6 +++--
 vcl/source/control/lstbox.cxx    |   12 +++++++----
 vcl/source/filter/wmf/enhwmf.cxx |   42 +++++++++++++++++++++++++--------------
 vcl/source/filter/wmf/wmf.cxx    |    6 -----
 4 files changed, 40 insertions(+), 26 deletions(-)

New commits:
commit c21ddcdb30b8dd7be56176e00bc2d4780cb342e1
Author: Fabio Buso <dev.siroibaf at gmail.com>
Date:   Tue Nov 10 23:08:55 2015 +0100

    tdf#93243 replace boost::bind with c++11 lambdas in vcl/source tree
    
    Change-Id: Id12333cce50e14698e32195c49863d2e0cb448e4
    Reviewed-on: https://gerrit.libreoffice.org/19893
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index faa2dc7..94dc649 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -215,7 +215,8 @@ 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( boost::bind( &ComboBox::Impl::ImplClickButtonHandler, m_pImpl.get(), _1 ));
+        m_pImpl->m_pBtn->buttonDownSignal.connect( [this]( ImplBtn* pImplBtn )
+                                                   { this->m_pImpl->ImplClickButtonHandler( pImplBtn ); } );
         m_pImpl->m_pBtn->Show();
 
         nEditStyle |= WB_NOBORDER;
@@ -247,7 +248,8 @@ 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( boost::bind( &ComboBox::Impl::ImplUserDrawHandler, m_pImpl.get(), _1 ) );
+    m_pImpl->m_pImplLB->userDrawSignal.connect( [this]( UserDrawEvent* pUserDrawEvent )
+                                                { this->m_pImpl->ImplUserDrawHandler( pUserDrawEvent ); } );
     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();
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 2858c08..4574618 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -137,15 +137,18 @@ 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( boost::bind( &ListBox::ImplClickButtonHandler, this, _1 ));
-        mpImplWin->userDrawSignal.connect( boost::bind( &ListBox::ImplUserDrawHandler, this, _1 ) );
+        mpImplWin->buttonDownSignal.connect( [this]( Control* pControl )
+                                             { this->ImplClickButtonHandler( pControl ); } );
+        mpImplWin->userDrawSignal.connect( [this]( UserDrawEvent* pUserDrawEvent )
+                                           { this->ImplUserDrawHandler( pUserDrawEvent ); } );
         mpImplWin->Show();
         mpImplWin->GetDropTarget()->addDropTargetListener(xDrop);
         mpImplWin->SetEdgeBlending(GetEdgeBlending());
 
         mpBtn = VclPtr<ImplBtn>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
         ImplInitDropDownButton( mpBtn );
-        mpBtn->buttonDownSignal.connect( boost::bind( &ListBox::ImplClickButtonHandler, this, _1 ));
+        mpBtn->buttonDownSignal.connect( [this]( Control* pControl )
+                                         { this->ImplClickButtonHandler( pControl ); } );
         mpBtn->Show();
         mpBtn->GetDropTarget()->addDropTargetListener(xDrop);
     }
@@ -158,7 +161,8 @@ 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( boost::bind( &ListBox::ImplUserDrawHandler, this, _1 ) );
+    mpImplLB->userDrawSignal.connect( [this]( UserDrawEvent* pUserDrawEvent )
+                                      { this->ImplUserDrawHandler( pUserDrawEvent ); } );
     mpImplLB->SetFocusHdl( LINK( this, ListBox, ImplFocusHdl ) );
     mpImplLB->SetListItemSelectHdl( LINK( this, ListBox, ImplListItemSelectHdl ) );
     mpImplLB->SetPosPixel( Point() );
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index eabb1fd..a55709b 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -20,7 +20,6 @@
 #include "winmtf.hxx"
 #include <osl/endian.h>
 #include <basegfx/matrix/b2dhommatrix.hxx>
-#include <boost/bind.hpp>
 #include <vcl/dibtools.hxx>
 #include <memory>
 
@@ -468,7 +467,7 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, bool& bHaveDC)
 /**
  * Reads polygons from the stream.
  * The \<class T> parameter is for the type of the points (sal_uInt32 or sal_uInt16).
- * The \<class Drawer> parameter is a boost binding for the method that will draw the polygon.
+ * The \<class Drawer> parameter is a c++11 lambda for the method that will draw the polygon.
  * skipFirst: if the first point read is the 0th point or the 1st point in the array.
  * */
 template <class T, class Drawer>
@@ -696,21 +695,27 @@ bool EnhWMFReader::ReadEnhWMF()
             switch( nRecType )
             {
                 case EMR_POLYBEZIERTO :
-                    ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), true);
+                    ReadAndDrawPolygon<sal_Int32>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolyBezier( rPolygon, aTo, aRecordPath ); }, true );
                 break;
                 case EMR_POLYBEZIER :
-                    ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), false);
+                    ReadAndDrawPolygon<sal_Int32>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolyBezier( rPolygon, aTo, aRecordPath ); }, false );
                 break;
 
                 case EMR_POLYGON :
-                    ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolygon, _1, _2, _3, _4), false);
+                    ReadAndDrawPolygon<sal_Int32>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolygon( rPolygon, aTo, aRecordPath ); }, false );
                 break;
 
                 case EMR_POLYLINETO :
-                    ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), true);
+                    ReadAndDrawPolygon<sal_Int32>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolyLine( rPolygon, aTo, aRecordPath ); }, true );
                 break;
+
                 case EMR_POLYLINE :
-                    ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), false);
+                    ReadAndDrawPolygon<sal_Int32>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolyLine( rPolygon, aTo, aRecordPath ); }, false );
                 break;
 
                 case EMR_POLYPOLYLINE :
@@ -1514,26 +1519,33 @@ bool EnhWMFReader::ReadEnhWMF()
                 break;
 
                 case EMR_POLYBEZIERTO16 :
-                    ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), true);
-                    break;
+                    ReadAndDrawPolygon<sal_Int16>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolyBezier( rPolygon, aTo, aRecordPath ); }, true );
+                break;
+
                 case EMR_POLYBEZIER16 :
-                    ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), false);
+                    ReadAndDrawPolygon<sal_Int16>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolyBezier( rPolygon, aTo, aRecordPath ); }, false );
                 break;
 
                 case EMR_POLYGON16 :
-                    ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolygon, _1, _2, _3, _4), false);
+                    ReadAndDrawPolygon<sal_Int16>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolygon( rPolygon, aTo, aRecordPath ); }, false );
                 break;
 
                 case EMR_POLYLINETO16 :
-                    ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), true);
-                    break;
+                    ReadAndDrawPolygon<sal_Int16>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolyLine( rPolygon, aTo, aRecordPath ); }, true );
+                break;
+
                 case EMR_POLYLINE16 :
-                    ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), false);
+                    ReadAndDrawPolygon<sal_Int16>( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath )
+                                                   { pWinMtfOutput->DrawPolyLine( rPolygon, aTo, aRecordPath ); }, false );
                 break;
 
                 case EMR_POLYPOLYLINE16 :
                     ReadAndDrawPolyLine<sal_Int16>();
-                    break;
+                break;
 
                 case EMR_POLYPOLYGON16 :
                     ReadAndDrawPolyPolygon<sal_Int16>();
diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx
index e2f1b6b..1b39721 100644
--- a/vcl/source/filter/wmf/wmf.cxx
+++ b/vcl/source/filter/wmf/wmf.cxx
@@ -24,8 +24,6 @@
 #include <vcl/gdimetafiletools.hxx>
 #include <comphelper/scopeguard.hxx>
 
-#include <boost/bind.hpp>
-
 bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem, WMF_EXTERNALHEADER *pExtHeader )
 {
     sal_uInt32 nMetaType;
@@ -63,9 +61,7 @@ bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem*
     SvStreamEndian nOrigNumberFormat = rStream.GetEndian();
     rStream.SetEndian( SvStreamEndian::LITTLE );
     //exception-safe reset nOrigNumberFormat at end of scope
-    const ::comphelper::ScopeGuard aScopeGuard(
-        boost::bind(&SvStream::SetEndian, ::boost::ref(rStream),
-          nOrigNumberFormat));
+    const ::comphelper::ScopeGuard aScopeGuard( [&rStream, nOrigNumberFormat] () { rStream.SetEndian( nOrigNumberFormat ); } );
 
     rStream.Seek( 0x28 );
     rStream.ReadUInt32( nMetaType );


More information about the Libreoffice-commits mailing list