diff options
author | August Sodora <augsod@gmail.com> | 2012-01-11 10:47:56 -0500 |
---|---|---|
committer | August Sodora <augsod@gmail.com> | 2012-01-11 18:32:12 -0500 |
commit | a140141e272854110e2e164be69c35839631a0e0 (patch) | |
tree | 5274402c5a3a6162852a90d8a39fc6f2ad9c926b /svx | |
parent | 2042da484765a029e0545a530e3d9a6f38218821 (diff) |
SvStringsDtor->std::vector
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/numfmtsh.hxx | 4 | ||||
-rw-r--r-- | svx/source/items/numfmtsh.cxx | 50 |
2 files changed, 23 insertions, 31 deletions
diff --git a/svx/inc/svx/numfmtsh.hxx b/svx/inc/svx/numfmtsh.hxx index a2425a4745c4..3ae23f4f66ca 100644 --- a/svx/inc/svx/numfmtsh.hxx +++ b/svx/inc/svx/numfmtsh.hxx @@ -190,8 +190,8 @@ public: short GetListPos4Entry(sal_uInt32 nIdx); short GetListPos4Entry( const String& rFmtString ); - void GetCurrencySymbols( SvStringsDtor& rList, sal_uInt16* pPos ); - void GetCurrencySymbols( SvStringsDtor& rList, bool bFlag ); + void GetCurrencySymbols(std::vector<rtl::OUString>& rList, sal_uInt16* pPos ); + void GetCurrencySymbols(std::vector<rtl::OUString>& rList, bool bFlag ); sal_uInt16 FindCurrencyTableEntry( const String& rFmtString, bool &bTestBanking ); bool IsInTable(sal_uInt16 nPos,bool bTmpBanking,const String &rFmtString); diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 9736e9785ad4..c76f7a4de86e 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -1500,14 +1500,13 @@ String SvxNumberFormatShell::GetStandardName() const return pFormatter->GetStandardName( eCurLanguage); } -void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, sal_uInt16* pPos ) +void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList, sal_uInt16* pPos) { - const NfCurrencyEntry* pTmpCurrencyEntry=SvNumberFormatter::MatchSystemCurrency(); bool bFlag=(pTmpCurrencyEntry==NULL); - GetCurrencySymbols( rList, bFlag); + GetCurrencySymbols(rList, bFlag); if(pPos!=NULL) { @@ -1540,7 +1539,7 @@ void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, sal_uInt16* } -void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, bool bFlag ) +void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList, bool bFlag) { aCurCurrencyList.clear(); @@ -1550,21 +1549,18 @@ void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, bool bFlag SvtLanguageTable* pLanguageTable=new SvtLanguageTable; sal_uInt16 nStart=1; - sal_uInt16 i,j; XubString aString( ApplyLreOrRleEmbedding( rCurrencyTable[0]->GetSymbol())); aString += sal_Unicode(' '); aString += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[0]->GetLanguage())); - WSStringPtr pStr = new XubString(aString); - rList.Insert( pStr,rList.Count()); + rList.push_back(aString); sal_uInt16 nAuto=(sal_uInt16)-1; aCurCurrencyList.push_back(nAuto); if(bFlag) { - pStr = new XubString(aString); - rList.Insert( pStr,rList.Count()); + rList.push_back(aString); aCurCurrencyList.push_back(0); ++nStart; } @@ -1574,7 +1570,7 @@ void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, bool bFlag const String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " ")); - for(i=1;i<nCount;i++) + for(sal_uInt16 i = 1; i < nCount; ++i) { XubString aStr( ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetBankSymbol())); aStr += aTwoSpace; @@ -1582,40 +1578,36 @@ void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, bool bFlag aStr += aTwoSpace; aStr += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[i]->GetLanguage())); - pStr = new XubString(aStr); - for(j=nStart;j<rList.Count();j++) - { - const StringPtr pTestStr=rList[j]; - if (aCollator.compareString( *pStr, *pTestStr) < 0) + sal_uInt16 j = nStart; + for(; j < rList.size(); ++j) + if (aCollator.compareString(aStr, rList[j]) < 0) break; // insert before first greater than - } - rList.Insert( pStr,j); - aCurCurrencyList.insert(aCurCurrencyList.begin()+j, i); + + rList.insert(rList.begin() + j, aStr); + aCurCurrencyList.insert(aCurCurrencyList.begin() + j, i); } // Append ISO codes to symbol list. // XXX If this is to be changed, various other places would had to be // adapted that assume this order! - sal_uInt16 nCont = rList.Count(); + sal_uInt16 nCont = rList.size(); - for(i=1;i<nCount;i++) + for(sal_uInt16 i = 1; i < nCount; ++i) { bool bInsert = true; - pStr = new XubString( ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetBankSymbol())); + rtl::OUString aStr(ApplyLreOrRleEmbedding(rCurrencyTable[i]->GetBankSymbol())); - for (j = nCont; j < rList.Count() && bInsert; ++j) + sal_uInt16 j = nCont; + for(; j < rList.size() && bInsert; ++j) { - const StringPtr pTestStr=rList[j]; - - if(*pTestStr==*pStr) + if(rList[j] == aStr) bInsert = false; - else - if (aCollator.compareString( *pStr, *pTestStr) < 0) - break; // insert before first greater than + else if (aCollator.compareString(aStr, rList[j]) < 0) + break; // insert before first greater than } if(bInsert) { - rList.Insert( pStr,j); + rList.insert(rList.begin() + j, aStr); aCurCurrencyList.insert(aCurCurrencyList.begin()+j, i); } } |