diff options
author | Eike Rathke <erack@redhat.com> | 2017-11-24 16:09:35 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-11-24 21:34:14 +0100 |
commit | bb4cd5271e38ac69b1a9a8738bfdd7e13189f1f4 (patch) | |
tree | 79da1412436bfcbaabfd95f1f76cf0aa19cbd294 | |
parent | 5e1d49db805b82fb0e75e34e21f2e935c04f58a7 (diff) |
Get rid of two more temporary SvNumberFormatter instances
Change-Id: Id2afd9dd9d791383a1374b5abe52b47b43a19f08
Reviewed-on: https://gerrit.libreoffice.org/45236
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | basic/source/sbx/sbxdate.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx index 4a9749a28b74..e59c9214a90b 100644 --- a/basic/source/sbx/sbxdate.cxx +++ b/basic/source/sbx/sbxdate.cxx @@ -26,6 +26,8 @@ #include <basic/sbx.hxx> #include <basic/sberrors.hxx> #include "sbxconv.hxx" +#include <runtime.hxx> +#include <sbintern.hxx> #include <math.h> #include <comphelper/processfactory.hxx> #include <memory> @@ -101,8 +103,16 @@ double ImpGetDate( const SbxValues* p ) else { LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType(); - - std::unique_ptr<SvNumberFormatter> pFormatter(new SvNumberFormatter( comphelper::getProcessComponentContext(), eLangType )); + 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; sal_Int32 nCheckPos = 0; @@ -269,7 +279,16 @@ start: Color* pColor; LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType(); - std::unique_ptr<SvNumberFormatter> pFormatter(new SvNumberFormatter( comphelper::getProcessComponentContext(), eLangType )); + 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; sal_Int32 nCheckPos = 0; |