diff options
author | Eike Rathke <erack@redhat.com> | 2015-08-10 16:40:39 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-08-10 17:12:43 +0200 |
commit | ae9a59382f11166da44512a01ae38fc4790ac0d4 (patch) | |
tree | 2441881032193eaa82604823331b52f5a97e6ece /chart2 | |
parent | 131d5b01f400899470925757658841080b09283a (diff) |
if we have a number formatter then use it, dammit..
Change-Id: I43b777bb0b3f53682bab7af4643b29e2bd313caa
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 2b522b1cf059..c77c9a544afc 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -1165,27 +1165,28 @@ bool DiagramHelper::isDateNumberFormat( sal_Int32 nNumberFormat, const Reference sal_Int32 DiagramHelper::getDateNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) { sal_Int32 nRet=-1; - Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() ); - if( xNumberFormats.is() ) - { - bool bCreate = true; - const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper(); - Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, - rLocaleDataWrapper.getLanguageTag().getLocale(), bCreate ); - if( aKeySeq.getLength() ) - { - nRet = aKeySeq[0]; - } - } //try to get a date format with full year display + const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag(); NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier ); SvNumberFormatter* pNumFormatter = aNumberFormatterWrapper.getSvNumberFormatter(); if( pNumFormatter ) { - const SvNumberformat* pFormat = pNumFormatter->GetEntry( nRet ); - if( pFormat ) - nRet = pNumFormatter->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, pFormat->GetLanguage() ); + nRet = pNumFormatter->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, rLanguageTag.getLanguageType() ); + } + else + { + Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() ); + if( xNumberFormats.is() ) + { + bool bCreate = true; + Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, + rLanguageTag.getLocale(), bCreate ); + if( aKeySeq.getLength() ) + { + nRet = aKeySeq[0]; + } + } } return nRet; } |