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 8e7e9d7d31da470e7d2bc0303e77c022bf253ce3 Author: Pedro F. Giffuni <[email protected]> AuthorDate: Fri Nov 6 00:32:18 2026 -0500 Boost modernization Phase 3 continued: boost::bind to C++14 lambdas (~20 more files) - Replace boost::bind with C++14 lambdas in: - sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx (Layer::Validate, RepaintRectangle, Repaint, Resize, Dispose, ValidateRectangle, ILayerPainter::Paint) - sd/source/ui/slidesorter/view/SlsButtonBar.cxx (AnimationFunction::Blend, ApplyButtonAlphaChange, SetButtonAlphaAnimationId) - Remove #include <boost/bind.hpp> where no longer needed --- .../sd/source/ui/slidesorter/view/SlsButtonBar.cxx | 48 +++++++++++----------- .../ui/slidesorter/view/SlsLayeredDevice.cxx | 24 +++++------ 2 files changed, 34 insertions(+), 38 deletions(-) diff --git a/main/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/main/sd/source/ui/slidesorter/view/SlsButtonBar.cxx index 263ac01aa3..2e42c7973c 100644 --- a/main/sd/source/ui/slidesorter/view/SlsButtonBar.cxx +++ b/main/sd/source/ui/slidesorter/view/SlsButtonBar.cxx @@ -49,7 +49,6 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/numeric/ftools.hxx> #include <com/sun/star/presentation/XPresentation2.hpp> -#include <boost/bind.hpp> #include <memory> using ::com::sun::star::uno::Any; @@ -726,18 +725,18 @@ void ButtonBar::StartFadeAnimation ( // Prepare the blending functors that translate [0,1] animation // times into alpha values of buttons and button bar. - const ::boost::function<double(double)> aButtonBlendFunctor ( - ::boost::bind( - controller::AnimationFunction::Blend, - nCurrentButtonAlpha, - nTargetAlpha, - ::boost::bind(controller::AnimationFunction::Linear, _1))); - const ::boost::function<double(double)> aButtonBarBlendFunctor ( - ::boost::bind( - controller::AnimationFunction::Blend, - nCurrentButtonBarAlpha, - nTargetAlpha, - ::boost::bind(controller::AnimationFunction::Linear, _1))); + const std::function<double(double)> aButtonBlendFunctor ( + [nCurrentButtonAlpha, nTargetAlpha](double t) { + return controller::AnimationFunction::Blend( + nCurrentButtonAlpha, nTargetAlpha, + controller::AnimationFunction::Linear( t )); + }); + const std::function<double(double)> aButtonBarBlendFunctor ( + [nCurrentButtonBarAlpha, nTargetAlpha](double t) { + return controller::AnimationFunction::Blend( + nCurrentButtonBarAlpha, nTargetAlpha, + controller::AnimationFunction::Linear( t )); + }); // Delay the fade in a little bit when the buttons are not visible at // all so that we do not leave a trail of half-visible buttons when the @@ -753,19 +752,20 @@ void ButtonBar::StartFadeAnimation ( : Theme::Integer_ButtonFadeOutDuration)); pDescriptor->GetVisualState().SetButtonAlphaAnimationId( mrSlideSorter.GetController().GetAnimator()->AddAnimation( - ::boost::bind( - controller::AnimationFunction::ApplyButtonAlphaChange, - pDescriptor, - ::boost::ref(mrSlideSorter.GetView()), - ::boost::bind(aButtonBlendFunctor, _1), - ::boost::bind(aButtonBarBlendFunctor, _1)), + [pDescriptor, &mrSlideSorter, &aButtonBlendFunctor, &aButtonBarBlendFunctor](double t) { + return controller::AnimationFunction::ApplyButtonAlphaChange( + pDescriptor, + mrSlideSorter.GetView(), + aButtonBlendFunctor( t ), + aButtonBarBlendFunctor( t )); + }, nDelay, nDuration, - ::boost::bind( - &model::VisualState::SetButtonAlphaAnimationId, - ::boost::ref(pDescriptor->GetVisualState()), - controller::Animator::NotAnAnimationId) - )); + [&pDescriptor]() { + pDescriptor->GetVisualState().SetButtonAlphaAnimationId( + controller::Animator::NotAnAnimationId); + } + )); } diff --git a/main/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/main/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx index c76e36693a..38f7c6fbdb 100644 --- a/main/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx +++ b/main/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx @@ -28,7 +28,6 @@ #include <vcl/window.hxx> #include <vcl/virdev.hxx> -#include <boost/bind.hpp> #include <boost/function.hpp> #include <memory> @@ -280,9 +279,9 @@ void LayeredDevice::Repaint (const Region& rRepaintRegion) ::std::for_each( mpLayers->begin(), mpLayers->end(), - ::boost::bind(&Layer::Validate, _1, mpTargetWindow->GetMapMode())); + [&](auto& layer) { layer.Validate( mpTargetWindow->GetMapMode() ); }); - ForAllRectangles(rRepaintRegion, ::boost::bind(&LayeredDevice::RepaintRectangle, this, _1)); + ForAllRectangles(rRepaintRegion, [this](auto& rect) { this->RepaintRectangle( rect ); }); } @@ -306,7 +305,7 @@ void LayeredDevice::RepaintRectangle (const Rectangle& rRepaintRectangle) ::std::for_each( mpLayers->begin(), mpLayers->end(), - ::boost::bind(&Layer::Repaint, _1, ::boost::ref(*mpBackBuffer), rRepaintRectangle)); + [&](auto& layer) { layer.Repaint( *mpBackBuffer, rRepaintRectangle ); }); DeviceCopy(*mpTargetWindow, *mpBackBuffer, rRepaintRectangle); } @@ -319,7 +318,7 @@ void LayeredDevice::Resize (void) { const Size aSize (mpTargetWindow->GetSizePixel()); mpBackBuffer->SetOutputSizePixel(aSize); - ::std::for_each(mpLayers->begin(), mpLayers->end(), ::boost::bind(&Layer::Resize, _1, aSize)); + ::std::for_each(mpLayers->begin(), mpLayers->end(), [&aSize](auto& layer) { layer.Resize( aSize ); }); } @@ -327,7 +326,7 @@ void LayeredDevice::Resize (void) void LayeredDevice::Dispose (void) { - ::std::for_each(mpLayers->begin(), mpLayers->end(), ::boost::bind(&Layer::Dispose, _1)); + ::std::for_each(mpLayers->begin(), mpLayers->end(), [](auto& layer) { layer.Dispose(); }); mpLayers->clear(); } @@ -461,7 +460,7 @@ void Layer::Validate (const MapMode& rMapMode) mpLayerDevice->SetMapMode(rMapMode); ForAllRectangles( aRegion, - ::boost::bind(&Layer::ValidateRectangle, this, _1)); + [&](auto& rect) { mpLayerDevice->ValidateRectangle( rect ); })); } } @@ -500,13 +499,10 @@ void Layer::Repaint ( } else { - ::std::for_each( - maPainters.begin(), - maPainters.end(), - ::boost::bind(&ILayerPainter::Paint, - _1, - ::boost::ref(rTargetDevice), - rRepaintRectangle)); + ::std::for_each( + maPainters.begin(), + maPainters.end(), + [&](auto& painter) { painter.Paint( rTargetDevice, rRepaintRectangle ); }); } }
