Kaydet (Commit) 40e2f7f9 authored tarafından Rafael Dominguez's avatar Rafael Dominguez Kaydeden (comit) Joseph Powers

Replace List for std::vector<String>.

üst f82f7ba5
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
explicit ScScenarioListBox( ScScenarioWindow& rParent ); explicit ScScenarioListBox( ScScenarioWindow& rParent );
virtual ~ScScenarioListBox(); virtual ~ScScenarioListBox();
void UpdateEntries( List* pNewEntryList ); void UpdateEntries( const std::vector<String> &aNewEntryList );
protected: protected:
virtual void Select(); virtual void Select();
......
...@@ -64,15 +64,12 @@ ScScenarioListBox::~ScScenarioListBox() ...@@ -64,15 +64,12 @@ ScScenarioListBox::~ScScenarioListBox()
{ {
} }
void ScScenarioListBox::UpdateEntries( List* pNewEntryList ) void ScScenarioListBox::UpdateEntries( const std::vector<String> &aNewEntryList )
{ {
Clear(); Clear();
maEntries.clear(); maEntries.clear();
if( !pNewEntryList ) switch( aNewEntryList.size() )
return;
switch( pNewEntryList->Count() )
{ {
case 0: case 0:
// no scenarios in current sheet // no scenarios in current sheet
...@@ -81,31 +78,33 @@ void ScScenarioListBox::UpdateEntries( List* pNewEntryList ) ...@@ -81,31 +78,33 @@ void ScScenarioListBox::UpdateEntries( List* pNewEntryList )
case 1: case 1:
// sheet is a scenario container, comment only // sheet is a scenario container, comment only
mrParent.SetComment( *static_cast< String* >( pNewEntryList->First() ) ); mrParent.SetComment( aNewEntryList[0] );
break; break;
default: default:
{ {
// sheet contains scenarios // sheet contains scenarios
DBG_ASSERT( pNewEntryList->Count() % 3 == 0, "ScScenarioListBox::UpdateEntries - wrong list size" ); DBG_ASSERT( aNewEntryList.size() % 3 == 0, "ScScenarioListBox::UpdateEntries - wrong list size" );
SetUpdateMode( false ); SetUpdateMode( false );
String* pEntry = static_cast< String* >( pNewEntryList->First() );
while( pEntry ) std::vector<String>::const_iterator iter;
for (iter = aNewEntryList.begin(); iter != aNewEntryList.end(); ++iter)
{ {
ScenarioEntry aEntry; ScenarioEntry aEntry;
// first entry of a triple is the scenario name // first entry of a triple is the scenario name
aEntry.maName = *pEntry; aEntry.maName = *iter;
// second entry of a triple is the scenario comment // second entry of a triple is the scenario comment
if( (pEntry = static_cast< String* >( pNewEntryList->Next() )) != 0 ) ++iter;
aEntry.maComment = *pEntry; aEntry.maComment = *iter;
// third entry of a triple is the protection ("0" = not protected, "1" = protected) // third entry of a triple is the protection ("0" = not protected, "1" = protected)
if( (pEntry = static_cast< String* >( pNewEntryList->Next() )) != 0 ) ++iter;
aEntry.mbProtected = (pEntry->Len() > 0) && (pEntry->GetChar( 0 ) != '0'); aEntry.mbProtected = (iter->Len() > 0) && (iter->GetChar( 0 ) != '0');
maEntries.push_back( aEntry ); maEntries.push_back( aEntry );
InsertEntry( aEntry.maName, LISTBOX_APPEND ); InsertEntry( aEntry.maName, LISTBOX_APPEND );
pEntry = static_cast< String* >( pNewEntryList->Next() );
} }
SetUpdateMode( sal_True ); SetUpdateMode( sal_True );
SetNoSelection(); SetNoSelection();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment