diff options
-rw-r--r-- | i18nutil/source/utility/unicode.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/field.cxx | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx index 56daacdacd1a..0fb6b72366e0 100644 --- a/i18nutil/source/utility/unicode.cxx +++ b/i18nutil/source/utility/unicode.cxx @@ -955,7 +955,7 @@ OUString SAL_CALL unicode::formatPercent(double dNumber, } UnicodeString output; - xF->format(dNumber, output); + xF->format(dNumber/100, output); return OUString(reinterpret_cast<const sal_Unicode *>(output.getBuffer()), output.length()); } diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 9a0e5694c5da..b765deda9ec9 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1423,13 +1423,22 @@ void MetricFormatter::SetValue( sal_Int64 nNewValue, FieldUnit eInUnit ) OUString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const { + //whether percent is separated from its number is locale + //specific, pawn it off to icu to decide + if (meUnit == FUNIT_PERCENT) + { + double dValue = nValue; + dValue /= ImplPower10(GetDecimalDigits()); + return unicode::formatPercent(dValue, Application::GetSettings().GetUILanguageTag()); + } + OUString aStr = NumericFormatter::CreateFieldText( nValue ); if( meUnit == FUNIT_CUSTOM ) aStr += maCustomUnitText; else { - if (meUnit != FUNIT_NONE && meUnit != FUNIT_PERCENT && meUnit != FUNIT_DEGREE) + if (meUnit != FUNIT_NONE && meUnit != FUNIT_DEGREE) aStr += " "; aStr += ImplMetricToString( meUnit ); } |