summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2017-09-02 07:09:21 +0900
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-02 08:07:52 +0200
commitcba232f91898af9e57a5c6980e11974e1a68f2a1 (patch)
tree0b3927e2f1b611d1f58c72ac6af0ba7f43996055 /svx
parent9245ce93b0c9a55bd84e8b448919db2d706e9b06 (diff)
svx: Simplify code with std::unique_ptr
as SdrPathObj owns mpDAC. Change-Id: I3e4411046fa55ae8ffae2da5e406ad7d20a7ca6e Reviewed-on: https://gerrit.libreoffice.org/41818 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdopath.cxx24
1 files changed, 5 insertions, 19 deletions
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 49df3cb8cb34..b079c6ae3393 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -1658,7 +1658,6 @@ sdr::contact::ViewContact* SdrPathObj::CreateObjectSpecificViewContact()
SdrPathObj::SdrPathObj(SdrObjKind eNewKind)
: meKind(eNewKind),
- mpDAC(nullptr),
mdBrightness(0.0)
{
bClosedObj = IsClosed();
@@ -1667,17 +1666,13 @@ SdrPathObj::SdrPathObj(SdrObjKind eNewKind)
SdrPathObj::SdrPathObj(SdrObjKind eNewKind, const basegfx::B2DPolyPolygon& rPathPoly, double dBrightness)
: maPathPolygon(rPathPoly),
meKind(eNewKind),
- mpDAC(nullptr),
mdBrightness(dBrightness)
{
bClosedObj = IsClosed();
ImpForceKind();
}
-SdrPathObj::~SdrPathObj()
-{
- impDeleteDAC();
-}
+SdrPathObj::~SdrPathObj() = default;
static bool lcl_ImpIsLine(const basegfx::B2DPolyPolygon& rPolyPolygon)
{
@@ -2224,7 +2219,7 @@ basegfx::B2DPolyPolygon SdrPathObj::getSpecialDragPoly(const SdrDragStat& rDrag)
bool SdrPathObj::BegCreate(SdrDragStat& rStat)
{
- impDeleteDAC();
+ mpDAC.reset();
return impGetDAC().BegCreate(rStat);
}
@@ -2274,7 +2269,7 @@ bool SdrPathObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
}
}
- impDeleteDAC();
+ mpDAC.reset();
}
return bRetval;
@@ -2288,7 +2283,7 @@ bool SdrPathObj::BckCreate(SdrDragStat& rStat)
void SdrPathObj::BrkCreate(SdrDragStat& rStat)
{
impGetDAC().BrkCreate(rStat);
- impDeleteDAC();
+ mpDAC.reset();
}
// polygons
@@ -2817,21 +2812,12 @@ ImpPathForDragAndCreate& SdrPathObj::impGetDAC() const
{
if(!mpDAC)
{
- const_cast<SdrPathObj*>(this)->mpDAC = new ImpPathForDragAndCreate(*const_cast<SdrPathObj*>(this));
+ const_cast<SdrPathObj*>(this)->mpDAC.reset(new ImpPathForDragAndCreate(*const_cast<SdrPathObj*>(this)));
}
return *mpDAC;
}
-void SdrPathObj::impDeleteDAC() const
-{
- if(mpDAC)
- {
- delete mpDAC;
- const_cast<SdrPathObj*>(this)->mpDAC = nullptr;
- }
-}
-
// transformation interface for StarOfficeAPI. This implements support for
// homogeneous 3x3 matrices containing the transformation of the SdrObject. At the