[Libreoffice-commits] .: 3 commits - sc/source

Joseph Powers jpowers at kemper.freedesktop.org
Sun May 22 22:52:55 PDT 2011


 sc/source/ui/inc/navipi.hxx     |    2 +-
 sc/source/ui/navipi/scenwnd.cxx |   29 ++++++++++++++---------------
 sc/source/ui/view/cellsh.cxx    |   17 ++++++-----------
 sc/source/ui/view/tabvwshb.cxx  |    7 +++----
 4 files changed, 24 insertions(+), 31 deletions(-)

New commits:
commit dea06b746fb0b9e7d06f4eeba41c352bd33d887c
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sat May 21 18:29:38 2011 -0430

    Replace List for std::vector<String>.

diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 74ee9d3..215a658 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -552,13 +552,12 @@ void ScTabViewShell::GetUndoState(SfxItemSet &rSet)
                     SfxStringListItem aStrLst( nWhich );
                     if ( pUndoManager )
                     {
-                        List* pList = aStrLst.GetList();
+                        std::vector<String> &aList = aStrLst.GetList();
                         sal_Bool bIsUndo = ( nWhich == SID_GETUNDOSTRINGS );
                         size_t nCount = bIsUndo ? pUndoManager->GetUndoActionCount() : pUndoManager->GetRedoActionCount();
                         for (size_t i=0; i<nCount; i++)
-                            pList->Insert( new String( bIsUndo ? pUndoManager->GetUndoActionComment(i) :
-                                                                 pUndoManager->GetRedoActionComment(i) ),
-                                           LIST_APPEND );
+                            aList.push_back( bIsUndo ? pUndoManager->GetUndoActionComment(i) :
+                                                       pUndoManager->GetRedoActionComment(i) );
                     }
                     rSet.Put( aStrLst );
                 }
commit 6da3ad3fc84228effdd09221dd7d4c3a1755f8d4
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sat May 21 18:24:08 2011 -0430

    Replace List for std::vector<String>.

diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 5d6c875..d795128 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -735,8 +735,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
 
             case SID_SELECT_SCENARIO:
                 {
-                    List		aList;
-
+                    std::vector<String> aList;
                     Color	aDummyCol;
 
                     if ( !pDoc->IsScenario(nTab) )
@@ -750,12 +749,12 @@ void ScCellShell::GetState(SfxItemSet &rSet)
                         while ( pDoc->IsScenario(nScTab) )
                         {
                             pDoc->GetName( nScTab, aStr );
-                            aList.Insert( new String( aStr ), LIST_APPEND );
+                            aList.push_back(aStr);
                             pDoc->GetScenarioData( nScTab, aStr, aDummyCol, nFlags );
-                            aList.Insert( new String( aStr ), LIST_APPEND );
+                            aList.push_back(aStr);
                             // Protection is sal_True if both Sheet and Scenario are protected
                             aProtect = (bSheetProtected && (nFlags & SC_SCENARIO_PROTECT)) ? '1' : '0';
-                            aList.Insert( new String( aProtect), LIST_APPEND );
+                            aList.push_back(aProtect);
                             ++nScTab;
                         }
                     }
@@ -764,15 +763,11 @@ void ScCellShell::GetState(SfxItemSet &rSet)
                         String	aComment;
                         sal_uInt16	nDummyFlags;
                         pDoc->GetScenarioData( nTab, aComment, aDummyCol, nDummyFlags );
-                        DBG_ASSERT( aList.Count() == 0, "List not empty!" );
-                        aList.Insert( new String( aComment ) );
+                        DBG_ASSERT( aList.empty(), "List not empty!" );
+                        aList.push_back(aComment);
                     }
 
                     rSet.Put( SfxStringListItem( nWhich, &aList ) );
-
-                    sal_uLong nCount = aList.Count();
-                    for ( sal_uLong i=0; i<nCount; i++ )
-                        delete (String*) aList.GetObject(i);
                 }
                 break;
 
commit a78957fe6458ee5298c31ef5356fdcd6e6ea61b0
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sat May 21 18:13:34 2011 -0430

    Replace List for std::vector<String>.

diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx
index 1f3cbd8..46c8578 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 377f4a8..56cfa47 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();


More information about the Libreoffice-commits mailing list