Kaydet (Commit) 91e0161d authored tarafından Daniel Robertson's avatar Daniel Robertson Kaydeden (comit) Noel Grandin

tdf#93243 slideshow: replace boost::bind

Replace boost::bind with C++11 lambdas

Change-Id: I13c500d085e6b8e80b2c067139db4ed0fffb2c71
Reviewed-on: https://gerrit.libreoffice.org/19299Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst b6297280
......@@ -27,8 +27,6 @@
#include <basegfx/numeric/ftools.hxx>
#include <boost/bind.hpp>
#include <cmath>
#include <algorithm>
#include <functional>
......@@ -169,11 +167,8 @@ namespace slideshow
// already added?
if( ::std::any_of( maViewShapes.begin(),
maViewShapes.end(),
::boost::bind<bool>(
::std::equal_to< ViewLayerSharedPtr >(),
::boost::bind( &ViewBackgroundShape::getViewLayer,
_1 ),
::boost::cref( rNewLayer ) ) ) )
[&rNewLayer]( const ViewBackgroundShapeSharedPtr& pBgShape )
{ return pBgShape->getViewLayer() == rNewLayer; } ) )
{
// yes, nothing to do
return;
......@@ -195,22 +190,16 @@ namespace slideshow
OSL_ENSURE( ::std::count_if(maViewShapes.begin(),
aEnd,
::boost::bind<bool>(
::std::equal_to< ViewLayerSharedPtr >(),
::boost::bind( &ViewBackgroundShape::getViewLayer,
_1 ),
::boost::cref( rLayer ) ) ) < 2,
[&rLayer]( const ViewBackgroundShapeSharedPtr& pBgShape )
{ return pBgShape->getViewLayer() == rLayer; } ) < 2,
"BackgroundShape::removeViewLayer(): Duplicate ViewLayer entries!" );
ViewBackgroundShapeVector::iterator aIter;
if( (aIter=::std::remove_if( maViewShapes.begin(),
aEnd,
::boost::bind<bool>(
::std::equal_to< ViewLayerSharedPtr >(),
::boost::bind( &ViewBackgroundShape::getViewLayer,
_1 ),
::boost::cref( rLayer ) ) )) == aEnd )
[&rLayer]( const ViewBackgroundShapeSharedPtr& pBgShape )
{ return pBgShape->getViewLayer() == rLayer; } )) == aEnd )
{
// view layer seemingly was not added, failed
return false;
......@@ -280,9 +269,8 @@ namespace slideshow
// redraw all view shapes, by calling their render() method
if( ::std::count_if( maViewShapes.begin(),
maViewShapes.end(),
::boost::bind( &ViewBackgroundShape::render,
_1,
::boost::cref( mpMtf ) ) )
[this]( const ViewBackgroundShapeSharedPtr& pBgShape )
{ return pBgShape->render( this->mpMtf ); } )
!= static_cast<ViewBackgroundShapeVector::difference_type>(maViewShapes.size()) )
{
// at least one of the ViewBackgroundShape::render() calls did return
......
......@@ -44,9 +44,6 @@
#include "viewshape.hxx"
#include "tools.hxx"
#include <boost/bind.hpp>
using namespace ::com::sun::star;
namespace slideshow
......@@ -742,12 +739,8 @@ namespace slideshow
// already there?
if( (aIter=::std::find_if( maRenderers.begin(),
aEnd,
::boost::bind(
::std::equal_to< ::cppcanvas::CanvasSharedPtr >(),
::boost::cref( rDestinationCanvas ),
::boost::bind(
&RendererCacheEntry::getDestinationCanvas,
_1 ) ) ) ) == aEnd )
[&rDestinationCanvas]( const RendererCacheEntry& rCacheEntry )
{ return rDestinationCanvas == rCacheEntry.getDestinationCanvas(); } ) ) == aEnd )
{
if( maRenderers.size() >= MAX_RENDER_CACHE_ENTRIES )
{
......
......@@ -25,13 +25,9 @@
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
#include <boost/noncopyable.hpp>
#include "layer.hxx"
#include <boost/bind.hpp>
using namespace ::com::sun::star;
namespace slideshow
......@@ -69,10 +65,8 @@ namespace slideshow
const ViewEntryVector::iterator aEnd( maViewEntries.end() );
if( (aIter=std::find_if( maViewEntries.begin(),
aEnd,
boost::bind<bool>(
std::equal_to< ViewSharedPtr >(),
boost::bind( &ViewEntry::getView, _1 ),
boost::cref( rNewView )))) != aEnd )
[&rNewView]( const ViewEntry& rViewEntry )
{ return rViewEntry.getView() == rNewView; } ) ) != aEnd )
{
// already added - just return existing layer
return aIter->mpViewLayer;
......@@ -102,10 +96,8 @@ namespace slideshow
const ViewEntryVector::iterator aEnd( maViewEntries.end() );
if( (aIter=std::find_if( maViewEntries.begin(),
aEnd,
boost::bind<bool>(
std::equal_to< ViewSharedPtr >(),
boost::bind( &ViewEntry::getView, _1 ),
boost::cref( rView )))) == aEnd )
[&rView]( const ViewEntry& rViewEntry )
{ return rViewEntry.getView() == rView; } ) ) == aEnd )
{
// View was not added/is already removed
return ViewLayerSharedPtr();
......@@ -113,10 +105,8 @@ namespace slideshow
OSL_ENSURE( std::count_if( maViewEntries.begin(),
aEnd,
boost::bind<bool>(
std::equal_to< ViewSharedPtr >(),
boost::bind( &ViewEntry::getView, _1 ),
boost::cref( rView ))) == 1,
[&rView]( const ViewEntry& rViewEntry )
{ return rViewEntry.getView() == rView; } ) == 1,
"Layer::removeView(): view added multiple times" );
ViewLayerSharedPtr pRet( aIter->mpViewLayer );
......@@ -176,10 +166,9 @@ namespace slideshow
maBounds = maNewBounds;
if( std::count_if( maViewEntries.begin(),
maViewEntries.end(),
boost::bind( &ViewLayer::resize,
boost::bind( &ViewEntry::getViewLayer,
_1 ),
boost::cref(maBounds)) ) == 0 )
[this]( const ViewEntry& rViewEntry )
{ return rViewEntry.getViewLayer()->resize( this->maBounds ); }
) == 0 )
{
return false;
}
......@@ -207,9 +196,11 @@ namespace slideshow
clearUpdateRanges();
}
class LayerEndUpdate : private boost::noncopyable
class LayerEndUpdate
{
public:
LayerEndUpdate( const LayerEndUpdate& ) = delete;
LayerEndUpdate& operator=( const LayerEndUpdate& ) = delete;
explicit LayerEndUpdate( LayerSharedPtr const& rLayer ) :
mpLayer( rLayer )
{}
......
......@@ -25,7 +25,7 @@
#include <comphelper/anytostring.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <boost/bind.hpp>
#include <boost/mem_fn.hpp>
#include <algorithm>
#include "layermanager.hxx"
......@@ -166,14 +166,10 @@ namespace slideshow
// add View to all registered shapes
manageViews(
boost::bind(&Layer::addView,
_1,
boost::cref(rView)),
// repaint on view add
boost::bind(&Shape::addViewLayer,
_1,
_2,
true) );
[&rView]( const LayerSharedPtr& pLayer )
{ return pLayer->addView( rView ); },
[]( const ShapeSharedPtr& pShape, const ViewLayerSharedPtr& pLayer )
{ return pShape->addViewLayer( pLayer, true ); } );
// in case we haven't reached all layers from the
// maAllShapes, issue addView again for good measure
......@@ -190,12 +186,10 @@ namespace slideshow
// remove View from all registered shapes
manageViews(
boost::bind(&Layer::removeView,
_1,
boost::cref(rView)),
boost::bind(&Shape::removeViewLayer,
_1,
_2) );
[&rView]( const LayerSharedPtr& pLayer )
{ return pLayer->removeView( rView ); },
[]( const ShapeSharedPtr& pShape, const ViewLayerSharedPtr& pLayer )
{ return pShape->removeViewLayer( pLayer ); } );
// in case we haven't reached all layers from the
// maAllShapes, issue removeView again for good measure
......
......@@ -26,7 +26,7 @@
#include "shapemanagerimpl.hxx"
#include <boost/bind.hpp>
#include <boost/mem_fn.hpp>
using namespace com::sun::star;
......@@ -151,10 +151,8 @@ bool ShapeManagerImpl::handleMouseReleased( awt::MouseEvent const& e )
// DON'T do anything with /this/ after this point!
pCont->forEach<presentation::XShapeEventListener>(
boost::bind( &presentation::XShapeEventListener::click,
_1,
boost::cref(xShape),
boost::cref(e) ));
[&xShape, &e]( const uno::Reference< presentation::XShapeEventListener >& rListener )
{ return rListener->click( xShape, e ); } );
return true; // handled this event
}
......
......@@ -61,8 +61,6 @@
#include "targetpropertiescreator.hxx"
#include "tools.hxx"
#include <boost/bind.hpp>
#include <iterator>
#include <functional>
#include <iostream>
......
......@@ -95,9 +95,7 @@
#include "framerate.hxx"
#include "pointersymbol.hxx"
#include <boost/noncopyable.hpp>
#include <boost/bind.hpp>
#include <boost/mem_fn.hpp>
#include <map>
#include <vector>
#include <iterator>
......@@ -505,8 +503,7 @@ private:
struct SlideShowImpl::SeparateListenerImpl : public EventHandler,
public ViewRepaintHandler,
public HyperlinkHandler,
public AnimationEventHandler,
private boost::noncopyable
public AnimationEventHandler
{
SlideShowImpl& mrShow;
ScreenUpdater& mrScreenUpdater;
......@@ -520,6 +517,9 @@ struct SlideShowImpl::SeparateListenerImpl : public EventHandler,
mrEventQueue( rEventQueue )
{}
SeparateListenerImpl( const SeparateListenerImpl& ) = delete;
SeparateListenerImpl& operator=( const SeparateListenerImpl& ) = delete;
// EventHandler
virtual bool handleEvent() SAL_OVERRIDE
{
......@@ -1241,8 +1241,8 @@ sal_Bool SlideShowImpl::previousEffect() throw (uno::RuntimeException, std::exce
{
return maEffectRewinder.rewind(
maScreenUpdater.createLock(false),
::boost::bind<void>(::boost::mem_fn(&SlideShowImpl::redisplayCurrentSlide), this),
::boost::bind<void>(::boost::mem_fn(&SlideShowImpl::rewindEffectToPreviousSlide), this));
[this]() { return this->redisplayCurrentSlide(); },
[this]() { return this->rewindEffectToPreviousSlide(); } );
}
}
......@@ -1996,8 +1996,7 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout )
//::dispose clearing mpPresTimer
std::shared_ptr<canvas::tools::ElapsedTime> xTimer(mpPresTimer);
comphelper::ScopeGuard scopeGuard(
boost::bind( &canvas::tools::ElapsedTime::releaseTimer,
boost::cref(xTimer) ) );
[&xTimer]() { return xTimer->releaseTimer(); } );
xTimer->holdTimer();
// process queues
......@@ -2206,7 +2205,7 @@ void SlideShowImpl::notifySlideAnimationsEnded()
// schedule a slide end event, with automatic mode's
// delay
aNotificationEvents = makeInterruptableDelay(
boost::bind<void>( boost::mem_fn(&SlideShowImpl::notifySlideEnded), this, false ),
[this]() { return this->notifySlideEnded( false ); },
maEventMultiplexer.getAutomaticTimeout() );
}
else
......@@ -2231,7 +2230,7 @@ void SlideShowImpl::notifySlideAnimationsEnded()
bHasAutomaticNextSlide )
{
aNotificationEvents = makeInterruptableDelay(
boost::bind<void>( boost::mem_fn(&SlideShowImpl::notifySlideEnded), this, false ),
[this]() { return this->notifySlideEnded( false ); },
nAutomaticNextSlideTimeout);
// TODO(F2): Provide a mechanism to let the user override
......@@ -2331,10 +2330,8 @@ void SlideShowImpl::notifySlideEnded (const bool bReverse)
// GIF) will not be stopped.
maListenerContainer.forEach<presentation::XSlideShowListener>(
boost::bind<void>(
::boost::mem_fn(&presentation::XSlideShowListener::slideEnded),
_1,
bReverse));
[&bReverse]( const uno::Reference< presentation::XSlideShowListener >& xListener )
{ return xListener->slideEnded( bReverse ); } );
}
bool SlideShowImpl::notifyHyperLinkClicked( OUString const& hyperLink )
......@@ -2342,9 +2339,8 @@ bool SlideShowImpl::notifyHyperLinkClicked( OUString const& hyperLink )
osl::MutexGuard const guard( m_aMutex );
maListenerContainer.forEach<presentation::XSlideShowListener>(
boost::bind( &presentation::XSlideShowListener::hyperLinkClicked,
_1,
boost::cref(hyperLink) ));
[&hyperLink]( const uno::Reference< presentation::XSlideShowListener >& xListener )
{ return xListener->hyperLinkClicked( hyperLink ); } );
return true;
}
......@@ -2361,17 +2357,15 @@ bool SlideShowImpl::handleAnimationEvent( const AnimationNodeSharedPtr& rNode )
{
case AnimationNode::ACTIVE:
maListenerContainer.forEach<presentation::XSlideShowListener>(
boost::bind( &animations::XAnimationListener::beginEvent,
_1,
boost::cref(xNode) ));
[&xNode]( const uno::Reference< animations::XAnimationListener >& xListener )
{ return xListener->beginEvent( xNode ); } );
break;
case AnimationNode::FROZEN:
case AnimationNode::ENDED:
maListenerContainer.forEach<presentation::XSlideShowListener>(
boost::bind( &animations::XAnimationListener::endEvent,
_1,
boost::cref(xNode) ));
[&xNode]( const uno::Reference< animations::XAnimationListener >& xListener )
{ return xListener->endEvent( xNode ); } );
if(mpCurrentSlide->isPaintOverlayActive())
mpCurrentSlide->drawPolygons();
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment