From 566adca89eeccc53d72704cc43f0c4afc4254fce Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Mon, 5 Nov 2012 02:35:29 -0600 Subject: xmloff: simplify the use of AddToCode most use of that API is to add a single sal_Unicode, it is silly to manufacture a full OUString just to pass that via AddToCode to then append it to a OUStringBuffer adding AddToCode(sal_Unicode c) to simplify these case also remove a silly iteration over a OUString's character to re-add each character one by one via AddToCode() Change-Id: Ia8a58551a1c24312baaa250b8d36fe21c46127e7 --- xmloff/inc/xmloff/xmlnumfi.hxx | 1 + xmloff/source/style/xmlnumfi.cxx | 36 +++++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 13 deletions(-) (limited to 'xmloff') diff --git a/xmloff/inc/xmloff/xmlnumfi.hxx b/xmloff/inc/xmloff/xmlnumfi.hxx index 552caa5f3815..f162f5be8aa1 100644 --- a/xmloff/inc/xmloff/xmlnumfi.hxx +++ b/xmloff/inc/xmloff/xmlnumfi.hxx @@ -202,6 +202,7 @@ public: const LocaleDataWrapper& GetLocaleData() const; void AddToCode( const rtl::OUString& rString ); + void AddToCode( sal_Unicode c ); void AddNumber( const SvXMLNumberInfo& rInfo ); void AddCurrency( const rtl::OUString& rContent, LanguageType nLang ); diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index f5b8c2124fab..f142ce936e5b 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -1098,13 +1098,13 @@ void SvXMLNumFmtElementContext::EndElement() break; case XML_TOK_STYLE_TEXT_CONTENT: - rParent.AddToCode( OUString::valueOf((sal_Unicode)'@') ); + rParent.AddToCode( (sal_Unicode)'@'); break; case XML_TOK_STYLE_FILL_CHARACTER: if ( aContent.getLength() ) { - rParent.AddToCode( OUString::valueOf((sal_Unicode)'*') ); - rParent.AddToCode( OUString::valueOf( aContent[0] ) ); + rParent.AddToCode( (sal_Unicode)'*' ); + rParent.AddToCode( aContent[0] ); } break; case XML_TOK_STYLE_BOOLEAN: @@ -1188,13 +1188,11 @@ void SvXMLNumFmtElementContext::EndElement() if ( aNumInfo.nDecimals > 0 ) { // manually add the decimal places - const String& rSep = rParent.GetLocaleData().getNumDecimalSep(); - for ( xub_StrLen j=0; j 0 ) { rParent.AddToCode( OUString::valueOf( aNumInfo.nFracDenominator ) ); @@ -1221,7 +1221,9 @@ void SvXMLNumFmtElementContext::EndElement() else { for (i=0; iGetLocaleData( nFormatLang ); } +void SvXMLNumFormatContext::AddToCode( sal_Unicode c ) +{ + aFormatCode.append( c ); + bHasExtraText = sal_True; +} + void SvXMLNumFormatContext::AddToCode( const rtl::OUString& rString ) { aFormatCode.append( rString ); -- cgit