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 9a1b859473b6af36f08090403e38c16c925e0814 Author: Pedro F. Giffuni <[email protected]> AuthorDate: Fri Nov 6 00:12:12 2026 -0500 Boost modernization Phase 3 continued: boost::bind to C++14 lambdas (~20 more files) - Replace boost::bind with C++14 lambdas in: - vcl/aqua/source/gdi/salprn.cxx (rtl_freeMemory deleter) - canvas/source/tools/surfaceproxy.cxx (Surface::draw, drawRectangularArea, drawWithClip x3) - sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx (GetTransparentColor, SetFillColor, SetLineColor, Create*PopupControl x4) - Remove #include <boost/bind.hpp> where no longer needed --- main/canvas/source/tools/surfaceproxy.cxx | 21 ++-------- .../canvas/source/vcl/canvashelper_texturefill.cxx | 5 +-- main/canvas/source/vcl/spritecanvas.cxx | 16 +++----- main/canvas/source/vcl/spritecanvashelper.cxx | 45 ++++++---------------- .../ui/sidebar/CellAppearancePropertyPanel.cxx | 17 ++++---- main/slideshow/test/testshape.cxx | 11 +----- main/vcl/aqua/source/gdi/salprn.cxx | 3 +- main/xmloff/source/core/RDFaExportHelper.cxx | 7 +--- main/xmloff/source/core/RDFaImportHelper.cxx | 8 ++-- 9 files changed, 38 insertions(+), 95 deletions(-) diff --git a/main/canvas/source/tools/surfaceproxy.cxx b/main/canvas/source/tools/surfaceproxy.cxx index e76d274223..75d6290cdf 100644 --- a/main/canvas/source/tools/surfaceproxy.cxx +++ b/main/canvas/source/tools/surfaceproxy.cxx @@ -24,7 +24,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_canvas.hxx" -#include <boost/bind.hpp> #include <basegfx/polygon/b2dpolygoncutandtouch.hxx> #include <basegfx/polygon/b2dpolygontriangulator.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> @@ -109,11 +108,7 @@ namespace canvas { ::std::for_each( maSurfaceList.begin(), maSurfaceList.end(), - ::boost::bind( &Surface::draw, - _1, - fAlpha, - ::boost::cref(rPos), - ::boost::cref(rTransform))); + [&](auto& surface) { surface->draw( fAlpha, rPos, rTransform ); } ); return true; } @@ -129,12 +124,7 @@ namespace canvas { ::std::for_each( maSurfaceList.begin(), maSurfaceList.end(), - ::boost::bind(&Surface::drawRectangularArea, - _1, - fAlpha, - ::boost::cref(rPos), - ::boost::cref(rArea), - ::boost::cref(rTransform))); + [&](auto& surface) { surface->drawRectangularArea( fAlpha, rPos, rArea, rTransform ); } ); return true; } @@ -166,12 +156,7 @@ namespace canvas ::std::for_each( maSurfaceList.begin(), maSurfaceList.end(), - ::boost::bind(&Surface::drawWithClip, - _1, - fAlpha, - ::boost::cref(rPos), - ::boost::cref(rTriangulatedPolygon), - ::boost::cref(rTransform))); + [&](auto& surface) { surface->drawWithClip( fAlpha, rPos, rTriangulatedPolygon, rTransform ); } ); return true; } diff --git a/main/canvas/source/vcl/canvashelper_texturefill.cxx b/main/canvas/source/vcl/canvashelper_texturefill.cxx index 1c24f9e4b8..c6e58952a0 100644 --- a/main/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/main/canvas/source/vcl/canvashelper_texturefill.cxx @@ -60,7 +60,6 @@ #include <canvas/canvastools.hxx> #include <canvas/parametricpolypolygon.hxx> -#include <boost/bind.hpp> #include "spritecanvas.hxx" #include "canvashelper.hxx" @@ -772,9 +771,7 @@ namespace vclcanvas std::transform(&rValues.maColors[0], &rValues.maColors[0]+rValues.maColors.getLength(), aColors.begin(), - boost::bind( - &vcl::unotools::stdColorSpaceSequenceToColor, - _1)); + [](const auto& val) { return vcl::unotools::stdColorSpaceSequenceToColor( val ); })); // TODO(E1): Return value // TODO(F1): FillRule diff --git a/main/canvas/source/vcl/spritecanvas.cxx b/main/canvas/source/vcl/spritecanvas.cxx index 52190f977a..98ca1fa22d 100644 --- a/main/canvas/source/vcl/spritecanvas.cxx +++ b/main/canvas/source/vcl/spritecanvas.cxx @@ -71,17 +71,11 @@ namespace vclcanvas maPropHelper.addProperties( ::canvas::PropertySetHelper::MakeMap ("UnsafeScrolling", - boost::bind(&SpriteCanvasHelper::isUnsafeScrolling, - boost::ref(maCanvasHelper)), - boost::bind(&SpriteCanvasHelper::enableUnsafeScrolling, - boost::ref(maCanvasHelper), - _1)) - ("SpriteBounds", - boost::bind(&SpriteCanvasHelper::isSpriteBounds, - boost::ref(maCanvasHelper)), - boost::bind(&SpriteCanvasHelper::enableSpriteBounds, - boost::ref(maCanvasHelper), - _1))); + [&]() { return maCanvasHelper.isUnsafeScrolling(); }, + [&](auto& val) { maCanvasHelper.enableUnsafeScrolling( val ); }) + ("SpriteBounds", + [&]() { return maCanvasHelper.isSpriteBounds(); }, + [&](auto& val) { maCanvasHelper.enableSpriteBounds( val ); })); VERBOSE_TRACE( "VCLSpriteCanvas::initialize called" ); diff --git a/main/canvas/source/vcl/spritecanvashelper.cxx b/main/canvas/source/vcl/spritecanvashelper.cxx index 84b427892c..71384cb39c 100644 --- a/main/canvas/source/vcl/spritecanvashelper.cxx +++ b/main/canvas/source/vcl/spritecanvashelper.cxx @@ -323,10 +323,7 @@ namespace vclcanvas // repaint all active sprites on top of background into // VDev. mpRedrawManager->forEachSprite( - ::boost::bind( - &spriteRedraw, - ::boost::ref( maVDev.get() ), - _1 ) ); + [&](auto& sprite) { spriteRedraw( maVDev.get(), sprite ); } ); // flush to screen rOutDev.EnableMapMode( sal_False ); @@ -435,12 +432,9 @@ namespace vclcanvas // opaque sprite content) // repaint all affected sprites directly to output device - ::std::for_each( rUpdateArea.maComponentList.begin(), - rUpdateArea.maComponentList.end(), - ::boost::bind( - &spriteRedrawStub3, - ::boost::ref( rOutDev ), - _1 ) ); + ::std::for_each( rUpdateArea.maComponentList.begin(), + rUpdateArea.maComponentList.end(), + [&](auto& sprite) { spriteRedrawStub3( rOutDev, sprite ); } ); } else { @@ -464,12 +458,9 @@ namespace vclcanvas // sprite rOutDev.Push( PUSH_CLIPREGION ); const Sprite::Reference& rSprite = aFirst->second.getSprite(); - ::std::for_each( aUnscrollableAreas.begin(), - aUnscrollableAreas.end(), - ::boost::bind( &opaqueUpdateSpriteArea, - ::boost::cref(rSprite), - ::boost::ref(rOutDev), - _1 ) ); + ::std::for_each( aUnscrollableAreas.begin(), + aUnscrollableAreas.end(), + [&](auto& area) { opaqueUpdateSpriteArea( rSprite, rOutDev, area ); } ); rOutDev.Pop(); } @@ -482,10 +473,7 @@ namespace vclcanvas ::basegfx::B2DRange( rDestRect ) ); ::std::for_each( aUncoveredAreas.begin(), aUncoveredAreas.end(), - ::boost::bind( &repaintBackground, - ::boost::ref(rOutDev), - ::boost::ref(rBackOutDev), - _1 ) ); + [&](auto& area) { repaintBackground( rOutDev, rBackOutDev, area ); } ); } void SpriteCanvasHelper::opaqueUpdate( const ::basegfx::B2DRange& rTotalArea, @@ -510,10 +498,7 @@ namespace vclcanvas // repaint all affected sprites directly to output device ::std::for_each( rSortedUpdateSprites.begin(), rSortedUpdateSprites.end(), - ::boost::bind( - &spriteRedrawStub, - ::boost::ref( rOutDev ), - _1 ) ); + [&](auto& sprite) { spriteRedrawStub( rOutDev, sprite ); } ); } void SpriteCanvasHelper::genericUpdate( const ::basegfx::B2DRange& rRequestedArea, @@ -588,10 +573,7 @@ namespace vclcanvas ::basegfx::B2DPoint aPoint = ::vcl::unotools::b2DPointFromPoint(aOutputPosition); ::std::for_each( rSortedUpdateSprites.begin(), rSortedUpdateSprites.end(), - ::boost::bind( &spriteRedrawStub2, - ::boost::ref( maVDev.get() ), - ::boost::cref( aPoint ), - _1 ) ); + [&](auto& sprite) { spriteRedrawStub2( maVDev.get(), aPoint, sprite ); } ); // flush to screen rOutDev.EnableMapMode( sal_False ); @@ -683,11 +665,8 @@ namespace vclcanvas double nPixel(0.0); // accumulate pixel count for each sprite into fCount - mpRedrawManager->forEachSprite( ::boost::bind( - makeAdder(nPixel,1.0), - ::boost::bind( - &calcNumPixel, - _1 ) ) ); + auto adder = makeAdder(nPixel, 1.0); + mpRedrawManager->forEachSprite( [adder](auto& sprite) { adder( calcNumPixel( sprite ) ); } ); static const int NUM_VIRDEV(2); static const int BYTES_PER_PIXEL(3); diff --git a/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx index a3a942d6d6..1efb711660 100644 --- a/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx +++ b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -39,7 +39,6 @@ #include <editeng/colritem.hxx> #include <vcl/svapp.hxx> #include <svx/sidebar/ColorControl.hxx> -#include <boost/bind.hpp> #include <svx/sidebar/PopupContainer.hxx> #include <CellLineStyleControl.hxx> #include <CellLineStylePopup.hxx> @@ -81,8 +80,8 @@ svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateFillColorPopupCon mpBindings, ScResId(RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR), ScResId(VS_FILLCOLOR), - ::boost::bind(GetTransparentColor), - ::boost::bind(&CellAppearancePropertyPanel::SetFillColor, this, _1, _2), + []() { return GetTransparentColor(); }, + [this](auto& a1, auto& a2) { this->SetFillColor( a1, a2 ); }, pParent, &aResId); } @@ -105,8 +104,8 @@ svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateLineColorPopupCon mpBindings, ScResId(RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR), ScResId(VS_LINECOLOR), - ::boost::bind(GetTransparentColor), - ::boost::bind(&CellAppearancePropertyPanel::SetLineColor, this, _1, _2), + []() { return GetTransparentColor(); }, + [this](auto& a1, auto& a2) { this->SetLineColor( a1, a2 ); }, pParent, 0); } @@ -239,8 +238,8 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel( mbTLBR(false), mbBLTR(false), - maFillColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateFillColorPopupControl, this, _1)), - maLineColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateLineColorPopupControl, this, _1)), + maFillColorPopup(this, [this](const auto& param) { return this->CreateFillColorPopupControl( param ); }), + maLineColorPopup(this, [this](const auto& param) { return this->CreateLineColorPopupControl( param ); }), mpCellLineStylePopup(), mpCellBorderStylePopup(), @@ -370,7 +369,7 @@ IMPL_LINK(CellAppearancePropertyPanel, TbxCellBorderSelectHdl, ToolBox*, pToolBo mpCellBorderStylePopup.reset( new CellBorderStylePopup( this, - ::boost::bind(&CellAppearancePropertyPanel::CreateCellBorderStylePopupControl, this, _1))); + [this](const auto& param) { return this->CreateCellBorderStylePopupControl( param ); })); } if(mpCellBorderStylePopup.get()) @@ -394,7 +393,7 @@ IMPL_LINK(CellAppearancePropertyPanel, TbxLineStyleSelectHdl, ToolBox*, pToolBox mpCellLineStylePopup.reset( new CellLineStylePopup( this, - ::boost::bind(&CellAppearancePropertyPanel::CreateCellLineStylePopupControl, this, _1))); + [this](const auto& param) { return this->CreateCellLineStylePopupControl( param ); })); } if(mpCellLineStylePopup.get()) diff --git a/main/slideshow/test/testshape.cxx b/main/slideshow/test/testshape.cxx index 9a95dd1539..09aaac4591 100644 --- a/main/slideshow/test/testshape.cxx +++ b/main/slideshow/test/testshape.cxx @@ -31,7 +31,6 @@ #include "tests.hxx" #include "com/sun/star/presentation/XSlideShowView.hpp" -#include <boost/bind.hpp> namespace target = slideshow::internal; using namespace ::com::sun::star; @@ -131,20 +130,14 @@ private: if( std::find_if( maViewLayers.begin(), maViewLayers.end(), - boost::bind( std::equal_to< target::ViewLayerSharedPtr >(), - boost::cref( rNewLayer ), - boost::bind( std::select1st<ViewVector::value_type>(), - _1 ))) == maViewLayers.end() ) + [&rNewLayer](const auto& entry) { return rNewLayer == entry.first; }) == maViewLayers.end() ) throw std::exception(); maViewLayers.erase( std::remove_if( maViewLayers.begin(), maViewLayers.end(), - boost::bind( std::equal_to< target::ViewLayerSharedPtr >(), - boost::cref( rNewLayer ), - boost::bind( std::select1st<ViewVector::value_type>(), - _1 )))); + [&rNewLayer](const auto& entry) { return rNewLayer == entry.first; })); return true; } virtual bool clearAllViewLayers() diff --git a/main/vcl/aqua/source/gdi/salprn.cxx b/main/vcl/aqua/source/gdi/salprn.cxx index c8ffbdcd1d..eded2a25cb 100644 --- a/main/vcl/aqua/source/gdi/salprn.cxx +++ b/main/vcl/aqua/source/gdi/salprn.cxx @@ -24,7 +24,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <boost/bind.hpp> #include "vcl/print.hxx" #include "vcl/unohelp.hxx" @@ -90,7 +89,7 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) : const int nWidth = 100, nHeight = 100; maContextMemory.reset( reinterpret_cast<sal_uInt8*>( rtl_allocateMemory( nWidth * 4 * nHeight ) ), - boost::bind( rtl_freeMemory, _1 ) ); + [](void* p) { rtl_freeMemory( p ); } ); if( maContextMemory ) { diff --git a/main/xmloff/source/core/RDFaExportHelper.cxx b/main/xmloff/source/core/RDFaExportHelper.cxx index cefee116d8..1ffd09a964 100644 --- a/main/xmloff/source/core/RDFaExportHelper.cxx +++ b/main/xmloff/source/core/RDFaExportHelper.cxx @@ -44,7 +44,6 @@ #include <rtl/ustrbuf.hxx> -#include <boost/bind.hpp> #include <boost/iterator_adaptors.hpp> #ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp // N.B.: the check for the header guard _of a specific version of boost_ @@ -202,13 +201,11 @@ RDFaExportHelper::AddRDFa( ::comphelper::intersperse( ::boost::make_transform_iterator( ::comphelper::stl_begin(rStatements), - ::boost::bind(&makeCURIE, &m_rExport, - ::boost::bind(&rdf::Statement::Predicate, _1))), + [&](const auto& stmt) { return makeCURIE( &m_rExport, stmt.Predicate ); }), // argh, this must be the same type :( ::boost::make_transform_iterator( ::comphelper::stl_end(rStatements), - ::boost::bind(&makeCURIE, &m_rExport, - ::boost::bind(&rdf::Statement::Predicate, _1))), + [&](const auto& stmt) { return makeCURIE( &m_rExport, stmt.Predicate ); }), ::comphelper::OUStringBufferAppender(property), ::rtl::OUString::createFromAscii(" ")); diff --git a/main/xmloff/source/core/RDFaImportHelper.cxx b/main/xmloff/source/core/RDFaImportHelper.cxx index 0f10dcb9d3..939873da15 100644 --- a/main/xmloff/source/core/RDFaImportHelper.cxx +++ b/main/xmloff/source/core/RDFaImportHelper.cxx @@ -38,7 +38,6 @@ #include <rtl/ustring.hxx> -#include <boost/bind.hpp> #include <boost/iterator_adaptors.hpp> #ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp // N.B.: the check for the header guard _of a specific version of boost_ @@ -361,14 +360,15 @@ void RDFaInserter::InsertRDFaEntry( predicates.reserve(i_rEntry.m_pRDFaAttributes->m_Properties.size()); + auto makeURI = [this](const auto& prop) { return this->MakeURI( prop ); }; ::std::remove_copy_if( ::boost::make_transform_iterator( i_rEntry.m_pRDFaAttributes->m_Properties.begin(), - ::boost::bind(&RDFaInserter::MakeURI, this, _1)), + makeURI), // argh, this must be the same type :( ::boost::make_transform_iterator( i_rEntry.m_pRDFaAttributes->m_Properties.end(), - ::boost::bind(&RDFaInserter::MakeURI, this, _1)), + makeURI), ::std::back_inserter(predicates), ref_is_null() ); // compiles only on wntmsci12 @@ -490,7 +490,7 @@ void RDFaImportHelper::InsertRDFa( if (!xRepository.is()) return; RDFaInserter inserter(GetImport().GetComponentContext(), xRepository); ::std::for_each(m_RDFaEntries.begin(), m_RDFaEntries.end(), - ::boost::bind(&RDFaInserter::InsertRDFaEntry, &inserter, _1)); + [&inserter](const auto& entry) { inserter.InsertRDFaEntry( entry ); }); } } // namespace xmloff
