From f3feba9fcdb4ddb0ed1c823c0d477724838f3344 Mon Sep 17 00:00:00 2001 From: Rafael Dominguez Date: Sat, 5 Mar 2011 06:34:05 -0800 Subject: Remove usage of List container. --- sd/source/ui/dlg/assclass.cxx | 121 +++++++++++++++--------------------------- sd/source/ui/inc/assclass.hxx | 18 +++---- 2 files changed, 53 insertions(+), 86 deletions(-) (limited to 'sd/source') diff --git a/sd/source/ui/dlg/assclass.cxx b/sd/source/ui/dlg/assclass.cxx index c7c545ff62eb..a299d39aba0e 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 #include #include #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 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::iterator iter = maPages[nIndex].begin(); + std::vector::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;i0) && (nPage <= mnPages), "Seite nicht vorhanden!" ); diff --git a/sd/source/ui/inc/assclass.hxx b/sd/source/ui/inc/assclass.hxx index 9074ab44f9ce..053c96ccdba9 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 +#include + #include #include "sddllapi.h" #define MAX_PAGES 10 -class List; class Control; class SD_DLLPUBLIC Assistent { - List* mpPages[MAX_PAGES]; + std::vector 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 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(); }; -- cgit