Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index



From 64658bf13ec18ddb750a62b62ebba12db5215b2e Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 14:16:06 -0430
Subject: [PATCH 1/4] Remove uneeded parameter for Sort function.

---
 svl/inc/svl/slstitm.hxx      |    2 +-
 svl/source/items/slstitm.cxx |   16 ++++------------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/svl/inc/svl/slstitm.hxx b/svl/inc/svl/slstitm.hxx
index 3db957b..e0c5e9a 100644
--- a/svl/inc/svl/slstitm.hxx
+++ b/svl/inc/svl/slstitm.hxx
@@ -75,7 +75,7 @@ public:
     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
     virtual SfxPoolItem*       Create( SvStream &, sal_uInt16 nVersion ) const;
     virtual SvStream&          Store( SvStream &, sal_uInt16 nItemVersion ) const;
-    void                                       Sort( sal_Bool bAscending = sal_True, List* 
pParallelList = 0 );
+    void                                       Sort( sal_Bool bAscending = sal_True);
 
     virtual    bool            PutValue  ( const com::sun::star::uno::Any& rVal,
                                          sal_uInt8 nMemberId = 0 );
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index 720e86d..fcd2ab3 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -51,7 +51,7 @@ public:
 
             SfxImpStringList() { nRefCount = 1; }
             ~SfxImpStringList();
-    void       Sort( sal_Bool bAscending, List* );
+    void       Sort( sal_Bool bAscending);
 };
 
 //------------------------------------------------------------------------
@@ -70,9 +70,8 @@ SfxImpStringList::~SfxImpStringList()
 
 //------------------------------------------------------------------------
 
-void SfxImpStringList::Sort( sal_Bool bAscending, List* pParallelList )
+void SfxImpStringList::Sort( sal_Bool bAscending)
 {
-    DBG_ASSERT(!pParallelList || pParallelList->Count() >= aList.Count(),"Sort:ParallelList too 
small");
     sal_uLong nCount = aList.Count();
     if( nCount > 1 )
     {
@@ -102,13 +101,6 @@ void SfxImpStringList::Sort( sal_Bool bAscending, List* pParallelList )
                     bSwapped = sal_True;
                     aList.Replace( pStr1, nCur + 1 );
                     aList.Replace( pStr2, nCur );
-                    if( pParallelList )
-                    {
-                        void* p1 = pParallelList->GetObject( nCur );
-                        void* p2 = pParallelList->GetObject( nCur + 1 );
-                        pParallelList->Replace( p1, nCur + 1 );
-                        pParallelList->Replace( p2, nCur );
-                    }
                 }
             }
         }
@@ -355,11 +347,11 @@ int SfxStringListItem::IsPoolable() const
 
 //------------------------------------------------------------------------
 
-void SfxStringListItem::Sort( sal_Bool bAscending, List* pParallelList )
+void SfxStringListItem::Sort( sal_Bool bAscending)
 {
     DBG_ASSERT(GetRefCount()==0,"Sort:RefCount!=0");
     if( pImp )
-        pImp->Sort( bAscending, pParallelList );
+        pImp->Sort( bAscending);
 }
 
 //----------------------------------------------------------------------------
-- 
1.7.3.4

From a26495bae645888d06ee8ed310a8961d862d93bf Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 14:16:27 -0430
Subject: [PATCH 2/4] Move GetList to implementation file.

---
 svl/inc/svl/slstitm.hxx      |    3 +--
 svl/source/items/slstitm.cxx |    5 +++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/svl/inc/svl/slstitm.hxx b/svl/inc/svl/slstitm.hxx
index e0c5e9a..7f23651 100644
--- a/svl/inc/svl/slstitm.hxx
+++ b/svl/inc/svl/slstitm.hxx
@@ -52,8 +52,7 @@ public:
 
     List *                                     GetList();
 
-    const List *                       GetList() const
-    { return SAL_CONST_CAST(SfxStringListItem *, this)->GetList(); }
+    const List *                       GetList() const;
 
 #ifndef TF_POOLABLE
     virtual int                        IsPoolable() const;
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index fcd2ab3..5f1f6dc 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -198,6 +198,11 @@ List* SfxStringListItem::GetList()
     return &(pImp->aList);
 }
 
