From 00bc5a097313fbd003675267be961ad3a152ba42 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 3 Dec 2017 21:46:37 +0200 Subject: wrap scoped enum around css::util::NumberFormat Change-Id: Icab5ded8bccdb95f79b3fa35ea164f47919c68fa Reviewed-on: https://gerrit.libreoffice.org/46339 Tested-by: Jenkins Reviewed-by: Eike Rathke --- basic/source/comp/scanner.cxx | 4 ++-- basic/source/runtime/methods.cxx | 12 ++++++------ basic/source/runtime/runtime.cxx | 5 +++-- basic/source/sbx/sbxdate.cxx | 11 ++++++----- basic/source/sbx/sbxscan.cxx | 2 +- 5 files changed, 18 insertions(+), 16 deletions(-) (limited to 'basic') diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 67177b7d9f44..2ecb7310d543 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -575,8 +575,8 @@ bool SbiScanner::NextSym() bool bSuccess = pFormatter->IsNumberFormat(aSym, nIndex, nVal); if( bSuccess ) { - short nType_ = pFormatter->GetType(nIndex); - if( !(nType_ & css::util::NumberFormat::DATE) ) + SvNumFormatType nType_ = pFormatter->GetType(nIndex); + if( !(nType_ & SvNumFormatType::DATE) ) bSuccess = false; } diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 542c8817700c..d1f4206c31c5 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -2048,7 +2048,7 @@ void SbRtl_DateValue(StarBASIC *, SbxArray & rPar, bool) double fResult; OUString aStr( rPar.Get(1)->GetOUString() ); bool bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult ); - short nType = pFormatter->GetType( nIndex ); + SvNumFormatType nType = pFormatter->GetType( nIndex ); // DateValue("February 12, 1969") raises error if the system locale is not en_US // It seems that both locale number formatter and English number @@ -2061,9 +2061,9 @@ void SbRtl_DateValue(StarBASIC *, SbxArray & rPar, bool) nType = pFormatter->GetType( nIndex ); } - if(bSuccess && (nType==css::util::NumberFormat::DATE || nType==css::util::NumberFormat::DATETIME)) + if(bSuccess && (nType==SvNumFormatType::DATE || nType==SvNumFormatType::DATETIME)) { - if ( nType == css::util::NumberFormat::DATETIME ) + if ( nType == SvNumFormatType::DATETIME ) { // cut time if ( fResult > 0.0 ) @@ -2105,10 +2105,10 @@ void SbRtl_TimeValue(StarBASIC *, SbxArray & rPar, bool) double fResult; bool bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetOUString(), nIndex, fResult ); - short nType = pFormatter->GetType(nIndex); - if(bSuccess && (nType==css::util::NumberFormat::TIME||nType==css::util::NumberFormat::DATETIME)) + SvNumFormatType nType = pFormatter->GetType(nIndex); + if(bSuccess && (nType==SvNumFormatType::TIME||nType==SvNumFormatType::DATETIME)) { - if ( nType == css::util::NumberFormat::DATETIME ) + if ( nType == SvNumFormatType::DATETIME ) { // cut days fResult = fmod( fResult, 1 ); diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 2eaa60f85e5f..2b81778917e0 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -408,8 +408,9 @@ std::shared_ptr SbiInstance::PrepareNumberFormatter( sal_uInt std::shared_ptr pNumberFormatter( new SvNumberFormatter( comphelper::getProcessComponentContext(), eLangType )); - sal_Int32 nCheckPos = 0; short nType; - rnStdTimeIdx = pNumberFormatter->GetStandardFormat( css::util::NumberFormat::TIME, eLangType ); + sal_Int32 nCheckPos = 0; + SvNumFormatType nType; + rnStdTimeIdx = pNumberFormatter->GetStandardFormat( SvNumFormatType::TIME, eLangType ); // the formatter's standard templates have only got a two-digit date // -> registering an own format diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx index e59c9214a90b..5342d557e1f0 100644 --- a/basic/source/sbx/sbxdate.cxx +++ b/basic/source/sbx/sbxdate.cxx @@ -116,7 +116,8 @@ double ImpGetDate( const SbxValues* p ) sal_uInt32 nIndex; sal_Int32 nCheckPos = 0; - short nType = 127; + SvNumFormatType nType = SvNumFormatType::DEFINED | SvNumFormatType::DATE | SvNumFormatType::TIME | SvNumFormatType::CURRENCY + | SvNumFormatType::NUMBER | SvNumFormatType::SCIENTIFIC | SvNumFormatType::FRACTION; // Default templates of the formatter have only two-digit // date. Therefore register an own format. @@ -144,9 +145,9 @@ double ImpGetDate( const SbxValues* p ) bool bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes ); if ( bSuccess ) { - short nType_ = pFormatter->GetType( nIndex ); - if(!(nType_ & ( css::util::NumberFormat::DATETIME | css::util::NumberFormat::DATE | - css::util::NumberFormat::TIME | css::util::NumberFormat::DEFINED ))) + SvNumFormatType nType_ = pFormatter->GetType( nIndex ); + if(!(nType_ & ( SvNumFormatType::DATETIME | SvNumFormatType::DATE | + SvNumFormatType::TIME | SvNumFormatType::DEFINED ))) { bSuccess = false; } @@ -292,7 +293,7 @@ start: sal_uInt32 nIndex; sal_Int32 nCheckPos = 0; - short nType; + SvNumFormatType nType; SvtSysLocale aSysLocale; DateOrder eDate = aSysLocale.GetLocaleData().getDateOrder(); diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 3408c0e9f151..d13cacb3616c 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -703,7 +703,7 @@ void SbxValue::Format( OUString& rRes, const OUString* pFmt ) const if( bSuccess ) { sal_Int32 nCheckPos = 0; - short nType; + SvNumFormatType nType; OUString aFmtStr = *pFmt; const VbaFormatInfo* pInfo = getFormatInfo( aFmtStr ); if( pInfo->meType != VbaFormatType::Null ) -- cgit