summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/numfmtsh.hxx4
-rw-r--r--svx/source/cui/numfmt.cxx3
-rw-r--r--svx/source/cui/numfmt.hrc7
-rw-r--r--svx/source/cui/numfmt.hxx1
-rw-r--r--svx/source/cui/numfmt.src4
-rw-r--r--svx/source/items/numfmtsh.cxx61
6 files changed, 44 insertions, 36 deletions
diff --git a/svx/inc/svx/numfmtsh.hxx b/svx/inc/svx/numfmtsh.hxx
index 8e2eb238d3bd..5e6fe3737f94 100644
--- a/svx/inc/svx/numfmtsh.hxx
+++ b/svx/inc/svx/numfmtsh.hxx
@@ -212,8 +212,8 @@ public:
short GetListPos4Entry(sal_uInt32 nIdx);
short GetListPos4Entry( const String& rFmtString );
- void GetCurrencySymbols(SvStringsDtor& rList,const XubString& rStrEurope,USHORT* pPos);
- void GetCurrencySymbols(SvStringsDtor& rList,const XubString& rStrEurope, BOOL bFlag);
+ void GetCurrencySymbols( SvStringsDtor& rList, USHORT* pPos );
+ void GetCurrencySymbols( SvStringsDtor& rList, BOOL bFlag );
USHORT FindCurrencyTableEntry( const String& rFmtString, BOOL &bTestBanking );
BOOL IsInTable(USHORT nPos,BOOL bTmpBanking,const String &rFmtString);
diff --git a/svx/source/cui/numfmt.cxx b/svx/source/cui/numfmt.cxx
index a3b426c6110e..d6978ea008b8 100644
--- a/svx/source/cui/numfmt.cxx
+++ b/svx/source/cui/numfmt.cxx
@@ -292,7 +292,6 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage( Window* pParent,
pNumFmtShell ( NULL ),
nInitFormat ( ULONG_MAX ),
- aStrEurope ( THIS_SVX_RES( STR_EUROPE) ),
sAutomaticEntry ( THIS_SVX_RES( STR_AUTO_ENTRY)),
pLastActivWindow( NULL )
{
@@ -1887,7 +1886,7 @@ void SvxNumberFormatTabPage::FillCurrencyBox()
USHORT nPos=0;
USHORT nSelPos=0;
- pNumFmtShell->GetCurrencySymbols(aList,aStrEurope,&nSelPos);
+ pNumFmtShell->GetCurrencySymbols( aList, &nSelPos);
for(USHORT i=1;i<aList.Count();i++)
{
diff --git a/svx/source/cui/numfmt.hrc b/svx/source/cui/numfmt.hrc
index 7f63e02b57d5..102c5a212ac6 100644
--- a/svx/source/cui/numfmt.hrc
+++ b/svx/source/cui/numfmt.hrc
@@ -64,10 +64,9 @@
#define IB_INFO 31
#define IL_ICON 32
#define LB_CURRENCY 33
-#define STR_EUROPE 34
-#define CB_SOURCEFORMAT 35
-#define IL_ICON_HC 36
-#define STR_AUTO_ENTRY 37
+#define CB_SOURCEFORMAT 34
+#define IL_ICON_HC 35
+#define STR_AUTO_ENTRY 36
#define TBX_ADDREMOVE 1
#define IID_ADD 1
diff --git a/svx/source/cui/numfmt.hxx b/svx/source/cui/numfmt.hxx
index ff9d0813f6e5..e14f397cf0ba 100644
--- a/svx/source/cui/numfmt.hxx
+++ b/svx/source/cui/numfmt.hxx
@@ -170,7 +170,6 @@ private:
long nCurFormatHeight;
long nStdFormatY;
long nStdFormatHeight;
- LocalizedString aStrEurope;
LocalizedString sAutomaticEntry;
Window* pLastActivWindow;
diff --git a/svx/source/cui/numfmt.src b/svx/source/cui/numfmt.src
index ab71ae446998..96269bb9ec09 100644
--- a/svx/source/cui/numfmt.src
+++ b/svx/source/cui/numfmt.src
@@ -256,10 +256,6 @@ TabPage RID_SVXPAGE_NUMBERFORMAT
IdCount = { 3 ; };
};
- String STR_EUROPE
- {
- Text [ en-US ] = "Europe";
- };
String STR_AUTO_ENTRY
{
Text [ en-US ] = "Automatic";
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index d4dd02f74a3b..ca6333753769 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -45,6 +45,7 @@
#include <svtools/langtab.hxx>
#include <vcl/svapp.hxx>
+#include <comphelper/processfactory.hxx>
#include <svx/numfmtsh.hxx>
// class SvxNumberFormatShell --------------------------------------------
@@ -1523,22 +1524,22 @@ String SvxNumberFormatShell::GetStandardName() const
return pFormatter->GetStandardName( eCurLanguage);
}
-void SvxNumberFormatShell::GetCurrencySymbols(SvStringsDtor& rList,const XubString& rStrEurope, sal_uInt16* pPos)
+void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, sal_uInt16* pPos )
{
const NfCurrencyEntry* pTmpCurrencyEntry=SvNumberFormatter::MatchSystemCurrency();
sal_Bool bFlag=(pTmpCurrencyEntry==NULL);
- GetCurrencySymbols(rList,rStrEurope, bFlag);
+ GetCurrencySymbols( rList, bFlag);
if(pPos!=NULL)
{
const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
- sal_uInt16 nCount=rCurrencyTable.Count();
+ sal_uInt16 nTableCount=rCurrencyTable.Count();
*pPos=0;
- nCount=aCurCurrencyList.Count();
+ sal_uInt16 nCount=aCurCurrencyList.Count();
if(bFlag)
{
@@ -1549,8 +1550,9 @@ void SvxNumberFormatShell::GetCurrencySymbols(SvStringsDtor& rList,const XubStri
{
for(sal_uInt16 i=1;i<nCount;i++)
{
- if(aCurCurrencyList[i]!=(sal_uInt16)-1 &&
- pTmpCurrencyEntry==rCurrencyTable[aCurCurrencyList[i]])
+ const sal_uInt16 j = aCurCurrencyList[i];
+ if (j != (sal_uInt16)-1 && j < nTableCount &&
+ pTmpCurrencyEntry == rCurrencyTable[j])
{
*pPos=i;
nCurCurrencyEntryPos=i;
@@ -1562,7 +1564,7 @@ void SvxNumberFormatShell::GetCurrencySymbols(SvStringsDtor& rList,const XubStri
}
-void SvxNumberFormatShell::GetCurrencySymbols(SvStringsDtor& rList,const XubString& /*rStrEurope*/, sal_Bool bFlag)
+void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, sal_Bool bFlag )
{
aCurCurrencyList.Remove(0,aCurCurrencyList.Count());
@@ -1574,9 +1576,9 @@ void SvxNumberFormatShell::GetCurrencySymbols(SvStringsDtor& rList,const XubStri
sal_uInt16 nStart=1;
sal_uInt16 i,j;
- XubString aString(rCurrencyTable[0]->GetSymbol());
+ XubString aString( ApplyLreOrRleEmbedding( rCurrencyTable[0]->GetSymbol()));
aString += sal_Unicode(' ');
- aString += pLanguageTable->GetString(rCurrencyTable[0]->GetLanguage());
+ aString += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[0]->GetLanguage()));
WSStringPtr pStr = new XubString(aString);
rList.Insert( pStr,rList.Count());
@@ -1591,41 +1593,54 @@ void SvxNumberFormatShell::GetCurrencySymbols(SvStringsDtor& rList,const XubStri
++nStart;
}
- for(i=1;i<nCount;i++)
- {
- XubString _aString(rCurrencyTable[i]->GetSymbol());
- _aString += sal_Unicode(' ');
- _aString += pLanguageTable->GetString(rCurrencyTable[i]->GetLanguage());
+ CollatorWrapper aCollator( ::comphelper::getProcessServiceFactory());
+ aCollator.loadDefaultCollator( Application::GetSettings().GetLocale(), 0);
- pStr = new XubString(_aString);
+ const String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " "));
+ for(i=1;i<nCount;i++)
+ {
+ XubString aStr( ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetBankSymbol()));
+ aStr += aTwoSpace;
+ aStr += ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetSymbol());
+ aStr += aTwoSpace;
+ aStr += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[i]->GetLanguage()));
+
+ pStr = new XubString(aStr);
+#if 0
+ fprintf( stderr, "currency entry: %s\n", ByteString( *pStr, RTL_TEXTENCODING_UTF8).GetBuffer());
+#endif
for(j=nStart;j<rList.Count();j++)
{
const StringPtr pTestStr=rList[j];
-
- if(*pTestStr>aString) break;
+ if (aCollator.compareString( *pStr, *pTestStr) < 0)
+ break; // insert before first greater than
}
rList.Insert( pStr,j);
aCurCurrencyList.Insert(i,j);
}
+ // 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();
for(i=1;i<nCount;i++)
{
- sal_Bool bTest=sal_True;
- pStr = new XubString(rCurrencyTable[i]->GetBankSymbol());
+ bool bInsert = true;
+ pStr = new XubString( ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetBankSymbol()));
- for(j=nCont;j<rList.Count();j++)
+ for (j = nCont; j < rList.Count() && bInsert; ++j)
{
const StringPtr pTestStr=rList[j];
if(*pTestStr==*pStr)
- bTest=sal_False;
+ bInsert = false;
else
- if(*pTestStr>*pStr) break;
+ if (aCollator.compareString( *pStr, *pTestStr) < 0)
+ break; // insert before first greater than
}
- if(bTest)
+ if(bInsert)
{
rList.Insert( pStr,j);
aCurCurrencyList.Insert(i,j);