summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2011-05-21 18:13:34 -0430
committerJoseph Powers <jpowers27@cox.net>2011-05-22 22:52:43 -0700
commita78957fe6458ee5298c31ef5356fdcd6e6ea61b0 (patch)
treeac602a894b657678c1b9f5b6cefe17f4b532e6e4
parent66ac561d255ab92a43dcf933ac9bc76577ba7659 (diff)
Replace List for std::vector<String>.
-rw-r--r--sc/source/ui/inc/navipi.hxx2
-rw-r--r--sc/source/ui/navipi/scenwnd.cxx29
2 files changed, 15 insertions, 16 deletions
diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx
index 1f3cbd878..46c8578b3 100644
--- a/sc/source/ui/inc/navipi.hxx
+++ b/sc/source/ui/inc/navipi.hxx
@@ -73,7 +73,7 @@ public:
explicit ScScenarioListBox( ScScenarioWindow& rParent );
virtual ~ScScenarioListBox();
- void UpdateEntries( List* pNewEntryList );
+ void UpdateEntries( const std::vector<String> &aNewEntryList );
protected:
virtual void Select();
diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx
index 377f4a850..56cfa4783 100644
--- a/sc/source/ui/navipi/scenwnd.cxx
+++ b/sc/source/ui/navipi/scenwnd.cxx
@@ -64,15 +64,12 @@ ScScenarioListBox::~ScScenarioListBox()
{
}
-void ScScenarioListBox::UpdateEntries( List* pNewEntryList )
+void ScScenarioListBox::UpdateEntries( const std::vector<String> &aNewEntryList )
{
Clear();
maEntries.clear();
- if( !pNewEntryList )
- return;
-
- switch( pNewEntryList->Count() )
+ switch( aNewEntryList.size() )
{
case 0:
// no scenarios in current sheet
@@ -81,31 +78,33 @@ void ScScenarioListBox::UpdateEntries( List* pNewEntryList )
case 1:
// sheet is a scenario container, comment only
- mrParent.SetComment( *static_cast< String* >( pNewEntryList->First() ) );
+ mrParent.SetComment( aNewEntryList[0] );
break;
default:
{
// 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 );
- 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;
// first entry of a triple is the scenario name
- aEntry.maName = *pEntry;
+ aEntry.maName = *iter;
+
// second entry of a triple is the scenario comment
- if( (pEntry = static_cast< String* >( pNewEntryList->Next() )) != 0 )
- aEntry.maComment = *pEntry;
+ ++iter;
+ aEntry.maComment = *iter;
+
// third entry of a triple is the protection ("0" = not protected, "1" = protected)
- if( (pEntry = static_cast< String* >( pNewEntryList->Next() )) != 0 )
- aEntry.mbProtected = (pEntry->Len() > 0) && (pEntry->GetChar( 0 ) != '0');
+ ++iter;
+ aEntry.mbProtected = (iter->Len() > 0) && (iter->GetChar( 0 ) != '0');
maEntries.push_back( aEntry );
InsertEntry( aEntry.maName, LISTBOX_APPEND );
- pEntry = static_cast< String* >( pNewEntryList->Next() );
}
SetUpdateMode( sal_True );
SetNoSelection();