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

use std::unique_ptr in wmfemfhelper::TargetHolder

Change-Id: I2fab3b9a111513ac711a6480eb240de99eea1991
Reviewed-on: https://gerrit.libreoffice.org/43486Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 159b26e4
......@@ -25,6 +25,7 @@
#include <vcl/font.hxx>
#include <vcl/outdevstate.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <memory>
// predefines
namespace drawinglayer { namespace geometry { class ViewInformation2D; }}
......@@ -42,13 +43,13 @@ namespace wmfemfhelper
class TargetHolder
{
private:
std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aTargets;
std::vector< std::unique_ptr<drawinglayer::primitive2d::BasePrimitive2D> > aTargets;
public:
TargetHolder();
~TargetHolder();
sal_uInt32 size() const;
void append(drawinglayer::primitive2d::BasePrimitive2D* pCandidate);
void append(std::unique_ptr<drawinglayer::primitive2d::BasePrimitive2D> pCandidate);
drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequence(const PropertyHolder& rPropertyHolder);
};
}
......
......@@ -36,6 +36,7 @@
#include <drawinglayer/attribute/fontattribute.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <o3tl/make_unique.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
......@@ -421,7 +422,7 @@ namespace emfplushelper
}
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
o3tl::make_unique<drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D>(
polygon,
lineAttribute,
aStrokeAttribute));
......@@ -437,7 +438,7 @@ namespace emfplushelper
}
drawinglayer::attribute::StrokeAttribute strokeAttribute(aPattern);
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
o3tl::make_unique<drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D>(
polygon,
lineAttribute,
strokeAttribute));
......@@ -446,7 +447,7 @@ namespace emfplushelper
else // no further line decoration, so use simple primitive
{
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
o3tl::make_unique<drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D>(
polygon,
lineAttribute));
}
......@@ -466,7 +467,7 @@ namespace emfplushelper
if (isColor) // use Color
{
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
o3tl::make_unique<drawinglayer::primitive2d::PolyPolygonColorPrimitive2D>(
polygon,
::Color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff).getBColor()));
......@@ -525,7 +526,7 @@ namespace emfplushelper
// temporal solution: create a solid colored polygon
// TODO create a 'real' hatching primitive
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
o3tl::make_unique<drawinglayer::primitive2d::PolyPolygonColorPrimitive2D>(
polygon,
fillColor.getBColor()));
}
......@@ -634,7 +635,7 @@ namespace emfplushelper
// create the same one used for SVG
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::SvgLinearGradientPrimitive2D(
o3tl::make_unique<drawinglayer::primitive2d::SvgLinearGradientPrimitive2D>(
aTextureTransformation,
polygon,
aVector,
......@@ -650,7 +651,7 @@ namespace emfplushelper
// create the same one used for SVG
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::SvgRadialGradientPrimitive2D(
o3tl::make_unique<drawinglayer::primitive2d::SvgRadialGradientPrimitive2D>(
aTextureTransformation,
polygon,
aVector,
......@@ -1130,7 +1131,7 @@ namespace emfplushelper
if (aSize.Width() > 0 && aSize.Height() > 0)
{
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::BitmapPrimitive2D(aBmp, aTransformMatrix));
o3tl::make_unique<drawinglayer::primitive2d::BitmapPrimitive2D>(aBmp, aTransformMatrix));
}
else
{
......@@ -1142,7 +1143,7 @@ namespace emfplushelper
GDIMetaFile aGDI(image.graphic.GetGDIMetaFile());
aGDI.Clip(aSource);
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::MetafilePrimitive2D(aTransformMatrix, aGDI));
o3tl::make_unique<drawinglayer::primitive2d::MetafilePrimitive2D>(aTransformMatrix, aGDI));
}
}
else
......@@ -1219,7 +1220,7 @@ namespace emfplushelper
std::vector<double> emptyVector;
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
o3tl::make_unique<drawinglayer::primitive2d::TextSimplePortionPrimitive2D>(
transformMatrix,
text,
0, // text always starts at 0
......@@ -1619,7 +1620,7 @@ namespace emfplushelper
//generate TextSimplePortionPrimitive2D
mrTargetHolders.Current().append(
new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
o3tl::make_unique<drawinglayer::primitive2d::TextSimplePortionPrimitive2D>(
transformMatrix,
text,
pos, // take character at current pos
......
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