[Libreoffice-commits] .: 2 commits - cui/source

August Sodora augsod at kemper.freedesktop.org
Tue Jan 10 20:57:07 PST 2012


 cui/source/inc/macroass.hxx      |    1 
 cui/source/inc/macropg.hxx       |    1 
 cui/source/tabpages/autocdlg.cxx |   70 +++++++++++++++------------------------
 3 files changed, 28 insertions(+), 44 deletions(-)

New commits:
commit 1681ee65f67cf1c382a34f7ea35fe118dc8603aa
Author: August Sodora <augsod at gmail.com>
Date:   Tue Jan 10 23:55:12 2012 -0500

    SvStringsDtor->std::vector

diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index a532f16..48eb935 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -1468,19 +1468,16 @@ IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit*, pEdt)
 
 struct StringsArrays
 {
+    std::vector<rtl::OUString> aAbbrevStrings;
+    std::vector<rtl::OUString> aDoubleCapsStrings;
 
-    SvStringsDtor aAbbrevStrings;
-    SvStringsDtor aDoubleCapsStrings;
-
-    StringsArrays() :
-        aAbbrevStrings(5,5), aDoubleCapsStrings(5,5) {}
+    StringsArrays() { }
 };
-typedef StringsArrays* StringsArraysPtr;
 
-sal_Bool lcl_FindInArray(SvStringsDtor& rStrings, const String& rString)
+sal_Bool lcl_FindInArray(std::vector<rtl::OUString>& rStrings, const String& rString)
 {
-    for(sal_uInt16 i = 0; i < rStrings.Count(); i++)
-        if(rString == *rStrings.GetObject(i))
+    for(std::vector<rtl::OUString>::iterator i = rStrings.begin(); i != rStrings.end(); ++i)
+        if((*i).equals(rString))
             return sal_True;
     return sal_False;
 }
@@ -1590,12 +1587,12 @@ sal_Bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet&  )
                     if( !lcl_FindInArray(pArrays->aDoubleCapsStrings, *pString))
                       pWrdList->DeleteAndDestroy( i );
                 }
-                nCount = pArrays->aDoubleCapsStrings.Count();
-                for( i = 0; i < nCount; ++i )
+
+                for(std::vector<rtl::OUString>::iterator it = pArrays->aDoubleCapsStrings.begin(); it != pArrays->aDoubleCapsStrings.end(); ++i)
                 {
-                    String* pEntry = new String( *pArrays->aDoubleCapsStrings.GetObject( i ) );
-                    if( !pWrdList->Insert( pEntry ))
-                        delete pEntry;
+                    String* s = new String(*it);
+                    if(!pWrdList->Insert(s))
+                        delete s;
                 }
                 pAutoCorrect->SaveWrdSttExceptList(eCurLang);
             }
@@ -1612,13 +1609,14 @@ sal_Bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet&  )
                     if( !lcl_FindInArray(pArrays->aAbbrevStrings, *pString))
                         pCplList->DeleteAndDestroy( i );
                 }
-                nCount = pArrays->aAbbrevStrings.Count();
-                for( i = 0; i < nCount; ++i )
+
+                for(std::vector<rtl::OUString>::iterator it = pArrays->aAbbrevStrings.begin(); it != pArrays->aAbbrevStrings.end(); ++it)
                 {
-                    String* pEntry = new String( *pArrays->aAbbrevStrings.GetObject(i) );
-                    if( !pCplList->Insert( pEntry ))
-                        delete pEntry;
+                    String* s = new String(*it);
+                    if(!pCplList->Insert(s))
+                        delete s;
                 }
+
                 pAutoCorrect->SaveCplSttExceptList(eCurLang);
             }
         }