+const List* SfxStringListItem::GetList () const
+{
+    return SAL_CONST_CAST(SfxStringListItem *, this)->GetList();
+}
+
 //------------------------------------------------------------------------
 
 int SfxStringListItem::operator==( const SfxPoolItem& rItem ) const
-- 
1.7.3.4

From e807298d25538d258e321af2cc73606645985999 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 16:14:56 -0430
Subject: [PATCH 3/4] Replace List for std::vector in SfxStringListItem.

---
 svl/inc/svl/slstitm.hxx      |    8 ++-
 svl/source/items/slstitm.cxx |  104 +++++++++++++++++------------------------
 2 files changed, 48 insertions(+), 64 deletions(-)

diff --git a/svl/inc/svl/slstitm.hxx b/svl/inc/svl/slstitm.hxx
index 7f23651..b6def5d 100644
--- a/svl/inc/svl/slstitm.hxx
+++ b/svl/inc/svl/slstitm.hxx
@@ -28,6 +28,8 @@
 #ifndef _SFXSLSTITM_HXX
 #define _SFXSLSTITM_HXX
 
+#include <vector>
+
 #include "svl/svldllapi.h"
 #include <tools/rtti.hxx>
 #include <tools/list.hxx>
@@ -45,14 +47,14 @@ public:
     TYPEINFO();
 
     SfxStringListItem();
-    SfxStringListItem( sal_uInt16 nWhich, const List* pList=NULL );
+    SfxStringListItem( sal_uInt16 nWhich, const std::vector<String> *pList=NULL );
     SfxStringListItem( sal_uInt16 nWhich, SvStream& rStream );
     SfxStringListItem( const SfxStringListItem& rItem );
     ~SfxStringListItem();
 
-    List *                                     GetList();
+    std::vector<String>&    GetList();
 
-    const List *                       GetList() const;
+    const std::vector<String>& GetList() const;
 
 #ifndef TF_POOLABLE
     virtual int                        IsPoolable() const;
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index 5f1f6dc..5f61238 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -47,7 +47,7 @@ class SfxImpStringList
 {
 public:
     sal_uInt16 nRefCount;
-    List       aList;
+    std::vector<String>        aList;
 
             SfxImpStringList() { nRefCount = 1; }
             ~SfxImpStringList();
@@ -59,12 +59,6 @@ public:
 SfxImpStringList::~SfxImpStringList()
 {
     DBG_ASSERT(nRefCount!=0xffff,"ImpList already deleted");
-    String* pStr = (String*)aList.First();
-    while( pStr )
-    {
-        delete pStr;
-        pStr = (String*)aList.Next();
-    }
     nRefCount = 0xffff;
 }
 
@@ -72,7 +66,7 @@ SfxImpStringList::~SfxImpStringList()
 
 void SfxImpStringList::Sort( sal_Bool bAscending)
 {
-    sal_uLong nCount = aList.Count();
+    sal_uLong nCount = aList.size();
     if( nCount > 1 )
     {
         nCount -= 2;
@@ -83,10 +77,10 @@ void SfxImpStringList::Sort( sal_Bool bAscending)
             bSwapped = sal_False;
             for( sal_uLong nCur = 0; nCur <= nCount; nCur++ )
             {
-                String* pStr1 = (String*)aList.GetObject( nCur );
-                String* pStr2 = (String*)aList.GetObject( nCur+1 );
+                String aStr1 = aList[nCur];
+                String aStr2 = aList[nCur+1];
                 // COMPARE_GREATER => pStr2 ist groesser als pStr1
-                StringCompare eCompare = pStr1->CompareIgnoreCaseToAscii( *pStr2 ); //@@@
+                StringCompare eCompare = aStr1.CompareIgnoreCaseToAscii( aStr2 ); //@@@
                 sal_Bool bSwap = sal_False;
                 if( bAscending )
                 {
@@ -99,8 +93,8 @@ void SfxImpStringList::Sort( sal_Bool bAscending)
                 if( bSwap )
                 {
                     bSwapped = sal_True;
-                    aList.Replace( pStr1, nCur + 1 );
-                    aList.Replace( pStr2, nCur );
+                    aList[nCur+1] = aStr1;
+                    aList[nCur] = aStr2;
                 }
             }
         }
@@ -116,7 +110,7 @@ SfxStringListItem::SfxStringListItem() :
 
 //------------------------------------------------------------------------
 
-SfxStringListItem::SfxStringListItem( sal_uInt16 which, const List* pList ) :
+SfxStringListItem::SfxStringListItem( sal_uInt16 which, const std::vector<String>* pList ) :
     SfxPoolItem( which ),
     pImp(NULL)
 {
@@ -126,14 +120,8 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, const List* pList ) :
     {
         pImp = new SfxImpStringList;
 
-        long i, nCount = pList->Count();
-        String  *pStr1, *pStr2;
-        for( i=0; i < nCount; i++ )
-        {
-            pStr1 = (String*)pList->GetObject(i);
-            pStr2 = new String( *pStr1 );
-            pImp->aList.Insert( pStr2, LIST_APPEND );
-        }
+        if (pImp)
+            pImp->aList = *pList;
     }
 }
 
@@ -149,13 +137,15 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) :
     if( nEntryCount )
         pImp = new SfxImpStringList;
 
-    long   i;
-    String*  pStr;
-    for( i=0; i < nEntryCount; i++ )
+    if (pImp)
     {
-        pStr = new String;
-        readByteString(rStream, *pStr);
-        pImp->aList.Insert( pStr, LIST_APPEND );
+        long   i;
+        String  aStr;
+        for( i=0; i < nEntryCount; i++ )
+        {
+            readByteString(rStream, aStr);
+            pImp->aList.push_back(aStr);
+        }
     }
 }
 
@@ -163,10 +153,8 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) :
 
 SfxStringListItem::SfxStringListItem( const SfxStringListItem& rItem ) :
     SfxPoolItem( rItem ),
-    pImp(NULL)
+    pImp(rItem.pImp)
 {
-    pImp = rItem.pImp;
-
     if( pImp )
     {
         DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
@@ -190,15 +178,15 @@ SfxStringListItem::~SfxStringListItem()
 
 //------------------------------------------------------------------------
 
-List* SfxStringListItem::GetList()
+std::vector<String>& SfxStringListItem::GetList()
 {
     if( !pImp )
         pImp = new SfxImpStringList;
     DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
-    return &(pImp->aList);
+    return pImp->aList;
 }
 
-const List* SfxStringListItem::GetList () const
+const std::vector<String>& SfxStringListItem::GetList () const
 {
     return SAL_CONST_CAST(SfxStringListItem *, this)->GetList();
 }
@@ -211,10 +199,7 @@ int SfxStringListItem::operator==( const SfxPoolItem& rItem ) const
 
     SfxStringListItem* pItem = (SfxStringListItem*)&rItem;
 
-    if( pImp == pItem->pImp )
-        return sal_True;
-    else
-        return sal_False;
+    return pImp == pItem->pImp;
 }
 
 //------------------------------------------------------------------------
@@ -265,16 +250,11 @@ SvStream& SfxStringListItem::Store( SvStream & rStream, sal_uInt16 ) const
 
     DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
 
-    long nCount = pImp->aList.Count();
+    sal_uInt32 nCount = pImp->aList.size();
     rStream << nCount;
 
-    long i;
-    String* pStr;
-    for( i=0; i < nCount; i++ )
-    {
-        pStr = (String*)(pImp->aList.GetObject( i ));
-        writeByteString(rStream, *pStr);
-    }
+    for( sal_uInt32 i=0; i < nCount; i++ )
+        writeByteString(rStream, pImp->aList[i]);
 
     return rStream;
 }
@@ -305,17 +285,15 @@ void SfxStringListItem::SetString( const XubString& rStr )
         else
             nLen = nDelimPos - nStart;
 
-        XubString* pStr = new XubString(aStr.Copy(nStart, nLen));
         // String gehoert der Liste
-        pImp->aList.Insert( pStr, LIST_APPEND );
+        pImp->aList.push_back(aStr.Copy(nStart, nLen));
 
         nStart += nLen + 1 ;   // delimiter ueberspringen
     } while( nDelimPos != STRING_NOTFOUND );
 
     // Kein Leerstring am Ende
-    if( pImp->aList.Last() &&
-        !((XubString*)pImp->aList.Last())->Len() )
-        delete (XubString*)pImp->aList.Remove( pImp->aList.Count()-1 );
+    if (!pImp->aList.empty() && !(pImp->aList.rbegin())->Len())
+        pImp->aList.pop_back();
 }
 
 //------------------------------------------------------------------------
@@ -326,13 +304,17 @@ XubString SfxStringListItem::GetString()
     if ( pImp )
     {
         DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
-        XubString* pStr = (XubString*)(pImp->aList.First());
-        while( pStr )
+
+        std::vector<String>::iterator iter;
+        for (iter = pImp->aList.begin();;)
         {
-            aStr += *pStr;
-            pStr = (XubString*)(pImp->aList.Next());
-            if ( pStr )
+            aStr += *iter;
+            ++iter;
+
+            if (iter != pImp->aList.end())
                 aStr += '\r';
+            else
+                break;
         }
     }
     aStr.ConvertLineEnd();
@@ -371,22 +353,22 @@ void SfxStringListItem::SetStringList( const com::sun::star::uno::Sequence< 
rtl:
         pImp->nRefCount--;
     pImp = new SfxImpStringList;
 
-    for ( sal_Int32 n = 0; n < rList.getLength(); n++ )
+    if (pImp)
     {
-        XubString* pStr = new XubString( rList[n] );
         // String gehoert der Liste
-        pImp->aList.Insert( pStr, LIST_APPEND );
+        for ( sal_Int32 n = 0; n < rList.getLength(); n++ )
+            pImp->aList.push_back(XubString(rList[n]));
     }
 }
 
 //----------------------------------------------------------------------------
 void SfxStringListItem::GetStringList( com::sun::star::uno::Sequence< rtl::OUString >& rList ) 
const
 {
-    long nCount = pImp->aList.Count();
+    long nCount = pImp->aList.size();
 
     rList.realloc( nCount );
     for( long i=0; i < nCount; i++ )
-        rList[i] = *(String*)(pImp->aList.GetObject( i ));
+        rList[i] = pImp->aList[i];
 }
 
 //----------------------------------------------------------------------------
-- 
1.7.3.4

From 25e76887d23e907593a71d6691e83bdf97863177 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 16:52:19 -0430
Subject: [PATCH 4/4] Remove tools/list.hxx include.

---
 svl/inc/svl/slstitm.hxx |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/svl/inc/svl/slstitm.hxx b/svl/inc/svl/slstitm.hxx
index b6def5d..e4d858f 100644
--- a/svl/inc/svl/slstitm.hxx
+++ b/svl/inc/svl/slstitm.hxx
@@ -32,7 +32,6 @@
 
 #include "svl/svldllapi.h"
 #include <tools/rtti.hxx>
-#include <tools/list.hxx>
 #include <svl/poolitem.hxx>
 #include <com/sun/star/uno/Sequence.h>
 
-- 
1.7.3.4

From 27c2b96d989fefd49def3be921855cecb59f6b2d Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 17:21:16 -0430
Subject: [PATCH 1/2] Replace List for std::vector<String>.

---
 cui/source/tabpages/numpages.cxx |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 5b69c4d..21dbb6f 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -3586,13 +3586,10 @@ void SvxNumOptionsTabPage::PageCreated(SfxAllItemSet aSet)
     if (pListItem)
     {
         ListBox& myCharFmtLB = GetCharFmtListBox();
-        const List *pList = (pListItem)->GetList();
-        sal_uInt32 nCount = pList->Count();;
+        const std::vector<String> &aList = (pListItem)->GetList();
+        sal_uInt32 nCount = aList.size();;
         for(sal_uInt32 i = 0; i < nCount; i++)
-        {
-            myCharFmtLB.InsertEntry(*(const String*)(pList->GetObject(i)) );
-
-        }
+            myCharFmtLB.InsertEntry(aList[i]);
     }
     if (pMetricItem)
         SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
-- 
1.7.3.4

From 37a8932da11a5f8638fc171f5f04f5d0dd787461 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 18:13:34 -0430
Subject: [PATCH 1/3] Replace List for std::vector<String>.

---
 sc/source/ui/inc/navipi.hxx     |    2 +-
 sc/source/ui/navipi/scenwnd.cxx |   29 ++++++++++++++---------------
 2 files changed, 15 insertions(+), 16 deletions(-)

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();
-- 
1.7.3.4

From 6b747319f848829d677263d326481cf831ae8965 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 18:24:08 -0430
Subject: [PATCH 2/3] Replace List for std::vector<String>.

---
 sc/source/ui/view/cellsh.cxx |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

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;
 
-- 
1.7.3.4

From 917307469146fccf4a373953e1286c0007081677 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 18:29:38 -0430
Subject: [PATCH 3/3] Replace List for std::vector<String>.

---
 sc/source/ui/view/tabvwshb.cxx |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

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 );
                 }
-- 
1.7.3.4

From 4f063166eb4bde316617d5219a7a678d826cd4a3 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 18:47:21 -0430
Subject: [PATCH 1/3] Replace List with std::vector<String>.

---
 sw/source/ui/shells/basesh.cxx |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index 6351356..ae621c6 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -2693,12 +2693,12 @@ void SwBaseShell::GetGalleryState( SfxItemSet &rSet )
         {
             int nSel = rSh.GetSelectionType();
             SfxStringListItem aLst( nWhich );
-            List *pLst = aLst.GetList();
+            std::vector<String> &rLst = aLst.GetList();
             nParagraphPos = nGraphicPos = nOlePos = nFramePos = nTablePos =
             nTableRowPos  = nTableCellPos = nPagePos =
             nHeaderPos           = nFooterPos = 0;
             sal_uInt8 nPos = 1;
-            pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PAGE ), pLst->Count() );
+            rLst.push_back( SW_RESSTR( STR_SWBG_PAGE ) );
             nPagePos = nPos++;
             sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
             sal_Bool bHtmlMode = 0 != (nHtmlMode & HTMLMODE_ON);
@@ -2706,57 +2706,57 @@ void SwBaseShell::GetGalleryState( SfxItemSet &rSet )
             if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) &&
                  (nSel & nsSelectionType::SEL_TXT) )
             {
-                pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PARAGRAPH ), pLst->Count() );
+                rLst.push_back( SW_RESSTR( STR_SWBG_PARAGRAPH ) );
                 nParagraphPos = nPos++;
             }
             if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_SOME_STYLES)) &&
                     nSel & (nsSelectionType::SEL_TBL|nsSelectionType::SEL_TBL_CELLS) )
             {
-                pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE ), pLst->Count() );
+                rLst.push_back( SW_RESSTR( STR_SWBG_TABLE ) );
                 nTablePos = nPos++;
 
                 if(!bHtmlMode)
                 {
-                    pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_ROW ), pLst->Count() );
+                    rLst.push_back( SW_RESSTR( STR_SWBG_TABLE_ROW ) );
                     nTableRowPos = nPos++;
                 }
 
-                pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_CELL), pLst->Count() );
+                rLst.push_back( SW_RESSTR( STR_SWBG_TABLE_CELL) );
                 nTableCellPos = nPos++;
             }
             if(!bHtmlMode)
             {
                 if ( nSel & nsSelectionType::SEL_FRM )
                 {
-                    pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FRAME ), pLst->Count() );
+                    rLst.push_back( SW_RESSTR( STR_SWBG_FRAME ) );
                     nFramePos = nPos++;
                 }
                 if ( nSel & nsSelectionType::SEL_GRF )
                 {
-                    pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_GRAPHIC ), pLst->Count() );
+                    rLst.push_back( SW_RESSTR( STR_SWBG_GRAPHIC ) );
                     nGraphicPos = nPos++;
                 }
                 if ( nSel & nsSelectionType::SEL_OLE )
                 {
-                    pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_OLE ), pLst->Count() );
+                    rLst.push_back( SW_RESSTR( STR_SWBG_OLE ) );
                     nOlePos = nPos++;
                 }
                 const sal_uInt16 nType = rSh.GetFrmType(0,sal_True);
                 if ( nType & FRMTYPE_HEADER )
                 {
-                    pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_HEADER ), pLst->Count() );
+                    rLst.push_back( SW_RESSTR( STR_SWBG_HEADER ) );
                     nHeaderPos = nPos++;
                 }
                 if ( nType & FRMTYPE_FOOTER )
                 {
-                    pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FOOTER ), pLst->Count() );
+                    rLst.push_back( SW_RESSTR( STR_SWBG_FOOTER ) );
                     nFooterPos = nPos;
                 }
             }
-            if ( pLst->Count() )
-                rSet.Put( aLst );
-            else
+            if ( rLst.empty() )
                 rSet.DisableItem( nWhich );
+            else
+                rSet.Put( aLst );
             break;
         }
     }
-- 
1.7.3.4

From 497a411d52e05e5da5b4b1baca036a1b6de64076 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 18:50:49 -0430
Subject: [PATCH 2/3] Replace List with std::vector<String>.

---
 sw/source/ui/misc/num.cxx |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 6507bcf..2b8f5e7 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -991,20 +991,16 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& 
rPage)
             rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
             SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
             ::FillCharStyleListBox(rCharFmtLB, pDocShell);
-            List aList;
+
+            std::vector<String> aList;
             for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
-            {
+                 aList.push_back( String(rCharFmtLB.GetEntry(j)));
 
-                 aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
-            }
             aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
 
             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) );
             rPage.PageCreated(aSet);
-            for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
-                    delete (XubString*)aList.Remove(i);
-            aList.Clear();
         }
         break;
     case RID_SVXPAGE_NUM_POSITION:
-- 
1.7.3.4

From 66bf39fdfc73c0760d6350ac86c27e20426f3ddd Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 18:56:04 -0430
Subject: [PATCH 3/3] Replace List for std::vector<String>.

---
 sw/source/ui/fmtui/tmpdlg.cxx |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index ec3b136..694a136 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -505,10 +505,10 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
         case TP_PAGE_STD:
             if(0 == (nHtmlMode & HTMLMODE_ON ))
             {
-                List aList;
-                String* pNew = new String;
-                SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, *pNew );
-                aList.Insert( pNew, (sal_uLong)0 );
+                std::vector<String> aList;
+                String aNew;
+                SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, aNew );
+                aList.push_back( aNew );
                 if( pWrtShell )
                 {
                     SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
@@ -517,15 +517,12 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
                     SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
                     while(pFirstStyle)
                     {
-                        aList.Insert( new String(pFirstStyle->GetName()),
-                                        aList.Count());
+                        aList.push_back( pFirstStyle->GetName() );
                         pFirstStyle = pStyleSheetPool->Next();
                     }
                 }
                 aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));
                 rPage.PageCreated(aSet);
-                for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
-                    delete (String*)aList.Remove(i);
             }
             break;
 
@@ -557,19 +554,15 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
             rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
             SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
             ::FillCharStyleListBox(rCharFmtLB, pDocShell);
-            List aList;
+
+            std::vector<String> aList;
             for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
-            {
+                 aList.push_back( rCharFmtLB.GetEntry(j) );
 
-                 aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
-            }
             aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
             rPage.PageCreated(aSet);
-            for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
-                    delete (XubString*)aList.Remove(i);
-            aList.Clear();
         }
         break;
         case RID_SVXPAGE_NUM_POSITION:
-- 
1.7.3.4

From 2dcd506d2dd850eeff07bb23d0c818cc16cdf9d2 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 16:28:03 -0430
Subject: [PATCH 3/6] Replace List for std::vector<String>.

---
 sfx2/source/appl/appcfg.cxx |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 07da418..80c69be 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -384,23 +384,14 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet )
                         if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_SECUREURLS))
                         {
                             ::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs = 
aSecurityOptions.GetSecureURLs();
-                            List aList;
+                            std::vector<String> aList;
                             sal_uInt32 nCount = seqURLs.getLength();
                             sal_uInt32 nURL;
                             for( nURL=0; nURL<nCount; ++nURL )
-                            {
-                                aList.Insert( new String( seqURLs[nURL] ), LIST_APPEND );
-                            }
-                            if( !rSet.Put( SfxStringListItem( rPool.GetWhich(SID_SECURE_URL),
-                                    &aList ) ) )
-                            {
+                                aList.push_back(seqURLs[nURL]);
+
+                            if( !rSet.Put( SfxStringListItem( rPool.GetWhich(SID_SECURE_URL), 
&aList ) ) )
                                 bRet = sal_False;
-                            }
-                            for( nURL=0; nURL<nCount; ++nURL )
-                            {
-                                delete (String*)aList.GetObject(nURL);
-                            }
-                            aList.Clear();
                         }
                     }
                     break;
@@ -774,13 +765,12 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
         DELETEZ(pAppData_Impl->pSecureURLs);
 
         DBG_ASSERT(pItem->ISA(SfxStringListItem), "StringListItem expected");
-        const List *pList = ((SfxStringListItem*)pItem)->GetList();
-        sal_uInt32 nCount = pList->Count();
+        const std::vector<String> &aList = ((SfxStringListItem*)pItem)->GetList();
+        sal_uInt32 nCount = aList.size();
         ::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs(nCount);
         for( sal_uInt32 nPosition=0;nPosition<nCount;++nPosition)
-        {
-            seqURLs[nPosition] = *(const String*)(pList->GetObject(nPosition));
-        }
+            seqURLs[nPosition] = aList[nPosition];
+
         aSecurityOptions.SetSecureURLs( seqURLs );
     }
 
-- 
1.7.3.4

From 56fedf1c30b367a3dfaaff5c9541f554e51717d6 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 16:49:31 -0430
Subject: [PATCH 4/6] Replace List with std::vector<String>.

---
 svx/source/gallery2/galbrws2.cxx |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index ef95bbd..c5c68c5 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -122,11 +122,10 @@ void GalleryBackgroundPopup::StateChanged( sal_uInt16 nSID, SfxItemState 
eState,
 
         if( ( pStrLstItem = PTR_CAST( SfxStringListItem, pItem ) ) != NULL )
         {
-            List* pList = pStrLstItem->GetList();
+            const std::vector<String> &aList = pStrLstItem->GetList();
 
-            if( pList )
-                for ( sal_uIntPtr i = 0, nCount = pList->Count(); i < nCount; i++ )
-                    InsertItem( (sal_uInt16) i + 1, *(String*) pList->GetObject( i ) );
+            for ( sal_uIntPtr i = 0, nCount = aList.size(); i < nCount; i++ )
+                InsertItem( (sal_uInt16) i + 1, aList[i]);
         }
         else if( ( pStrItem = PTR_CAST( SfxStringItem, pItem ) ) != NULL )
             InsertItem( 1, pStrItem->GetValue() );
-- 
1.7.3.4

From 112fbd08acb5bb7c9754c5cdab427b127983e461 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 17:04:16 -0430
Subject: [PATCH 5/6] Replace List for std::vector<String>.

---
 svx/source/dialog/srchdlg.cxx |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 81a712f..6c744d5 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -158,15 +158,18 @@ void ListToStrArr_Impl( sal_uInt16 nId, SvStringsDtor& rStrLst, ComboBox& 
rCBox
 {
     SfxStringListItem* pSrchItem =
         (SfxStringListItem*)SFX_APP()->GetItem( nId );
-    List* pLst = pSrchItem ? pSrchItem->GetList() : 0;
 
-    if ( pLst )
-        for ( sal_uInt16 i = 0; i < pLst->Count(); ++i )
+    if (pSrchItem)
+    {
+        std::vector<String> aLst = pSrchItem->GetList();
+
+        for ( sal_uInt16 i = 0; i < aLst.size(); ++i )
         {
-            String* pTmp = new String( *(String*)( pLst->GetObject(i) ) );
+            String* pTmp = new String(aLst[i]);
             rStrLst.Insert( pTmp, rStrLst.Count() );
             rCBox.InsertEntry( *pTmp );
         }
+    }
 }
 
 // -----------------------------------------------------------------------
@@ -174,10 +177,10 @@ void ListToStrArr_Impl( sal_uInt16 nId, SvStringsDtor& rStrLst, ComboBox& 
rCBox
 void StrArrToList_Impl( sal_uInt16 nId, const SvStringsDtor& rStrLst )
 {
     DBG_ASSERT( rStrLst.Count(), "check in advance");
-    List aLst;
+    std::vector<String> aLst;
 
     for ( sal_uInt16 i = 0; i < rStrLst.Count(); ++i )
-        aLst.Insert( rStrLst[ i ], LIST_APPEND );
+        aLst.push_back( *rStrLst[ i ]);
 
     SFX_APP()->PutItem( SfxStringListItem( nId, &aLst ) );
 }
-- 
1.7.3.4

From 6f102f516bd25fc11c2854e90756e1544da028b4 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 17:06:29 -0430
Subject: [PATCH 6/6] Replace List for std::vector<String>.

---
 svx/source/tbxctrls/lboxctrl.cxx |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
index 434d318..ac8fa85 100644
--- a/svx/source/tbxctrls/lboxctrl.cxx
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -302,13 +302,10 @@ void SvxUndoRedoControl::StateChanged(
         if ( pState && pState->ISA( SfxStringListItem ) )
         {
             SfxStringListItem &rItem = *(SfxStringListItem *)pState;
-            const List* pLst = rItem.GetList();
-            DBG_ASSERT( pLst, "no undo actions available" );
-            if ( pLst )
-            {
-                for( long nI = 0, nEnd = pLst->Count(); nI < nEnd; ++nI )
-                    aUndoRedoList.push_back( rtl::OUString( *(String *)pLst->GetObject( nI )));
-            }
+
+            const std::vector<String> &aLst = rItem.GetList();
+            for( long nI = 0, nEnd = aLst.size(); nI < nEnd; ++nI )
+                aUndoRedoList.push_back( rtl::OUString( aLst[nI] ));
         }
     }
 }
-- 
1.7.3.4

From 66edde0d8a013e37d21ec269bbaa6a7bb42a4965 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 21 May 2011 17:37:19 -0430
Subject: [PATCH 2/2] Replace List for std::vector<String>.

---
 cui/source/inc/page.hxx      |    2 +-
 cui/source/tabpages/page.cxx |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 99d071b..7ddd00a 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -222,7 +222,7 @@ public:
     void                SetPaperFormatRanges( Paper eStart, Paper eEnd )
                             { ePaperStart = eStart, ePaperEnd = eEnd; }
 
-    void                               SetCollectionList(const List* pList);
+    void                               SetCollectionList(const std::vector<String> &aList);
     virtual void               PageCreated (SfxAllItemSet aSet);
 };
 
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 52db5d6..25d5978 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -1645,13 +1645,13 @@ IMPL_LINK_INLINE_END( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG 
)
 
 // -----------------------------------------------------------------------
 
-void SvxPageDescPage::SetCollectionList(const List* pList)
+void SvxPageDescPage::SetCollectionList(const std::vector<String> &aList)
 {
-    sStandardRegister = *(String*)pList->GetObject(0);
-    for( sal_uInt16 i = 1; i < pList->Count(); i++   )
-    {
-        aRegisterLB.InsertEntry(*(String*)pList->GetObject(i));
-    }
+    OSL_ENSURE(!aList.empty(), "Empty string list");
+
+    sStandardRegister = aList[0];
+    for( sal_uInt16 i = 1; i < aList.size(); i++   )
+        aRegisterLB.InsertEntry(aList[i]);
 
     aRegisterCB  .Show();
     aRegisterFT  .Show();
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.