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 <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2025-07-01 09:37:18 +02:00
parent bf00c26bf1
commit 149c0ff96d
2 changed files with 12 additions and 13 deletions
+11 -10
View File
@@ -1534,10 +1534,10 @@ void SlideshowImpl::registerShapeEvents( Reference< XShapes > const & xShapes )
if( !xSetInfo.is() || !xSetInfo->hasPropertyByName( gsOnClick ) )
continue;
WrappedShapeEventImplPtr pEvent = std::make_shared<WrappedShapeEventImpl>();
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 )
{
+1 -3
View File
@@ -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;