SvStringsDtor->std::vector

This commit is contained in:
August Sodora 2012-01-11 10:47:56 -05:00
parent 2042da4847
commit a140141e27
3 changed files with 28 additions and 37 deletions

View file

@ -1730,15 +1730,14 @@ void SvxNumberFormatTabPage::SetOkHdl( const Link& rOkHandler )
void SvxNumberFormatTabPage::FillCurrencyBox()
{
SvStringsDtor aList;
std::vector<rtl::OUString> aList;
sal_uInt16 nSelPos=0;
pNumFmtShell->GetCurrencySymbols(aList, &nSelPos);
pNumFmtShell->GetCurrencySymbols( aList, &nSelPos);
for(std::vector<rtl::OUString>::iterator i = aList.begin() + 1;i != aList.end(); ++i)
aLbCurrency.InsertEntry(*i);
for(sal_uInt16 i=1;i<aList.Count();i++)
{
aLbCurrency.InsertEntry( *aList[i] );
}
aLbCurrency.SelectEntryPos(nSelPos);
}

View file

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

View file

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