summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-08-15 12:38:45 +0200
committerMichael Stahl <mstahl@redhat.com>2012-08-16 18:44:04 +0200
commited04025e10815c89fe02d0cf823253d540e21635 (patch)
treec3d2c860cc777073e80542a2bff6142d1866e110 /svx/source
parentdd3b0fa68b9e850ed8df34094c21abfbd8c6f61b (diff)
Convert maMaPag field in class SdrModel from Container to std::vector
Change-Id: I232ad32be90d93fe35a6cf089373e5a830e62113
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/svdraw/svdmodel.cxx62
1 files changed, 38 insertions, 24 deletions
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 3caa86aef37c..7bae5830fe22 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -226,7 +226,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, sal_Bool bLoadRefCounts):
aReadDate( DateTime::EMPTY ),
- maMaPag(1024,32,32),
+ maMaPag(),
maPages(1024,32,32)
{
#ifdef TIMELOG
@@ -239,7 +239,7 @@ SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, sal
SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, sal_Bool bLoadRefCounts):
aReadDate( DateTime::EMPTY ),
- maMaPag(1024,32,32),
+ maMaPag(),
maPages(1024,32,32),
aTablePath(rPath)
{
@@ -253,7 +253,7 @@ SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbed
SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable, sal_Bool bLoadRefCounts):
aReadDate( DateTime::EMPTY ),
- maMaPag(1024,32,32),
+ maMaPag(),
maPages(1024,32,32)
{
#ifdef TIMELOG
@@ -266,7 +266,7 @@ SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, boo
SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable, sal_Bool bLoadRefCounts):
aReadDate( DateTime::EMPTY ),
- maMaPag(1024,32,32),
+ maMaPag(),
maPages(1024,32,32),
aTablePath(rPath)
{
@@ -282,7 +282,7 @@ SdrModel::SdrModel(const SdrModel& /*rSrcModel*/):
SfxBroadcaster(),
tools::WeakBase< SdrModel >(),
aReadDate( DateTime::EMPTY ),
- maMaPag(1024,32,32),
+ maMaPag(),
maPages(1024,32,32)
{
#ifdef TIMELOG
@@ -741,7 +741,7 @@ void SdrModel::ClearModel(sal_Bool bCalledFromDestructor)
{
DeleteMasterPage( (sal_uInt16)i );
}
- maMaPag.Clear();
+ maMaPag.clear();
MasterPageListChanged();
pLayerAdmin->ClearLayer();
@@ -1415,15 +1415,27 @@ void SdrModel::SetChanged(sal_Bool bFlg)
void SdrModel::RecalcPageNums(bool bMaster)
{
- Container& rPL=*(bMaster ? &maMaPag : &maPages);
- sal_uInt16 nAnz=sal_uInt16(rPL.Count());
- sal_uInt16 i;
- for (i=0; i<nAnz; i++) {
- SdrPage* pPg=(SdrPage*)(rPL.GetObject(i));
- pPg->SetPageNum(i);
+ if(bMaster)
+ {
+ sal_uInt16 nAnz=sal_uInt16(maMaPag.size());
+ sal_uInt16 i;
+ for (i=0; i<nAnz; i++) {
+ SdrPage* pPg=maMaPag[i];
+ pPg->SetPageNum(i);
+ }
+ bMPgNumsDirty=sal_False;
+ }
+ else
+ {
+ Container& rPL=maPages;
+ sal_uInt16 nAnz=sal_uInt16(rPL.Count());
+ sal_uInt16 i;
+ for (i=0; i<nAnz; i++) {
+ SdrPage* pPg=(SdrPage*)(rPL.GetObject(i));
+ pPg->SetPageNum(i);
+ }
+ bPagNumsDirty=sal_False;
}
- if (bMaster) bMPgNumsDirty=sal_False;
- else bPagNumsDirty=sal_False;
}
void SdrModel::InsertPage(SdrPage* pPage, sal_uInt16 nPos)
@@ -1477,7 +1489,7 @@ void SdrModel::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos)
{
sal_uInt16 nAnz=GetMasterPageCount();
if (nPos>nAnz) nPos=nAnz;
- maMaPag.Insert(pPage,nPos);
+ maMaPag.insert(maMaPag.begin()+nPos,pPage);
MasterPageListChanged();
pPage->SetInserted(sal_True);
pPage->SetPageNum(nPos);
@@ -1499,7 +1511,8 @@ void SdrModel::DeleteMasterPage(sal_uInt16 nPgNum)
SdrPage* SdrModel::RemoveMasterPage(sal_uInt16 nPgNum)
{
- SdrPage* pRetPg=(SdrPage*)maMaPag.Remove(nPgNum);
+ SdrPage* pRetPg=maMaPag[nPgNum];
+ maMaPag.erase(maMaPag.begin()+nPgNum);
MasterPageListChanged();
if(pRetPg)
@@ -1525,11 +1538,12 @@ SdrPage* SdrModel::RemoveMasterPage(sal_uInt16 nPgNum)
void SdrModel::MoveMasterPage(sal_uInt16 nPgNum, sal_uInt16 nNewPos)
{
- SdrPage* pPg=(SdrPage*)maMaPag.Remove(nPgNum);
+ SdrPage* pPg=maMaPag[nPgNum];
+ maMaPag.erase(maMaPag.begin()+nPgNum);
MasterPageListChanged();
if (pPg!=NULL) {
pPg->SetInserted(sal_False);
- maMaPag.Insert(pPg,nNewPos);
+ maMaPag.insert(maMaPag.begin()+nNewPos,pPg);
MasterPageListChanged();
}
bMPgNumsDirty=sal_True;
@@ -1700,7 +1714,7 @@ void SdrModel::Merge(SdrModel& rSourceModel,
// Now append all of them to the end of the DstModel.
// Don't use InsertMasterPage(), because everything is
// inconsistent until all are in.
- maMaPag.Insert(pPg,nDstMasterPageAnz);
+ maMaPag.insert(maMaPag.begin()+nDstMasterPageAnz, pPg);
MasterPageListChanged();
pPg->SetInserted(sal_True);
pPg->SetModel(this);
@@ -1993,19 +2007,19 @@ void SdrModel::PageListChanged()
const SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum) const
{
- DBG_ASSERT(nPgNum < maMaPag.Count(), "SdrModel::GetMasterPage: Access out of range (!)");
- return (SdrPage*)(maMaPag.GetObject(nPgNum));
+ DBG_ASSERT(nPgNum < maMaPag.size(), "SdrModel::GetMasterPage: Access out of range (!)");
+ return maMaPag[nPgNum];
}
SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum)
{
- DBG_ASSERT(nPgNum < maMaPag.Count(), "SdrModel::GetMasterPage: Access out of range (!)");
- return (SdrPage*)(maMaPag.GetObject(nPgNum));
+ DBG_ASSERT(nPgNum < maMaPag.size(), "SdrModel::GetMasterPage: Access out of range (!)");
+ return maMaPag[nPgNum];
}
sal_uInt16 SdrModel::GetMasterPageCount() const
{
- return sal_uInt16(maMaPag.Count());
+ return sal_uInt16(maMaPag.size());
}
void SdrModel::MasterPageListChanged()