diff options
author | Andreas Bregas <ab@openoffice.org> | 2001-11-26 15:34:28 +0000 |
---|---|---|
committer | Andreas Bregas <ab@openoffice.org> | 2001-11-26 15:34:28 +0000 |
commit | 77d0aea6d6278af3c493845d89a8ccad3f30ce21 (patch) | |
tree | f14f2f5fc1d669d6a483f56deab08f7aad9eca33 /basic/source/runtime/runtime.cxx | |
parent | ff5893d6f516aa109847ca7b5dda64c04eb0b9d0 (diff) |
#94896# Changed NumberFormatter handling
Diffstat (limited to 'basic/source/runtime/runtime.cxx')
-rw-r--r-- | basic/source/runtime/runtime.cxx | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 8a8a38cb821d..d937ebbe9c73 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -2,9 +2,9 @@ * * $RCSfile: runtime.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: er $ $Date: 2001-11-23 19:17:50 $ + * last change: $Author: ab $ $Date: 2001-11-26 16:34:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,6 +70,7 @@ #include <svtools/zforlist.hxx> #endif #include <svtools/sbx.hxx> +#include <svtools/syslocale.hxx> #include "runtime.hxx" #pragma hdrstop #include "sbintern.hxx" @@ -83,10 +84,6 @@ #include <comphelper/processfactory.hxx> #endif -#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX -#include <svtools/syslocale.hxx> -#endif - // Makro MEMBER() #include <macfix.hxx> @@ -336,23 +333,51 @@ SbiDllMgr* SbiInstance::GetDllMgr() // #39629 NumberFormatter jetzt ueber statische Methode anlegen SvNumberFormatter* SbiInstance::GetNumberFormatter() { + LanguageType eLangType = GetpApp()->GetSettings().GetLanguage(); + SvtSysLocale aSysLocale; + DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat(); + if( pNumberFormatter ) + { + if( eLangType != meFormatterLangType || + eDate != meFormatterDateFormat ) + { + delete pNumberFormatter; + pNumberFormatter = NULL; + } + } + meFormatterLangType = eLangType; + meFormatterDateFormat = eDate; if( !pNumberFormatter ) - PrepareNumberFormatter( pNumberFormatter, nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx ); + PrepareNumberFormatter( pNumberFormatter, nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx, + &meFormatterLangType, &meFormatterDateFormat ); return pNumberFormatter; } // #39629 NumberFormatter auch statisch anbieten void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter, - ULONG &rnStdDateIdx, ULONG &rnStdTimeIdx, ULONG &rnStdDateTimeIdx ) + ULONG &rnStdDateIdx, ULONG &rnStdTimeIdx, ULONG &rnStdDateTimeIdx, + LanguageType* peFormatterLangType, DateFormat* peFormatterDateFormat ) { - LanguageType eLangType = Application::GetSettings().GetLanguage(); - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - rpNumberFormatter = new SvNumberFormatter( xFactory, eLangType ); + + LanguageType eLangType; + if( peFormatterLangType ) + eLangType = *peFormatterLangType; + else + eLangType = GetpApp()->GetSettings().GetLanguage(); + + DateFormat eDate; + if( peFormatterDateFormat ) + eDate = *peFormatterDateFormat; else - rpNumberFormatter = new SvNumberFormatter( eLangType ); + { + SvtSysLocale aSysLocale; + eDate = aSysLocale.GetLocaleData().getDateFormat(); + } + + rpNumberFormatter = new SvNumberFormatter( xFactory, eLangType ); + xub_StrLen nCheckPos = 0; short nType; rnStdTimeIdx = rpNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eLangType ); @@ -364,7 +389,6 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter, // austauscht. Problem: Print Year(Date) unter engl. BS // siehe auch svtools\source\sbx\sbxdate.cxx - DateFormat eDate = SvtSysLocale().GetLocaleData().getDateFormat(); String aDateStr; switch( eDate ) { |