diff options
author | Eike Rathke <erack@redhat.com> | 2015-08-10 17:04:13 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-08-10 17:12:45 +0200 |
commit | 0f4b3cb7d3d68906de316a64dcec281da2a641bd (patch) | |
tree | 21b052b3e2486f08d9e8a7aab91a6855f7117be6 | |
parent | ae9a59382f11166da44512a01ae38fc4790ac0d4 (diff) |
if we have a number formatter then use it, dammit..
Change-Id: I2d70bed4d9cf6f0ef4556a327c51fc5c10fcd2be
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index c77c9a544afc..3dcbf4b2b17c 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -1243,16 +1243,25 @@ sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const Reference< util::XN sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) { sal_Int32 nRet=-1; - Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() ); - if( xNumberFormats.is() ) + const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag(); + NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier ); + SvNumberFormatter* pNumFormatter = aNumberFormatterWrapper.getSvNumberFormatter(); + if( pNumFormatter ) { - bool bCreate = true; - const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper(); - Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::PERCENT, - rLocaleDataWrapper.getLanguageTag().getLocale(), bCreate ); - if( aKeySeq.getLength() ) + nRet = pNumFormatter->GetStandardFormat( util::NumberFormat::PERCENT, rLanguageTag.getLanguageType() ); + } + else + { + Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() ); + if( xNumberFormats.is() ) { - nRet = aKeySeq[0]; + bool bCreate = true; + Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::PERCENT, + rLanguageTag.getLocale(), bCreate ); + if( aKeySeq.getLength() ) + { + nRet = aKeySeq[0]; + } } } return nRet; |