[Libreoffice-commits] core.git: svx/source
Stephan Bergmann
sbergman at redhat.com
Tue Jun 13 09:28:15 UTC 2017
svx/source/svdraw/svdfmtf.cxx | 14 ++++----------
svx/source/svdraw/svdfmtf.hxx | 11 +++++++----
2 files changed, 11 insertions(+), 14 deletions(-)
New commits:
commit 16265a1f84f0ac7c16beee6a3591653eaaa90323
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jun 13 11:27:48 2017 +0200
Use unique_ptr for ImpSdrGDIMetaFileImport::mp*Attr
Change-Id: I8bfe10e46cfaacb329998b11fe507c2302fe2d44
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 104e0bb47892..9b08878962ef 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -19,6 +19,7 @@
#include "svdfmtf.hxx"
#include <editeng/editdata.hxx>
+#include <o3tl/make_unique.hxx>
#include <math.h>
#include <svx/xpoly.hxx>
#include <vcl/svapp.hxx>
@@ -109,19 +110,12 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(
mpVD->SetLineColor();
mpVD->SetFillColor();
maOldLineColor.SetRed( mpVD->GetLineColor().GetRed() + 1 );
- mpLineAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_LINE_FIRST, XATTR_LINE_LAST, 0, 0);
- mpFillAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0);
- mpTextAttr = new SfxItemSet(rModel.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END, 0, 0);
+ mpLineAttr = o3tl::make_unique<SfxItemSet>(rModel.GetItemPool(), XATTR_LINE_FIRST, XATTR_LINE_LAST, 0, 0);
+ mpFillAttr = o3tl::make_unique<SfxItemSet>(rModel.GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0);
+ mpTextAttr = o3tl::make_unique<SfxItemSet>(rModel.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END, 0, 0);
checkClip();
}
-ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport()
-{
- delete mpLineAttr;
- delete mpFillAttr;
- delete mpTextAttr;
-}
-
void ImpSdrGDIMetaFileImport::DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport)
{
const sal_uLong nCount(rMtf.GetActionSize());
diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx
index 25621d7ac7cf..7b3d0d12315a 100644
--- a/svx/source/svdraw/svdfmtf.hxx
+++ b/svx/source/svdraw/svdfmtf.hxx
@@ -20,6 +20,10 @@
#ifndef INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX
#define INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX
+#include <sal/config.h>
+
+#include <memory>
+
#include <tools/contnr.hxx>
#include <tools/fract.hxx>
#include <vcl/metaact.hxx>
@@ -46,9 +50,9 @@ protected:
ScopedVclPtr<VirtualDevice> mpVD;
tools::Rectangle maScaleRect;
size_t mnMapScalingOfs; // from here on, not edited with MapScaling
- SfxItemSet* mpLineAttr;
- SfxItemSet* mpFillAttr;
- SfxItemSet* mpTextAttr;
+ std::unique_ptr<SfxItemSet> mpLineAttr;
+ std::unique_ptr<SfxItemSet> mpFillAttr;
+ std::unique_ptr<SfxItemSet> mpTextAttr;
SdrModel* mpModel;
SdrLayerID mnLayer;
Color maOldLineColor;
@@ -159,7 +163,6 @@ public:
SdrModel& rModel,
SdrLayerID nLay,
const tools::Rectangle& rRect);
- ~ImpSdrGDIMetaFileImport();
size_t DoImport(
const GDIMetaFile& rMtf,
More information about the Libreoffice-commits
mailing list