summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-08-14 11:01:38 +0200
committerMichael Stahl <mstahl@redhat.com>2012-08-16 15:14:57 +0200
commit62035e55b4128a5bf391c45160e0be5347fa23ae (patch)
treec4eecf9d76584c8730b8121fc45f6ab8f2dddd63
parent028b34d93be5b794a195df518741ed67f9afdc09 (diff)
Convert aList field in SdrLinkList class from Container to std::vector
Change-Id: Idf07339186827fb57ded1586108f1a4a49069f42
-rw-r--r--svx/inc/svx/svdetc.hxx12
-rw-r--r--svx/source/svdraw/svdetc.cxx12
2 files changed, 14 insertions, 10 deletions
diff --git a/svx/inc/svx/svdetc.hxx b/svx/inc/svx/svdetc.hxx
index b2408f305447..85690efbad5e 100644
--- a/svx/inc/svx/svdetc.hxx
+++ b/svx/inc/svx/svdetc.hxx
@@ -219,16 +219,16 @@ public:
class SdrLinkList
{
- Container aList;
+ std::vector<Link*> aList;
protected:
unsigned FindEntry(const Link& rLink) const;
public:
- SdrLinkList(): aList(1024,4,4) {}
- ~SdrLinkList() { Clear(); }
+ SdrLinkList(): aList() {}
+ ~SdrLinkList() { Clear(); }
SVX_DLLPUBLIC void Clear();
- unsigned GetLinkCount() const { return (unsigned)aList.Count(); }
- Link& GetLink(unsigned nNum) { return *((Link*)(aList.GetObject(nNum))); }
- const Link& GetLink(unsigned nNum) const { return *((Link*)(aList.GetObject(nNum))); }
+ unsigned GetLinkCount() const { return (unsigned)aList.size(); }
+ Link& GetLink(unsigned nNum) { return *aList[nNum]; }
+ const Link& GetLink(unsigned nNum) const { return *aList[nNum]; }
void InsertLink(const Link& rLink, unsigned nPos=0xFFFF);
void RemoveLink(const Link& rLink);
bool HasLink(const Link& rLink) const { return FindEntry(rLink)!=0xFFFF; }
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index e43b55b0269f..fb3a18869f77 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -290,9 +290,9 @@ void SdrLinkList::Clear()
{
unsigned nAnz=GetLinkCount();
for (unsigned i=0; i<nAnz; i++) {
- delete (Link*)aList.GetObject(i);
+ delete aList[i];
}
- aList.Clear();
+ aList.clear();
}
unsigned SdrLinkList::FindEntry(const Link& rLink) const
@@ -309,7 +309,10 @@ void SdrLinkList::InsertLink(const Link& rLink, unsigned nPos)
unsigned nFnd=FindEntry(rLink);
if (nFnd==0xFFFF) {
if (rLink.IsSet()) {
- aList.Insert(new Link(rLink),nPos);
+ if(nPos==0xFFFF)
+ aList.push_back(new Link(rLink));
+ else
+ aList.insert(aList.begin() + nPos, new Link(rLink));
} else {
OSL_FAIL("SdrLinkList::InsertLink(): Tried to insert a link that was not set already.");
}
@@ -322,7 +325,8 @@ void SdrLinkList::RemoveLink(const Link& rLink)
{
unsigned nFnd=FindEntry(rLink);
if (nFnd!=0xFFFF) {
- Link* pLink=(Link*)aList.Remove(nFnd);
+ Link* pLink = aList[nFnd];
+ aList.erase( aList.begin() + nFnd );
delete pLink;
} else {
OSL_FAIL("SdrLinkList::RemoveLink(): Link not found.");