This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch compilers-101 in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 3baca6b677b061607335280ce2c980731c05ed26 Author: Pedro F. Giffuni <[email protected]> AuthorDate: Fri Nov 6 00:06:45 2026 -0500 Boost modernization Phase 3 continued: boost::bind to C++14 lambdas (~20 more files) - Replace boost::bind with C++14 lambdas in: - framework/source/uielement/toolbarmanager.cxx (ToolBar::SetItemImage) - canvas/source/simplecanvas/simplecanvasimpl.cxx (rect2Poly, XCanvas::createFont) - canvas/source/tools/surface.cxx (IRenderModule::endPrimitive x3) - canvas/source/tools/spriteredrawmanager.cxx (nested bind: B2DRangeExpander+getUpdateArea+select2nd, isAreaUpdateNotOpaque, needsUpdate+select2nd) - sc/source/ui/drawfunc/drawsh2.cxx (GetSidebarContextName callback) - Remove #include <boost/bind.hpp> where no longer needed --- main/canvas/source/simplecanvas/simplecanvasimpl.cxx | 11 ++--------- main/canvas/source/tools/spriteredrawmanager.cxx | 16 +++------------- main/canvas/source/tools/surface.cxx | 16 ++++++++-------- main/framework/source/uielement/toolbarmanager.cxx | 3 +-- main/sc/source/ui/drawfunc/drawsh2.cxx | 3 +-- 5 files changed, 15 insertions(+), 34 deletions(-) diff --git a/main/canvas/source/simplecanvas/simplecanvasimpl.cxx b/main/canvas/source/simplecanvas/simplecanvasimpl.cxx index 84717de7cb..7d448086fd 100644 --- a/main/canvas/source/simplecanvas/simplecanvasimpl.cxx +++ b/main/canvas/source/simplecanvas/simplecanvasimpl.cxx @@ -43,7 +43,6 @@ #include "canvas/canvastools.hxx" -#include <boost/bind.hpp> #define SERVICE_NAME "com.sun.star.rendering.SimpleCanvas" @@ -102,9 +101,7 @@ namespace explicit SimpleRenderState( uno::Reference<rendering::XGraphicDevice> const& xDevice ) : m_aPenColor( &color2Sequence), m_aFillColor( &color2Sequence ), - m_aRectClip( boost::bind( &rect2Poly, - xDevice, - _1 )), + m_aRectClip( [&](const auto& rect) { return rect2Poly( xDevice, rect ); } ), m_aTransformation() { tools::setIdentityAffineMatrix2D( m_aTransformation ); @@ -167,11 +164,7 @@ namespace const uno::Reference< uno::XComponentContext >& ) : SimpleCanvasBase( m_aMutex ), mxCanvas( grabCanvas(aArguments) ), - maFont(boost::bind( &rendering::XCanvas::createFont, - boost::cref(mxCanvas), - _1, - uno::Sequence< beans::PropertyValue >(), - geometry::Matrix2D() )), + maFont( [&](const auto& fontRequest) { return mxCanvas->createFont( fontRequest, uno::Sequence< beans::PropertyValue >(), geometry::Matrix2D() ); } ), maViewState(), maRenderState( mxCanvas->getDevice() ) { diff --git a/main/canvas/source/tools/spriteredrawmanager.cxx b/main/canvas/source/tools/spriteredrawmanager.cxx index 3430cc0472..cfc0368da7 100644 --- a/main/canvas/source/tools/spriteredrawmanager.cxx +++ b/main/canvas/source/tools/spriteredrawmanager.cxx @@ -36,7 +36,6 @@ #include <algorithm> #include <functional> #include <iterator> -#include <boost/bind.hpp> namespace canvas @@ -420,19 +419,13 @@ namespace canvas ::basegfx::B2DRange aTrueArea( aBegin->second.getUpdateArea() ); ::std::for_each( aBegin, aEnd, - ::boost::bind( ::basegfx::B2DRangeExpander(aTrueArea), - ::boost::bind( &SpriteInfo::getUpdateArea, - ::boost::bind( ::std::select2nd<AreaComponent>(), - _1 ) ) ) ); + [&](const auto& component) { B2DRangeExpander(aTrueArea)( component.second->getUpdateArea() ); } ); // and check whether _any_ of the sprites tells that its area // update will not be opaque. return (::std::find_if( aBegin, aEnd, - ::boost::bind( &SpriteRedrawManager::isAreaUpdateNotOpaque, - this, - ::boost::cref(aTrueArea), - _1 ) ) == aEnd ); + [&](const auto& component) { return this->isAreaUpdateNotOpaque( aTrueArea, component ); } ) == aEnd ); } bool SpriteRedrawManager::areSpritesChanged( const UpdateArea& rUpdateArea ) const @@ -446,10 +439,7 @@ namespace canvas rUpdateArea.maComponentList.end() ); return (::std::find_if( rUpdateArea.maComponentList.begin(), aEnd, - ::boost::bind( &SpriteInfo::needsUpdate, - ::boost::bind( - ::std::select2nd<SpriteConnectedRanges::ComponentType>(), - _1 ) ) ) != aEnd ); + [](const auto& component) { return component.second->needsUpdate(); } ) != aEnd ); } SpriteRedrawManager::SpriteRedrawManager() : diff --git a/main/canvas/source/tools/surface.cxx b/main/canvas/source/tools/surface.cxx index 337ca7c0f2..8496fe87d4 100644 --- a/main/canvas/source/tools/surface.cxx +++ b/main/canvas/source/tools/surface.cxx @@ -28,7 +28,6 @@ #include <basegfx/polygon/b2dpolygonclipper.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <comphelper/scopeguard.hxx> -#include <boost/bind.hpp> namespace canvas { @@ -192,8 +191,9 @@ namespace canvas // issue an endPrimitive() when leaving the scope const ::comphelper::ScopeGuard aScopeGuard( - boost::bind( &::canvas::IRenderModule::endPrimitive, - ::boost::ref(pRenderModule) ) ); + const ::comphelper::ScopeGuard aScopeGuard( + [&]() { pRenderModule->endPrimitive(); } + ); vertex.u=static_cast<float>(u2); vertex.v=static_cast<float>(v2); vertex.x=static_cast<float>(p0.getX()); vertex.y=static_cast<float>(p0.getY()); @@ -318,8 +318,9 @@ namespace canvas // issue an endPrimitive() when leaving the scope const ::comphelper::ScopeGuard aScopeGuard( - boost::bind( &::canvas::IRenderModule::endPrimitive, - ::boost::ref(pRenderModule) ) ); + const ::comphelper::ScopeGuard aScopeGuard( + [&]() { pRenderModule->endPrimitive(); } + ); vertex.u=static_cast<float>(u2); vertex.v=static_cast<float>(v2); vertex.x=static_cast<float>(p0.getX()); vertex.y=static_cast<float>(p0.getY()); @@ -428,9 +429,8 @@ namespace canvas pRenderModule->beginPrimitive( canvas::IRenderModule::PRIMITIVE_TYPE_TRIANGLE ); // issue an endPrimitive() when leaving the scope - const ::comphelper::ScopeGuard aScopeGuard( - boost::bind( &::canvas::IRenderModule::endPrimitive, - ::boost::ref(pRenderModule) ) ); + const ::comphelper::ScopeGuard aScopeGuard( + [&]() { pRenderModule->endPrimitive(); } ); for(sal_uInt32 nIndex=0; nIndex<nVertexCount; ++nIndex) { diff --git a/main/framework/source/uielement/toolbarmanager.cxx b/main/framework/source/uielement/toolbarmanager.cxx index 72ad34348b..88f0658288 100644 --- a/main/framework/source/uielement/toolbarmanager.cxx +++ b/main/framework/source/uielement/toolbarmanager.cxx @@ -96,7 +96,6 @@ #include <rtl/logfile.hxx> #include <svtools/menuoptions.hxx> #include <unotools/cmdoptions.hxx> -#include <boost/bind.hpp> #include <svtools/acceleratorexecute.hxx> //_________________________________________________________________________________________________________________ @@ -804,7 +803,7 @@ void ToolBarManager::setToolBarImage(const Image& _aImage,const CommandToInfoMap { const ::std::vector< sal_uInt16 >& _rIDs = _pIter->second.aIds; m_pToolBar->SetItemImage( _pIter->second.nId, _aImage ); - ::std::for_each(_rIDs.begin(),_rIDs.end(),::boost::bind(&ToolBar::SetItemImage,m_pToolBar,_1,_aImage)); + ::std::for_each(_rIDs.begin(),_rIDs.end(),[&](const auto& id) { m_pToolBar->SetItemImage( id, _aImage ); }); } void SAL_CALL ToolBarManager::elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) diff --git a/main/sc/source/ui/drawfunc/drawsh2.cxx b/main/sc/source/ui/drawfunc/drawsh2.cxx index 3ecd8e7312..3e1c59c915 100644 --- a/main/sc/source/ui/drawfunc/drawsh2.cxx +++ b/main/sc/source/ui/drawfunc/drawsh2.cxx @@ -56,7 +56,6 @@ #include <svx/svdoole2.hxx> #include <svx/svdocapt.hxx> -#include <boost/bind.hpp> sal_uInt16 ScGetFontWorkId(); // in drtxtob @@ -70,7 +69,7 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) : SfxShell(pData->GetViewShell()), pViewData( pData ), mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( - ::boost::bind(&ScDrawShell::GetSidebarContextName, this), + [this]() { return this->GetSidebarContextName(); }, GetFrame()->GetFrame().GetController(), sfx2::sidebar::EnumContext::Context_Cell)) {
