diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-25 15:14:04 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-27 23:00:04 -0600 |
commit | ca3cd8bfc47f59c610c89d3ef3daf841bef6fc03 (patch) | |
tree | 415983a2cea352d75915160835f35f4dcd3b6c97 | |
parent | fb4685458544670fba5f627d4572ea780f9f7785 (diff) |
another round of String -> OUString conversion in zforlist
Change-Id: I9979927af016f0b782ae9481a6207649f6455558
-rw-r--r-- | svl/inc/svl/zforlist.hxx | 131 | ||||
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 10 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 95 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 10 |
4 files changed, 132 insertions, 114 deletions
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index c31499867483..eda0956c1163 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -224,8 +224,8 @@ typedef ::std::set< LanguageType > NfInstalledLocales; */ class SVL_DLLPUBLIC NfCurrencyEntry { - String aSymbol; /// currency symbol - String aBankSymbol; /// currency abbreviation + OUString aSymbol; /// currency symbol + OUString aBankSymbol; /// currency abbreviation LanguageType eLanguage; /// language/country value sal_uInt16 nPositiveFormat; /// position of symbol sal_uInt16 nNegativeFormat; /// position of symbol and type and position of negative sign @@ -241,24 +241,22 @@ private: // nDecimalFormat := 0, 1, 2 // #,##0 or #,##0.00 or #,##0.-- is returned - SVL_DLLPRIVATE OUString Impl_BuildFormatStringNumChars( - const LocaleDataWrapper&, sal_uInt16 nDecimalFormat) const; + SVL_DLLPRIVATE OUString Impl_BuildFormatStringNumChars( const LocaleDataWrapper&, sal_uInt16 nDecimalFormat) const; public: NfCurrencyEntry( const LocaleDataWrapper& rLocaleData, - LanguageType eLang ); - NfCurrencyEntry( - const ::com::sun::star::i18n::Currency & rCurr, - const LocaleDataWrapper& rLocaleData, - LanguageType eLang ); + LanguageType eLang ); + NfCurrencyEntry( const ::com::sun::star::i18n::Currency & rCurr, + const LocaleDataWrapper& rLocaleData, + LanguageType eLang ); ~NfCurrencyEntry() {} /// Symbols and language identical bool operator==( const NfCurrencyEntry& r ) const; - const String& GetSymbol() const { return aSymbol; } - const String& GetBankSymbol() const { return aBankSymbol; } + const OUString& GetSymbol() const { return aSymbol; } + const OUString& GetBankSymbol() const { return aBankSymbol; } LanguageType GetLanguage() const { return eLanguage; } sal_uInt16 GetPositiveFormat() const { return nPositiveFormat; } sal_uInt16 GetNegativeFormat() const { return nNegativeFormat; } @@ -268,35 +266,34 @@ public: /** [$DM-407] (bBank==false) or [$DEM] (bBank==true) is returned. If bBank==false and bWithoutExtension==true only [$DM] */ - OUString BuildSymbolString(bool bBank, - bool bWithoutExtension = false) const; + OUString BuildSymbolString(bool bBank, bool bWithoutExtension = false) const; /** #,##0.00 [$DM-407] is returned, separators from rLoc, incl. minus sign but without [RED] */ - OUString BuildPositiveFormatString(bool bBank, - const LocaleDataWrapper&, sal_uInt16 nDecimalFormat = 1) const; - OUString BuildNegativeFormatString(bool bBank, - const LocaleDataWrapper&, sal_uInt16 nDecimalFormat = 1) const; + OUString BuildPositiveFormatString(bool bBank, const LocaleDataWrapper&, + sal_uInt16 nDecimalFormat = 1) const; + OUString BuildNegativeFormatString(bool bBank, const LocaleDataWrapper&, + sal_uInt16 nDecimalFormat = 1) const; /** [$DM-407] (or [$DEM] if bBank==true) is appended/prepended to rStr, incl. minus sign */ void CompletePositiveFormatString(OUStringBuffer& rStr, bool bBank, - sal_uInt16 nPosiFormat) const; + sal_uInt16 nPosiFormat) const; void CompleteNegativeFormatString(OUStringBuffer& rStr, bool bBank, - sal_uInt16 nNegaFormat) const; + sal_uInt16 nNegaFormat) const; /// rSymStr is appended/prepended to rStr, incl. minus sign static void CompletePositiveFormatString(OUStringBuffer& rStr, - const String& rSymStr, sal_uInt16 nPosiFormat); + const OUString& rSymStr, sal_uInt16 nPosiFormat); static void CompleteNegativeFormatString(OUStringBuffer& rStr, - const String& rSymStr, sal_uInt16 nNegaFormat); + const OUString& rSymStr, sal_uInt16 nNegaFormat); /** Representation of a currency (symbol position and negative sign) in other language settings */ static sal_uInt16 GetEffectivePositiveFormat( sal_uInt16 nIntlFormat, - sal_uInt16 nCurrFormat, bool bBank ); + sal_uInt16 nCurrFormat, bool bBank ); static sal_uInt16 GetEffectiveNegativeFormat( sal_uInt16 nIntlFormat, - sal_uInt16 nCurrFormat, bool bBank ); + sal_uInt16 nCurrFormat, bool bBank ); /// General Unicode Euro symbol static inline sal_Unicode GetEuroSymbol() { return sal_Unicode(0x20AC); } @@ -393,10 +390,10 @@ public: nKey contains the index key of the format. */ bool PutEntry( String& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey, - LanguageType eLnge = LANGUAGE_DONTKNOW ); + LanguageType eLnge = LANGUAGE_DONTKNOW ); bool PutEntry( OUString& rString, sal_Int32& nCheckPos, short& nType, sal_uInt32& nKey, - LanguageType eLnge = LANGUAGE_DONTKNOW ); + LanguageType eLnge = LANGUAGE_DONTKNOW ); /** Same as <method>PutEntry</method> but the format code string is considered to be of language/country eLnge and is converted to @@ -414,12 +411,12 @@ public: converted to another System language/country eNewLnge. In this case the automatic currency is converted too. */ bool PutandConvertEntrySystem( OUString& rString, sal_Int32& nCheckPos, - short& nType, sal_uInt32& nKey, - LanguageType eLnge, LanguageType eNewLnge ); + short& nType, sal_uInt32& nKey, + LanguageType eLnge, LanguageType eNewLnge ); bool PutandConvertEntrySystem( String& rString, xub_StrLen& nCheckPos, - short& nType, sal_uInt32& nKey, - LanguageType eLnge, LanguageType eNewLnge ); + short& nType, sal_uInt32& nKey, + LanguageType eLnge, LanguageType eNewLnge ); /** Similar to <method>PutEntry</method> and <method>PutandConvertEntry</method> or @@ -459,9 +456,9 @@ public: and/or could not be converted. */ sal_uInt32 GetIndexPuttingAndConverting( String & rString, LanguageType eLnge, - LanguageType eSysLnge, short & rType, - bool & rNewInserted, - xub_StrLen & rCheckPos ); + LanguageType eSysLnge, short & rType, + bool & rNewInserted, + xub_StrLen & rCheckPos ); sal_uInt32 GetIndexPuttingAndConverting( OUString & rString, LanguageType eLnge, LanguageType eSysLnge, short & rType, @@ -481,7 +478,7 @@ public: returned in fOutNumber <FALSE/> if input is not a number */ - bool IsNumberFormat( const String& sString, sal_uInt32& F_Index, double& fOutNumber ); + bool IsNumberFormat( const OUString& sString, sal_uInt32& F_Index, double& fOutNumber ); /// Format a number according to a format index, return string and color void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex, @@ -511,9 +508,9 @@ public: <TRUE/> else, in which case the string and color are returned. */ bool GetPreviewString( const String& sFormatString, double fPreviewNumber, - String& sOutString, Color** ppColor, - LanguageType eLnge = LANGUAGE_DONTKNOW, - bool bUseStarFormat = false ); + String& sOutString, Color** ppColor, + LanguageType eLnge = LANGUAGE_DONTKNOW, + bool bUseStarFormat = false ); bool GetPreviewString(const OUString& sFormatString, double fPreviewNumber, @@ -549,8 +546,8 @@ public: @return NUMBERFORMAT_ENTRY_NOT_FOUND if not found, else the format index. */ - sal_uInt32 TestNewString( const String& sFormatString, - LanguageType eLnge = LANGUAGE_DONTKNOW ); + sal_uInt32 TestNewString( const OUString& sFormatString, + LanguageType eLnge = LANGUAGE_DONTKNOW ); /// Whether format index nFIndex is of type text or not bool IsTextFormat(sal_uInt32 nFIndex) const; @@ -574,16 +571,16 @@ public: 0 if format code string parsed without errors, otherwise error position (like nCheckPos on <method>PutEntry</method>) */ - sal_uInt32 GetFormatSpecialInfo( const String&, bool& bThousand, bool& IsRed, - sal_uInt16& nPrecision, sal_uInt16& nAnzLeading, - LanguageType eLnge = LANGUAGE_DONTKNOW ); + sal_uInt32 GetFormatSpecialInfo( const OUString&, bool& bThousand, bool& IsRed, + sal_uInt16& nPrecision, sal_uInt16& nAnzLeading, + LanguageType eLnge = LANGUAGE_DONTKNOW ); /// Check if format code string may be deleted by user - bool IsUserDefined( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); + bool IsUserDefined( const OUString& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); /** Return the format index of the format code string for language/country, or NUMBERFORMAT_ENTRY_NOT_FOUND */ - sal_uInt32 GetEntryKey( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); + sal_uInt32 GetEntryKey( const OUString& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); /// Return the format for a format index const SvNumberformat* GetEntry( sal_uInt32 nKey ) const; @@ -603,14 +600,14 @@ public: Maybe not the default format but a special builtin format, e.g. for NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0 */ sal_uInt32 GetStandardFormat( double fNumber, sal_uInt32 nFIndex, short eType, - LanguageType eLnge ); + LanguageType eLnge ); /// Whether nFIndex is a special builtin format bool IsSpecialStandardFormat( sal_uInt32 nFIndex, LanguageType eLnge ); /** Return the corresponding edit format of a format. */ sal_uInt32 GetEditFormat( double fNumber, sal_uInt32 nFIndex, short eType, - LanguageType eLnge, SvNumberformat* pFormat ); + LanguageType eLnge, SvNumberformat* pFormat ); /// Return the reference date Date* GetNullDate(); @@ -679,12 +676,12 @@ public: inline static sal_uInt16 ExpandTwoDigitYear( sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart ); /// DEPRICATED: Return first character of the decimal separator of the current language/country - sal_Unicode GetDecSep() const { return GetNumDecimalSep().GetChar(0); } + sal_Unicode GetDecSep() const { return GetNumDecimalSep()[0]; } /// Return the decimal separator of the current language/country - String GetDecimalSep() const { return GetNumDecimalSep(); } + OUString GetDecimalSep() const { return GetNumDecimalSep(); } /// Return the decimal separator matching the locale of the given format - String GetFormatDecimalSep( sal_uInt32 nFormat ) const; + OUString GetFormatDecimalSep( sal_uInt32 nFormat ) const; /// Return a <type>NfCurrencyTable</type> with pointers to <type>NfCurrencyEntry</type> entries static const NfCurrencyTable& GetTheCurrencyTable(); @@ -711,8 +708,8 @@ public: <NULL/> if not found else pointer to <type>NfCurrencyEntry</type> */ - static const NfCurrencyEntry* GetCurrencyEntry( const String& rAbbrev, - LanguageType eLang ); + static const NfCurrencyEntry* GetCurrencyEntry( const OUString& rAbbrev, + LanguageType eLang ); /** Return a <type>NfCurrencyEntry</type> pointer matching the symbol combination of a LegacyOnly currency. Note that this means only that @@ -723,15 +720,14 @@ public: @return A matching entry, or else <NULL/>. */ - static const NfCurrencyEntry* GetLegacyOnlyCurrencyEntry( - const String& rSymbol, const String& rAbbrev ); + static const NfCurrencyEntry* GetLegacyOnlyCurrencyEntry( const OUString& rSymbol, const OUString& rAbbrev ); /** Set the default system currency. The combination of abbreviation and language must match an existent element of theCurrencyTable. If not, the SYSTEM (current locale) entry becomes the default. This method is meant for the configuration of the default currency. */ - static void SetDefaultSystemCurrency( const String& rAbbrev, LanguageType eLang ); + static void SetDefaultSystemCurrency( const OUString& rAbbrev, LanguageType eLang ); /** Get all standard formats for a specific currency, formats are appended to the <type>NfWSStringsDtor</type> list. @@ -742,7 +738,7 @@ public: position of default format */ sal_uInt16 GetCurrencyFormatStrings( NfWSStringsDtor&, const NfCurrencyEntry&, - bool bBank ) const; + bool bBank ) const; /** Whether nFormat is of type NUMBERFORMAT_CURRENCY and the format code contains a new SYMBOLTYPE_CURRENCY and if so which one [$xxx-nnn]. @@ -750,7 +746,8 @@ public: returned, even if the format code only contains [$xxx] ! */ bool GetNewCurrencySymbolString( sal_uInt32 nFormat, String& rSymbol, - const NfCurrencyEntry** ppEntry = NULL, bool* pBank = NULL ) const; + const NfCurrencyEntry** ppEntry = NULL, + bool* pBank = NULL ) const; /** Look up the corresponding <type>NfCurrencyEntry</type> matching rSymbol (may be CurrencySymbol or CurrencyAbbreviation) and possibly @@ -789,8 +786,10 @@ public: else <NULL/>. */ static const NfCurrencyEntry* GetCurrencyEntry( bool & bFoundBank, - const String& rSymbol, const String& rExtension, - LanguageType eFormatLanguage, bool bOnlyStringLanguage = false ); + const OUString& rSymbol, + const OUString& rExtension, + LanguageType eFormatLanguage, + bool bOnlyStringLanguage = false ); /// Get compatibility ("automatic" old style) currency from I18N locale data void GetCompatibilityCurrency( OUString& rSymbol, OUString& rAbbrev ) const; @@ -836,9 +835,9 @@ private: bool bNoZero; // Zero value suppression // cached locale data items needed almost any time - String aDecimalSep; - String aThousandSep; - String aDateSep; + OUString aDecimalSep; + OUString aThousandSep; + OUString aDateSep; #ifdef _ZFORLIST_CXX // ----- private Methoden ----- @@ -940,9 +939,9 @@ private: #ifndef DBG_UTIL inline #endif - static bool ImpLookupCurrencyEntryLoopBody( - const NfCurrencyEntry*& pFoundEntry, bool& bFoundBank, - const NfCurrencyEntry* pData, sal_uInt16 nPos, const String& rSymbol ); + static bool ImpLookupCurrencyEntryLoopBody( const NfCurrencyEntry*& pFoundEntry, + bool& bFoundBank, const NfCurrencyEntry* pData, + sal_uInt16 nPos, const OUString& rSymbol ); // link to be set at <method>SvtSysLocaleOptions::SetCurrencyChangeLink()</method> DECL_DLLPRIVATE_STATIC_LINK( SvNumberFormatter, CurrencyChangeLink, void* ); @@ -1010,13 +1009,13 @@ public: // cached locale data items // return the corresponding decimal separator - inline const String& GetNumDecimalSep() const { return aDecimalSep; } + inline const OUString& GetNumDecimalSep() const { return aDecimalSep; } // return the corresponding group (AKA thousand) separator - inline const String& GetNumThousandSep() const { return aThousandSep; } + inline const OUString& GetNumThousandSep() const { return aThousandSep; } // return the corresponding date separator - inline const String& GetDateSep() const { return aDateSep; } + inline const OUString& GetDateSep() const { return aDateSep; } }; diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 250b89b30bf4..0d5000a7ffa3 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -2609,7 +2609,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( if (eSetType == NUMBERFORMAT_FRACTION) // Fraction 1 = 1/1 { if (i >= nAnzStrings || // no end string nor decimal separator - sStrArray[i] == pFormatter->GetNumDecimalSep()) + sStrArray[i] == (String)pFormatter->GetNumDecimalSep()) { eScannedType = NUMBERFORMAT_FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; @@ -2630,7 +2630,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( eScannedType == NUMBERFORMAT_UNDEFINED && // not date or currency nDecPos == 0 && // no previous decimal separator (i >= nAnzStrings || // no end string nor decimal separator - sStrArray[i] == pFormatter->GetNumDecimalSep()) + sStrArray[i] == (String)pFormatter->GetNumDecimalSep()) ) { eScannedType = NUMBERFORMAT_FRACTION; @@ -2909,9 +2909,9 @@ void ImpSvNumberInputScan::InitText() void ImpSvNumberInputScan::ChangeIntl() { - sal_Unicode cDecSep = pFormatter->GetNumDecimalSep().GetChar(0); - bDecSepInDateSeps = ( cDecSep == '-' || - cDecSep == pFormatter->GetDateSep().GetChar(0) ); + sal_Unicode cDecSep = pFormatter->GetNumDecimalSep()[0]; + bDecSepInDateSeps = ( cDecSep == (sal_Unicode)'-' || + cDecSep == pFormatter->GetDateSep()[0] ); bTextInitialized = false; aUpperCurrSymbol.Erase(); InvalidateDateAcceptancePatterns(); diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index f443dd67585b..37c5c848c745 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -1130,7 +1130,7 @@ SvNumberFormatTable& SvNumberFormatter::GetEntryTable( return *pFormatTable; } -bool SvNumberFormatter::IsNumberFormat(const String& sString, +bool SvNumberFormatter::IsNumberFormat(const OUString& sString, sal_uInt32& F_Index, double& fOutNumber) { @@ -1145,7 +1145,9 @@ bool SvNumberFormatter::IsNumberFormat(const String& sString, { FType = pFormat->GetType() &~NUMBERFORMAT_DEFINED; if (FType == 0) + { FType = NUMBERFORMAT_DEFINED; + } ChangeIntl(pFormat->GetLanguage()); } @@ -1876,10 +1878,10 @@ bool SvNumberFormatter::GetPreviewString( const OUString& sFormatString, } } -sal_uInt32 SvNumberFormatter::TestNewString(const String& sFormatString, +sal_uInt32 SvNumberFormatter::TestNewString(const OUString& sFormatString, LanguageType eLnge) { - if (sFormatString.Len() == 0) // no empty string + if (sFormatString.isEmpty()) // no empty string { return NUMBERFORMAT_ENTRY_NOT_FOUND; } @@ -2071,16 +2073,19 @@ sal_uInt16 SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const } -String SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const +OUString SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const { const SvNumberformat* pFormat = GetFormatEntry(nFormat); if ( !pFormat || pFormat->GetLanguage() == ActLnge ) + { return GetNumDecimalSep(); - - String aRet; + } + OUString aRet; LanguageType eSaveLang = xLocaleData.getCurrentLanguage(); if ( pFormat->GetLanguage() == eSaveLang ) + { aRet = xLocaleData->getNumDecimalSep(); + } else { LanguageTag aSaveLocale( xLocaleData->getLanguageTag() ); @@ -2092,9 +2097,9 @@ String SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const } -sal_uInt32 SvNumberFormatter::GetFormatSpecialInfo( const String& rFormatString, - bool& bThousand, bool& IsRed, sal_uInt16& nPrecision, - sal_uInt16& nAnzLeading, LanguageType eLnge ) +sal_uInt32 SvNumberFormatter::GetFormatSpecialInfo( const OUString& rFormatString, + bool& bThousand, bool& IsRed, sal_uInt16& nPrecision, + sal_uInt16& nAnzLeading, LanguageType eLnge ) { if (eLnge == LANGUAGE_DONTKNOW) @@ -3020,7 +3025,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, return sString.makeStringAndClear(); } -bool SvNumberFormatter::IsUserDefined(const String& sStr, +bool SvNumberFormatter::IsUserDefined(const OUString& sStr, LanguageType eLnge) { if (eLnge == LANGUAGE_DONTKNOW) @@ -3043,8 +3048,8 @@ bool SvNumberFormatter::IsUserDefined(const String& sStr, return false; } -sal_uInt32 SvNumberFormatter::GetEntryKey(const String& sStr, - LanguageType eLnge) +sal_uInt32 SvNumberFormatter::GetEntryKey(const OUString& sStr, + LanguageType eLnge) { if (eLnge == LANGUAGE_DONTKNOW) { @@ -3319,8 +3324,7 @@ const NfCurrencyEntry& SvNumberFormatter::GetCurrencyEntry( LanguageType eLang ) // static -const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( - const String& rAbbrev, LanguageType eLang ) +const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry(const OUString& rAbbrev, LanguageType eLang ) { eLang = MsLangId::getRealLanguage( eLang ); const NfCurrencyTable& rTable = GetTheCurrencyTable(); @@ -3328,26 +3332,32 @@ const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( for ( sal_uInt16 j = 0; j < nCount; j++ ) { if ( rTable[j].GetLanguage() == eLang && - rTable[j].GetBankSymbol() == rAbbrev ) + rTable[j].GetBankSymbol() == rAbbrev ) + { return &rTable[j]; + } } return NULL; } // static -const NfCurrencyEntry* SvNumberFormatter::GetLegacyOnlyCurrencyEntry( - const String& rSymbol, const String& rAbbrev ) +const NfCurrencyEntry* SvNumberFormatter::GetLegacyOnlyCurrencyEntry( const OUString& rSymbol, + const OUString& rAbbrev ) { if (!bCurrencyTableInitialized) + { GetTheCurrencyTable(); // just for initialization + } const NfCurrencyTable& rTable = theLegacyOnlyCurrencyTable::get(); sal_uInt16 nCount = rTable.size(); for ( sal_uInt16 j = 0; j < nCount; j++ ) { if ( rTable[j].GetSymbol() == rSymbol && - rTable[j].GetBankSymbol() == rAbbrev ) + rTable[j].GetBankSymbol() == rAbbrev ) + { return &rTable[j]; + } } return NULL; } @@ -3366,14 +3376,16 @@ IMPL_STATIC_LINK_NOINSTANCE( SvNumberFormatter, CurrencyChangeLink, SAL_UNUSED_P // static -void SvNumberFormatter::SetDefaultSystemCurrency( const String& rAbbrev, LanguageType eLang ) +void SvNumberFormatter::SetDefaultSystemCurrency( const OUString& rAbbrev, LanguageType eLang ) { ::osl::MutexGuard aGuard( GetMutex() ); if ( eLang == LANGUAGE_SYSTEM ) + { eLang = SvtSysLocale().GetLanguageTag().getLanguageType(); + } const NfCurrencyTable& rTable = GetTheCurrencyTable(); sal_uInt16 nCount = rTable.size(); - if ( rAbbrev.Len() ) + if ( !rAbbrev.isEmpty() ) { for ( sal_uInt16 j = 0; j < nCount; j++ ) { @@ -3496,9 +3508,9 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat() #ifndef DBG_UTIL inline #endif - bool SvNumberFormatter::ImpLookupCurrencyEntryLoopBody( - const NfCurrencyEntry*& pFoundEntry, bool& bFoundBank, - const NfCurrencyEntry* pData, sal_uInt16 nPos, const String& rSymbol ) + bool SvNumberFormatter::ImpLookupCurrencyEntryLoopBody( const NfCurrencyEntry*& pFoundEntry, bool& bFoundBank, + const NfCurrencyEntry* pData, sal_uInt16 nPos, + const OUString& rSymbol ) { bool bFound; if ( pData->GetSymbol() == rSymbol ) @@ -3524,22 +3536,28 @@ inline { // first entry is SYSTEM pFoundEntry = MatchSystemCurrency(); if ( pFoundEntry ) + { return false; // break loop // even if there are more matching entries // this one is propably the one we are looking for + } else + { pFoundEntry = pData; + } } else + { pFoundEntry = pData; + } } return true; } -bool SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat, - String& rStr, const NfCurrencyEntry** ppEntry /* = NULL */, - bool* pBank /* = NULL */ ) const +bool SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat, String& rStr, + const NfCurrencyEntry** ppEntry /* = NULL */, + bool* pBank /* = NULL */ ) const { rStr.Erase(); if ( ppEntry ) @@ -3593,16 +3611,16 @@ bool SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat, // static const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( bool & bFoundBank, - const String& rSymbol, - const String& rExtension, + const OUString& rSymbol, + const OUString& rExtension, LanguageType eFormatLanguage, bool bOnlyStringLanguage ) { - xub_StrLen nExtLen = rExtension.Len(); + sal_Int32 nExtLen = rExtension.getLength(); LanguageType eExtLang; if ( nExtLen ) { - sal_Int32 nExtLang = OUString( rExtension ).toInt32( 16 ); + sal_Int32 nExtLang = rExtension.toInt32( 16 ); if ( !nExtLang ) { eExtLang = LANGUAGE_DONTKNOW; @@ -3831,7 +3849,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() } rCurrencyTable.insert( rCurrencyTable.begin() + nCurrencyPos++, pEntry ); if ( !nSystemCurrencyPosition && (aConfiguredCurrencyAbbrev.Len() ? - pEntry->GetBankSymbol() == aConfiguredCurrencyAbbrev && + pEntry->GetBankSymbol() == OUString(aConfiguredCurrencyAbbrev) && pEntry->GetLanguage() == eConfiguredCurrencyLanguage : false) ) { nSystemCurrencyPosition = nCurrencyPos-1; @@ -3876,7 +3894,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() rCurrencyTable.insert( rCurrencyTable.begin() + nCurrencyPos++, pEntry ); if ( !nSecondarySystemCurrencyPosition && (aConfiguredCurrencyAbbrev.Len() ? - pEntry->GetBankSymbol() == aConfiguredCurrencyAbbrev : + pEntry->GetBankSymbol() == OUString(aConfiguredCurrencyAbbrev) : pEntry->GetLanguage() == eConfiguredCurrencyLanguage) ) { nSecondarySystemCurrencyPosition = nCurrencyPos-1; @@ -4056,7 +4074,8 @@ OUString NfCurrencyEntry::BuildSymbolString(bool bBank, aBuf.append(aBankSymbol); else { - if ( aSymbol.Search( '-' ) != STRING_NOTFOUND || aSymbol.Search( ']' ) != STRING_NOTFOUND ) + if ( aSymbol.indexOf( (sal_Unicode)'-' ) >= 0 || + aSymbol.indexOf( (sal_Unicode)']' ) >= 0) { aBuf.append('"').append(aSymbol).append('"'); } @@ -4114,7 +4133,7 @@ OUString NfCurrencyEntry::BuildNegativeFormatString(bool bBank, void NfCurrencyEntry::CompletePositiveFormatString(OUStringBuffer& rStr, bool bBank, - sal_uInt16 nPosiForm) const + sal_uInt16 nPosiForm) const { OUString aSymStr = BuildSymbolString(bBank); NfCurrencyEntry::CompletePositiveFormatString( rStr, aSymStr, nPosiForm ); @@ -4122,7 +4141,7 @@ void NfCurrencyEntry::CompletePositiveFormatString(OUStringBuffer& rStr, bool bB void NfCurrencyEntry::CompleteNegativeFormatString(OUStringBuffer& rStr, bool bBank, - sal_uInt16 nNegaForm) const + sal_uInt16 nNegaForm) const { OUString aSymStr = BuildSymbolString(bBank); NfCurrencyEntry::CompleteNegativeFormatString( rStr, aSymStr, nNegaForm ); @@ -4130,8 +4149,8 @@ void NfCurrencyEntry::CompleteNegativeFormatString(OUStringBuffer& rStr, bool bB // static -void NfCurrencyEntry::CompletePositiveFormatString(OUStringBuffer& rStr, - const String& rSymStr, sal_uInt16 nPositiveFormat) +void NfCurrencyEntry::CompletePositiveFormatString(OUStringBuffer& rStr, const OUString& rSymStr, + sal_uInt16 nPositiveFormat) { switch( nPositiveFormat ) { @@ -4162,7 +4181,7 @@ void NfCurrencyEntry::CompletePositiveFormatString(OUStringBuffer& rStr, // static void NfCurrencyEntry::CompleteNegativeFormatString(OUStringBuffer& rStr, - const String& rSymStr, + const OUString& rSymStr, sal_uInt16 nNegativeFormat) { switch( nNegativeFormat ) diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 527ff35bbdf7..1d86c92cc9ef 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -2077,7 +2077,7 @@ void SvNumberformat::ImpGetOutputStandard(double& fNumber, OUString& OutString) nStandardPrec = ::std::min(nStandardPrec, static_cast<sal_uInt16>(14)); // limits to 14 decimals OutString = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_E, nStandardPrec /*2*/, - GetFormatter().GetNumDecimalSep().GetChar(0)); + GetFormatter().GetNumDecimalSep()[0]); } else { @@ -2122,7 +2122,7 @@ void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, OUString& rOutS rOutString = ::rtl::math::doubleToUString( rNumber, rtl_math_StringFormat_F, nPrecision /*2*/, - GetFormatter().GetNumDecimalSep().GetChar(0), true ); + GetFormatter().GetNumDecimalSep()[0], true ); if (rOutString[0] == (sal_Unicode)'-' && comphelper::string::getTokenCount(rOutString, '0') == rOutString.getLength()) { @@ -2154,7 +2154,7 @@ void SvNumberformat::ImpGetOutputInputLine(double fNumber, OUString& OutString) OutString = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - GetFormatter().GetNumDecimalSep().GetChar(0), true ); + GetFormatter().GetNumDecimalSep()[0], true ); if ( eType & NUMBERFORMAT_PERCENT && bModified) { @@ -2297,7 +2297,7 @@ void lcl_GetOutputStringScientific(double fNumber, sal_uInt16 nCharCount, nPrec = ::std::min(nPrec, static_cast<sal_uInt16>(14)); // limit to 14 decimals. rOutString = ::rtl::math::doubleToUString(fNumber, rtl_math_StringFormat_E, - nPrec, rFormatter.GetNumDecimalSep().GetChar(0)); + nPrec, rFormatter.GetNumDecimalSep()[0]); } sal_Int32 lcl_GetForcedDenominator(const ImpSvNumberformatInfo &rInfo, sal_uInt16 nAnz) @@ -2458,7 +2458,7 @@ bool SvNumberformat::GetOutputString(double fNumber, nStandardPrec = ::std::min(nStandardPrec, static_cast<sal_uInt16>(14)); // limits to 14 decimals sBuff = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_E, nStandardPrec /*2*/, - GetFormatter().GetNumDecimalSep().GetChar(0), true); + GetFormatter().GetNumDecimalSep()[0], true); } } if (bSign) |