summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drawinglayer/source/animation/animationtiming.cxx30
-rw-r--r--drawinglayer/source/primitive2d/animatedprimitive2d.cxx6
-rw-r--r--include/drawinglayer/animation/animationtiming.hxx13
-rw-r--r--include/drawinglayer/primitive2d/animatedprimitive2d.hxx4
4 files changed, 22 insertions, 31 deletions
diff --git a/drawinglayer/source/animation/animationtiming.cxx b/drawinglayer/source/animation/animationtiming.cxx
index 72400c1cd5dd..683c5f5b830c 100644
--- a/drawinglayer/source/animation/animationtiming.cxx
+++ b/drawinglayer/source/animation/animationtiming.cxx
@@ -19,7 +19,7 @@
#include <drawinglayer/animation/animationtiming.hxx>
#include <basegfx/numeric/ftools.hxx>
-
+#include <o3tl/make_unique.hxx>
namespace drawinglayer
{
@@ -46,9 +46,9 @@ namespace drawinglayer
{
}
- AnimationEntry* AnimationEntryFixed::clone() const
+ std::unique_ptr<AnimationEntry> AnimationEntryFixed::clone() const
{
- return new AnimationEntryFixed(mfDuration, mfState);
+ return o3tl::make_unique<AnimationEntryFixed>(mfDuration, mfState);
}
bool AnimationEntryFixed::operator==(const AnimationEntry& rCandidate) const
@@ -95,9 +95,9 @@ namespace drawinglayer
{
}
- AnimationEntry* AnimationEntryLinear::clone() const
+ std::unique_ptr<AnimationEntry> AnimationEntryLinear::clone() const
{
- return new AnimationEntryLinear(mfDuration, mfFrequency, mfStart, mfStop);
+ return o3tl::make_unique<AnimationEntryLinear>(mfDuration, mfFrequency, mfStart, mfStop);
}
bool AnimationEntryLinear::operator==(const AnimationEntry& rCandidate) const
@@ -178,22 +178,18 @@ namespace drawinglayer
AnimationEntryList::~AnimationEntryList()
{
- for(AnimationEntry* i : maEntries)
- {
- delete i;
- }
}
- AnimationEntry* AnimationEntryList::clone() const
+ std::unique_ptr<AnimationEntry> AnimationEntryList::clone() const
{
- AnimationEntryList* pNew = new AnimationEntryList();
+ std::unique_ptr<AnimationEntryList> pNew(o3tl::make_unique<AnimationEntryList>());
- for(AnimationEntry* i : maEntries)
+ for(const auto &i : maEntries)
{
pNew->append(*i);
}
- return pNew;
+ return std::move(pNew);
}
bool AnimationEntryList::operator==(const AnimationEntry& rCandidate) const
@@ -277,16 +273,16 @@ namespace drawinglayer
{
}
- AnimationEntry* AnimationEntryLoop::clone() const
+ std::unique_ptr<AnimationEntry> AnimationEntryLoop::clone() const
{
- AnimationEntryLoop* pNew = new AnimationEntryLoop(mnRepeat);
+ std::unique_ptr<AnimationEntryLoop> pNew(o3tl::make_unique<AnimationEntryLoop>(mnRepeat));
- for(AnimationEntry* i : maEntries)
+ for(const auto &i : maEntries)
{
pNew->append(*i);
}
- return pNew;
+ return std::move(pNew);
}
bool AnimationEntryLoop::operator==(const AnimationEntry& rCandidate) const
diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index 713c4bd52bcd..13564af2bce5 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -33,9 +33,6 @@ namespace drawinglayer
{
void AnimatedSwitchPrimitive2D::setAnimationEntry(const animation::AnimationEntry& rNew)
{
- // delete cloned animation description
- delete mpAnimationEntry;
-
// clone given animation description
mpAnimationEntry = rNew.clone();
}
@@ -45,7 +42,6 @@ namespace drawinglayer
const Primitive2DContainer& rChildren,
bool bIsTextAnimation)
: GroupPrimitive2D(rChildren),
- mpAnimationEntry(nullptr),
mbIsTextAnimation(bIsTextAnimation)
{
// clone given animation description
@@ -54,8 +50,6 @@ namespace drawinglayer
AnimatedSwitchPrimitive2D::~AnimatedSwitchPrimitive2D()
{
- // delete cloned animation description
- delete mpAnimationEntry;
}
bool AnimatedSwitchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
diff --git a/include/drawinglayer/animation/animationtiming.hxx b/include/drawinglayer/animation/animationtiming.hxx
index 4514349744aa..67d13eeede0b 100644
--- a/include/drawinglayer/animation/animationtiming.hxx
+++ b/include/drawinglayer/animation/animationtiming.hxx
@@ -23,6 +23,7 @@
#include <drawinglayer/drawinglayerdllapi.h>
#include <vector>
+#include <memory>
namespace drawinglayer
@@ -40,7 +41,7 @@ namespace drawinglayer
public:
AnimationEntry();
virtual ~AnimationEntry();
- virtual AnimationEntry* clone() const = 0;
+ virtual std::unique_ptr<AnimationEntry> clone() const = 0;
virtual bool operator==(const AnimationEntry& rCandidate) const = 0;
virtual double getDuration() const = 0;
@@ -58,7 +59,7 @@ namespace drawinglayer
public:
AnimationEntryFixed(double fDuration, double fState);
virtual ~AnimationEntryFixed() override;
- virtual AnimationEntry* clone() const override;
+ virtual std::unique_ptr<AnimationEntry> clone() const override;
virtual bool operator==(const AnimationEntry& rCandidate) const override;
virtual double getDuration() const override;
@@ -78,7 +79,7 @@ namespace drawinglayer
public:
AnimationEntryLinear(double fDuration, double fFrequency, double fStart, double fStop);
virtual ~AnimationEntryLinear() override;
- virtual AnimationEntry* clone() const override;
+ virtual std::unique_ptr<AnimationEntry> clone() const override;
virtual bool operator==(const AnimationEntry& rCandidate) const override;
virtual double getDuration() const override;
@@ -91,7 +92,7 @@ namespace drawinglayer
{
protected:
double mfDuration;
- ::std::vector< AnimationEntry* > maEntries;
+ ::std::vector< std::unique_ptr<AnimationEntry> > maEntries;
// helpers
sal_uInt32 impGetIndexAtTime(double fTime, double &rfAddedTime) const;
@@ -99,7 +100,7 @@ namespace drawinglayer
public:
AnimationEntryList();
virtual ~AnimationEntryList() override;
- virtual AnimationEntry* clone() const override;
+ virtual std::unique_ptr<AnimationEntry> clone() const override;
virtual bool operator==(const AnimationEntry& rCandidate) const override;
void append(const AnimationEntry& rCandidate);
@@ -117,7 +118,7 @@ namespace drawinglayer
public:
AnimationEntryLoop(sal_uInt32 nRepeat);
virtual ~AnimationEntryLoop() override;
- virtual AnimationEntry* clone() const override;
+ virtual std::unique_ptr<AnimationEntry> clone() const override;
virtual bool operator==(const AnimationEntry& rCandidate) const override;
virtual double getDuration() const override;
diff --git a/include/drawinglayer/primitive2d/animatedprimitive2d.hxx b/include/drawinglayer/primitive2d/animatedprimitive2d.hxx
index 580271bac434..0e86019b8f4b 100644
--- a/include/drawinglayer/primitive2d/animatedprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/animatedprimitive2d.hxx
@@ -25,7 +25,7 @@
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
-
+#include <memory>
// predefines
namespace drawinglayer { namespace animation {
@@ -58,7 +58,7 @@ namespace drawinglayer
to an animation state [0.0 .. 1.0]. This member contains a cloned
definition and is owned by this implementation.
*/
- animation::AnimationEntry* mpAnimationEntry;
+ std::unique_ptr<animation::AnimationEntry> mpAnimationEntry;
/** flag if this is a text or graphic animation. Necessary since SdrViews need to differentiate
between both types if they are on/off