From 87e31cb51b277513d28eff5236f308f2941126b4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 15 Aug 2012 11:12:18 +0200 Subject: Convert aList field in SdrHelpLineList class from Container to std::vector Change-Id: Ie91548bfad1cd60d8926cb5cc729a07f539590a1 --- svx/inc/svx/svdhlpln.hxx | 34 +++++++++++++++++++++++++--------- svx/source/svdraw/svdhlpln.cxx | 2 +- 2 files changed, 26 insertions(+), 10 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/svdhlpln.hxx b/svx/inc/svx/svdhlpln.hxx index 33b0a8c2bc99..51dc1c90b207 100644 --- a/svx/inc/svx/svdhlpln.hxx +++ b/svx/inc/svx/svdhlpln.hxx @@ -34,7 +34,6 @@ #include #include -#include #include "svx/svxdllapi.h" class OutputDevice; @@ -73,21 +72,38 @@ public: #define SDRHELPLINE_NOTFOUND 0xFFFF class SVX_DLLPUBLIC SdrHelpLineList { - Container aList; + std::vector aList; protected: - SdrHelpLine* GetObject(sal_uInt16 i) const { return (SdrHelpLine*)(aList.GetObject(i)); } + SdrHelpLine* GetObject(sal_uInt16 i) const { return aList[i]; } public: - SdrHelpLineList(): aList(1024,4,4) {} - SdrHelpLineList(const SdrHelpLineList& rSrcList): aList(1024,4,4) { *this=rSrcList; } + SdrHelpLineList(): aList() {} + SdrHelpLineList(const SdrHelpLineList& rSrcList): aList() { *this=rSrcList; } ~SdrHelpLineList() { Clear(); } void Clear(); void operator=(const SdrHelpLineList& rSrcList); bool operator==(const SdrHelpLineList& rCmp) const; bool operator!=(const SdrHelpLineList& rCmp) const { return !operator==(rCmp); } - sal_uInt16 GetCount() const { return sal_uInt16(aList.Count()); } - void Insert(const SdrHelpLine& rHL, sal_uInt16 nPos=0xFFFF) { aList.Insert(new SdrHelpLine(rHL),nPos); } - void Delete(sal_uInt16 nPos) { delete (SdrHelpLine*)aList.Remove(nPos); } // #i24900# - void Move(sal_uInt16 nPos, sal_uInt16 nNewPos) { aList.Insert(aList.Remove(nPos),nNewPos); } + sal_uInt16 GetCount() const { return sal_uInt16(aList.size()); } + void Insert(const SdrHelpLine& rHL) { aList.push_back(new SdrHelpLine(rHL)); } + void Insert(const SdrHelpLine& rHL, sal_uInt16 nPos) + { + if(nPos==0xFFFF) + aList.push_back(new SdrHelpLine(rHL)); + else + aList.insert(aList.begin() + nPos, new SdrHelpLine(rHL)); + } + void Delete(sal_uInt16 nPos) + { + SdrHelpLine* p = aList[nPos]; + delete p; + aList.erase(aList.begin() + nPos); + } + void Move(sal_uInt16 nPos, sal_uInt16 nNewPos) + { + SdrHelpLine* p = aList[nPos]; + aList.erase(aList.begin() + nPos); + aList.insert(aList.begin() + nNewPos, p); + } SdrHelpLine& operator[](sal_uInt16 nPos) { return *GetObject(nPos); } const SdrHelpLine& operator[](sal_uInt16 nPos) const { return *GetObject(nPos); } sal_uInt16 HitTest(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const; diff --git a/svx/source/svdraw/svdhlpln.cxx b/svx/source/svdraw/svdhlpln.cxx index 7b44b46ceb01..70508e0aba0b 100644 --- a/svx/source/svdraw/svdhlpln.cxx +++ b/svx/source/svdraw/svdhlpln.cxx @@ -89,7 +89,7 @@ void SdrHelpLineList::Clear() for (sal_uInt16 i=0; i