diff options
author | Eike Rathke <erack@redhat.com> | 2017-11-24 16:25:41 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-11-24 21:32:01 +0100 |
commit | 2f8174594da56e6feb0c339993f673afdd859794 (patch) | |
tree | ef0bba5fe94caa979594c898db3eeb8a6ed7e1f1 /basic | |
parent | 28288295aeddf2fe2100af4f60f453a05fe25508 (diff) |
Aaand another one.. SvNumberFormatter instance
... just to parse with LANGUAGE_ENGLISH_US if system locale failed..
Change-Id: Id9b7cfb5b5f21c46789f30e8e8c72a7524491e95
Reviewed-on: https://gerrit.libreoffice.org/45238
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/methods.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 6b47d8b2a78f..e91893d76d50 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -2043,24 +2043,22 @@ void SbRtl_DateValue(StarBASIC *, SbxArray & rPar, bool) pFormatter = SbiInstance::PrepareNumberFormatter( n, n, n ); } - sal_uInt32 nIndex = 0; + LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType(); + sal_uInt32 nIndex = pFormatter->GetStandardIndex( eLangType); double fResult; OUString aStr( rPar.Get(1)->GetOUString() ); bool bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult ); short nType = pFormatter->GetType( nIndex ); // DateValue("February 12, 1969") raises error if the system locale is not en_US - // by using SbiInstance::GetNumberFormatter. - // It seems that both locale number formatter and English number formatter - // are supported in Visual Basic. - LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType(); + // It seems that both locale number formatter and English number + // formatter are supported in Visual Basic. if( !bSuccess && ( eLangType != LANGUAGE_ENGLISH_US ) ) { - // Create a new SvNumberFormatter by using LANGUAGE_ENGLISH to get the date value; - SvNumberFormatter aFormatter( comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US ); - nIndex = 0; - bSuccess = aFormatter.IsNumberFormat( aStr, nIndex, fResult ); - nType = aFormatter.GetType( nIndex ); + // Try using LANGUAGE_ENGLISH_US to get the date value. + nIndex = pFormatter->GetStandardIndex( LANGUAGE_ENGLISH_US); + bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult ); + nType = pFormatter->GetType( nIndex ); } if(bSuccess && (nType==css::util::NumberFormat::DATE || nType==css::util::NumberFormat::DATETIME)) |