From 149c0ff96d057f993e31669cbf1debe21fd69cd1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 30 Jun 2025 13:38:17 +0200 Subject: [PATCH] remove some unnecessary indirection when storing WrappedShapeEventImpl Change-Id: Icad7edfc8b7d3949f87b32811873d83daedc0ff6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187209 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sd/source/ui/slideshow/slideshowimpl.cxx | 21 +++++++++++---------- sd/source/ui/slideshow/slideshowimpl.hxx | 4 +--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index ae24d94dcf6f..e45eb04bbf4a 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -1534,10 +1534,10 @@ void SlideshowImpl::registerShapeEvents( Reference< XShapes > const & xShapes ) if( !xSetInfo.is() || !xSetInfo->hasPropertyByName( gsOnClick ) ) continue; - WrappedShapeEventImplPtr pEvent = std::make_shared(); - xSet->getPropertyValue( gsOnClick ) >>= pEvent->meClickAction; + WrappedShapeEventImpl aEvent; + xSet->getPropertyValue( gsOnClick ) >>= aEvent.meClickAction; - switch( pEvent->meClickAction ) + switch( aEvent.meClickAction ) { case ClickAction_PREVPAGE: case ClickAction_NEXTPAGE: @@ -1547,8 +1547,8 @@ void SlideshowImpl::registerShapeEvents( Reference< XShapes > const & xShapes ) break; case ClickAction_BOOKMARK: if( xSetInfo->hasPropertyByName( gsBookmark ) ) - xSet->getPropertyValue( gsBookmark ) >>= pEvent->maStrBookmark; - if( getSlideNumberForBookmark( pEvent->maStrBookmark ) == -1 ) + xSet->getPropertyValue( gsBookmark ) >>= aEvent.maStrBookmark; + if( getSlideNumberForBookmark( aEvent.maStrBookmark ) == -1 ) continue; break; case ClickAction_DOCUMENT: @@ -1556,17 +1556,17 @@ void SlideshowImpl::registerShapeEvents( Reference< XShapes > const & xShapes ) case ClickAction_PROGRAM: case ClickAction_MACRO: if( xSetInfo->hasPropertyByName( gsBookmark ) ) - xSet->getPropertyValue( gsBookmark ) >>= pEvent->maStrBookmark; + xSet->getPropertyValue( gsBookmark ) >>= aEvent.maStrBookmark; break; case ClickAction_VERB: if( xSetInfo->hasPropertyByName( gsVerb ) ) - xSet->getPropertyValue( gsVerb ) >>= pEvent->mnVerb; + xSet->getPropertyValue( gsVerb ) >>= aEvent.mnVerb; break; default: continue; // skip all others } - maShapeEventMap[ xShape ] = std::move(pEvent); + maShapeEventMap[ xShape ] = std::move(aEvent); if( mxListenerProxy.is() ) mxListenerProxy->addShapeEventListener( xShape ); @@ -1705,9 +1705,10 @@ void SlideshowImpl::click( const Reference< XShape >& xShape ) { SolarMutexGuard aSolarGuard; - WrappedShapeEventImplPtr pEvent = maShapeEventMap[xShape]; - if( !pEvent ) + auto it = maShapeEventMap.find(xShape); + if (it == maShapeEventMap.end()) return; + WrappedShapeEventImpl* pEvent = &it->second; switch( pEvent->meClickAction ) { diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index c0bbc1f9e72b..e4a48d6cbc86 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -77,8 +77,6 @@ struct WrappedShapeEventImpl WrappedShapeEventImpl() : meClickAction( css::presentation::ClickAction_NONE ), mnVerb( 0 ) {}; }; -typedef std::shared_ptr< WrappedShapeEventImpl > WrappedShapeEventImplPtr; - class SlideShowListenerProxy : public ::cppu::WeakImplHelper< css::presentation::XSlideShowNavigationListener, css::presentation::XShapeEventListener > { @@ -347,7 +345,7 @@ private: bool mbUsePen; double mdUserPaintStrokeWidth; - std::map< css::uno::Reference< css::drawing::XShape >, WrappedShapeEventImplPtr > + std::map< css::uno::Reference< css::drawing::XShape >, WrappedShapeEventImpl > maShapeEventMap; css::uno::Reference< css::drawing::XDrawPage > mxPreviewDrawPage;