[Libreoffice-commits] core.git: svgio/inc svgio/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Jan 19 05:41:22 UTC 2017


 svgio/inc/svganode.hxx                     |    7 ++++---
 svgio/inc/svgcirclenode.hxx                |    7 ++++---
 svgio/inc/svgclippathnode.hxx              |    7 ++++---
 svgio/inc/svgellipsenode.hxx               |    7 ++++---
 svgio/inc/svggnode.hxx                     |    7 ++++---
 svgio/inc/svggradientnode.hxx              |    3 ++-
 svgio/inc/svgimagenode.hxx                 |    8 +++++---
 svgio/inc/svglinenode.hxx                  |    7 ++++---
 svgio/inc/svgmarkernode.hxx                |    8 +++++---
 svgio/inc/svgmasknode.hxx                  |    8 +++++---
 svgio/inc/svgrectnode.hxx                  |    7 ++++---
 svgio/inc/svgsvgnode.hxx                   |    8 +++++---
 svgio/inc/svgsymbolnode.hxx                |    6 ++++--
 svgio/inc/svgtextnode.hxx                  |    8 +++++---
 svgio/inc/svgusenode.hxx                   |    8 +++++---
 svgio/source/svgreader/svganode.cxx        |    1 -
 svgio/source/svgreader/svgcirclenode.cxx   |    1 -
 svgio/source/svgreader/svgclippathnode.cxx |    1 -
 svgio/source/svgreader/svgellipsenode.cxx  |    1 -
 svgio/source/svgreader/svggnode.cxx        |    1 -
 svgio/source/svgreader/svggradientnode.cxx |   11 +++--------
 svgio/source/svgreader/svgimagenode.cxx    |    1 -
 svgio/source/svgreader/svglinenode.cxx     |    1 -
 svgio/source/svgreader/svgmarkernode.cxx   |    1 -
 svgio/source/svgreader/svgmasknode.cxx     |    1 -
 svgio/source/svgreader/svgrectnode.cxx     |    1 -
 svgio/source/svgreader/svgsvgnode.cxx      |    1 -
 svgio/source/svgreader/svgsymbolnode.cxx   |    1 -
 svgio/source/svgreader/svgtextnode.cxx     |    1 -
 svgio/source/svgreader/svgusenode.cxx      |    1 -
 30 files changed, 67 insertions(+), 64 deletions(-)

New commits:
commit 2da34e265db6ca56e43d9b2ab8cee04b1cc4fb29
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 18 09:48:47 2017 +0200

    new loplugin: useuniqueptr: svgio
    
    Change-Id: I645ac954ac519fe713f4347cdf69780b0f8070e4
    Reviewed-on: https://gerrit.libreoffice.org/33252
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svgio/inc/svganode.hxx b/svgio/inc/svganode.hxx
index 1f5774a..b7660a0 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 cd19de4..68fc3e9 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 a273932..202fc2c 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 ad7d223..12a2cf5 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 6f631da..8a50000 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 cffd427..de586f4 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 bba54d5..7162eb9 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 5f59588..1611e22 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 e993961..0818be3 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 43a213a..21b7de9 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 362b2c9..7366c5a 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 10204ee..d0b707a 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 a6458fe..fbf03c2 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 e3bd310..db1f260 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 a6eccaa..05c0063 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 9efa573..7b61fcb 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 d950632..29d0395 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 dc607c7..0c1cc3e 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 1a021ac..2080066 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 c3ae8ca..28c4dd8 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 0af85b4..8d700c5 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 e1033df..7179874 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 3720fb0..1ab7eee 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 110b4b8..f37798c 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 34f8faa..b10fd3f 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 50df6c5..93acc54 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 91b3579..7800666 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 66264f81..d3b60ab 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 5c44ce0..5ca0754 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 7495c2b..6db0ee1 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


More information about the Libreoffice-commits mailing list