Convert field from Container to std::vector in SdrPageGridFrameList

Change-Id: I5940936e986b2f6580ca9ce973359d8179631f8c
This commit is contained in:
Noel Grandin 2012-08-15 13:29:19 +02:00 committed by Michael Stahl
parent 17afe4cea7
commit e5da8190e0
3 changed files with 28 additions and 11 deletions

View file

@ -32,6 +32,7 @@
#include <svx/svdpage.hxx>
#include <comphelper/uno3.hxx>
#include "svx/svxdllapi.h"
#include <tools/contnr.hxx>
class StarBASIC;
class FmFormModel;

View file

@ -33,7 +33,6 @@
#include <vcl/print.hxx>
#include <vcl/gdimtf.hxx>
#include <tools/weakbase.hxx>
#include <tools/contnr.hxx>
#include <cppuhelper/weakref.hxx>
#include <svx/svdtypes.hxx>
#include <svx/svdlayer.hxx>
@ -133,10 +132,10 @@ public:
// Neuberechnung der Objekt-Ordnungsnummern
void RecalcObjOrdNums();
bool IsObjOrdNumsDirty() const { return bObjOrdNumsDirty; }
virtual void NbcInsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND
virtual void NbcInsertObject(SdrObject* pObj, sal_uIntPtr nPos=0xFFFF
, const SdrInsertReason* pReason=NULL
);
virtual void InsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND
virtual void InsertObject(SdrObject* pObj, sal_uIntPtr nPos=0xFFFF
, const SdrInsertReason* pReason=NULL
);
// aus Liste entfernen ohne delete
@ -338,20 +337,37 @@ public:
};
class SVX_DLLPUBLIC SdrPageGridFrameList {
Container aList;
std::vector<SdrPageGridFrame*> aList;
private:
SVX_DLLPRIVATE SdrPageGridFrameList(const SdrPageGridFrameList& rSrcList); // never implemented
SVX_DLLPRIVATE void operator=(const SdrPageGridFrameList& rSrcList); // never implemented
protected:
SdrPageGridFrame* GetObject(sal_uInt16 i) const { return (SdrPageGridFrame*)(aList.GetObject(i)); }
SdrPageGridFrame* GetObject(sal_uInt16 i) const { return aList[i]; }
public:
SdrPageGridFrameList(): aList(1024,4,4) {}
SdrPageGridFrameList(): aList() {}
~SdrPageGridFrameList() { Clear(); }
void Clear();
sal_uInt16 GetCount() const { return sal_uInt16(aList.Count()); }
void Insert(const SdrPageGridFrame& rGF, sal_uInt16 nPos=0xFFFF) { aList.Insert(new SdrPageGridFrame(rGF),nPos); }
void Delete(sal_uInt16 nPos) { delete (SdrPageGridFrame*)aList.Remove(nPos); }
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 SdrPageGridFrame& rGF) { aList.push_back(new SdrPageGridFrame(rGF)); }
void Insert(const SdrPageGridFrame& rGF, sal_uInt16 nPos)
{
if(nPos==0xFFFF)
aList.push_back(new SdrPageGridFrame(rGF));
else
aList.insert(aList.begin()+nPos,new SdrPageGridFrame(rGF));
}
void Delete(sal_uInt16 nPos)
{
SdrPageGridFrame* p = aList[nPos];
aList.erase(aList.begin()+nPos);
delete p;
}
void Move(sal_uInt16 nPos, sal_uInt16 nNewPos)
{
SdrPageGridFrame* p = aList[nPos];
aList.erase(aList.begin()+nPos);
aList.insert(aList.begin()+nNewPos,p);
}
SdrPageGridFrame& operator[](sal_uInt16 nPos) { return *GetObject(nPos); }
const SdrPageGridFrame& operator[](sal_uInt16 nPos) const { return *GetObject(nPos); }
};

View file

@ -1088,7 +1088,7 @@ void SdrPageGridFrameList::Clear()
for (sal_uInt16 i=0; i<nAnz; i++) {
delete GetObject(i);
}
aList.Clear();
aList.clear();
}
//////////////////////////////////////////////////////////////////////////////