summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-18 09:48:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-19 05:40:55 +0000
commit2da34e265db6ca56e43d9b2ab8cee04b1cc4fb29 (patch)
treee2cbed69babc7f551e0db01a9cd023db809b2204 /svgio
parent9767537e22e178eb23872de138ea70e57c1a6725 (diff)
new loplugin: useuniqueptr: svgio
Change-Id: I645ac954ac519fe713f4347cdf69780b0f8070e4 Reviewed-on: https://gerrit.libreoffice.org/33252 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/inc/svganode.hxx7
-rw-r--r--svgio/inc/svgcirclenode.hxx7
-rw-r--r--svgio/inc/svgclippathnode.hxx7
-rw-r--r--svgio/inc/svgellipsenode.hxx7
-rw-r--r--svgio/inc/svggnode.hxx7
-rw-r--r--svgio/inc/svggradientnode.hxx3
-rw-r--r--svgio/inc/svgimagenode.hxx8
-rw-r--r--svgio/inc/svglinenode.hxx7
-rw-r--r--svgio/inc/svgmarkernode.hxx8
-rw-r--r--svgio/inc/svgmasknode.hxx8
-rw-r--r--svgio/inc/svgrectnode.hxx7
-rw-r--r--svgio/inc/svgsvgnode.hxx8
-rw-r--r--svgio/inc/svgsymbolnode.hxx6
-rw-r--r--svgio/inc/svgtextnode.hxx8
-rw-r--r--svgio/inc/svgusenode.hxx8
-rw-r--r--svgio/source/svgreader/svganode.cxx1
-rw-r--r--svgio/source/svgreader/svgcirclenode.cxx1
-rw-r--r--svgio/source/svgreader/svgclippathnode.cxx1
-rw-r--r--svgio/source/svgreader/svgellipsenode.cxx1
-rw-r--r--svgio/source/svgreader/svggnode.cxx1
-rw-r--r--svgio/source/svgreader/svggradientnode.cxx11
-rw-r--r--svgio/source/svgreader/svgimagenode.cxx1
-rw-r--r--svgio/source/svgreader/svglinenode.cxx1
-rw-r--r--svgio/source/svgreader/svgmarkernode.cxx1
-rw-r--r--svgio/source/svgreader/svgmasknode.cxx1
-rw-r--r--svgio/source/svgreader/svgrectnode.cxx1
-rw-r--r--svgio/source/svgreader/svgsvgnode.cxx1
-rw-r--r--svgio/source/svgreader/svgsymbolnode.cxx1
-rw-r--r--svgio/source/svgreader/svgtextnode.cxx1
-rw-r--r--svgio/source/svgreader/svgusenode.cxx1
30 files changed, 67 insertions, 64 deletions
diff --git a/svgio/inc/svganode.hxx b/svgio/inc/svganode.hxx
index 1f5774a6f3c7..b7660a0e4de5 100644
--- a/svgio/inc/svganode.hxx
+++ b/svgio/inc/svganode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -34,7 +35,7 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgANode(
@@ -47,8 +48,8 @@ namespace svgio
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/inc/svgcirclenode.hxx b/svgio/inc/svgcirclenode.hxx
index cd19de4927f8..68fc3e935e38 100644
--- a/svgio/inc/svgcirclenode.hxx
+++ b/svgio/inc/svgcirclenode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -37,7 +38,7 @@ namespace svgio
SvgNumber maCx;
SvgNumber maCy;
SvgNumber maR;
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgCircleNode(
@@ -59,8 +60,8 @@ namespace svgio
const SvgNumber& getR() const { return maR; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/inc/svgclippathnode.hxx b/svgio/inc/svgclippathnode.hxx
index a2739325ac95..202fc2c6d89a 100644
--- a/svgio/inc/svgclippathnode.hxx
+++ b/svgio/inc/svgclippathnode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -34,7 +35,7 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
SvgUnits maClipPathUnits;
public:
@@ -57,8 +58,8 @@ namespace svgio
void setClipPathUnits(const SvgUnits aClipPathUnits) { maClipPathUnits = aClipPathUnits; }
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/inc/svgellipsenode.hxx b/svgio/inc/svgellipsenode.hxx
index ad7d22303e3c..12a2cf5835ee 100644
--- a/svgio/inc/svgellipsenode.hxx
+++ b/svgio/inc/svgellipsenode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -38,7 +39,7 @@ namespace svgio
SvgNumber maCy;
SvgNumber maRx;
SvgNumber maRy;
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgEllipseNode(
@@ -63,8 +64,8 @@ namespace svgio
const SvgNumber& getRy() const { return maRy; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/inc/svggnode.hxx b/svgio/inc/svggnode.hxx
index 6f631da1a26c..8a5000014953 100644
--- a/svgio/inc/svggnode.hxx
+++ b/svgio/inc/svggnode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -34,7 +35,7 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgGNode(
@@ -48,8 +49,8 @@ namespace svgio
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/inc/svggradientnode.hxx b/svgio/inc/svggradientnode.hxx
index cffd427af653..de586f4cb22a 100644
--- a/svgio/inc/svggradientnode.hxx
+++ b/svgio/inc/svggradientnode.hxx
@@ -23,6 +23,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
#include <drawinglayer/primitive2d/svggradientprimitive2d.hxx>
+#include <memory>
namespace svgio
{
@@ -50,7 +51,7 @@ namespace svgio
/// variable scan values, dependent of given XAttributeList
SvgUnits maGradientUnits;
drawinglayer::primitive2d::SpreadMethod maSpreadMethod;
- basegfx::B2DHomMatrix* mpaGradientTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix> mpaGradientTransform;
/// link to another gradient used as style. If maXLink
/// is set, the node can be fetched on demand by using
diff --git a/svgio/inc/svgimagenode.hxx b/svgio/inc/svgimagenode.hxx
index bba54d55b25b..7162eb9d280a 100644
--- a/svgio/inc/svgimagenode.hxx
+++ b/svgio/inc/svgimagenode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -35,7 +36,8 @@ namespace svgio
/// variable scan values, dependent of given XAttributeList
SvgAspectRatio maSvgAspectRatio;
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix>
+ mpaTransform;
SvgNumber maX;
SvgNumber maY;
SvgNumber maWidth;
@@ -58,8 +60,8 @@ namespace svgio
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
/// x content, set if found in current context
const SvgNumber& getX() const { return maX; }
diff --git a/svgio/inc/svglinenode.hxx b/svgio/inc/svglinenode.hxx
index 5f595888ea27..1611e22602cf 100644
--- a/svgio/inc/svglinenode.hxx
+++ b/svgio/inc/svglinenode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -38,7 +39,7 @@ namespace svgio
SvgNumber maY1;
SvgNumber maX2;
SvgNumber maY2;
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgLineNode(
@@ -63,8 +64,8 @@ namespace svgio
const SvgNumber& getY2() const { return maY2; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/inc/svgmarkernode.hxx b/svgio/inc/svgmarkernode.hxx
index e993961462a5..0818be37a85a 100644
--- a/svgio/inc/svgmarkernode.hxx
+++ b/svgio/inc/svgmarkernode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -44,7 +45,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DRange* mpViewBox;
+ std::unique_ptr<basegfx::B2DRange>
+ mpViewBox;
SvgAspectRatio maSvgAspectRatio;
SvgNumber maRefX;
SvgNumber maRefY;
@@ -71,8 +73,8 @@ namespace svgio
virtual const basegfx::B2DRange getCurrentViewPort() const override;
/// viewBox content
- const basegfx::B2DRange* getViewBox() const { return mpViewBox; }
- void setViewBox(const basegfx::B2DRange* pViewBox) { if(mpViewBox) delete mpViewBox; mpViewBox = nullptr; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
+ const basegfx::B2DRange* getViewBox() const { return mpViewBox.get(); }
+ void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset( new basegfx::B2DRange(*pViewBox) ); }
/// SvgAspectRatio content
const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
diff --git a/svgio/inc/svgmasknode.hxx b/svgio/inc/svgmasknode.hxx
index 43a213a6b203..21b7de915452 100644
--- a/svgio/inc/svgmasknode.hxx
+++ b/svgio/inc/svgmasknode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -38,7 +39,8 @@ namespace svgio
SvgNumber maY;
SvgNumber maWidth;
SvgNumber maHeight;
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix>
+ mpaTransform;
SvgUnits maMaskUnits;
SvgUnits maMaskContentUnits;
@@ -70,8 +72,8 @@ namespace svgio
const SvgNumber& getHeight() const { return maHeight; }
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
/// MaskUnits content
void setMaskUnits(const SvgUnits aMaskUnits) { maMaskUnits = aMaskUnits; }
diff --git a/svgio/inc/svgrectnode.hxx b/svgio/inc/svgrectnode.hxx
index 362b2c90b09f..7366c5a3af58 100644
--- a/svgio/inc/svgrectnode.hxx
+++ b/svgio/inc/svgrectnode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -40,7 +41,7 @@ namespace svgio
SvgNumber maHeight;
SvgNumber maRx;
SvgNumber maRy;
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgRectNode(
@@ -71,8 +72,8 @@ namespace svgio
const SvgNumber& getRy() const { return maRy; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/inc/svgsvgnode.hxx b/svgio/inc/svgsvgnode.hxx
index 10204ee3c975..d0b707abb198 100644
--- a/svgio/inc/svgsvgnode.hxx
+++ b/svgio/inc/svgsvgnode.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SVGIO_INC_SVGSVGNODE_HXX
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -33,7 +34,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DRange* mpViewBox;
+ std::unique_ptr<basegfx::B2DRange>
+ mpViewBox;
SvgAspectRatio maSvgAspectRatio;
SvgNumber maX;
SvgNumber maY;
@@ -70,8 +72,8 @@ namespace svgio
virtual const basegfx::B2DRange getCurrentViewPort() const override;
/// viewBox content
- const basegfx::B2DRange* getViewBox() const { return mpViewBox; }
- void setViewBox(const basegfx::B2DRange* pViewBox) { if(mpViewBox) delete mpViewBox; mpViewBox = nullptr; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
+ const basegfx::B2DRange* getViewBox() const { return mpViewBox.get(); }
+ void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset( new basegfx::B2DRange(*pViewBox) ); }
/// SvgAspectRatio content
const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
diff --git a/svgio/inc/svgsymbolnode.hxx b/svgio/inc/svgsymbolnode.hxx
index a6458fe1d21e..fbf03c22c61c 100644
--- a/svgio/inc/svgsymbolnode.hxx
+++ b/svgio/inc/svgsymbolnode.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SVGIO_INC_SVGSYMBOLNODE_HXX
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -33,7 +34,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DRange* mpViewBox;
+ std::unique_ptr<basegfx::B2DRange>
+ mpViewBox;
SvgAspectRatio maSvgAspectRatio;
public:
@@ -46,7 +48,7 @@ namespace svgio
virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
/// viewBox content
- void setViewBox(const basegfx::B2DRange* pViewBox) { if(mpViewBox) delete mpViewBox; mpViewBox = nullptr; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
+ void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset( new basegfx::B2DRange(*pViewBox) ); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx
index e3bd3102dd5e..db1f26076e03 100644
--- a/svgio/inc/svgtextnode.hxx
+++ b/svgio/inc/svgtextnode.hxx
@@ -23,6 +23,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
#include <svgcharacternode.hxx>
+#include <memory>
namespace svgio
{
@@ -35,7 +36,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix>
+ mpaTransform;
SvgTextPositions maSvgTextPositions;
/// local helpers
@@ -61,8 +63,8 @@ namespace svgio
virtual double getCurrentFontSize() const override;
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/inc/svgusenode.hxx b/svgio/inc/svgusenode.hxx
index a6eccaa05cd0..05c0063699c5 100644
--- a/svgio/inc/svgusenode.hxx
+++ b/svgio/inc/svgusenode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -34,7 +35,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix>
+ mpaTransform;
SvgNumber maX;
SvgNumber maY;
SvgNumber maWidth;
@@ -55,8 +57,8 @@ namespace svgio
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
/// x content
const SvgNumber& getX() const { return maX; }
diff --git a/svgio/source/svgreader/svganode.cxx b/svgio/source/svgreader/svganode.cxx
index 9efa57331c27..7b61fcbfc934 100644
--- a/svgio/source/svgreader/svganode.cxx
+++ b/svgio/source/svgreader/svganode.cxx
@@ -36,7 +36,6 @@ namespace svgio
SvgANode::~SvgANode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgANode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgcirclenode.cxx b/svgio/source/svgreader/svgcirclenode.cxx
index d950632286bf..29d0395eb6eb 100644
--- a/svgio/source/svgreader/svgcirclenode.cxx
+++ b/svgio/source/svgreader/svgcirclenode.cxx
@@ -39,7 +39,6 @@ namespace svgio
SvgCircleNode::~SvgCircleNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgCircleNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgclippathnode.cxx b/svgio/source/svgreader/svgclippathnode.cxx
index dc607c7e627e..0c1cc3e75fd4 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -42,7 +42,6 @@ namespace svgio
SvgClipPathNode::~SvgClipPathNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgClipPathNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgellipsenode.cxx b/svgio/source/svgreader/svgellipsenode.cxx
index 1a021acbdbad..2080066ffade 100644
--- a/svgio/source/svgreader/svgellipsenode.cxx
+++ b/svgio/source/svgreader/svgellipsenode.cxx
@@ -40,7 +40,6 @@ namespace svgio
SvgEllipseNode::~SvgEllipseNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgEllipseNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx
index c3ae8ca75c1e..28c4dd8a0ccc 100644
--- a/svgio/source/svgreader/svggnode.cxx
+++ b/svgio/source/svgreader/svggnode.cxx
@@ -38,7 +38,6 @@ namespace svgio
SvgGNode::~SvgGNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgGNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svggradientnode.cxx b/svgio/source/svgreader/svggradientnode.cxx
index 0af85b4d19c7..8d700c5247d4 100644
--- a/svgio/source/svgreader/svggradientnode.cxx
+++ b/svgio/source/svgreader/svggradientnode.cxx
@@ -59,7 +59,6 @@ namespace svgio
SvgGradientNode::~SvgGradientNode()
{
- delete mpaGradientTransform;
// do NOT delete mpXLink, it's only referenced, not owned
}
@@ -472,7 +471,7 @@ namespace svgio
{
if(mpaGradientTransform)
{
- return mpaGradientTransform;
+ return mpaGradientTransform.get();
}
const_cast< SvgGradientNode* >(this)->tryToFindLink();
@@ -487,15 +486,11 @@ namespace svgio
void SvgGradientNode::setGradientTransform(const basegfx::B2DHomMatrix* pMatrix)
{
- if(mpaGradientTransform)
- {
- delete mpaGradientTransform;
- mpaGradientTransform = nullptr;
- }
+ mpaGradientTransform.reset();
if(pMatrix)
{
- mpaGradientTransform = new basegfx::B2DHomMatrix(*pMatrix);
+ mpaGradientTransform.reset(new basegfx::B2DHomMatrix(*pMatrix) );
}
}
diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx
index e1033df3720a..717987464539 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -57,7 +57,6 @@ namespace svgio
SvgImageNode::~SvgImageNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgImageNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svglinenode.cxx b/svgio/source/svgreader/svglinenode.cxx
index 3720fb00bcc7..1ab7eeea009c 100644
--- a/svgio/source/svgreader/svglinenode.cxx
+++ b/svgio/source/svgreader/svglinenode.cxx
@@ -40,7 +40,6 @@ namespace svgio
SvgLineNode::~SvgLineNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgLineNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgmarkernode.cxx b/svgio/source/svgreader/svgmarkernode.cxx
index 110b4b821783..f37798cc5754 100644
--- a/svgio/source/svgreader/svgmarkernode.cxx
+++ b/svgio/source/svgreader/svgmarkernode.cxx
@@ -43,7 +43,6 @@ namespace svgio
SvgMarkerNode::~SvgMarkerNode()
{
- delete mpViewBox;
}
const SvgStyleAttributes* SvgMarkerNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgmasknode.cxx b/svgio/source/svgreader/svgmasknode.cxx
index 34f8faa5516a..b10fd3ffee22 100644
--- a/svgio/source/svgreader/svgmasknode.cxx
+++ b/svgio/source/svgreader/svgmasknode.cxx
@@ -48,7 +48,6 @@ namespace svgio
SvgMaskNode::~SvgMaskNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgMaskNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx
index 50df6c5f020e..93acc5425bb0 100644
--- a/svgio/source/svgreader/svgrectnode.cxx
+++ b/svgio/source/svgreader/svgrectnode.cxx
@@ -42,7 +42,6 @@ namespace svgio
SvgRectNode::~SvgRectNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgRectNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx
index 91b357977cf9..780066610072 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -106,7 +106,6 @@ namespace svgio
SvgSvgNode::~SvgSvgNode()
{
- delete mpViewBox;
}
const SvgStyleAttributes* SvgSvgNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgsymbolnode.cxx b/svgio/source/svgreader/svgsymbolnode.cxx
index 66264f814879..d3b60ab1aa3d 100644
--- a/svgio/source/svgreader/svgsymbolnode.cxx
+++ b/svgio/source/svgreader/svgsymbolnode.cxx
@@ -37,7 +37,6 @@ namespace svgio
SvgSymbolNode::~SvgSymbolNode()
{
- delete mpViewBox;
}
const SvgStyleAttributes* SvgSymbolNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgtextnode.cxx b/svgio/source/svgreader/svgtextnode.cxx
index 5c44ce064c16..5ca07549fb8b 100644
--- a/svgio/source/svgreader/svgtextnode.cxx
+++ b/svgio/source/svgreader/svgtextnode.cxx
@@ -42,7 +42,6 @@ namespace svgio
SvgTextNode::~SvgTextNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgTextNode::getSvgStyleAttributes() const
diff --git a/svgio/source/svgreader/svgusenode.cxx b/svgio/source/svgreader/svgusenode.cxx
index 7495c2b1d5ad..6db0ee1d2f92 100644
--- a/svgio/source/svgreader/svgusenode.cxx
+++ b/svgio/source/svgreader/svgusenode.cxx
@@ -41,7 +41,6 @@ namespace svgio
SvgUseNode::~SvgUseNode()
{
- delete mpaTransform;
}
const SvgStyleAttributes* SvgUseNode::getSvgStyleAttributes() const