From cee62b1068775b7d0bcd2875e9789c8c36c22057 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 24 Jan 2020 13:21:10 +0200 Subject: loplugin:makeshared in slideshow Change-Id: I87dead1ed09aa50c939c03ae8ed3faf9300a8b4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87354 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/engine/activities/activitiesfactory.cxx | 28 +++--- slideshow/source/engine/animationfactory.cxx | 27 +++--- .../engine/animationnodes/animationbasenode.cxx | 6 +- .../engine/animationnodes/animationcolornode.cxx | 5 +- .../engine/animationnodes/animationnodefactory.cxx | 72 +++++++------- .../source/engine/animationnodes/setactivity.hxx | 3 +- slideshow/source/engine/effectrewinder.cxx | 18 ++-- .../source/engine/rehearsetimingsactivity.cxx | 10 +- slideshow/source/engine/shapes/backgroundshape.cxx | 5 +- .../source/engine/shapes/drawinglayeranimation.cxx | 4 +- slideshow/source/engine/shapes/drawshape.cxx | 14 +-- .../source/engine/shapes/externalshapebase.cxx | 2 +- slideshow/source/engine/shapes/gdimtftools.cxx | 4 +- .../engine/shapes/intrinsicanimationactivity.cxx | 7 +- slideshow/source/engine/shapes/shapeimporter.cxx | 4 +- slideshow/source/engine/shapes/viewshape.cxx | 5 +- slideshow/source/engine/slide/layermanager.cxx | 2 +- slideshow/source/engine/slide/slideimpl.cxx | 4 +- slideshow/source/engine/slide/userpaintoverlay.cxx | 2 +- slideshow/source/engine/slideshowimpl.cxx | 8 +- slideshow/source/engine/smilfunctionparser.cxx | 2 +- .../transitions/parametricpolypolygonfactory.cxx | 104 ++++++++------------- .../engine/transitions/shapetransitionfactory.cxx | 10 +- .../source/engine/transitions/slidechangebase.cxx | 2 +- .../engine/transitions/slidetransitionfactory.cxx | 35 +++---- slideshow/source/engine/usereventqueue.cxx | 20 ++-- 26 files changed, 177 insertions(+), 226 deletions(-) (limited to 'slideshow/source/engine') diff --git a/slideshow/source/engine/activities/activitiesfactory.cxx b/slideshow/source/engine/activities/activitiesfactory.cxx index eee0f55cda2d..63b39d2d23d5 100644 --- a/slideshow/source/engine/activities/activitiesfactory.cxx +++ b/slideshow/source/engine/activities/activitiesfactory.cxx @@ -420,15 +420,14 @@ AnimationActivitySharedPtr createFromToByActivity( aBy = aTmpValue; } - return AnimationActivitySharedPtr( - new FromToByActivity( + return std::make_shared>( aFrom, aTo, aBy, rParms, rAnim, rInterpolator, - bCumulative ) ); + bCumulative ); } /* The following table shows which animator combines with @@ -630,13 +629,12 @@ AnimationActivitySharedPtr createValueListActivity( aValueVector.push_back( aValue ); } - return AnimationActivitySharedPtr( - new ValuesActivity( + return std::make_shared>( aValueVector, rParms, rAnim, rInterpolator, - bCumulative ) ); + bCumulative ); } /** Generate Activity for given XAnimate, corresponding to given Value vector @@ -741,10 +739,10 @@ AnimationActivitySharedPtr createActivity( { // since DiscreteActivityBase suspends itself // between the frames, create a WakeupEvent for it. - aActivityParms.mpWakeupEvent.reset( - new WakeupEvent( + aActivityParms.mpWakeupEvent = + std::make_shared( rParms.mrEventQueue.getTimer(), - rParms.mrActivitiesQueue ) ); + rParms.mrActivitiesQueue ); AnimationActivitySharedPtr pActivity( createValueListActivity< DiscreteActivityBase >( @@ -805,10 +803,10 @@ AnimationActivitySharedPtr createActivity( // since DiscreteActivityBase suspends itself // between the frames, create a WakeupEvent for it. - aActivityParms.mpWakeupEvent.reset( - new WakeupEvent( + aActivityParms.mpWakeupEvent = + std::make_shared( rParms.mrEventQueue.getTimer(), - rParms.mrActivitiesQueue ) ); + rParms.mrActivitiesQueue ); AnimationActivitySharedPtr pActivity( createFromToByActivity< DiscreteActivityBase >( @@ -1008,11 +1006,9 @@ AnimationActivitySharedPtr ActivitiesFactory::createSimpleActivity( rParms.mbAutoReverse ); if( bDirectionForward ) - return AnimationActivitySharedPtr( - new SimpleActivity<1>( aActivityParms, rAnim ) ); + return std::make_shared>( aActivityParms, rAnim ); else - return AnimationActivitySharedPtr( - new SimpleActivity<0>( aActivityParms, rAnim ) ); + return std::make_shared>( aActivityParms, rAnim ); } } // namespace internal diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx index 4d42fb45a425..ce831d2a4aaf 100644 --- a/slideshow/source/engine/animationfactory.cxx +++ b/slideshow/source/engine/animationfactory.cxx @@ -592,9 +592,8 @@ namespace slideshow typename AnimationBase::ValueType (ShapeAttributeLayer::*pGetValue)() const, void (ShapeAttributeLayer::*pSetValue)( const typename AnimationBase::ValueType& ) ) { - return ::std::shared_ptr< AnimationBase >( - new GenericAnimation< AnimationBase, - SGI_identity< typename AnimationBase::ValueType > >( + return std::make_shared >>( rShapeManager, nFlags, pIsValid, @@ -603,7 +602,7 @@ namespace slideshow pSetValue, // no modification necessary, use identity functor here SGI_identity< typename AnimationBase::ValueType >(), - SGI_identity< typename AnimationBase::ValueType >() ) ); + SGI_identity< typename AnimationBase::ValueType >() ); } class Scaler @@ -633,15 +632,14 @@ namespace slideshow void (ShapeAttributeLayer::*pSetValue)( const double& ), double nScaleValue ) { - return NumberAnimationSharedPtr( - new GenericAnimation< NumberAnimation, Scaler >( rShapeManager, + return std::make_shared>( rShapeManager, nFlags, pIsValid, nDefaultValue / nScaleValue, pGetValue, pSetValue, Scaler( 1.0/nScaleValue ), - Scaler( nScaleValue ) ) ); + Scaler( nScaleValue ) ); } @@ -1077,8 +1075,7 @@ namespace slideshow switch( nTransformType ) { case animations::AnimationTransformType::SCALE: - return PairAnimationSharedPtr( - new TupleAnimation< ::basegfx::B2DSize >( + return std::make_shared>( rShapeManager, nFlags, &ShapeAttributeLayer::isWidthValid, @@ -1091,11 +1088,10 @@ namespace slideshow rBounds.getRange(), &ShapeAttributeLayer::getWidth, &ShapeAttributeLayer::getHeight, - &ShapeAttributeLayer::setSize ) ); + &ShapeAttributeLayer::setSize ); case animations::AnimationTransformType::TRANSLATE: - return PairAnimationSharedPtr( - new TupleAnimation< ::basegfx::B2DPoint >( + return std::make_shared>( rShapeManager, nFlags, &ShapeAttributeLayer::isPosXValid, @@ -1108,7 +1104,7 @@ namespace slideshow rSlideSize, &ShapeAttributeLayer::getPosX, &ShapeAttributeLayer::getPosY, - &ShapeAttributeLayer::setPosition ) ); + &ShapeAttributeLayer::setPosition ); default: ENSURE_OR_THROW( false, @@ -1231,11 +1227,10 @@ namespace slideshow const ::basegfx::B2DVector& rSlideSize, int nFlags ) { - return NumberAnimationSharedPtr( - new PathAnimation( rSVGDPath, nAdditive, + return std::make_shared( rSVGDPath, nAdditive, rShapeManager, rSlideSize, - nFlags ) ); + nFlags ); } } diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx index a26f840e1017..ef12aa97e104 100644 --- a/slideshow/source/engine/animationnodes/animationbasenode.cxx +++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx @@ -142,10 +142,10 @@ AnimationBaseNode::AnimationBaseNode( // Slide::prefetchShow() initializes shape // attributes right after animation import (or // the Slide class must be changed). - mpShapeSubset.reset( - new ShapeSubset( mpShape, + mpShapeSubset = + std::make_shared( mpShape, rTreeNode, - mpSubsetManager )); + mpSubsetManager ); // Override NodeContext, and flag this node as // a special independent subset one. This is diff --git a/slideshow/source/engine/animationnodes/animationcolornode.cxx b/slideshow/source/engine/animationnodes/animationcolornode.cxx index 4d6daeec3a05..ac3450ea55e3 100644 --- a/slideshow/source/engine/animationnodes/animationcolornode.cxx +++ b/slideshow/source/engine/animationnodes/animationcolornode.cxx @@ -101,13 +101,12 @@ AnimationActivitySharedPtr AnimationColorNode::createActivity() const // interface, and internally converts HSL to RGB color return ActivitiesFactory::createAnimateActivity( aParms, - HSLColorAnimationSharedPtr( - new HSLWrapper( + std::make_shared( AnimationFactory::createColorPropertyAnimation( mxColorNode->getAttributeName(), getShape(), getContext().mpSubsettableShapeManager, - getSlideSize() ))), + getSlideSize() )), mxColorNode ); default: diff --git a/slideshow/source/engine/animationnodes/animationnodefactory.cxx b/slideshow/source/engine/animationnodes/animationnodefactory.cxx index 7589ce03ae85..e39b268991ee 100644 --- a/slideshow/source/engine/animationnodes/animationnodefactory.cxx +++ b/slideshow/source/engine/animationnodes/animationnodefactory.cxx @@ -133,8 +133,8 @@ public: // normalize things, which does the right thing // here: the subset is only removed after _the // last_ animation node releases the shared ptr. - aContext.mpMasterShapeSubset.reset( - new ShapeSubset( *aContext.mpMasterShapeSubset ) ); + aContext.mpMasterShapeSubset = + std::make_shared( *aContext.mpMasterShapeSubset ); createChild( xChildNode, aContext ); } @@ -233,15 +233,15 @@ bool implCreateIteratedNodes( DocTreeNode::NodeType::LogicalParagraph ) > aTarget.Paragraph, "implCreateIteratedNodes(): paragraph index out of range" ); - pTargetSubset.reset( - new ShapeSubset( + pTargetSubset = + std::make_shared( pTargetShape, // retrieve index aTarget.Paragraph of // type PARAGRAPH from this shape rTreeNodeSupplier.getTreeNode( aTarget.Paragraph, DocTreeNode::NodeType::LogicalParagraph ), - rContext.maContext.mpSubsettableShapeManager ) ); + rContext.maContext.mpSubsettableShapeManager ); // iterate target is not the whole shape, but only // the selected paragraph - subset _must_ be @@ -263,9 +263,9 @@ bool implCreateIteratedNodes( } else { - pTargetSubset.reset( - new ShapeSubset( pTargetShape, - rContext.maContext.mpSubsettableShapeManager )); + pTargetSubset = + std::make_shared( pTargetShape, + rContext.maContext.mpSubsettableShapeManager ); } aContext.mpMasterShapeSubset = pTargetSubset; @@ -397,22 +397,22 @@ bool implCreateIteratedNodes( if( bParagraphTarget ) { // create subsets relative to paragraph subset - aContext.mpMasterShapeSubset.reset( - new ShapeSubset( + aContext.mpMasterShapeSubset = + std::make_shared( pTargetSubset, rTreeNodeSupplier.getSubsetTreeNode( pTargetSubset->getSubset(), i, - eIterateNodeType ) ) ); + eIterateNodeType ) ); } else { // create subsets from main shape - aContext.mpMasterShapeSubset.reset( - new ShapeSubset( pTargetSubset, + aContext.mpMasterShapeSubset = + std::make_shared( pTargetSubset, rTreeNodeSupplier.getTreeNode( i, - eIterateNodeType ) ) ); + eIterateNodeType ) ); } CloningNodeCreator aCreator( rParent, aContext ); @@ -452,61 +452,61 @@ BaseNodeSharedPtr implCreateAnimationNode( return pCreatedNode; case animations::AnimationNodeType::PAR: - pCreatedNode = pCreatedContainer = BaseContainerNodeSharedPtr( - new ParallelTimeContainer( xNode, rParent, rContext ) ); + pCreatedNode = pCreatedContainer = + std::make_shared( xNode, rParent, rContext ); break; case animations::AnimationNodeType::ITERATE: // map iterate container to ParallelTimeContainer. // the iterating functionality is to be found // below, (see method implCreateIteratedNodes) - pCreatedNode = pCreatedContainer = BaseContainerNodeSharedPtr( - new ParallelTimeContainer( xNode, rParent, rContext ) ); + pCreatedNode = pCreatedContainer = + std::make_shared( xNode, rParent, rContext ); break; case animations::AnimationNodeType::SEQ: - pCreatedNode = pCreatedContainer = BaseContainerNodeSharedPtr( - new SequentialTimeContainer( xNode, rParent, rContext ) ); + pCreatedNode = pCreatedContainer = + std::make_shared( xNode, rParent, rContext ); break; case animations::AnimationNodeType::ANIMATE: - pCreatedNode.reset( new PropertyAnimationNode( - xNode, rParent, rContext ) ); + pCreatedNode = std::make_shared( + xNode, rParent, rContext ); break; case animations::AnimationNodeType::SET: - pCreatedNode.reset( new AnimationSetNode( - xNode, rParent, rContext ) ); + pCreatedNode = std::make_shared( + xNode, rParent, rContext ); break; case animations::AnimationNodeType::ANIMATEMOTION: - pCreatedNode.reset( new AnimationPathMotionNode( - xNode, rParent, rContext ) ); + pCreatedNode = std::make_shared( + xNode, rParent, rContext ); break; case animations::AnimationNodeType::ANIMATECOLOR: - pCreatedNode.reset( new AnimationColorNode( - xNode, rParent, rContext ) ); + pCreatedNode = std::make_shared( + xNode, rParent, rContext ); break; case animations::AnimationNodeType::ANIMATETRANSFORM: - pCreatedNode.reset( new AnimationTransformNode( - xNode, rParent, rContext ) ); + pCreatedNode = std::make_shared( + xNode, rParent, rContext ); break; case animations::AnimationNodeType::TRANSITIONFILTER: - pCreatedNode.reset( new AnimationTransitionFilterNode( - xNode, rParent, rContext ) ); + pCreatedNode = std::make_shared( + xNode, rParent, rContext ); break; case animations::AnimationNodeType::AUDIO: - pCreatedNode.reset( new AnimationAudioNode( - xNode, rParent, rContext ) ); + pCreatedNode = std::make_shared( + xNode, rParent, rContext ); break; case animations::AnimationNodeType::COMMAND: - pCreatedNode.reset( new AnimationCommandNode( - xNode, rParent, rContext ) ); + pCreatedNode = std::make_shared( + xNode, rParent, rContext ); break; default: diff --git a/slideshow/source/engine/animationnodes/setactivity.hxx b/slideshow/source/engine/animationnodes/setactivity.hxx index fbe6e3a11397..37e3ff3a53b4 100644 --- a/slideshow/source/engine/animationnodes/setactivity.hxx +++ b/slideshow/source/engine/animationnodes/setactivity.hxx @@ -133,8 +133,7 @@ template AnimationActivitySharedPtr makeSetActivity( const ::std::shared_ptr< AnimationT >& rAnimation, const typename AnimationT::ValueType& rToValue ) { - return AnimationActivitySharedPtr( - new SetActivity(rParms,rAnimation,rToValue) ); + return std::make_shared>(rParms,rAnimation,rToValue); } } // namespace internal diff --git a/slideshow/source/engine/effectrewinder.cxx b/slideshow/source/engine/effectrewinder.cxx index 41f6976fc6ed..729dc2198db1 100644 --- a/slideshow/source/engine/effectrewinder.cxx +++ b/slideshow/source/engine/effectrewinder.cxx @@ -96,20 +96,20 @@ void EffectRewinder::initialize() // b,c) a slide was started or ended (in which case the effect counter // is reset. - mpAnimationStartHandler.reset( - new RewinderAnimationEventHandler( + mpAnimationStartHandler = + std::make_shared( [this]( const AnimationNodeSharedPtr& pNode) - { return this->notifyAnimationStart( pNode ); } ) ); + { return this->notifyAnimationStart( pNode ); } ); mrEventMultiplexer.addAnimationStartHandler(mpAnimationStartHandler); - mpSlideStartHandler.reset( - new RewinderEventHandler( - [this]() { return this->resetEffectCount(); } ) ); + mpSlideStartHandler = + std::make_shared( + [this]() { return this->resetEffectCount(); } ); mrEventMultiplexer.addSlideStartHandler(mpSlideStartHandler); - mpSlideEndHandler.reset( - new RewinderEventHandler( - [this]() { return this->resetEffectCount(); } ) ); + mpSlideEndHandler = + std::make_shared( + [this]() { return this->resetEffectCount(); } ); mrEventMultiplexer.addSlideEndHandler(mpSlideEndHandler); } diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx index ce07413054a4..48920bae0e51 100644 --- a/slideshow/source/engine/rehearsetimingsactivity.cxx +++ b/slideshow/source/engine/rehearsetimingsactivity.cxx @@ -189,12 +189,12 @@ std::shared_ptr RehearseTimingsActivity::create( std::shared_ptr pActivity( new RehearseTimingsActivity( rContext )); - pActivity->mpMouseHandler.reset( - new MouseHandler(*pActivity) ); - pActivity->mpWakeUpEvent.reset( - new WakeupEvent( rContext.mrEventQueue.getTimer(), + pActivity->mpMouseHandler = + std::make_shared(*pActivity); + pActivity->mpWakeUpEvent = + std::make_shared( rContext.mrEventQueue.getTimer(), pActivity, - rContext.mrActivitiesQueue )); + rContext.mrActivitiesQueue ); rContext.mrEventMultiplexer.addViewHandler( pActivity ); diff --git a/slideshow/source/engine/shapes/backgroundshape.cxx b/slideshow/source/engine/shapes/backgroundshape.cxx index adc550662298..dde159ca477f 100644 --- a/slideshow/source/engine/shapes/backgroundshape.cxx +++ b/slideshow/source/engine/shapes/backgroundshape.cxx @@ -288,11 +288,10 @@ namespace slideshow const uno::Reference< drawing::XDrawPage >& xMasterPage, const SlideShowContext& rContext ) { - return ShapeSharedPtr( - new BackgroundShape( + return std::make_shared( xDrawPage, xMasterPage, - rContext )); + rContext ); } } } diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index 0e377c8b855b..46bbb7efd2cb 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -713,7 +713,7 @@ ActivityImpl::ActivityImpl( : maContext(rContext), mpWakeupEvent(pWakeupEvent), mpParentDrawShape(pParentDrawShape), - mpListener( new IntrinsicAnimationListener(*this) ), + mpListener( std::make_shared(*this) ), maTimer(rContext.mrEventQueue.getTimer()), mfRotationAngle(0.0), mbIsShapeAnimated(false), @@ -912,7 +912,7 @@ std::shared_ptr createDrawingLayerAnimActivity( { auto const pWakeupEvent = std::make_shared( rContext.mrEventQueue.getTimer(), rContext.mrActivitiesQueue ); - pActivity.reset( new ActivityImpl( rContext, pWakeupEvent, pDrawShape ) ); + pActivity = std::make_shared( rContext, pWakeupEvent, pDrawShape ); pWakeupEvent->setActivity( pActivity ); } catch( uno::RuntimeException& ) diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index a09dd07e19f0..f4a541ecd907 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -69,7 +69,7 @@ namespace slideshow mxComponentContext); if (!mpCurrMtf) - mpCurrMtf.reset( new GDIMetaFile ); + mpCurrMtf = std::make_shared(); // TODO(F1): Currently, the scroll metafile will // never contain any verbose text comments. Thus, @@ -387,7 +387,7 @@ namespace slideshow xContainingPage, mnCurrMtfLoadFlags, mxComponentContext ); if (!mpCurrMtf) - mpCurrMtf.reset(new GDIMetaFile); + mpCurrMtf = std::make_shared(); maSubsetting.reset( mpCurrMtf ); @@ -547,9 +547,9 @@ namespace slideshow std::back_insert_iterator< std::vector >( aTimeout ), std::mem_fn(&MtfAnimationFrame::getDuration) ); - WakeupEventSharedPtr pWakeupEvent( - new WakeupEvent( rContext.mrEventQueue.getTimer(), - rContext.mrActivitiesQueue ) ); + WakeupEventSharedPtr pWakeupEvent = + std::make_shared( rContext.mrEventQueue.getTimer(), + rContext.mrActivitiesQueue ); ActivitySharedPtr pActivity = createIntrinsicAnimationActivity( @@ -604,7 +604,7 @@ namespace slideshow return; } - ViewShapeSharedPtr pNewShape( new ViewShape( rNewLayer ) ); + ViewShapeSharedPtr pNewShape = std::make_shared( rNewLayer ); maViewShapes.push_back( pNewShape ); @@ -1015,7 +1015,7 @@ namespace slideshow ShapeAttributeLayerSharedPtr DrawShape::createAttributeLayer() { // create new layer, with last as its new child - mpAttributeLayer.reset( new ShapeAttributeLayer( mpAttributeLayer ) ); + mpAttributeLayer = std::make_shared( mpAttributeLayer ); // Update the local state ids to reflect those of the new layer. updateStateIds(); diff --git a/slideshow/source/engine/shapes/externalshapebase.cxx b/slideshow/source/engine/shapes/externalshapebase.cxx index fef7cef6d5d4..52b617ebf8c3 100644 --- a/slideshow/source/engine/shapes/externalshapebase.cxx +++ b/slideshow/source/engine/shapes/externalshapebase.cxx @@ -83,7 +83,7 @@ namespace slideshow const SlideShowContext& rContext ) : mxComponentContext( rContext.mxComponentContext ), mxShape( xShape ), - mpListener( new ExternalShapeBaseListener(*this) ), + mpListener( std::make_shared(*this) ), mpShapeManager( rContext.mpSubsettableShapeManager ), mrEventMultiplexer( rContext.mrEventMultiplexer ), mnPriority( nPrio ), // TODO(F1): When ZOrder someday becomes usable: make this ( getAPIShapePrio( xShape ) ), diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx index 2a7bb51a4ae8..3a06b8002dd7 100644 --- a/slideshow/source/engine/shapes/gdimtftools.cxx +++ b/slideshow/source/engine/shapes/gdimtftools.cxx @@ -131,7 +131,7 @@ public: hasUnsupportedActions(aGraphic.GetGDIMetaFile()) ) ) { // wrap bitmap into GDIMetafile - GDIMetaFileSharedPtr xMtf(new GDIMetaFile); + GDIMetaFileSharedPtr xMtf = std::make_shared(); ::BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); @@ -346,7 +346,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, // extract current aVDev content into a new animation // frame - GDIMetaFileSharedPtr pMtf( new GDIMetaFile() ); + GDIMetaFileSharedPtr pMtf = std::make_shared(); pMtf->AddAction( new MetaBmpExAction( aEmptyPoint, BitmapEx( diff --git a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx index de0bc4e5a2ea..3fe1d59ce8d7 100644 --- a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx +++ b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx @@ -118,7 +118,7 @@ namespace slideshow maContext( rContext ), mpDrawShape( rDrawShape ), mpWakeupEvent( rWakeupEvent ), - mpListener( new IntrinsicAnimationListener(*this) ), + mpListener( std::make_shared(*this) ), maTimeouts( rTimeouts ), mnCurrIndex(0), mnNumLoops(nNumLoops), @@ -240,12 +240,11 @@ namespace slideshow const ::std::vector& rTimeouts, sal_uInt32 nNumLoops) { - return ActivitySharedPtr( - new IntrinsicAnimationActivity(rContext, + return std::make_shared(rContext, rDrawShape, rWakeupEvent, rTimeouts, - nNumLoops) ); + nNumLoops); } } } diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index c3b681017106..06ac4275af1d 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -477,10 +477,10 @@ ShapeSharedPtr ShapeImporter::importShape() // throw (ShapeLoadFailedException) if( rTop.mpGroupShape ) // in group particle mode? { - pRet.reset( new ShapeOfGroup( + pRet = std::make_shared( rTop.mpGroupShape /* container shape */, xCurrShape, xPropSet, - mnAscendingPrio ) ); + mnAscendingPrio ); } else { diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 8426503671f1..5df9650b4cc7 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -353,10 +353,9 @@ namespace slideshow const ::basegfx::B2DSize& rSpriteSizePixel(rSpriteBoundsPixel.getRange()); if( !mpSprite ) { - mpSprite.reset( - new AnimatedSprite( mpViewLayer, + mpSprite = std::make_shared( mpViewLayer, rSpriteSizePixel, - nPrio )); + nPrio ); } else { diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx index 543308ef5496..eb97b32da11d 100644 --- a/slideshow/source/engine/slide/layermanager.cxx +++ b/slideshow/source/engine/slide/layermanager.cxx @@ -611,7 +611,7 @@ namespace slideshow bool LayerManager::renderTo( const ::cppcanvas::CanvasSharedPtr& rTargetCanvas ) const { bool bRet( true ); - ViewLayerSharedPtr pTmpLayer( new DummyLayer( rTargetCanvas ) ); + ViewLayerSharedPtr pTmpLayer = std::make_shared( rTargetCanvas ); for( const auto& rShape : maAllShapes ) { diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index f58cca2128e6..ebd16911d2c0 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -307,10 +307,10 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra mxDrawPage( xDrawPage ), mxDrawPagesSupplier( xDrawPages ), mxRootNode( xRootNode ), - mpLayerManager( new LayerManager( + mpLayerManager( std::make_shared( rViewContainer, bDisableAnimationZOrder) ), - mpShapeManager( new ShapeManagerImpl( + mpShapeManager( std::make_shared( rEventMultiplexer, mpLayerManager, rCursorManager, diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx index e3f1954557b5..179b937d874a 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -443,7 +443,7 @@ namespace slideshow const SlideShowContext& rContext, const PolyPolygonVector& rPolygons, bool bActive ) : - mpHandler( new PaintOverlayHandler( rStrokeColor, + mpHandler( std::make_shared( rStrokeColor, nStrokeWidth, rContext.mrScreenUpdater, rContext.mrViewContainer, diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 9e9893ffdbba..0e3d0f87e927 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -534,7 +534,7 @@ SlideShowImpl::SlideShowImpl( maShapeCursors(), maUserPaintColor(), maUserPaintStrokeWidth(4.0), - mpPresTimer( new canvas::tools::ElapsedTime ), + mpPresTimer( std::make_shared() ), maScreenUpdater(maViewContainer), maEventQueue( mpPresTimer ), maEventMultiplexer( maEventQueue, @@ -593,10 +593,10 @@ SlideShowImpl::SlideShowImpl( } } - mpListener.reset( new SeparateListenerImpl( + mpListener = std::make_shared( *this, maScreenUpdater, - maEventQueue )); + maEventQueue ); maEventMultiplexer.addSlideAnimationsEndHandler( mpListener ); maEventMultiplexer.addViewRepaintHandler( mpListener ); maEventMultiplexer.addHyperlinkHandler( mpListener, 0.0 ); @@ -2332,7 +2332,7 @@ std::shared_ptr SlideShowImpl::getMediaTempFile(const OU OUString sTempUrl; if (::avmedia::CreateMediaTempFile(xInStream, sTempUrl, sDesiredExtension)) - aRet.reset(new avmedia::MediaTempFile(sTempUrl)); + aRet = std::make_shared(sTempUrl); xInStream->closeInput(); } diff --git a/slideshow/source/engine/smilfunctionparser.cxx b/slideshow/source/engine/smilfunctionparser.cxx index a2da99a4f29e..4953ccde2fcc 100644 --- a/slideshow/source/engine/smilfunctionparser.cxx +++ b/slideshow/source/engine/smilfunctionparser.cxx @@ -509,7 +509,7 @@ namespace slideshow const ParserContextSharedPtr& getParserContext() { - static ParserContextSharedPtr lcl_parserContext( new ParserContext ); + static ParserContextSharedPtr lcl_parserContext = std::make_shared(); // clear node stack (since we reuse the static object, that's // the whole point here) diff --git a/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx b/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx index 2f190257902d..94ee99cecd48 100644 --- a/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx +++ b/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx @@ -61,61 +61,46 @@ namespace slideshow switch (nType) { case BARWIPE: - return ParametricPolyPolygonSharedPtr( - new BarWipePolyPolygon ); + return std::make_shared(); case BLINDSWIPE: - return ParametricPolyPolygonSharedPtr( - new BarWipePolyPolygon( 6 ) ); + return std::make_shared( 6 ); case BOXWIPE: - return ParametricPolyPolygonSharedPtr( - new BoxWipe( nSubType == LEFTCENTER || + return std::make_shared( nSubType == LEFTCENTER || nSubType == TOPCENTER || nSubType == RIGHTCENTER|| - nSubType == BOTTOMCENTER ) ); + nSubType == BOTTOMCENTER ); case FOURBOXWIPE: - return ParametricPolyPolygonSharedPtr( - new FourBoxWipe( nSubType == CORNERSOUT ) ); + return std::make_shared( nSubType == CORNERSOUT ); case BARNDOORWIPE: - return ParametricPolyPolygonSharedPtr( - new BarnDoorWipe ); + return std::make_shared(); case DIAGONALWIPE: - return ParametricPolyPolygonSharedPtr( - new BarWipePolyPolygon ); + return std::make_shared(); case VEEWIPE: - return ParametricPolyPolygonSharedPtr( - new VeeWipe ); + return std::make_shared(); case IRISWIPE: - return ParametricPolyPolygonSharedPtr( - new IrisWipe ); + return std::make_shared(); case ELLIPSEWIPE: - return ParametricPolyPolygonSharedPtr( - new EllipseWipe(nSubType) ); + return std::make_shared(nSubType); case CHECKERBOARDWIPE: - return ParametricPolyPolygonSharedPtr( - new CheckerBoardWipe ); + return std::make_shared(); case RANDOMBARWIPE: - return ParametricPolyPolygonSharedPtr( - new RandomWipe( 128, true /* bars */ ) ); + return std::make_shared( 128, true /* bars */ ); case DISSOLVE: - return ParametricPolyPolygonSharedPtr( - new RandomWipe( 16 * 16, // for now until dxcanvas is faster + return std::make_shared( 16 * 16, // for now until dxcanvas is faster // 64 * 64 /* elements */, - false /* dissolve */ ) ); + false /* dissolve */ ); case WATERFALLWIPE: - return ParametricPolyPolygonSharedPtr( - new WaterfallWipe( + return std::make_shared( 128, // flipOnYAxis: nSubType == VERTICALRIGHT || - nSubType == HORIZONTALLEFT ) ); + nSubType == HORIZONTALLEFT ); case CLOCKWIPE: - return ParametricPolyPolygonSharedPtr( - new ClockWipe ); + return std::make_shared(); case FANWIPE: - return ParametricPolyPolygonSharedPtr( - new FanWipe( // center: + return std::make_shared( // center: nSubType == CENTERTOP || - nSubType == CENTERRIGHT ) ); + nSubType == CENTERRIGHT ); case PINWHEELWIPE: { sal_Int32 blades; switch (nSubType) { @@ -135,12 +120,10 @@ namespace slideshow blades = 2; break; } - return ParametricPolyPolygonSharedPtr( - new PinWheelWipe( blades ) ); + return std::make_shared( blades ); } case SNAKEWIPE: - return ParametricPolyPolygonSharedPtr( - new SnakeWipe( + return std::make_shared( // elements: 8 * 8, // diagonal: @@ -152,10 +135,9 @@ namespace slideshow nSubType == TOPLEFTVERTICAL || nSubType == TOPRIGHTDIAGONAL || nSubType == BOTTOMLEFTDIAGONAL - ) ); + ); case PARALLELSNAKESWIPE: - return ParametricPolyPolygonSharedPtr( - new ParallelSnakesWipe( + return std::make_shared( // elements: 8 * 8, // diagonal: @@ -172,28 +154,25 @@ namespace slideshow nSubType == HORIZONTALTOPRIGHTOPPOSITE || nSubType == DIAGONALBOTTOMLEFTOPPOSITE || nSubType == DIAGONALTOPLEFTOPPOSITE - ) ); + ); case SPIRALWIPE: - return ParametricPolyPolygonSharedPtr( - new SpiralWipe( + return std::make_shared( // elements: 8 * 8, // flipOnYAxis: nSubType == TOPLEFTCOUNTERCLOCKWISE || nSubType == TOPRIGHTCOUNTERCLOCKWISE || nSubType == BOTTOMRIGHTCOUNTERCLOCKWISE || - nSubType == BOTTOMLEFTCOUNTERCLOCKWISE ) ); + nSubType == BOTTOMLEFTCOUNTERCLOCKWISE ); case BOXSNAKESWIPE: - return ParametricPolyPolygonSharedPtr( - new BoxSnakesWipe( + return std::make_shared( // elements: 8 * 8, // fourBox: nSubType == FOURBOXVERTICAL || - nSubType == FOURBOXHORIZONTAL ) ); + nSubType == FOURBOXHORIZONTAL ); case SINGLESWEEPWIPE: - return ParametricPolyPolygonSharedPtr( - new SweepWipe( + return std::make_shared( // center: nSubType == CLOCKWISETOP || nSubType == CLOCKWISERIGHT || @@ -206,10 +185,9 @@ namespace slideshow // flipOnYAxis: nSubType == COUNTERCLOCKWISEBOTTOMLEFT || nSubType == COUNTERCLOCKWISETOPRIGHT - ) ); + ); case DOUBLESWEEPWIPE: - return ParametricPolyPolygonSharedPtr( - new SweepWipe( + return std::make_shared( // center: nSubType == PARALLELVERTICAL || nSubType == PARALLELDIAGONAL || @@ -221,17 +199,16 @@ namespace slideshow nSubType == OPPOSITEVERTICAL || nSubType == OPPOSITEHORIZONTAL, // flipOnYAxis: - false ) ); + false ); case DOUBLEFANWIPE: - return ParametricPolyPolygonSharedPtr( - new FanWipe( + return std::make_shared( //center: true, // single: false, // fanIn: nSubType == FANINVERTICAL || - nSubType == FANINHORIZONTAL ) ); + nSubType == FANINHORIZONTAL ); case TRIANGLEWIPE: return ParametricPolyPolygonSharedPtr( FigureWipe::createTriangleWipe() ); @@ -263,18 +240,16 @@ namespace slideshow case MISCDIAGONALWIPE: { switch (nSubType) { case DOUBLEBARNDOOR: - return ParametricPolyPolygonSharedPtr( - new BarnDoorWipe( true /* doubled */ ) ); + return std::make_shared( true /* doubled */ ); case DOUBLEDIAMOND: - return ParametricPolyPolygonSharedPtr( - new DoubleDiamondWipe ); + return std::make_shared(); } break; } case ZIGZAGWIPE: - return ParametricPolyPolygonSharedPtr( new ZigZagWipe(5) ); + return std::make_shared(5); case BARNZIGZAGWIPE: - return ParametricPolyPolygonSharedPtr( new BarnZigZagWipe(5) ); + return std::make_shared(5); case BOWTIEWIPE: case BARNVEEWIPE: @@ -284,8 +259,7 @@ namespace slideshow case SALOONDOORWIPE: case WINDSHIELDWIPE: // for now, map to barwipe transition - return ParametricPolyPolygonSharedPtr( - new BarWipePolyPolygon ); + return std::make_shared(); default: case PUSHWIPE: diff --git a/slideshow/source/engine/transitions/shapetransitionfactory.cxx b/slideshow/source/engine/transitions/shapetransitionfactory.cxx index 666ce116b6be..ce4da4cb1611 100644 --- a/slideshow/source/engine/transitions/shapetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/shapetransitionfactory.cxx @@ -219,13 +219,12 @@ AnimationActivitySharedPtr createShapeTransitionByType( // create a clip activity from that pGeneratedActivity = ActivitiesFactory::createSimpleActivity( rParms, - NumberAnimationSharedPtr( - new ClippingAnimation( + std::make_shared( pPoly, rShapeManager, *pTransitionInfo, xTransition->getDirection(), - xTransition->getMode() ) ), + xTransition->getMode() ), true ); } break; @@ -302,14 +301,13 @@ AnimationActivitySharedPtr createShapeTransitionByType( // create a clip activity from that pGeneratedActivity = ActivitiesFactory::createSimpleActivity( rParms, - NumberAnimationSharedPtr( - new ClippingAnimation( + std::make_shared( pPoly, rShapeManager, *getTransitionInfo( animations::TransitionType::BARWIPE, nBarWipeSubType ), bDirectionForward, - xTransition->getMode() ) ), + xTransition->getMode() ), true ); } break; diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index 6c53690017cc..e0ef0b060b1f 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -125,7 +125,7 @@ SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& slideSizePixel.getY() ), 0x000000FFU ); - pRet.reset( new SlideBitmap( pBitmap )); + pRet = std::make_shared( pBitmap ); } else { diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx index 30724effa283..52b2bdc0b105 100644 --- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx @@ -730,27 +730,25 @@ NumberAnimationSharedPtr createPushWipeTransition( if( bComb ) { - return NumberAnimationSharedPtr( - new CombTransition( leavingSlide, + return std::make_shared( leavingSlide, pEnteringSlide, pSoundPlayer, rViewContainer, rScreenUpdater, rEventMultiplexer, aDirection, - 24 /* comb with 12 stripes */ )); + 24 /* comb with 12 stripes */ ); } else { - return NumberAnimationSharedPtr( - new MovingSlideChange( leavingSlide, + return std::make_shared( leavingSlide, pEnteringSlide, pSoundPlayer, rViewContainer, rScreenUpdater, rEventMultiplexer, aDirection, - aDirection )); + aDirection ); } } @@ -816,8 +814,7 @@ NumberAnimationSharedPtr createSlideWipeTransition( // the 'leaving' slide. - return NumberAnimationSharedPtr( - new MovingSlideChange( + return std::make_shared( o3tl::optional() /* no slide */, pEnteringSlide, pSoundPlayer, @@ -825,7 +822,7 @@ NumberAnimationSharedPtr createSlideWipeTransition( rScreenUpdater, rEventMultiplexer, basegfx::B2DVector(), - aInDirection )); + aInDirection ); } else { @@ -834,15 +831,14 @@ NumberAnimationSharedPtr createSlideWipeTransition( // and the old one is moving off in the foreground. - return NumberAnimationSharedPtr( - new MovingSlideChange( leavingSlide, + return std::make_shared( leavingSlide, pEnteringSlide, pSoundPlayer, rViewContainer, rScreenUpdater, rEventMultiplexer, aInDirection, - basegfx::B2DVector() )); + basegfx::B2DVector() ); } } @@ -953,15 +949,14 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition( nTransitionType, nTransitionSubType ) ); // create a clip transition from that - return NumberAnimationSharedPtr( - new ClippedSlideChange( pEnteringSlide, + return std::make_shared( pEnteringSlide, pPoly, *pTransitionInfo, rViewContainer, rScreenUpdater, rEventMultiplexer, bTransitionDirection, - pSoundPlayer )); + pSoundPlayer ); } case TransitionInfo::TRANSITION_SPECIAL: @@ -1070,25 +1065,23 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition( } if( nTransitionType == animations::TransitionType::FADE ) - return NumberAnimationSharedPtr( - new FadingSlideChange( + return std::make_shared( leavingSlide, pEnteringSlide, aFadeColor, pSoundPlayer, rViewContainer, rScreenUpdater, - rEventMultiplexer )); + rEventMultiplexer ); else - return NumberAnimationSharedPtr( - new CutSlideChange( + return std::make_shared( leavingSlide, pEnteringSlide, rTransitionFadeColor, pSoundPlayer, rViewContainer, rScreenUpdater, - rEventMultiplexer )); + rEventMultiplexer ); } } } diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx index 44078a390cb4..51a725fa7de7 100644 --- a/slideshow/source/engine/usereventqueue.cxx +++ b/slideshow/source/engine/usereventqueue.cxx @@ -495,7 +495,7 @@ void UserEventQueue::registerEvent( if( !rHandler ) { // create handler - rHandler.reset( new Handler( mrEventQueue ) ); + rHandler = std::make_shared( mrEventQueue ); // register handler on EventMultiplexer rRegistrationFunctor( rHandler ); } @@ -515,7 +515,7 @@ void UserEventQueue::registerEvent( if( !rHandler ) { // create handler - rHandler.reset( new Handler( mrEventQueue ) ); + rHandler = std::make_shared( mrEventQueue ); // register handler on EventMultiplexer rRegistrationFunctor( rHandler ); @@ -659,9 +659,9 @@ void UserEventQueue::registerShapeClickEvent( const EventSharedPtr& rEvent, if( !mpShapeClickEventHandler ) { // create handler - mpShapeClickEventHandler.reset( - new ShapeClickEventHandler(mrCursorManager, - mrEventQueue) ); + mpShapeClickEventHandler = + std::make_shared(mrCursorManager, + mrEventQueue); // register handler on EventMultiplexer mrMultiplexer.addClickHandler( mpShapeClickEventHandler, 1.0 ); @@ -722,8 +722,8 @@ void UserEventQueue::registerSkipEffectEvent( { if(!mpSkipEffectEventHandler) { - mpSkipEffectEventHandler.reset( - new SkipEffectEventHandler( mrEventQueue, mrMultiplexer ) ); + mpSkipEffectEventHandler = + std::make_shared( mrEventQueue, mrMultiplexer ); // register the handler on _two_ sources: we want the // nextEffect events, e.g. space bar, to trigger clicks, as well! mrMultiplexer.addClickHandler( mpSkipEffectEventHandler, @@ -750,9 +750,9 @@ void UserEventQueue::registerShapeDoubleClickEvent( if( !mpShapeDoubleClickEventHandler ) { // create handler - mpShapeDoubleClickEventHandler.reset( - new ShapeClickEventHandler(mrCursorManager, - mrEventQueue) ); + mpShapeDoubleClickEventHandler = + std::make_shared(mrCursorManager, + mrEventQueue); // register handler on EventMultiplexer mrMultiplexer.addDoubleClickHandler( mpShapeDoubleClickEventHandler, -- cgit