summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-07 17:05:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-05-07 17:24:18 +0100
commitbd6efb29d7b588669a27a7132b357e692c571a60 (patch)
tree6ca8ab496fc9dbc7ac873a4a4eae5c81d7f53d01 /svx
parent0e99a36c695d6349c8096654ddad70f962f312d0 (diff)
convert to use std::unique_ptr
Change-Id: If675a1d506d30ea05c3b2113d114f416b2947466
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdoole2.cxx49
1 files changed, 13 insertions, 36 deletions
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 1ab690845bb2..402bf801b7d3 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -595,9 +595,9 @@ class SdrOle2ObjImpl
public:
svt::EmbeddedObjectRef mxObjRef;
- Graphic* mpGraphic;
+ std::unique_ptr<Graphic> mxGraphic;
// TODO/LATER: do we really need this pointer?
- GraphicObject* mpGraphicObject;
+ std::unique_ptr<GraphicObject> mxGraphicObject;
OUString maProgName;
OUString aPersistName; // name of object in persist
SdrLightEmbeddedClient_Impl* pLightClient; // must be registered as client only using AddOwnLightClient() call
@@ -616,8 +616,6 @@ public:
rtl::Reference<SvxUnoShapeModifyListener> mxModifyListener;
explicit SdrOle2ObjImpl( bool bFrame ) :
- mpGraphic(nullptr),
- mpGraphicObject(nullptr),
pLightClient (nullptr),
mbFrame(bFrame),
mbInDestruction(false),
@@ -633,8 +631,6 @@ public:
SdrOle2ObjImpl( bool bFrame, const svt::EmbeddedObjectRef& rObjRef ) :
mxObjRef(rObjRef),
- mpGraphic(nullptr),
- mpGraphicObject(nullptr),
pLightClient (nullptr),
mbFrame(bFrame),
mbInDestruction(false),
@@ -650,8 +646,8 @@ public:
~SdrOle2ObjImpl()
{
- delete mpGraphic;
- delete mpGraphicObject;
+ mxGraphic.reset();
+ mxGraphicObject.reset();
if (mxModifyListener.is())
{
@@ -761,16 +757,8 @@ bool SdrOle2Obj::isUiActive() const
void SdrOle2Obj::SetGraphic(const Graphic& rGrf)
{
// only for setting a preview graphic
- if (mpImpl->mpGraphic)
- {
- delete mpImpl->mpGraphic;
- mpImpl->mpGraphic = nullptr;
- delete mpImpl->mpGraphicObject;
- mpImpl->mpGraphicObject = nullptr;
- }
-
- mpImpl->mpGraphic = new Graphic(rGrf);
- mpImpl->mpGraphicObject = new GraphicObject(*mpImpl->mpGraphic);
+ mpImpl->mxGraphic.reset(new Graphic(rGrf));
+ mpImpl->mxGraphicObject.reset(new GraphicObject(*mpImpl->mxGraphic));
SetChanged();
BroadcastObjectChange();
@@ -778,13 +766,8 @@ void SdrOle2Obj::SetGraphic(const Graphic& rGrf)
void SdrOle2Obj::ClearGraphic()
{
- if (mpImpl->mpGraphic)
- {
- delete mpImpl->mpGraphic;
- mpImpl->mpGraphic = nullptr;
- delete mpImpl->mpGraphicObject;
- mpImpl->mpGraphicObject = nullptr;
- }
+ mpImpl->mxGraphic.reset();
+ mpImpl->mxGraphicObject.reset();
SetChanged();
BroadcastObjectChange();
@@ -1409,7 +1392,7 @@ void SdrOle2Obj::SetObjRef( const css::uno::Reference < css::embed::XEmbeddedObj
if ( mpImpl->mxObjRef.is() )
{
- DELETEZ(mpImpl->mpGraphic);
+ mpImpl->mxGraphic.reset();
if ( (mpImpl->mxObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
SetResizeProtect(true);
@@ -1533,16 +1516,10 @@ SdrOle2Obj& SdrOle2Obj::assignFrom(const SdrOle2Obj& rObj)
mpImpl->maProgName = rOle2Obj.mpImpl->maProgName;
mpImpl->mbFrame = rOle2Obj.mpImpl->mbFrame;
- if (rOle2Obj.mpImpl->mpGraphic)
+ if (rOle2Obj.mpImpl->mxGraphic)
{
- if (mpImpl->mpGraphic)
- {
- delete mpImpl->mpGraphic;
- delete mpImpl->mpGraphicObject;
- }
-
- mpImpl->mpGraphic = new Graphic(*rOle2Obj.mpImpl->mpGraphic);
- mpImpl->mpGraphicObject = new GraphicObject(*mpImpl->mpGraphic);
+ mpImpl->mxGraphic.reset(new Graphic(*rOle2Obj.mpImpl->mxGraphic));
+ mpImpl->mxGraphicObject.reset(new GraphicObject(*mpImpl->mxGraphic));
}
if( pModel && rObj.GetModel() && !IsEmptyPresObj() )
@@ -1764,7 +1741,7 @@ const Graphic* SdrOle2Obj::GetGraphic() const
{
if ( mpImpl->mxObjRef.is() )
return mpImpl->mxObjRef.GetGraphic();
- return mpImpl->mpGraphic;
+ return mpImpl->mxGraphic.get();
}
void SdrOle2Obj::GetNewReplacement()