@@ -1702,14 +1700,12 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(sal_Bool bFromReset,
         lcl_ClearTable(aStringsTable);
     else
     {
-        StringsArraysPtr pArrays = 0;
+        StringsArrays* pArrays = NULL;
         if(aStringsTable.IsKeyValid(eOldLanguage))
         {
             pArrays = aStringsTable.Seek(sal_uLong(eOldLanguage));
-            pArrays->aAbbrevStrings.DeleteAndDestroy(
-                                    0, pArrays->aAbbrevStrings.Count());
-            pArrays->aDoubleCapsStrings.DeleteAndDestroy(
-                                    0, pArrays->aDoubleCapsStrings.Count());
+            pArrays->aAbbrevStrings.clear();
+            pArrays->aDoubleCapsStrings.clear();
         }
         else
         {
@@ -1719,16 +1715,10 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(sal_Bool bFromReset,
 
         sal_uInt16 i;
         for(i = 0; i < aAbbrevLB.GetEntryCount(); i++)
-        {
-            pArrays->aAbbrevStrings.Insert(
-                new String(aAbbrevLB.GetEntry(i)), i);
+            pArrays->aAbbrevStrings.push_back(rtl::OUString(aAbbrevLB.GetEntry(i)));
 
-        }
         for(i = 0; i < aDoubleCapsLB.GetEntryCount(); i++)
-        {
-            pArrays->aDoubleCapsStrings.Insert(
-                new String(aDoubleCapsLB.GetEntry(i)), i);
-        }
+            pArrays->aDoubleCapsStrings.push_back(rtl::OUString(aDoubleCapsLB.GetEntry(i)));
     }
     aDoubleCapsLB.Clear();
     aAbbrevLB.Clear();
@@ -1738,16 +1728,12 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(sal_Bool bFromReset,
 
     if(aStringsTable.IsKeyValid(eLang))
     {
-        StringsArraysPtr pArrays = aStringsTable.Seek(sal_uLong(eLang));
-        sal_uInt16 i;
-        for(i = 0; i < pArrays->aAbbrevStrings.Count(); i++ )
-        {
-            aAbbrevLB.InsertEntry(*pArrays->aAbbrevStrings.GetObject(i));
-        }
-        for( i = 0; i < pArrays->aDoubleCapsStrings.Count(); i++ )
-        {
-            aDoubleCapsLB.InsertEntry(*pArrays->aDoubleCapsStrings.GetObject(i));
-        }
+        StringsArrays* pArrays = aStringsTable.Seek(sal_uLong(eLang));
+        for(std::vector<rtl::OUString>::iterator i = pArrays->aAbbrevStrings.begin(); i != pArrays->aAbbrevStrings.end(); ++i)
+            aAbbrevLB.InsertEntry(*i);
+
+        for(std::vector<rtl::OUString>::iterator i = pArrays->aDoubleCapsStrings.begin(); i != pArrays->aDoubleCapsStrings.end(); ++i)
+            aDoubleCapsLB.InsertEntry(*i);
     }
     else
     {
commit d5e1963080018ada1da12adf2d97b1973e3d1e9a
Author: August Sodora <augsod at gmail.com>
Date:   Tue Jan 10 23:21:44 2012 -0500

    Remove unnecessary forward declarations

diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx
index 51e6193..849ac45 100644
--- a/cui/source/inc/macroass.hxx
+++ b/cui/source/inc/macroass.hxx
@@ -37,7 +37,6 @@
 #include <com/sun/star/frame/XFrame.hpp>
 
 class _SfxMacroTabPage;
-class SvStringsDtor;
 class SvTabListBox;
 class Edit;
 class String;
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
index 98d1283..142b416 100644
--- a/cui/source/inc/macropg.hxx
+++ b/cui/source/inc/macropg.hxx
@@ -58,7 +58,6 @@ struct EventDisplayName
 typedef ::std::vector< EventDisplayName >   EventDisplayNames;
 
 class _SvxMacroTabPage;
-class SvStringsDtor;
 class SvTabListBox;
 class Edit;
 class String;


More information about the Libreoffice-commits mailing list