[Libreoffice-commits] core.git: basic/source

Eike Rathke erack at redhat.com
Fri Nov 24 20:34:59 UTC 2017


 basic/source/sbx/sbxdate.cxx |   25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

New commits:
commit bb4cd5271e38ac69b1a9a8738bfdd7e13189f1f4
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Nov 24 16:09:35 2017 +0100

    Get rid of two more temporary SvNumberFormatter instances
    
    Change-Id: Id2afd9dd9d791383a1374b5abe52b47b43a19f08
    Reviewed-on: https://gerrit.libreoffice.org/45236
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

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;


More information about the Libreoffice-commits mailing list