From dbdf5ef32e2fc041183b762d9a1561430c96470b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 1 Jul 2018 22:04:20 +0200 Subject: use std::unique_ptr for CreateObjectSpecificViewContact Change-Id: I0fed54d345a43fe0bc21ebbe424e6fdc7eac9523 Reviewed-on: https://gerrit.libreoffice.org/56823 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- sw/source/core/draw/dcontact.cxx | 5 +++-- sw/source/core/draw/dflyobj.cxx | 9 +++++---- sw/source/core/inc/dflyobj.hxx | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 132d8f83662e..96c0787ae835 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -71,6 +71,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -2149,9 +2150,9 @@ namespace sdr } // end of namespace sdr /// implementation of class -sdr::contact::ViewContact* SwDrawVirtObj::CreateObjectSpecificViewContact() +std::unique_ptr SwDrawVirtObj::CreateObjectSpecificViewContact() { - return new sdr::contact::VCOfDrawVirtObj(*this); + return o3tl::make_unique(*this); } SwDrawVirtObj::SwDrawVirtObj( diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 3646acaf75da..70fab4972352 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -64,6 +64,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -114,11 +115,11 @@ sdr::properties::BaseProperties* SwFlyDrawObj::CreateObjectSpecificProperties() return new sdr::properties::DefaultProperties(*this); } -sdr::contact::ViewContact* SwFlyDrawObj::CreateObjectSpecificViewContact() +std::unique_ptr SwFlyDrawObj::CreateObjectSpecificViewContact() { // needs an own VC since createViewIndependentPrimitive2DSequence() // is called when RecalcBoundRect() is used - return new sdr::contact::VCOfSwFlyDrawObj(*this); + return o3tl::make_unique(*this); } SwFlyDrawObj::SwFlyDrawObj(SdrModel& rSdrModel) @@ -410,11 +411,11 @@ void SwVirtFlyDrawObj::Rotate(const Point& rRef, long nAngle, double sn, double } } -sdr::contact::ViewContact* SwVirtFlyDrawObj::CreateObjectSpecificViewContact() +std::unique_ptr SwVirtFlyDrawObj::CreateObjectSpecificViewContact() { // need an own ViewContact (VC) to allow creation of a specialized primitive // for being able to visualize the FlyFrames in primitive renderers - return new sdr::contact::VCOfSwVirtFlyDrawObj(*this); + return o3tl::make_unique(*this); } SwVirtFlyDrawObj::SwVirtFlyDrawObj( diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index c22ffae16251..181eeac6c95e 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -38,7 +38,7 @@ private: protected: // #i95264# SwFlyDrawObj needs an own VC since createViewIndependentPrimitive2DSequence() // is called when RecalcBoundRect() is used - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; + virtual std::unique_ptr CreateObjectSpecificViewContact() override; // protected destructor virtual ~SwFlyDrawObj() override; @@ -67,7 +67,7 @@ protected: // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is // not used but something own (top left of new SnapRect minus top left // of original SnapRect) - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; + virtual std::unique_ptr CreateObjectSpecificViewContact() override; // protected destructor virtual ~SwVirtFlyDrawObj() override; -- cgit