summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
Diffstat (limited to 'svl')
-rw-r--r--svl/inc/svl/zforlist.hxx14
-rw-r--r--svl/inc/svl/zformat.hxx4
-rw-r--r--svl/source/numbers/zforlist.cxx59
3 files changed, 39 insertions, 38 deletions
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 5b7ab3861182..0d82c0f1c41c 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -242,9 +242,9 @@ class SVL_DLLPUBLIC NfCurrencyEntry
private:
// nDecimalFormat := 0, 1, 2
- // #,##0 or #,##0.00 or #,##0.-- are assigned
- SVL_DLLPRIVATE void Impl_BuildFormatStringNumChars( String&,
- const LocaleDataWrapper&, sal_uInt16 nDecimalFormat ) const;
+ // #,##0 or #,##0.00 or #,##0.-- is returned
+ SVL_DLLPRIVATE OUString Impl_BuildFormatStringNumChars(
+ const LocaleDataWrapper&, sal_uInt16 nDecimalFormat) const;
public:
@@ -268,10 +268,10 @@ public:
sal_Unicode GetZeroChar() const { return cZeroChar; }
/** [$DM-407] (bBank==false) or [$DEM] (bBank==true)
- is assigned to rStr, if bBank==false and
+ is returned. If bBank==false and
bWithoutExtension==true only [$DM] */
- void BuildSymbolString( String& rStr, bool bBank,
- bool bWithoutExtension = false ) const;
+ OUString BuildSymbolString(bool bBank,
+ bool bWithoutExtension = false) const;
/** #,##0.00 [$DM-407] is assigned to rStr, separators
from rLoc, incl. minus sign but without [RED] */
@@ -870,7 +870,7 @@ private:
// Test whether format code already exists, then return index key,
// otherwise NUMBERFORMAT_ENTRY_NOT_FOUND
- SVL_DLLPRIVATE sal_uInt32 ImpIsEntry( const String& rString,
+ SVL_DLLPRIVATE sal_uInt32 ImpIsEntry( const OUString& rString,
sal_uInt32 CLOffset,
LanguageType eLnge );
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx
index 05a30e2d640c..f94e62d25dd7 100644
--- a/svl/inc/svl/zformat.hxx
+++ b/svl/inc/svl/zformat.hxx
@@ -221,7 +221,7 @@ public:
LanguageType GetLanguage() const { return maLocale.meLanguage;}
- const String& GetFormatstring() const { return sFormatstring; }
+ const OUString& GetFormatstring() const { return sFormatstring; }
// Build a format string of application defined keywords
String GetMappedFormatstring( const NfKeywordTable& rKeywords,
@@ -458,7 +458,7 @@ public:
private:
ImpSvNumFor NumFor[4]; // Array for the 4 subformats
- String sFormatstring; // The format code string
+ OUString sFormatstring; // The format code string
String sComment; // Comment, since number formatter version 6
double fLimit1; // Value for first condition
double fLimit2; // Value for second condition
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index e4596551dd44..cdc689a54b67 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -856,7 +856,7 @@ sal_uInt32 SvNumberFormatter::ImpGetCLOffset(LanguageType eLnge) const
return nOffset;
}
-sal_uInt32 SvNumberFormatter::ImpIsEntry(const String& rString,
+sal_uInt32 SvNumberFormatter::ImpIsEntry(const OUString& rString,
sal_uInt32 nCLOffset,
LanguageType eLnge)
{
@@ -3322,7 +3322,7 @@ bool SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat,
*ppEntry = pFoundEntry;
if ( pBank )
*pBank = bFoundBank;
- pFoundEntry->BuildSymbolString( rStr, bFoundBank );
+ rStr = pFoundEntry->BuildSymbolString(bFoundBank);
}
}
if ( !rStr.Len() )
@@ -3778,50 +3778,53 @@ bool NfCurrencyEntry::operator==( const NfCurrencyEntry& r ) const
;
}
-void NfCurrencyEntry::BuildSymbolString( String& rStr, bool bBank,
- bool bWithoutExtension ) const
+OUString NfCurrencyEntry::BuildSymbolString(bool bBank,
+ bool bWithoutExtension) const
{
- rStr = '[';
- rStr += '$';
- if ( bBank )
- rStr += aBankSymbol;
+ OUStringBuffer aBuf("[$");
+ if (bBank)
+ aBuf.append(aBankSymbol);
else
{
if ( aSymbol.Search( '-' ) != STRING_NOTFOUND || aSymbol.Search( ']' ) != STRING_NOTFOUND )
{
- rStr += '"';
- rStr += aSymbol;
- rStr += '"';
+ aBuf.append('"').append(aSymbol).append('"');
}
else
- rStr += aSymbol;
+ {
+ aBuf.append(aSymbol);
+ }
if ( !bWithoutExtension && eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_SYSTEM )
{
- rStr += '-';
- rStr += String::CreateFromInt32( sal_Int32( eLanguage ), 16 ).ToUpperAscii();
+ sal_Int32 nLang = static_cast<sal_Int32>(eLanguage);
+ aBuf.append('-').append(
+ OUString::valueOf(nLang, 16).toAsciiUpperCase());
}
}
- rStr += ']';
+ aBuf.append(']');
+ return aBuf.makeStringAndClear();
}
-
-void NfCurrencyEntry::Impl_BuildFormatStringNumChars( String& rStr,
- const LocaleDataWrapper& rLoc, sal_uInt16 nDecimalFormat ) const
+OUString NfCurrencyEntry::Impl_BuildFormatStringNumChars(
+ const LocaleDataWrapper& rLoc, sal_uInt16 nDecimalFormat) const
{
- rStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###0" ) );
- rStr.Insert( rLoc.getNumThousandSep(), 1 );
- if ( nDecimalFormat && nDigits )
+ OUStringBuffer aBuf;
+ aBuf.append('#').append(rLoc.getNumThousandSep()).append("##0");
+ if (nDecimalFormat && nDigits)
{
- rStr += rLoc.getNumDecimalSep();
- rStr.Expand( rStr.Len() + nDigits, (nDecimalFormat == 2 ? '-' : cZeroChar) );
+ aBuf.append(rLoc.getNumDecimalSep());
+ sal_Unicode cDecimalChar = nDecimalFormat == 2 ? '-' : cZeroChar;
+ for (sal_uInt16 i = 0; i < nDigits; ++i)
+ aBuf.append(cDecimalChar);
}
+ return aBuf.makeStringAndClear();
}
void NfCurrencyEntry::BuildPositiveFormatString( String& rStr, bool bBank,
const LocaleDataWrapper& rLoc, sal_uInt16 nDecimalFormat ) const
{
- Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat );
+ rStr = Impl_BuildFormatStringNumChars(rLoc, nDecimalFormat);
sal_uInt16 nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat(
rLoc.getCurrPositiveFormat(), nPositiveFormat, bBank );
CompletePositiveFormatString( rStr, bBank, nPosiForm );
@@ -3831,7 +3834,7 @@ void NfCurrencyEntry::BuildPositiveFormatString( String& rStr, bool bBank,
void NfCurrencyEntry::BuildNegativeFormatString( String& rStr, bool bBank,
const LocaleDataWrapper& rLoc, sal_uInt16 nDecimalFormat ) const
{
- Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat );
+ rStr = Impl_BuildFormatStringNumChars(rLoc, nDecimalFormat);
sal_uInt16 nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat(
rLoc.getCurrNegativeFormat(), nNegativeFormat, bBank );
CompleteNegativeFormatString( rStr, bBank, nNegaForm );
@@ -3841,8 +3844,7 @@ void NfCurrencyEntry::BuildNegativeFormatString( String& rStr, bool bBank,
void NfCurrencyEntry::CompletePositiveFormatString( String& rStr, bool bBank,
sal_uInt16 nPosiForm ) const
{
- String aSymStr;
- BuildSymbolString( aSymStr, bBank );
+ String aSymStr = BuildSymbolString(bBank);
NfCurrencyEntry::CompletePositiveFormatString( rStr, aSymStr, nPosiForm );
}
@@ -3850,8 +3852,7 @@ void NfCurrencyEntry::CompletePositiveFormatString( String& rStr, bool bBank,
void NfCurrencyEntry::CompleteNegativeFormatString( String& rStr, bool bBank,
sal_uInt16 nNegaForm ) const
{
- String aSymStr;
- BuildSymbolString( aSymStr, bBank );
+ String aSymStr = BuildSymbolString(bBank);
NfCurrencyEntry::CompleteNegativeFormatString( rStr, aSymStr, nNegaForm );
}