basic/source/comp/scanner.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
New commits: commit 28288295aeddf2fe2100af4f60f453a05fe25508 Author: Eike Rathke <[email protected]> Date: Fri Nov 24 15:45:08 2017 +0100 Get rid of a temporary SvNumberFormatter instance ... in case we have a runtime instance already. Only used for scanning date literals in source so not frequently used, otherwise we could remember a non-runtime instance formatter somewhere. Change-Id: I1146860c4b0aa4091708c22e498a6f720d6c7a13 Reviewed-on: https://gerrit.libreoffice.org/45232 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Eike Rathke <[email protected]> diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 07d739f29bc0..67177b7d9f44 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -20,6 +20,7 @@ #include <basiccharclass.hxx> #include <scanner.hxx> #include <sbintern.hxx> +#include <runtime.hxx> #include <i18nlangtag/lang.h> #include <comphelper/processfactory.hxx> @@ -560,12 +561,21 @@ bool SbiScanner::NextSym() aSym = aLine.copy( n, nCol - n - 1 ); // parse date literal - SvNumberFormatter aFormatter(comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US); - sal_uInt32 nIndex = 0; - bool bSuccess = aFormatter.IsNumberFormat(aSym, nIndex, nVal); + std::shared_ptr<SvNumberFormatter> pFormatter; + if (GetSbData()->pInst) + { + pFormatter = GetSbData()->pInst->GetNumberFormatter(); + } + else + { + sal_uInt32 nDummy; + pFormatter = SbiInstance::PrepareNumberFormatter( nDummy, nDummy, nDummy ); + } + sal_uInt32 nIndex = pFormatter->GetStandardIndex( LANGUAGE_ENGLISH_US); + bool bSuccess = pFormatter->IsNumberFormat(aSym, nIndex, nVal); if( bSuccess ) { - short nType_ = aFormatter.GetType(nIndex); + short nType_ = pFormatter->GetType(nIndex); if( !(nType_ & css::util::NumberFormat::DATE) ) bSuccess = false; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
