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