diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-01-20 13:31:17 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-01-20 13:32:15 +0000 |
commit | 062e6f76ba26d2c0a54a476a1168202bae2322a7 (patch) | |
tree | 311aa670a8eb3d1d176c87732f9916377743fe5c /vcl | |
parent | 78a61583c266a1fd222cd78c912e35e93f7010d3 (diff) |
Related: #i56998# use locale rules to format percentage
Change-Id: I2cdeefc5a5a1ee970ee3da5191ceae28b58340a1
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/field.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
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 ); } |