diff options
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 2 | ||||
-rw-r--r-- | svl/inc/svl/zforlist.hxx | 14 | ||||
-rw-r--r-- | svl/inc/svl/zformat.hxx | 4 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 59 | ||||
-rw-r--r-- | svtools/inc/svtools/fmtfield.hxx | 14 | ||||
-rw-r--r-- | svtools/inc/svtools/stdmenu.hxx | 6 | ||||
-rw-r--r-- | svtools/source/control/fmtfield.cxx | 26 | ||||
-rw-r--r-- | svtools/source/control/stdmenu.cxx | 12 | ||||
-rw-r--r-- | svx/source/items/numfmtsh.cxx | 11 |
9 files changed, 73 insertions, 75 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 2fa0bb27aa06..876748cd14a2 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2154,7 +2154,7 @@ inline bool lcl_FormatHasNegColor( const SvNumberformat* pFormat ) inline bool lcl_FormatHasOpenPar( const SvNumberformat* pFormat ) { - return pFormat && (pFormat->GetFormatstring().Search( '(' ) != STRING_NOTFOUND); + return pFormat && (pFormat->GetFormatstring().indexOf('(') != -1); } namespace { 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 ); } diff --git a/svtools/inc/svtools/fmtfield.hxx b/svtools/inc/svtools/fmtfield.hxx index d4fd75a23797..2bef4f3f26aa 100644 --- a/svtools/inc/svtools/fmtfield.hxx +++ b/svtools/inc/svtools/fmtfield.hxx @@ -125,7 +125,7 @@ public: void GetColor() const; - void SetTextValue(const XubString& rText); + void SetTextValue(const OUString& rText); // der String wird in ein double umgewandelt (durch den Formatter) und anschliessen in SetValue gesteckt sal_Bool IsEmptyFieldEnabled() const { return m_bEnableEmptyField; } @@ -159,8 +159,8 @@ public: // Das hier gelieferte Objekt wird allerdings zwischen allen Instanzen der Klasse geteilt (aus Zeit- und Platzgruenden), // also ist etwas Vorsicht angebracht ... - void GetFormat(XubString& rFormatString, LanguageType& eLang) const; - sal_Bool SetFormat(const XubString& rFormatString, LanguageType eLang); + OUString GetFormat(LanguageType& eLang) const; + sal_Bool SetFormat(const OUString& rFormatString, LanguageType eLang); // sal_False, wenn der FormatString nicht gesetzt werden konnte (also wahrscheinlich ungueltig ist) sal_Bool IsStrictFormat() const { return m_bStrictFormat; } @@ -196,10 +196,10 @@ public: einfach den Text formatiert ausgeben ... (der Text wird einfach nur durch den Formatter gejagt und dann gesetzt) */ - void SetTextFormatted(const XubString& rText); + void SetTextFormatted(const OUString& rText); String GetTextValue() const; - void SetDefaultText(const XubString& rDefault) { m_sDefaultText = rDefault; } + void SetDefaultText(const OUString& rDefault) { m_sDefaultText = rDefault; } String GetDefaultText() const { return m_sDefaultText; } // die bei der letzten Ausgabe-Operation vom Formatter gelieferte Farbe (Ausgabe-Operationen werden getriggert durch @@ -248,7 +248,7 @@ protected: virtual void Modify(); // CheckText ueberschreiben fuer Ueberpruefung zur Eingabezeit - virtual sal_Bool CheckText(const XubString&) const { return sal_True; } + virtual sal_Bool CheckText(const OUString&) const { return sal_True; } // any aspect of the current format has changed virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat); @@ -291,7 +291,7 @@ public: virtual ~DoubleNumericField(); protected: - virtual sal_Bool CheckText(const XubString& sText) const; + virtual sal_Bool CheckText(const OUString& sText) const; virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat); void ResetConformanceTester(); diff --git a/svtools/inc/svtools/stdmenu.hxx b/svtools/inc/svtools/stdmenu.hxx index 59d584c31879..3a936b057aad 100644 --- a/svtools/inc/svtools/stdmenu.hxx +++ b/svtools/inc/svtools/stdmenu.hxx @@ -113,7 +113,7 @@ FontList; FontNameMenu; FontSizeBox class SVT_DLLPUBLIC FontNameMenu : public PopupMenu { private: - XubString maCurName; + OUString maCurName; Link maSelectHdl; Link maHighlightHdl; @@ -126,8 +126,8 @@ public: void Fill( const FontList* pList ); - void SetCurName( const XubString& rName ); - const XubString& GetCurName() const { return maCurName; } + void SetCurName( const OUString& rName ); + const OUString& GetCurName() const { return maCurName; } void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } const Link& GetSelectHdl() const { return maSelectHdl; } diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index c59b1a57dcde..d4a4c5bfd649 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -395,7 +395,7 @@ void FormattedField::SetText( const XubString& rStr, const Selection& rNewSelect } //------------------------------------------------------------------------------ -void FormattedField::SetTextFormatted(const XubString& rStr) +void FormattedField::SetTextFormatted(const OUString& rStr) { DBG_CHKTHIS(FormattedField, NULL); @@ -628,9 +628,8 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, sal_Bool bReset } else { - XubString sOldFormat; LanguageType aOldLang; - GetFormat(sOldFormat, aOldLang); + OUString sOldFormat = GetFormat(aOldLang); sal_uInt32 nDestKey = pFormatter->TestNewString(sOldFormat); if (nDestKey == NUMBERFORMAT_ENTRY_NOT_FOUND) @@ -652,17 +651,19 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, sal_Bool bReset } //------------------------------------------------------------------------------ -void FormattedField::GetFormat(XubString& rFormatString, LanguageType& eLang) const +OUString FormattedField::GetFormat(LanguageType& eLang) const { DBG_CHKTHIS(FormattedField, NULL); const SvNumberformat* pFormatEntry = ImplGetFormatter()->GetEntry(m_nFormatKey); DBG_ASSERT(pFormatEntry != NULL, "FormattedField::GetFormat: no number format for the given format key."); - rFormatString = pFormatEntry ? pFormatEntry->GetFormatstring() : XubString(); + OUString sFormatString = pFormatEntry ? pFormatEntry->GetFormatstring() : OUString(); eLang = pFormatEntry ? pFormatEntry->GetLanguage() : LANGUAGE_DONTKNOW; + + return sFormatString; } //------------------------------------------------------------------------------ -sal_Bool FormattedField::SetFormat(const XubString& rFormatString, LanguageType eLang) +sal_Bool FormattedField::SetFormat(const OUString& rFormatString, LanguageType eLang) { DBG_CHKTHIS(FormattedField, NULL); sal_uInt32 nNewKey = ImplGetFormatter()->TestNewString(rFormatString, eLang); @@ -709,8 +710,7 @@ void FormattedField::SetThousandsSep(sal_Bool _bUseSeparator) // we need the language for the following LanguageType eLang; - String sFmtDescription; - GetFormat(sFmtDescription, eLang); + String sFmtDescription = GetFormat(eLang); // generate a new format ... ImplGetFormatter()->GenerateFormat(sFmtDescription, m_nFormatKey, eLang, _bUseSeparator, IsRed, nPrecision, nAnzLeading); @@ -753,8 +753,7 @@ void FormattedField::SetDecimalDigits(sal_uInt16 _nPrecision) // we need the language for the following LanguageType eLang; - String sFmtDescription; - GetFormat(sFmtDescription, eLang); + String sFmtDescription = GetFormat(eLang); // generate a new format ... ImplGetFormatter()->GenerateFormat(sFmtDescription, m_nFormatKey, eLang, bThousand, IsRed, _nPrecision, nAnzLeading); @@ -913,7 +912,7 @@ void FormattedField::SetMaxValue(double dMax) } //------------------------------------------------------------------------------ -void FormattedField::SetTextValue(const XubString& rText) +void FormattedField::SetTextValue(const OUString& rText) { DBG_CHKTHIS(FormattedField, NULL); SetText(rText); @@ -1126,7 +1125,7 @@ void DoubleNumericField::FormatChanged(FORMAT_CHANGE_TYPE nWhat) } //------------------------------------------------------------------------------ -sal_Bool DoubleNumericField::CheckText(const XubString& sText) const +sal_Bool DoubleNumericField::CheckText(const OUString& sText) const { // We'd like to implement this using the NumberFormatter::IsNumberFormat, but unfortunately, this doesn't // recognize fragments of numbers (like, for instance "1e", which happens during entering e.g. "1e10") @@ -1230,9 +1229,8 @@ void DoubleCurrencyField::setPrependCurrSym(sal_Bool _bPrepend) void DoubleCurrencyField::UpdateCurrencyFormat() { // the old settings - XubString sOldFormat; LanguageType eLanguage; - GetFormat(sOldFormat, eLanguage); + GetFormat(eLanguage); sal_Bool bThSep = GetThousandsSep(); sal_uInt16 nDigits = GetDecimalDigits(); diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx index 8bfe4b4135ae..51af872507f1 100644 --- a/svtools/source/control/stdmenu.cxx +++ b/svtools/source/control/stdmenu.cxx @@ -58,7 +58,7 @@ void FontNameMenu::Select() void FontNameMenu::Highlight() { - XubString aTempName = maCurName; + OUString aTempName = maCurName; maCurName = GetItemText( GetCurItemId() ); maHighlightHdl.Call( this ); maCurName = aTempName; @@ -84,7 +84,7 @@ void FontNameMenu::Fill( const FontList* pList ) sal_uInt16 j = GetItemCount(); while ( j ) { - XubString aText = GetItemText( GetItemId( j-1 ) ); + OUString aText = GetItemText( GetItemId( j-1 ) ); if ( rI18nHelper.CompareString( rName, aText ) > 0 ) break; j--; @@ -97,7 +97,7 @@ void FontNameMenu::Fill( const FontList* pList ) // ----------------------------------------------------------------------- -void FontNameMenu::SetCurName( const XubString& rName ) +void FontNameMenu::SetCurName(const OUString& rName) { maCurName = rName; @@ -111,7 +111,7 @@ void FontNameMenu::SetCurName( const XubString& rName ) if ( IsItemChecked( nItemId ) ) nChecked = nItemId; - XubString aText = GetItemText( nItemId ); + OUString aText = GetItemText( nItemId ); if ( aText == maCurName ) { CheckItem( nItemId, sal_True ); @@ -240,8 +240,8 @@ void FontSizeMenu::SetCurHeight( long nHeight ) { mnCurHeight = nHeight; - // check menue item - XubString aHeight = Application::GetSettings().GetUILocaleI18nHelper().GetNum( nHeight, 1, sal_True, sal_False ); + // check menu item + OUString aHeight = Application::GetSettings().GetUILocaleI18nHelper().GetNum( nHeight, 1, sal_True, sal_False ); sal_uInt16 nChecked = 0; sal_uInt16 nItemCount = GetItemCount(); for( sal_uInt16 i = 0; i < nItemCount; i++ ) diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 30ff4233b702..c1437048e48d 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -940,9 +940,9 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL if(pTmpCurrencyEntry!=NULL) { - pTmpCurrencyEntry->BuildSymbolString(rSymbol,false); - pTmpCurrencyEntry->BuildSymbolString(rBankSymbol,true); - pTmpCurrencyEntry->BuildSymbolString(rShortSymbol,bTmpBanking,true); + rSymbol = pTmpCurrencyEntry->BuildSymbolString(false); + rBankSymbol = pTmpCurrencyEntry->BuildSymbolString(true); + rShortSymbol = pTmpCurrencyEntry->BuildSymbolString(bTmpBanking,true); } SvNumberFormatTable::iterator it = pCurFmtTable->begin(); @@ -1722,9 +1722,8 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const String& rFmtStrin for(sal_uInt16 i=0;i<nCount;i++) { const NfCurrencyEntry* pTmpCurrencyEntry=&rCurrencyTable[i]; - XubString _aSymbol, aBankSymbol; - pTmpCurrencyEntry->BuildSymbolString(_aSymbol,false); - pTmpCurrencyEntry->BuildSymbolString(aBankSymbol,true); + OUString _aSymbol = pTmpCurrencyEntry->BuildSymbolString(false); + OUString aBankSymbol = pTmpCurrencyEntry->BuildSymbolString(true); if(rFmtString.Search(_aSymbol)!=STRING_NOTFOUND) { |