Kaydet (Commit) e1f479af authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SdrTextObj

Change-Id: I48f52056dcf17a568266be49f7422fa05be974db
Reviewed-on: https://gerrit.libreoffice.org/49274Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7bf0b997
...@@ -28,11 +28,12 @@ ...@@ -28,11 +28,12 @@
#include <svl/style.hxx> #include <svl/style.hxx>
#include <svx/xtextit0.hxx> #include <svx/xtextit0.hxx>
#include <svx/svdtext.hxx> #include <svx/svdtext.hxx>
#include <vector>
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <svx/svdpagv.hxx> #include <svx/svdpagv.hxx>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <memory>
#include <vector>
// forward declarations // forward declarations
...@@ -185,7 +186,7 @@ protected: ...@@ -185,7 +186,7 @@ protected:
GeoStat aGeo; GeoStat aGeo;
// this is the active text // this is the active text
SdrText* mpText; std::unique_ptr<SdrText> mpText;
// This contains the dimensions of the text // This contains the dimensions of the text
Size aTextSize; Size aTextSize;
......
...@@ -178,7 +178,7 @@ SdrTextObj::~SdrTextObj() ...@@ -178,7 +178,7 @@ SdrTextObj::~SdrTextObj()
rOutl.SetTextObj( nullptr ); rOutl.SetTextObj( nullptr );
} }
delete mpText; mpText.reset();
ImpDeregisterLink(); ImpDeregisterLink();
} }
...@@ -2113,7 +2113,7 @@ SdrText* SdrTextObj::getActiveText() const ...@@ -2113,7 +2113,7 @@ SdrText* SdrTextObj::getActiveText() const
if( !mpText ) if( !mpText )
return getText( 0 ); return getText( 0 );
else else
return mpText; return mpText.get();
} }
/** returns the nth available text. */ /** returns the nth available text. */
...@@ -2121,9 +2121,9 @@ SdrText* SdrTextObj::getText( sal_Int32 nIndex ) const ...@@ -2121,9 +2121,9 @@ SdrText* SdrTextObj::getText( sal_Int32 nIndex ) const
{ {
if( nIndex == 0 ) if( nIndex == 0 )
{ {
if( mpText == nullptr ) if( !mpText )
const_cast< SdrTextObj* >(this)->mpText = new SdrText( *const_cast< SdrTextObj* >(this) ); const_cast< SdrTextObj* >(this)->mpText.reset( new SdrText( *const_cast< SdrTextObj* >(this) ) );
return mpText; return mpText.get();
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment