[Libreoffice-commits] .: 4 commits - sfx2/source svx/source

Joseph Powers jpowers at kemper.freedesktop.org
Sun May 22 22:53:15 PDT 2011


 sfx2/source/appl/appcfg.cxx      |   26 ++++++++------------------
 svx/source/dialog/srchdlg.cxx    |   15 +++++++++------
 svx/source/gallery2/galbrws2.cxx |    7 +++----
 svx/source/tbxctrls/lboxctrl.cxx |   11 ++++-------
 4 files changed, 24 insertions(+), 35 deletions(-)

New commits:
commit dd1cc979ced4ba86ee4a4ffdda040912ac172053
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sat May 21 17:06:29 2011 -0430

    Replace List for std::vector<String>.

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] ));
         }
     }
 }
commit a72ca64d502d73e3c4a579f0e1aed9bfebd36c87
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sat May 21 17:04:16 2011 -0430

    Replace List for std::vector<String>.

diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index a4d031d..0dd4115 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 ) );
 }
commit a548e1e131357f91641ac9ef23ef41ce6ec525e4
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sat May 21 16:49:31 2011 -0430

    Replace List with std::vector<String>.

diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 8b5d698..aeac44d 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() );
commit a39c5bf3877438593000f8bb3b35e7bde2c1aa4f
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sat May 21 16:28:03 2011 -0430

    Replace List for std::vector<String>.

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


More information about the Libreoffice-commits mailing list