diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-13 13:16:27 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-04-13 18:36:05 +0200 |
commit | 608e93bce9d72ccabadeb6707f9a29c3499fd32e (patch) | |
tree | a37d9f370342c6d76fe6e5b4741a90535d12bde1 /basic | |
parent | fe62003caabf7665d41085c5d16f177f8186fce4 (diff) |
convert DateFormat to scoped enum and rename to DateOrder
Change-Id: I71d7a7755a5c20d5146d1ad7e96ca22b7823173a
Reviewed-on: https://gerrit.libreoffice.org/36517
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/inc/runtime.hxx | 4 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 26 | ||||
-rw-r--r-- | basic/source/sbx/sbxdate.cxx | 26 |
3 files changed, 28 insertions, 28 deletions
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index cf6d32a1e755..1b11dcd02ffe 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -142,7 +142,7 @@ class SbiInstance std::unique_ptr<SvNumberFormatter> pNumberFormatter; StarBASIC* pBasic; LanguageType meFormatterLangType; - DateFormat meFormatterDateFormat; + DateOrder meFormatterDateOrder; sal_uInt32 nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx; SbError nErr; @@ -200,7 +200,7 @@ public: // offer NumberFormatter also static static SvNumberFormatter* PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx, sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx, - LanguageType* peFormatterLangType=nullptr, DateFormat* peFormatterDateFormat=nullptr ); + LanguageType* peFormatterLangType=nullptr, DateOrder* peFormatterDateOrder=nullptr ); }; // There's one instance of this class for every executed sub-program. diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index a2cab4a629a5..5e4e5f299559 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -307,7 +307,7 @@ SbiInstance::SbiInstance( StarBASIC* p ) , pDdeCtrl(new SbiDdeControl) , pBasic(p) , meFormatterLangType(LANGUAGE_DONTKNOW) - , meFormatterDateFormat(YMD) + , meFormatterDateOrder(DateOrder::YMD) , nStdDateIdx(0) , nStdTimeIdx(0) , nStdDateTimeIdx(0) @@ -363,21 +363,21 @@ SvNumberFormatter* SbiInstance::GetNumberFormatter() { LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType(); SvtSysLocale aSysLocale; - DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat(); + DateOrder eDate = aSysLocale.GetLocaleData().getDateOrder(); if( pNumberFormatter ) { if( eLangType != meFormatterLangType || - eDate != meFormatterDateFormat ) + eDate != meFormatterDateOrder ) { pNumberFormatter.reset(nullptr); } } meFormatterLangType = eLangType; - meFormatterDateFormat = eDate; + meFormatterDateOrder = eDate; if( !pNumberFormatter ) { pNumberFormatter.reset(PrepareNumberFormatter( nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx, - &meFormatterLangType, &meFormatterDateFormat )); + &meFormatterLangType, &meFormatterDateOrder )); } return pNumberFormatter.get(); } @@ -385,7 +385,7 @@ SvNumberFormatter* SbiInstance::GetNumberFormatter() // #39629 offer NumberFormatter static too SvNumberFormatter* SbiInstance::PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx, sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx, - LanguageType* peFormatterLangType, DateFormat* peFormatterDateFormat ) + LanguageType* peFormatterLangType, DateOrder* peFormatterDateOrder ) { SvNumberFormatter* pNumberFormater = nullptr; LanguageType eLangType; @@ -397,15 +397,15 @@ SvNumberFormatter* SbiInstance::PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx { eLangType = Application::GetSettings().GetLanguageTag().getLanguageType(); } - DateFormat eDate; - if( peFormatterDateFormat ) + DateOrder eDate; + if( peFormatterDateOrder ) { - eDate = *peFormatterDateFormat; + eDate = *peFormatterDateOrder; } else { SvtSysLocale aSysLocale; - eDate = aSysLocale.GetLocaleData().getDateFormat(); + eDate = aSysLocale.GetLocaleData().getDateOrder(); } pNumberFormater = new SvNumberFormatter( comphelper::getProcessComponentContext(), eLangType ); @@ -425,9 +425,9 @@ SvNumberFormatter* SbiInstance::PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx switch( eDate ) { default: - case MDY: aDateStr = "MM/DD/YYYY"; break; - case DMY: aDateStr = "DD/MM/YYYY"; break; - case YMD: aDateStr = "YYYY/MM/DD"; break; + case DateOrder::MDY: aDateStr = "MM/DD/YYYY"; break; + case DateOrder::DMY: aDateStr = "DD/MM/YYYY"; break; + case DateOrder::YMD: aDateStr = "YYYY/MM/DD"; break; } OUString aStr( aDateStr ); // PutandConvertEntry() modifies string! pNumberFormater->PutandConvertEntry( aStr, nCheckPos, nType, diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx index 76b9c7306fa2..342aa0ef482c 100644 --- a/basic/source/sbx/sbxdate.cxx +++ b/basic/source/sbx/sbxdate.cxx @@ -116,14 +116,14 @@ double ImpGetDate( const SbxValues* p ) // quod vide basic/source/runtime/runtime.cxx SvtSysLocale aSysLocale; - DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat(); + DateOrder eDate = aSysLocale.GetLocaleData().getDateOrder(); OUString aDateStr; switch( eDate ) { default: - case MDY: aDateStr = "MM/DD/YYYY"; break; - case DMY: aDateStr = "DD/MM/YYYY"; break; - case YMD: aDateStr = "YYYY/MM/DD"; break; + case DateOrder::MDY: aDateStr = "MM/DD/YYYY"; break; + case DateOrder::DMY: aDateStr = "DD/MM/YYYY"; break; + case DateOrder::YMD: aDateStr = "YYYY/MM/DD"; break; } OUString aStr = aDateStr + " HH:MM:SS"; @@ -275,7 +275,7 @@ start: short nType; SvtSysLocale aSysLocale; - DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat(); + DateOrder eDate = aSysLocale.GetLocaleData().getDateOrder(); OUString aStr; // if the whole-number part is 0, we want no year! if( n <= -1.0 || n >= 1.0 ) @@ -285,20 +285,20 @@ start: { switch( eDate ) { - case MDY: aStr = "MM.TT.JJJJ"; break; - case DMY: aStr = "TT.MM.JJJJ"; break; - case YMD: aStr = "JJJJ.MM.TT"; break; - default: aStr = "MM.TT.JJJJ"; + case DateOrder::MDY: aStr = "MM.TT.JJJJ"; break; + case DateOrder::DMY: aStr = "TT.MM.JJJJ"; break; + case DateOrder::YMD: aStr = "JJJJ.MM.TT"; break; + default: aStr = "MM.TT.JJJJ"; } } else { switch( eDate ) { - case MDY: aStr = "MM.TT.JJJJ HH:MM:SS"; break; - case DMY: aStr = "TT.MM.JJJJ HH:MM:SS"; break; - case YMD: aStr = "JJJJ.MM.TT HH:MM:SS"; break; - default: aStr = "MM.TT.JJJJ HH:MM:SS"; + case DateOrder::MDY: aStr = "MM.TT.JJJJ HH:MM:SS"; break; + case DateOrder::DMY: aStr = "TT.MM.JJJJ HH:MM:SS"; break; + case DateOrder::YMD: aStr = "JJJJ.MM.TT HH:MM:SS"; break; + default: aStr = "MM.TT.JJJJ HH:MM:SS"; } } } |