diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-15 11:12:18 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-08-16 15:14:59 +0200 |
commit | 87e31cb51b277513d28eff5236f308f2941126b4 (patch) | |
tree | a63dd411ad86decd9f37882d9d98004c47d1cfbb /svx | |
parent | a6f60d546ac61bfd9db7fad06138512cde4acb5a (diff) |
Convert aList field in SdrHelpLineList class from Container to std::vector
Change-Id: Ie91548bfad1cd60d8926cb5cc729a07f539590a1
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/svdhlpln.hxx | 34 | ||||
-rw-r--r-- | svx/source/svdraw/svdhlpln.cxx | 2 |
2 files changed, 26 insertions, 10 deletions
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 <tools/gen.hxx> #include <vcl/pointr.hxx> -#include <tools/contnr.hxx> #include "svx/svxdllapi.h" class OutputDevice; @@ -73,21 +72,38 @@ public: #define SDRHELPLINE_NOTFOUND 0xFFFF class SVX_DLLPUBLIC SdrHelpLineList { - Container aList; + std::vector<SdrHelpLine*> 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<nAnz; i++) { delete GetObject(i); } - aList.Clear(); + aList.clear(); } void SdrHelpLineList::operator=(const SdrHelpLineList& rSrcList) |