diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx index 44f31d5129ee..9c0d6fa78a97 100644 --- a/slideshow/source/engine/pointersymbol.cxx +++ b/slideshow/source/engine/pointersymbol.cxx @@ -134,13 +134,11 @@ void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView ) void PointerSymbol::viewRemoved( const UnoViewSharedPtr& rView ) { - maViews.erase( - std::remove_if( - maViews.begin(), maViews.end(), + std::erase_if( + maViews, [&rView] ( const ViewsVecT::value_type& cp ) - { return rView == cp.first; } ), - maViews.end() ); + { return rView == cp.first; } ); } void PointerSymbol::viewChanged( const UnoViewSharedPtr& rView ) diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx index 8284a998900f..7afe8bca53f5 100644 --- a/slideshow/source/engine/rehearsetimingsactivity.cxx +++ b/slideshow/source/engine/rehearsetimingsactivity.cxx @@ -349,12 +349,11 @@ void RehearseTimingsActivity::viewAdded( const UnoViewSharedPtr& rView ) void RehearseTimingsActivity::viewRemoved( const UnoViewSharedPtr& rView ) { - maViews.erase( - std::remove_if( maViews.begin(), maViews.end(), + std::erase_if( + maViews, [&rView] ( const ViewsVecT::value_type& cp ) - { return rView == cp.first; } ), - maViews.end() ); + { return rView == cp.first; } ); } void RehearseTimingsActivity::viewChanged( const UnoViewSharedPtr& rView ) diff --git a/slideshow/source/engine/shapes/appletshape.cxx b/slideshow/source/engine/shapes/appletshape.cxx index 6cc16ad6e500..9402a7f1194f 100644 --- a/slideshow/source/engine/shapes/appletshape.cxx +++ b/slideshow/source/engine/shapes/appletshape.cxx @@ -184,6 +184,8 @@ namespace slideshow::internal { return rLayer == pShape->getViewLayer(); } ) < 2, "AppletShape::removeViewLayer(): Duplicate ViewLayer entries!" ); +// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase_if +#if defined ANDROID ViewAppletShapeVector::iterator aIter; if( (aIter=::std::remove_if( maViewAppletShapes.begin(), @@ -200,6 +202,14 @@ namespace slideshow::internal maViewAppletShapes.erase( aIter, aEnd ); return true; +#else + size_t nb = std::erase_if(maViewAppletShapes, + [&rLayer] + ( const ViewAppletShapeSharedPtr& pShape ) + { return rLayer == pShape->getViewLayer(); } ); + // if nb == 0, it means view layer seemingly was not added, failed + return (nb != 0); +#endif } diff --git a/slideshow/source/engine/shapes/backgroundshape.cxx b/slideshow/source/engine/shapes/backgroundshape.cxx index d304b9f901e6..3028b6f44c85 100644 --- a/slideshow/source/engine/shapes/backgroundshape.cxx +++ b/slideshow/source/engine/shapes/backgroundshape.cxx @@ -187,6 +187,8 @@ namespace slideshow::internal { return pBgShape->getViewLayer() == rLayer; } ) < 2, "BackgroundShape::removeViewLayer(): Duplicate ViewLayer entries!" ); +// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase_if +#if defined ANDROID ViewBackgroundShapeVector::iterator aIter; if( (aIter=::std::remove_if( maViewShapes.begin(), @@ -202,6 +204,14 @@ namespace slideshow::internal maViewShapes.erase( aIter, aEnd ); return true; +#else + + size_t nb = std::erase_if(maViewShapes, + [&rLayer]( const ViewBackgroundShapeSharedPtr& pBgShape ) + { return pBgShape->getViewLayer() == rLayer; } ); + // if nb == 0, it means view shape seemingly was not added, failed + return (nb != 0); +#endif } void BackgroundShape::clearAllViewLayers() diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index cdda31da8a66..185b76cc23d3 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -659,6 +659,9 @@ namespace slideshow::internal { return rLayer == pShape->getViewLayer(); } ) < 2, "DrawShape::removeViewLayer(): Duplicate ViewLayer entries!" ); + +// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase_if +#if defined ANDROID ViewShapeVector::iterator aIter; if( (aIter=::std::remove_if( maViewShapes.begin(), @@ -675,6 +678,14 @@ namespace slideshow::internal maViewShapes.erase( aIter, aEnd ); return true; +#else + size_t nb = std::erase_if(maViewShapes, + [&rLayer] + ( const ViewShapeSharedPtr& pShape ) + { return rLayer == pShape->getViewLayer(); } ); + // if nb == 0, it means view shape seemingly was not added, failed + return (nb != 0); +#endif } void DrawShape::clearAllViewLayers() diff --git a/slideshow/source/engine/shapes/mediashape.cxx b/slideshow/source/engine/shapes/mediashape.cxx index a5cbb926f4f5..c81fc87072c0 100644 --- a/slideshow/source/engine/shapes/mediashape.cxx +++ b/slideshow/source/engine/shapes/mediashape.cxx @@ -149,6 +149,8 @@ namespace slideshow::internal { return rLayer == pShape->getViewLayer(); } ) < 2, "MediaShape::removeViewLayer(): Duplicate ViewLayer entries!" ); +// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase_if +#if defined ANDROID ViewMediaShapeVector::iterator aIter; if( (aIter=::std::remove_if( maViewMediaShapes.begin(), @@ -165,6 +167,14 @@ namespace slideshow::internal maViewMediaShapes.erase( aIter, aEnd ); return true; +#else + size_t nb = std::erase_if(maViewMediaShapes, + [&rLayer] + ( const ViewMediaShapeSharedPtr& pShape ) + { return rLayer == pShape->getViewLayer(); } ); + // if nb == 0, it means view media shape seemingly was not added, failed + return (nb != 0); +#endif } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 57a76f752767..4f7cf5654d34 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -601,14 +601,10 @@ void SlideImpl::viewRemoved( const UnoViewSharedPtr& rView ) if( mpLayerManager ) mpLayerManager->viewRemoved( rView ); - const VectorOfVectorOfSlideBitmaps::iterator aEnd( maSlideBitmaps.end() ); - maSlideBitmaps.erase( - std::remove_if( maSlideBitmaps.begin(), - aEnd, + std::erase_if(maSlideBitmaps, [&rView] ( const VectorOfVectorOfSlideBitmaps::value_type& cp ) - { return rView == cp.first; } ), - aEnd ); + { return rView == cp.first; } ); } void SlideImpl::viewChanged( const UnoViewSharedPtr& rView ) diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx index ffae0a17d883..460e5c5de00a 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -89,9 +89,7 @@ namespace slideshow::internal virtual void viewRemoved( const UnoViewSharedPtr& rView ) override { - maViews.erase( ::std::remove( maViews.begin(), - maViews.end(), - rView ) ); + std::erase(maViews, rView); } virtual void viewChanged( const UnoViewSharedPtr& /*rView*/ ) override diff --git a/slideshow/source/engine/slideoverlaybutton.cxx b/slideshow/source/engine/slideoverlaybutton.cxx index bff6bc052ac0..40ade676b383 100644 --- a/slideshow/source/engine/slideoverlaybutton.cxx +++ b/slideshow/source/engine/slideoverlaybutton.cxx @@ -124,10 +124,7 @@ void SlideOverlayButton::viewAdded(const UnoViewSharedPtr& rView) void SlideOverlayButton::viewRemoved(const UnoViewSharedPtr& rView) { - maViews.erase( - std::remove_if(maViews.begin(), maViews.end(), - [&rView](const ViewsVecT::value_type& cp) { return rView == cp.first; }), - maViews.end()); + std::erase_if(maViews, [&rView](const ViewsVecT::value_type& cp) { return rView == cp.first; }); } void SlideOverlayButton::viewChanged(const UnoViewSharedPtr& rView) diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index 03534822f140..2fcadf10b647 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -404,13 +404,9 @@ void SlideChangeBase::viewRemoved( const UnoViewSharedPtr& rView ) return; // erase corresponding entry from maViewData - maViewData.erase( - std::remove_if( - maViewData.begin(), - maViewData.end(), + std::erase_if(maViewData, [rView]( const ViewEntry& rViewEntry ) - { return rView == rViewEntry.getView(); } ), - maViewData.end() ); + { return rView == rViewEntry.getView(); } ); } void SlideChangeBase::viewChanged( const UnoViewSharedPtr& rView ) diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx index 2810dcf8e741..849c35bed7fe 100644 --- a/slideshow/source/engine/waitsymbol.cxx +++ b/slideshow/source/engine/waitsymbol.cxx @@ -138,13 +138,11 @@ void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView ) void WaitSymbol::viewRemoved( const UnoViewSharedPtr& rView ) { - maViews.erase( - std::remove_if( - maViews.begin(), maViews.end(), + std::erase_if( + maViews, [&rView] ( const ViewsVecT::value_type& cp ) - { return rView == cp.first; } ), - maViews.end() ); + { return rView == cp.first; } ); } void WaitSymbol::viewChanged( const UnoViewSharedPtr& rView ) diff --git a/slideshow/source/inc/listenercontainer.hxx b/slideshow/source/inc/listenercontainer.hxx index 8deb1be90617..af40fb3e6467 100644 --- a/slideshow/source/inc/listenercontainer.hxx +++ b/slideshow/source/inc/listenercontainer.hxx @@ -299,6 +299,8 @@ public: { Guard aGuard(*this); +// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase +#if defined ANDROID const typename container_type::iterator aEnd( maListeners.end() ); typename container_type::iterator aIter; if( (aIter=std::remove(maListeners.begin(), @@ -311,6 +313,11 @@ public: maListeners.erase( aIter, aEnd ); return true; +#else + size_t nb = std::erase(maListeners, rListener); + // if nb == 0, it means listener wasn't found + return (nb != 0); +#endif } /// Removes all listeners in one go diff --git a/slideshow/test/testshape.cxx b/slideshow/test/testshape.cxx index db7031070ba8..dd25cc42401f 100644 --- a/slideshow/test/testshape.cxx +++ b/slideshow/test/testshape.cxx @@ -126,13 +126,11 @@ private: { return cp.first == rNewLayer; } ) ) throw std::exception(); - maViewLayers.erase( - std::remove_if( - maViewLayers.begin(), - maViewLayers.end(), + std::erase_if( + maViewLayers, [&rNewLayer] ( const ViewVector::value_type& cp ) - { return cp.first == rNewLayer; } ) ); + { return cp.first == rNewLayer; } ); return true; } virtual void clearAllViewLayers() override