diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-21 15:30:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-25 13:57:36 +0200 |
commit | b4fc996520b47a6212661a9de3a1c72ccfc379a4 (patch) | |
tree | 2dcb66d687dcdd1d91a75f9e498ca04742a7c564 /sd | |
parent | c30bdfbd22807e3f0c77f13a246ec243153ad7ae (diff) |
loplugin:useuniqueptr in SdrHdlList
Change-Id: I83241bd2ed172594704f4b115b584dc39b234086
Reviewed-on: https://gerrit.libreoffice.org/60959
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/animations/motionpathtag.cxx | 29 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationtag.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/viewoverlaymanager.cxx | 4 |
3 files changed, 18 insertions, 19 deletions
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index c6e83af4b701..0b8701956796 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -879,12 +879,11 @@ void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList ) } SmartTagReference xThis( this ); - SdPathHdl* pHdl = new SdPathHdl( xThis, mpPathObj ); + std::unique_ptr<SdPathHdl> pHdl(new SdPathHdl( xThis, mpPathObj )); pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM ); pHdl->SetPageView( mrView.GetSdrPageView() ); - pHdl->SetObj(mpPathObj); - rHandlerList.AddHdl( pHdl ); + rHandlerList.AddHdl( std::move(pHdl) ); if( isSelected() ) { @@ -908,7 +907,7 @@ void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList ) pSmartHdl->SetSourceHdlNum( pTempHdl->GetSourceHdlNum() ); pSmartHdl->SetPageView( mrView.GetSdrPageView() ); - rHandlerList.AddHdl( pSmartHdl ); + rHandlerList.AddHdl( std::unique_ptr<SmartHdl>(pSmartHdl) ); const bool bSelected = rMrkPnts.find( sal_uInt16(nHandle) ) != rMrkPnts.end(); pSmartHdl->SetSelected(bSelected); @@ -941,23 +940,23 @@ void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList ) bool bHgt0=aRect.Top()==aRect.Bottom(); if (bWdt0 && bHgt0) { - rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopLeft(),SdrHdlKind::UpperLeft)); + rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft(),SdrHdlKind::UpperLeft)); } else if (bWdt0 || bHgt0) { - rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopLeft() ,SdrHdlKind::UpperLeft)); - rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.BottomRight(),SdrHdlKind::LowerRight)); + rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft() ,SdrHdlKind::UpperLeft)); + rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomRight(),SdrHdlKind::LowerRight)); } else { - if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopLeft() ,SdrHdlKind::UpperLeft)); - if ( !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopCenter() ,SdrHdlKind::Upper)); - if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.TopRight() ,SdrHdlKind::UpperRight)); - if (!bWdt0 ) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.LeftCenter() ,SdrHdlKind::Left )); - if (!bWdt0 ) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.RightCenter() ,SdrHdlKind::Right)); - if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.BottomLeft() ,SdrHdlKind::LowerLeft)); - if ( !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.BottomCenter(),SdrHdlKind::Lower)); - if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(new SmartHdl( xThis, mpPathObj, aRect.BottomRight() ,SdrHdlKind::LowerRight)); + if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft() ,SdrHdlKind::UpperLeft)); + if ( !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopCenter() ,SdrHdlKind::Upper)); + if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopRight() ,SdrHdlKind::UpperRight)); + if (!bWdt0 ) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.LeftCenter() ,SdrHdlKind::Left )); + if (!bWdt0 ) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.RightCenter() ,SdrHdlKind::Right)); + if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomLeft() ,SdrHdlKind::LowerLeft)); + if ( !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomCenter(),SdrHdlKind::Lower)); + if (!bWdt0 && !bHgt0) rHandlerList.AddHdl(o3tl::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomRight() ,SdrHdlKind::LowerRight)); } while( nCount < rHandlerList.GetHdlCount() ) diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 0a3d017798a6..1b5d9bd86585 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -451,7 +451,7 @@ void AnnotationTag::addCustomHandles( SdrHdlList& rHandlerList ) if( mxAnnotation.is() ) { SmartTagReference xThis( this ); - AnnotationHdl* pHdl = new AnnotationHdl( xThis, mxAnnotation, Point() ); + std::unique_ptr<AnnotationHdl> pHdl(new AnnotationHdl( xThis, mxAnnotation, Point() )); pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM ); pHdl->SetPageView( mrView.GetSdrPageView() ); @@ -459,7 +459,7 @@ void AnnotationTag::addCustomHandles( SdrHdlList& rHandlerList ) Point aBasePos( static_cast<long>(aPosition.X * 100.0), static_cast<long>(aPosition.Y * 100.0) ); pHdl->SetPos( aBasePos ); - rHandlerList.AddHdl( pHdl ); + rHandlerList.AddHdl( std::move(pHdl) ); } } diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index 0e3b48ca369a..9331b53d50f9 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -387,13 +387,13 @@ void ChangePlaceholderTag::addCustomHandles( SdrHdlList& rHandlerList ) aPos.AdjustX( -(all_width >> 1) ); aPos.AdjustY( -(all_height >> 1) ); - ImageButtonHdl* pHdl = new ImageButtonHdl( xThis, aPoint ); + std::unique_ptr<ImageButtonHdl> pHdl(new ImageButtonHdl( xThis, aPoint )); pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM ); pHdl->SetPageView( mrView.GetSdrPageView() ); pHdl->SetPos( aPos ); - rHandlerList.AddHdl( pHdl ); + rHandlerList.AddHdl( std::move(pHdl) ); } } |