From c21ddcdb30b8dd7be56176e00bc2d4780cb342e1 Mon Sep 17 00:00:00 2001 From: Fabio Buso Date: Tue, 10 Nov 2015 23:08:55 +0100 Subject: 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 Tested-by: Jenkins --- 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(-) diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index faa2dc7ca430..94dc649487e2 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::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 2858c08287d7..4574618834c0 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::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::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 eabb1fd72dd9..a55709b0176d 100644 --- a/vcl/source/filter/wmf/enhwmf.cxx +++ b/vcl/source/filter/wmf/enhwmf.cxx @@ -20,7 +20,6 @@ #include "winmtf.hxx" #include #include -#include #include #include @@ -468,7 +467,7 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, bool& bHaveDC) /** * Reads polygons from the stream. * The \ parameter is for the type of the points (sal_uInt32 or sal_uInt16). - * The \ parameter is a boost binding for the method that will draw the polygon. + * The \ 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 @@ -696,21 +695,27 @@ bool EnhWMFReader::ReadEnhWMF() switch( nRecType ) { case EMR_POLYBEZIERTO : - ReadAndDrawPolygon(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), true); + ReadAndDrawPolygon( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath ) + { pWinMtfOutput->DrawPolyBezier( rPolygon, aTo, aRecordPath ); }, true ); break; case EMR_POLYBEZIER : - ReadAndDrawPolygon(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), false); + ReadAndDrawPolygon( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath ) + { pWinMtfOutput->DrawPolyBezier( rPolygon, aTo, aRecordPath ); }, false ); break; case EMR_POLYGON : - ReadAndDrawPolygon(boost::bind(&WinMtfOutput::DrawPolygon, _1, _2, _3, _4), false); + ReadAndDrawPolygon( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath ) + { pWinMtfOutput->DrawPolygon( rPolygon, aTo, aRecordPath ); }, false ); break; case EMR_POLYLINETO : - ReadAndDrawPolygon(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), true); + ReadAndDrawPolygon( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath ) + { pWinMtfOutput->DrawPolyLine( rPolygon, aTo, aRecordPath ); }, true ); break; + case EMR_POLYLINE : - ReadAndDrawPolygon(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), false); + ReadAndDrawPolygon( [] ( 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(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), true); - break; + ReadAndDrawPolygon( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath ) + { pWinMtfOutput->DrawPolyBezier( rPolygon, aTo, aRecordPath ); }, true ); + break; + case EMR_POLYBEZIER16 : - ReadAndDrawPolygon(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), false); + ReadAndDrawPolygon( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath ) + { pWinMtfOutput->DrawPolyBezier( rPolygon, aTo, aRecordPath ); }, false ); break; case EMR_POLYGON16 : - ReadAndDrawPolygon(boost::bind(&WinMtfOutput::DrawPolygon, _1, _2, _3, _4), false); + ReadAndDrawPolygon( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath ) + { pWinMtfOutput->DrawPolygon( rPolygon, aTo, aRecordPath ); }, false ); break; case EMR_POLYLINETO16 : - ReadAndDrawPolygon(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), true); - break; + ReadAndDrawPolygon( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath ) + { pWinMtfOutput->DrawPolyLine( rPolygon, aTo, aRecordPath ); }, true ); + break; + case EMR_POLYLINE16 : - ReadAndDrawPolygon(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), false); + ReadAndDrawPolygon( [] ( WinMtfOutput* pWinMtfOutput, tools::Polygon& rPolygon, bool aTo, bool aRecordPath ) + { pWinMtfOutput->DrawPolyLine( rPolygon, aTo, aRecordPath ); }, false ); break; case EMR_POLYPOLYLINE16 : ReadAndDrawPolyLine(); - break; + break; case EMR_POLYPOLYGON16 : ReadAndDrawPolyPolygon(); diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx index e2f1b6b4b6d3..1b3972110792 100644 --- a/vcl/source/filter/wmf/wmf.cxx +++ b/vcl/source/filter/wmf/wmf.cxx @@ -24,8 +24,6 @@ #include #include -#include - 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 ); -- cgit v1.2.3