summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2011-03-05 06:34:05 -0800
committerJoseph Powers <jpowers27@cox.net>2011-03-05 06:34:05 -0800
commit1602075988ec758341a184d54c67ed848d65d8a8 (patch)
treed80a78c8a8e8c04edf25668e753006f0498bd078 /sd/source
parentf9c0b40160b5081c16613d7ea592e42db0be437c (diff)
Remove usage of List container.
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/ui/dlg/assclass.cxx121
-rw-r--r--sd/source/ui/inc/assclass.hxx18
2 files changed, 53 insertions, 86 deletions
diff --git a/sd/source/ui/dlg/assclass.cxx b/sd/source/ui/dlg/assclass.cxx
index c7c545ff6..a299d39ab 100644
--- a/sd/source/ui/dlg/assclass.cxx
+++ b/sd/source/ui/dlg/assclass.cxx
@@ -29,50 +29,37 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
-
-#include <tools/list.hxx>
#include <tools/debug.hxx>
#include <vcl/ctrl.hxx>
#include "assclass.hxx"
-
Assistent::Assistent(int nNoOfPages)
+ : mnPages(nNoOfPages), mnCurrentPage(1)
{
- mnPages=nNoOfPages;
- if(mnPages>MAX_PAGES)
- {
- mnPages=MAX_PAGES;
- }
+ if(mnPages > MAX_PAGES)
+ mnPages = MAX_PAGES;
- mpPageStatus = new bool[mnPages];
+ mpPageStatus.reset(new bool[mnPages]);
- for(UINT8 i=0;i<mnPages;i++)
- {
- mpPages[i]=new List();
- mpPageStatus[i] = TRUE;
- }
- mnCurrentPage=1;
+ for(int i=0; i < mnPages; ++i)
+ mpPageStatus[i] = true;
}
-
-
bool Assistent::InsertControl(int nDestPage,Control* pUsedControl)
{
DBG_ASSERT( (nDestPage > 0) && (nDestPage <= mnPages), "Seite nicht vorhanden!");
+
if((nDestPage>0)&&(nDestPage<=mnPages))
{
- mpPages[nDestPage-1]->Insert(pUsedControl,LIST_APPEND);
+ maPages[nDestPage-1].push_back(pUsedControl);
pUsedControl->Hide();
pUsedControl->Disable();
return true;
}
- else
- {
- return false;
- }
-}
+ return false;
+}
bool Assistent::NextPage()
{
@@ -85,6 +72,7 @@ bool Assistent::NextPage()
if(nPage <= mnPages)
return GotoPage(nPage);
}
+
return false;
}
@@ -110,88 +98,67 @@ bool Assistent::GotoPage(const int nPageToGo)
if((nPageToGo>0)&&(nPageToGo<=mnPages)&&mpPageStatus[nPageToGo-1])
{
- int i;
- Control* pCurControl;
int nIndex=mnCurrentPage-1;
- for(i=0;i<(int)mpPages[nIndex]->Count();i++)
+ std::vector<Control*>::iterator iter = maPages[nIndex].begin();
+ std::vector<Control*>::iterator iterEnd = maPages[nIndex].end();
+
+ for(; iter != iterEnd; ++iter)
{
- pCurControl=(Control*)mpPages[nIndex]->GetObject(i);
- pCurControl->Disable();
- pCurControl->Hide();
- //schaltet die Controls der vorherigen Seite
- //zurueck
+ (*iter)->Disable();
+ (*iter)->Hide();
}
+
mnCurrentPage=nPageToGo;
nIndex=mnCurrentPage-1;
- for(i=0;i<(int)mpPages[nIndex]->Count();i++)
- {
- pCurControl=(Control*)mpPages[nIndex]->GetObject(i);
- pCurControl->Enable();
- pCurControl->Show();
- //zeigt die neue Seite im Fenster an
+ iter = maPages[nIndex].begin();
+ iterEnd = maPages[nIndex].end();
+
+ for(; iter != iterEnd; ++iter)
+ {
+ (*iter)->Enable();
+ (*iter)->Show();
}
+
return true;
}
- else
- {
- return false;
- }
+
+ return false;
}
-bool Assistent::IsLastPage()
+bool Assistent::IsLastPage() const
{
- if(mnCurrentPage==mnPages)
- {
+ if(mnCurrentPage == mnPages)
return true;
- }
- else
- {
- int nPage = mnCurrentPage+1;
- while(nPage <= mnPages && !mpPageStatus[nPage-1])
- nPage++;
- return nPage > mnPages;
- }
+ int nPage = mnCurrentPage+1;
+ while(nPage <= mnPages && !mpPageStatus[nPage-1])
+ nPage++;
+
+ return nPage > mnPages;
}
-bool Assistent::IsFirstPage()
+bool Assistent::IsFirstPage() const
{
- if(mnCurrentPage==1)
- {
+ if(mnCurrentPage == 1)
return true;
- }
- else
- {
- int nPage = mnCurrentPage-1;
- while(nPage > 0 && !mpPageStatus[nPage-1])
- nPage--;
-
- return nPage == 0;
- }
-}
-
+ int nPage = mnCurrentPage-1;
+ while(nPage > 0 && !mpPageStatus[nPage-1])
+ nPage--;
-int Assistent::GetCurrentPage()
-{
- return mnCurrentPage;
+ return nPage == 0;
}
-Assistent::~Assistent()
+int Assistent::GetCurrentPage() const
{
- for( int i=0;i<mnPages;i++)
- {
- delete mpPages[i];
- }
-
- delete [] mpPageStatus;
+ return mnCurrentPage;
}
-bool Assistent::IsEnabled( int nPage )
+bool Assistent::IsEnabled( int nPage ) const
{
DBG_ASSERT( (nPage>0) && (nPage <= mnPages), "Seite nicht vorhanden!" );
diff --git a/sd/source/ui/inc/assclass.hxx b/sd/source/ui/inc/assclass.hxx
index 11a765111..435801f14 100644
--- a/sd/source/ui/inc/assclass.hxx
+++ b/sd/source/ui/inc/assclass.hxx
@@ -29,17 +29,19 @@
#ifndef INC_ASSCLASS
#define INC_ASSCLASS
+#include <vector>
+#include <boost/scoped_array.hpp>
+
#include <tools/solar.h>
#include "sddllapi.h"
#define MAX_PAGES 10
-class List;
class Control;
class SD_DLLPUBLIC Assistent
{
- List* mpPages[MAX_PAGES];
+ std::vector<Control*> maPages[MAX_PAGES];
//enthaelt fuer jede Seite die Controls die
//korrekt geschaltet werden muessen
@@ -49,13 +51,13 @@ class SD_DLLPUBLIC Assistent
int mnCurrentPage;
//gibt die aktuelle Seite an
- bool* mpPageStatus;
+ boost::scoped_array<bool> mpPageStatus;
public:
Assistent(int nNoOfPage);
- bool IsEnabled( int nPage );
+ bool IsEnabled ( int nPage ) const;
void EnablePage( int nPage );
void DisablePage( int nPage );
@@ -71,16 +73,14 @@ public:
bool GotoPage(const int nPageToGo);
//springt zu einer angegebenen Seite
- bool IsLastPage();
+ bool IsLastPage() const;
//gibt an ob die aktuelle Seite die letzte ist
- bool IsFirstPage();
+ bool IsFirstPage() const;
//gibt an ob die aktuelle Seite die erste ist
- int GetCurrentPage();
+ int GetCurrentPage() const;
//gibt die aktuelle Seite zurueck
-
- ~Assistent();
};