diff options
Diffstat (limited to 'slideshow/source/engine/slideshowimpl.cxx')
-rw-r--r-- | slideshow/source/engine/slideshowimpl.cxx | 56 |
1 files changed, 21 insertions, 35 deletions
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index d1c417ded112..2633d11eb17b 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -886,18 +886,17 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition( PolygonMap::iterator SlideShowImpl::findPolygons( uno::Reference<drawing::XDrawPage> const& xDrawPage) { // TODO(P2) : Optimze research in the map. - bool bFound = false; - PolygonMap::iterator aIter=maPolygons.begin(); - - while(aIter!=maPolygons.end() && !bFound) + PolygonMap::iterator aEnd = maPolygons.end(); + for( auto aIter = maPolygons.begin(); + aIter != aEnd; + ++aIter ) { if(aIter->first == xDrawPage) - bFound = true; - else - ++aIter; + return aIter; } - - return aIter; + // if no element is found return the element + // one past the last valid element in the map + return aEnd; } SlideSharedPtr SlideShowImpl::makeSlide( @@ -1131,10 +1130,8 @@ void SlideShowImpl::displaySlide( // push new transformation to all views, if size changed if( !mpPreviousSlide || oldSlideSize != slideSize ) { - std::for_each( maViewContainer.begin(), - maViewContainer.end(), - boost::bind( &View::setViewSize, _1, - boost::cref(slideSize) )); + for( const auto& rView : maViewContainer ) + rView->setViewSize( slideSize ); // explicitly notify view change here, // because transformation might have changed: @@ -1447,18 +1444,16 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult aPropLayer <<= false; xLayerPropSet->setPropertyValue("IsLocked", aPropLayer); - PolygonMap::iterator aIter=maPolygons.begin(); - PolyPolygonVector aPolygons; ::cppcanvas::PolyPolygonSharedPtr pPolyPoly; ::basegfx::B2DPolyPolygon b2DPolyPoly; //Register polygons for each slide - while(aIter!=maPolygons.end()) + for( const auto& rPoly : maPolygons ) { - aPolygons = aIter->second; + aPolygons = rPoly.second; //Get shapes for the slide - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > Shapes(aIter->first, ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > Shapes(rPoly.first, ::com::sun::star::uno::UNO_QUERY); //Retrieve polygons for one slide for( PolyPolygonVector::iterator aIterPoly=aPolygons.begin(), aEnd=aPolygons.end(); @@ -1534,7 +1529,6 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult } } } - ++aIter; } } @@ -1961,11 +1955,8 @@ bool SlideShowImpl::requestCursor( sal_Int16 nCursorShape ) const sal_Int16 nActualCursor = calcActiveCursor(mnCurrentCursor); // change all views to the requested cursor ID - std::for_each( maViewContainer.begin(), - maViewContainer.end(), - boost::bind( &View::setCursorShape, - _1, - nActualCursor )); + for( const auto& rView : maViewContainer ) + rView->setCursorShape( nActualCursor ); return nActualCursor==nCursorShape; } @@ -1974,12 +1965,11 @@ void SlideShowImpl::resetCursor() { mnCurrentCursor = awt::SystemPointer::ARROW; + const sal_Int16 nActualCursor = calcActiveCursor( mnCurrentCursor ); + // change all views to the default cursor ID - std::for_each( maViewContainer.begin(), - maViewContainer.end(), - boost::bind( &View::setCursorShape, - _1, - calcActiveCursor(mnCurrentCursor) )); + for( const auto& rView : maViewContainer ) + rView->setCursorShape( nActualCursor ); } sal_Bool SlideShowImpl::update( double & nNextTimeout ) @@ -2121,13 +2111,11 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) (!bRet || nNextTimeout > 1.0) ) { - UnoViewVector::const_iterator aCurr(maViewContainer.begin()); - const UnoViewVector::const_iterator aEnd(maViewContainer.end()); - while( aCurr != aEnd ) + for( const auto& pView : maViewContainer ) { try { - uno::Reference< presentation::XSlideShowView > xView( (*aCurr)->getUnoView(), + uno::Reference< presentation::XSlideShowView > xView( pView->getUnoView(), uno::UNO_QUERY_THROW ); uno::Reference< util::XUpdatable > xUpdatable( xView->getCanvas(), uno::UNO_QUERY_THROW ); @@ -2143,8 +2131,6 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) comphelper::anyToString( cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 ).getStr() ); } - - ++aCurr; } mbSlideShowIdle = true; |