diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2017-12-03 21:46:37 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-12-19 22:08:26 +0100 |
commit | 00bc5a097313fbd003675267be961ad3a152ba42 (patch) | |
tree | de9b9e6981d3c2f262b9391335a067d4898185b6 /svl | |
parent | b74da08e556b7b001943f0288a61da53791d4dcf (diff) |
wrap scoped enum around css::util::NumberFormat
Change-Id: Icab5ded8bccdb95f79b3fa35ea164f47919c68fa
Reviewed-on: https://gerrit.libreoffice.org/46339
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/qa/unit/svl.cxx | 8 | ||||
-rw-r--r-- | svl/source/numbers/numfmuno.cxx | 19 | ||||
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 277 | ||||
-rw-r--r-- | svl/source/numbers/zforfind.hxx | 7 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 252 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 96 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 182 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.hxx | 4 |
8 files changed, 425 insertions, 420 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index bafb8d13bef9..74e37de42d6e 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -269,7 +269,7 @@ void Test::testNumberFormat() } sal_Int32 nPos; - short nType = css::util::NumberFormat::DEFINED; + SvNumFormatType nType = SvNumFormatType::DEFINED; sal_uInt32 nKey; OUString aCode; // Thai date format (implicit locale). @@ -1081,7 +1081,7 @@ void Test::checkDateInput( SvNumberFormatter& rFormatter, const char* pTimezone, CPPUNIT_ASSERT_MESSAGE( OString("Date not recognized: " + OString(pTimezone) + " " + OString(pIsoDate)).getStr(), bVal); CPPUNIT_ASSERT_MESSAGE("Format parsed is not date.", - (rFormatter.GetType(nIndex) & css::util::NumberFormat::DATE)); + (rFormatter.GetType(nIndex) & SvNumFormatType::DATE)); OUString aOutString; Color *pColor; rFormatter.GetOutputString( fVal, nIndex, aOutString, &pColor); @@ -1495,7 +1495,7 @@ void Test::testColorNamesConversion() // [FARBE1] -> [COLOR1] can't be tested because we have no color table link // set, so the scanner returns nCheckPos error. sal_Int32 nCheckPos; - short nType; + SvNumFormatType nType; sal_uInt32 nKey; OUString aFormatCode; @@ -1504,7 +1504,7 @@ void Test::testColorNamesConversion() aFormatCode = "[" + aGermanKeywords[i] + "]0"; aFormatter.PutandConvertEntry( aFormatCode, nCheckPos, nType, nKey, LANGUAGE_GERMAN, LANGUAGE_ENGLISH_US); CPPUNIT_ASSERT_EQUAL_MESSAGE("CheckPos should be 0.", sal_Int32(0), nCheckPos); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Type should be NUMBER.", css::util::NumberFormat::NUMBER, nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Type should be NUMBER.", SvNumFormatType::NUMBER, nType); CPPUNIT_ASSERT_EQUAL( OUString("[" + rEnglishKeywords[i] + "]0"), aFormatCode); } } diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index 3c50a2e16b71..bf2c13d82e29 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -382,8 +382,8 @@ uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType sal_uInt32 nIndex = 0; LanguageType eLang = lcl_GetLanguage( nLocale ); SvNumberFormatTable& rTable = bCreate ? - pFormatter->ChangeCL( nType, nIndex, eLang ) : - pFormatter->GetEntryTable( nType, nIndex, eLang ); + pFormatter->ChangeCL( static_cast<SvNumFormatType>(nType), nIndex, eLang ) : + pFormatter->GetEntryTable( static_cast<SvNumFormatType>(nType), nIndex, eLang ); sal_uInt32 nCount = rTable.size(); uno::Sequence<sal_Int32> aSeq(nCount); sal_Int32* pAry = aSeq.getArray(); @@ -427,7 +427,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const OUString& aFormat, LanguageType eLang = lcl_GetLanguage( nLocale ); sal_uInt32 nKey = 0; sal_Int32 nCheckPos = 0; - short nType = 0; + SvNumFormatType nType = SvNumFormatType::ALL; bool bOk = pFormatter->PutEntry( aFormStr, nCheckPos, nType, nKey, eLang ); if (bOk) nRet = nKey; @@ -457,7 +457,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const OUString& aFormat, LanguageType eNewLang = lcl_GetLanguage( nNewLocale ); sal_uInt32 nKey = 0; sal_Int32 nCheckPos = 0; - short nType = 0; + SvNumFormatType nType = SvNumFormatType::ALL; bool bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang ); if (bOk || nKey > 0) nRet = nKey; @@ -525,8 +525,9 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const LanguageType eLang = lcl_GetLanguage( nLocale ); // Mask out "defined" bit, so type from an existing number format // can directly be used for getStandardFormat - nType &= ~css::util::NumberFormat::DEFINED; - sal_Int32 nRet = pFormatter->GetStandardFormat(nType, eLang); + SvNumFormatType nType2 = static_cast<SvNumFormatType>(nType); + nType2 &= ~SvNumFormatType::DEFINED; + sal_Int32 nRet = pFormatter->GetStandardFormat(nType2, eLang); return nRet; } @@ -547,7 +548,7 @@ sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_ { ::osl::MutexGuard aGuard( m_aMutex ); - return SvNumberFormatter::IsCompatible( nOldType, nNewType ); + return SvNumberFormatter::IsCompatible( static_cast<SvNumFormatType>(nOldType), static_cast<SvNumFormatType>(nNewType) ); } sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const lang::Locale& nLocale ) @@ -644,7 +645,7 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const OUString& aProperty } else if (aPropertyName == PROPERTYNAME_USERDEF) { - aRet <<= ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 ); + aRet <<= bool( pFormat->GetType() & SvNumFormatType::DEFINED ); } else if (aPropertyName == PROPERTYNAME_DECIMALS) { @@ -744,7 +745,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValue OUString aComment = pFormat->GetComment(); bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ); //! Pass through SvNumberformat Member bStandard? - bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 ); + bool bUserDef( pFormat->GetType() & SvNumFormatType::DEFINED ); bool bThousand, bRed; sal_uInt16 nDecimals, nLeading; pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 7e4f3f69e128..c0f679e97b7a 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -80,8 +80,8 @@ ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP ) bTextInitialized( false ), bScanGenitiveMonths( false ), bScanPartitiveMonths( false ), - eScannedType( css::util::NumberFormat::UNDEFINED ), - eSetType( css::util::NumberFormat::UNDEFINED ) + eScannedType( SvNumFormatType::UNDEFINED ), + eSetType( SvNumFormatType::UNDEFINED ) { pFormatter = pFormatterP; pNullDate = new Date(30,12,1899); @@ -111,7 +111,7 @@ void ImpSvNumberInputScan::Reset() nStringsCnt = 0; nNumericsCnt = 0; nThousand = 0; - eScannedType = css::util::NumberFormat::UNDEFINED; + eScannedType = SvNumFormatType::UNDEFINED; nAmPm = 0; nPosThousandString = 0; nLogical = 0; @@ -1102,7 +1102,7 @@ bool ImpSvNumberInputScan::CanForceToIso8601( DateOrder eDateOrder ) bool ImpSvNumberInputScan::IsAcceptableIso8601( const SvNumberformat* pFormat ) { - if (pFormat && (pFormat->GetType() & css::util::NumberFormat::DATE)) + if (pFormat && (pFormat->GetType() & SvNumFormatType::DATE)) { switch (pFormatter->GetEvalDateFormat()) { @@ -1552,7 +1552,7 @@ bool ImpSvNumberInputScan::GetDateRef( double& fDays, sal_uInt16& nCounter, using namespace ::com::sun::star::i18n; NfEvalDateFormat eEDF; int nFormatOrder; - if ( pFormat && (pFormat->GetType() & css::util::NumberFormat::DATE) ) + if ( pFormat && (pFormat->GetType() & SvNumFormatType::DATE) ) { eEDF = pFormatter->GetEvalDateFormat(); switch ( eEDF ) @@ -2149,7 +2149,7 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString, } else if ( GetCurrency(rString, nPos, pFormat) ) // currency (DM 1)? { - eScannedType = css::util::NumberFormat::CURRENCY; // !!! it IS currency !!! + eScannedType = SvNumFormatType::CURRENCY; // !!! it IS currency !!! SkipBlanks(rString, nPos); if (nSign == 0) // no sign yet { @@ -2202,7 +2202,7 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString, // separator and a (year) number. if (nPos < rString.getLength() || (nStringsCnt >= 4 && nNumericsCnt >= 2)) { - eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date !!! + eScannedType = SvNumFormatType::DATE; // !!! it IS a date !!! nMonth = nTempMonth; nMonthPos = 1; // month at the beginning if ( nMonth < 0 ) @@ -2222,7 +2222,7 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString, if ( nTempDayOfWeek ) { // day of week is just parsed away - eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date !!! + eScannedType = SvNumFormatType::DATE; // !!! it IS a date !!! if ( nPos < rString.getLength() ) { if ( nTempDayOfWeek < 0 ) @@ -2299,7 +2299,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, sal_uInt16 nStringPos, const SvNumberformat* pFormat ) { sal_Int32 nPos = 0; - short eOldScannedType = eScannedType; + SvNumFormatType eOldScannedType = eScannedType; if ( nMatchedAllStrings ) { // Match against format in any case, so later on for a "1-2-3-4" input @@ -2328,15 +2328,15 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, if (bDecSepInDateSeps || // . also date separator SkipDatePatternSeparator( nStringPos, nPos, bSignedYear)) { - if ( eScannedType != css::util::NumberFormat::UNDEFINED && - eScannedType != css::util::NumberFormat::DATE && - eScannedType != css::util::NumberFormat::DATETIME) // already another type + if ( eScannedType != SvNumFormatType::UNDEFINED && + eScannedType != SvNumFormatType::DATE && + eScannedType != SvNumFormatType::DATETIME) // already another type { return MatchedReturn(); } - if (eScannedType == css::util::NumberFormat::UNDEFINED) + if (eScannedType == SvNumFormatType::UNDEFINED) { - eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date + eScannedType = SvNumFormatType::DATE; // !!! it IS a date } SkipBlanks(rString, nPos); } @@ -2351,7 +2351,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, SkipBlanks(rString, nPos); } } - else if ( (eScannedType & css::util::NumberFormat::TIME) && + else if ( (eScannedType & SvNumFormatType::TIME) && GetTime100SecSep( rString, nPos ) ) { // hundredth seconds separator if ( nDecPos ) @@ -2364,7 +2364,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, // out early to not get confused by later checks for group separator or // other. if (bIso8601Tsep && nPos == rString.getLength() && - eScannedType == css::util::NumberFormat::DATETIME && (rString == "." || rString == ",")) + eScannedType == SvNumFormatType::DATETIME && (rString == "." || rString == ",")) return true; SkipBlanks(rString, nPos); @@ -2372,13 +2372,13 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, if (SkipChar('/', rString, nPos)) // fraction? { - if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type - eScannedType != css::util::NumberFormat::DATE) // except date + if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type + eScannedType != SvNumFormatType::DATE) // except date { return MatchedReturn(); // => jan/31/1994 } - else if (eScannedType != css::util::NumberFormat::DATE && // analyzed no date until now - ( eSetType == css::util::NumberFormat::FRACTION || // and preset was fraction + else if (eScannedType != SvNumFormatType::DATE && // analyzed no date until now + ( eSetType == SvNumFormatType::FRACTION || // and preset was fraction (nNumericsCnt == 3 && // or 3 numbers (nStringPos == 3 || // and 3rd string particle (nStringPos == 4 && nSign))))) // or 4th if signed @@ -2386,8 +2386,8 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, SkipBlanks(rString, nPos); if (nPos == rString.getLength()) { - eScannedType = css::util::NumberFormat::FRACTION; // !!! it IS a fraction (so far) - if (eSetType == css::util::NumberFormat::FRACTION && + eScannedType = SvNumFormatType::FRACTION; // !!! it IS a fraction (so far) + if (eSetType == SvNumFormatType::FRACTION && nNumericsCnt == 2 && (nStringPos == 1 || // for 4/5 (nStringPos == 2 && nSign))) // or signed -4/5 @@ -2404,8 +2404,8 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, if (GetThousandSep(rString, nPos, nStringPos)) // 1,000 { - if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type - eScannedType != css::util::NumberFormat::CURRENCY) // except currency + if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type + eScannedType != SvNumFormatType::CURRENCY) // except currency { return MatchedReturn(); } @@ -2424,13 +2424,13 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, if (bDate || ((MayBeIso8601() || MayBeMonthDate()) && // 1999-12-31 31-Dec-1999 SkipChar( '-', rString, nPos))) { - if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type - eScannedType != css::util::NumberFormat::DATE) // except date + if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type + eScannedType != SvNumFormatType::DATE) // except date { return MatchedReturn(); } SkipBlanks(rString, nPos); - eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date + eScannedType = SvNumFormatType::DATE; // !!! it IS a date short nTmpMonth = GetMonth(rString, nPos); // 10. Jan 94 if (nMonth && nTmpMonth) // month dup { @@ -2468,14 +2468,14 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, { return MatchedReturn(); } - if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type - eScannedType != css::util::NumberFormat::DATE) // except date + if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type + eScannedType != SvNumFormatType::DATE) // except date { return MatchedReturn(); } if (nMonthStart > 0 && nPos < rString.getLength()) // 10Jan or Jan94 without separator are not dates { - eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date + eScannedType = SvNumFormatType::DATE; // !!! it IS a date nMonth = nTempMonth; nMonthPos = 2; // month in the middle if ( nMonth < 0 ) @@ -2494,14 +2494,14 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, if ( SkipChar('E', rString, nPos) || // 10E, 10e, 10,Ee SkipChar('e', rString, nPos) ) { - if (eScannedType != css::util::NumberFormat::UNDEFINED) // already another type + if (eScannedType != SvNumFormatType::UNDEFINED) // already another type { return MatchedReturn(); } else { SkipBlanks(rString, nPos); - eScannedType = css::util::NumberFormat::SCIENTIFIC; // !!! it IS scientific + eScannedType = SvNumFormatType::SCIENTIFIC; // !!! it IS scientific if ( nThousand+2 == nNumericsCnt && nDecPos == 2 ) // special case 1.E2 { nDecPos = 3; // 1,100.E2 1,100,100.E3 @@ -2518,12 +2518,12 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, { if (bDecSepInDateSeps) // . also date sep { - if ( eScannedType != css::util::NumberFormat::DATE && // already another type than date - eScannedType != css::util::NumberFormat::DATETIME) // or date time + if ( eScannedType != SvNumFormatType::DATE && // already another type than date + eScannedType != SvNumFormatType::DATETIME) // or date time { return MatchedReturn(); } - if (eScannedType == css::util::NumberFormat::DATE) + if (eScannedType == SvNumFormatType::DATE) { nDecPos = 0; // reset for time transition } @@ -2533,22 +2533,22 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, return MatchedReturn(); } } - if ((eScannedType == css::util::NumberFormat::DATE || // already date type - eScannedType == css::util::NumberFormat::DATETIME) && // or date time + if ((eScannedType == SvNumFormatType::DATE || // already date type + eScannedType == SvNumFormatType::DATETIME) && // or date time nNumericsCnt > 3) // and more than 3 numbers? (31.Dez.94 8:23) { SkipBlanks(rString, nPos); - eScannedType = css::util::NumberFormat::DATETIME; // !!! it IS date with time + eScannedType = SvNumFormatType::DATETIME; // !!! it IS date with time } - else if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type - eScannedType != css::util::NumberFormat::TIME) // except time + else if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type + eScannedType != SvNumFormatType::TIME) // except time { return MatchedReturn(); } else { SkipBlanks(rString, nPos); - eScannedType = css::util::NumberFormat::TIME; // !!! it IS a time + eScannedType = SvNumFormatType::TIME; // !!! it IS a time } if ( !nTimePos ) { @@ -2560,7 +2560,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, { switch (eScannedType) { - case css::util::NumberFormat::DATE: + case SvNumFormatType::DATE: if (nMonthPos == 1 && pLoc->getLongDateOrder() == DateOrder::MDY) { // #68232# recognize long date separators like ", " in "September 5, 1999" @@ -2584,12 +2584,12 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, // here if the locale's separator is not ':' so it couldn't // be detected above in the time block. if (nNumericsCnt >= 5) - eScannedType = css::util::NumberFormat::DATETIME; + eScannedType = SvNumFormatType::DATETIME; ++nPos; } } break; - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: if (nPos == 0 && rString.getLength() == 1 && MayBeIso8601()) { if (nStringPos == 9 && rString[0] == ':') @@ -2628,6 +2628,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, } #endif break; + default: break; } } @@ -2684,15 +2685,15 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, if (bDecSepInDateSeps || // . also date separator SkipDatePatternSeparator( nStringsCnt-1, nPos, bSignedYear)) { - if ( eScannedType != css::util::NumberFormat::UNDEFINED && - eScannedType != css::util::NumberFormat::DATE && - eScannedType != css::util::NumberFormat::DATETIME) // already another type + if ( eScannedType != SvNumFormatType::UNDEFINED && + eScannedType != SvNumFormatType::DATE && + eScannedType != SvNumFormatType::DATETIME) // already another type { return MatchedReturn(); } - if (eScannedType == css::util::NumberFormat::UNDEFINED) + if (eScannedType == SvNumFormatType::UNDEFINED) { - eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date + eScannedType = SvNumFormatType::DATE; // !!! it IS a date } SkipBlanks(rString, nPos); } @@ -2710,7 +2711,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, bool bSignDetectedHere = false; if ( nSign == 0 && // conflict - not signed - eScannedType != css::util::NumberFormat::DATE) // and not date + eScannedType != SvNumFormatType::DATE) // and not date //!? catch time too? { // not signed yet nSign = GetSign(rString, nPos); // 1- DM @@ -2733,14 +2734,14 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, if ( GetCurrency(rString, nPos, pFormat) ) // currency symbol? { - if (eScannedType != css::util::NumberFormat::UNDEFINED) // currency dup + if (eScannedType != SvNumFormatType::UNDEFINED) // currency dup { return MatchedReturn(); } else { SkipBlanks(rString, nPos); - eScannedType = css::util::NumberFormat::CURRENCY; + eScannedType = SvNumFormatType::CURRENCY; } // behind currency a '-' is allowed if (nSign == 0) // not signed yet { @@ -2751,7 +2752,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, return MatchedReturn(); } } - if ( nNegCheck && eScannedType == css::util::NumberFormat::CURRENCY && + if ( nNegCheck && eScannedType == SvNumFormatType::CURRENCY && SkipChar(')', rString, nPos) ) { nNegCheck = 0; // ')' skipped @@ -2761,12 +2762,12 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, if ( SkipChar('%', rString, nPos) ) // 1% { - if (eScannedType != css::util::NumberFormat::UNDEFINED) // already another type + if (eScannedType != SvNumFormatType::UNDEFINED) // already another type { return MatchedReturn(); } SkipBlanks(rString, nPos); - eScannedType = css::util::NumberFormat::PERCENT; + eScannedType = SvNumFormatType::PERCENT; } const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); @@ -2777,20 +2778,20 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, { return MatchedReturn(); } - if (eScannedType == css::util::NumberFormat::DATE && nNumericsCnt > 2) // 31.Dez.94 8: + if (eScannedType == SvNumFormatType::DATE && nNumericsCnt > 2) // 31.Dez.94 8: { SkipBlanks(rString, nPos); - eScannedType = css::util::NumberFormat::DATETIME; + eScannedType = SvNumFormatType::DATETIME; } - else if (eScannedType != css::util::NumberFormat::UNDEFINED && - eScannedType != css::util::NumberFormat::TIME) // already another type + else if (eScannedType != SvNumFormatType::UNDEFINED && + eScannedType != SvNumFormatType::TIME) // already another type { return MatchedReturn(); } else { SkipBlanks(rString, nPos); - eScannedType = css::util::NumberFormat::TIME; + eScannedType = SvNumFormatType::TIME; } if ( !nTimePos ) { @@ -2812,15 +2813,15 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, if (bDate || ((MayBeIso8601() || MayBeMonthDate()) && SkipChar( '-', rString, nPos))) { - if (eScannedType != css::util::NumberFormat::UNDEFINED && - eScannedType != css::util::NumberFormat::DATE) // already another type + if (eScannedType != SvNumFormatType::UNDEFINED && + eScannedType != SvNumFormatType::DATE) // already another type { return MatchedReturn(); } else { SkipBlanks(rString, nPos); - eScannedType = css::util::NumberFormat::DATE; + eScannedType = SvNumFormatType::DATE; } short nTmpMonth = GetMonth(rString, nPos); // 10. Jan if (nMonth && nTmpMonth) // month dup @@ -2847,14 +2848,14 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, { return MatchedReturn(); } - if (eScannedType != css::util::NumberFormat::UNDEFINED && - eScannedType != css::util::NumberFormat::DATE) // already another type + if (eScannedType != SvNumFormatType::UNDEFINED && + eScannedType != SvNumFormatType::DATE) // already another type { return MatchedReturn(); } if (nMonthStart > 0) // 10Jan without separator is not a date { - eScannedType = css::util::NumberFormat::DATE; + eScannedType = SvNumFormatType::DATE; nMonth = nTempMonth; nMonthPos = 3; // month at end if ( nMonth < 0 ) @@ -2872,9 +2873,9 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, sal_Int32 nOrigPos = nPos; if (GetTimeAmPm(rString, nPos)) { - if (eScannedType != css::util::NumberFormat::UNDEFINED && - eScannedType != css::util::NumberFormat::TIME && - eScannedType != css::util::NumberFormat::DATETIME) // already another type + if (eScannedType != SvNumFormatType::UNDEFINED && + eScannedType != SvNumFormatType::TIME && + eScannedType != SvNumFormatType::DATETIME) // already another type { return MatchedReturn(); } @@ -2882,16 +2883,16 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, { // If not already scanned as time, 6.78am does not result in 6 // seconds and 78 hundredths in the morning. Keep as suffix. - if (eScannedType != css::util::NumberFormat::TIME && nDecPos == 2 && nNumericsCnt == 2) + if (eScannedType != SvNumFormatType::TIME && nDecPos == 2 && nNumericsCnt == 2) { nPos = nOrigPos; // rewind am/pm } else { SkipBlanks(rString, nPos); - if ( eScannedType != css::util::NumberFormat::DATETIME ) + if ( eScannedType != SvNumFormatType::DATETIME ) { - eScannedType = css::util::NumberFormat::TIME; + eScannedType = SvNumFormatType::TIME; } } } @@ -2899,7 +2900,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, if ( nNegCheck && SkipChar(')', rString, nPos) ) { - if (eScannedType == css::util::NumberFormat::CURRENCY) // only if currency + if (eScannedType == SvNumFormatType::CURRENCY) // only if currency { nNegCheck = 0; // skip ')' SkipBlanks(rString, nPos); @@ -2911,8 +2912,8 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, } if ( nPos < rString.getLength() && - (eScannedType == css::util::NumberFormat::DATE || - eScannedType == css::util::NumberFormat::DATETIME) ) + (eScannedType == SvNumFormatType::DATE || + eScannedType == SvNumFormatType::DATETIME) ) { // day of week is just parsed away sal_Int32 nOldPos = nPos; @@ -2944,7 +2945,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, } #if NF_RECOGNIZE_ISO8601_TIMEZONES - if (nPos == 0 && eScannedType == css::util::NumberFormat::DATETIME && + if (nPos == 0 && eScannedType == SvNumFormatType::DATETIME && rString.getLength() == 1 && rString[ 0 ] == 'Z' && MayBeIso8601()) { // ISO 8601 timezone UTC yyyy-mm-ddThh:mmZ @@ -3100,7 +3101,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / nLogical = GetLogical( rStrArray ); if ( nLogical ) { - eScannedType = css::util::NumberFormat::LOGICAL; // !!! it's a BOOLEAN + eScannedType = SvNumFormatType::LOGICAL; // !!! it's a BOOLEAN nMatchedAllStrings &= ~nMatchedVirgin; return true; } @@ -3124,12 +3125,12 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / // nStringsCnt >= 1 if (GetNextNumber(i,j)) // i=1,0 { // Number at start - if (eSetType == css::util::NumberFormat::FRACTION) // Fraction 1 = 1/1 + if (eSetType == SvNumFormatType::FRACTION) // Fraction 1 = 1/1 { if (i >= nStringsCnt || // no end string nor decimal separator pFormatter->IsDecimalSep( sStrArray[i])) { - eScannedType = css::util::NumberFormat::FRACTION; + eScannedType = SvNumFormatType::FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; return true; } @@ -3144,16 +3145,16 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / i++; // next symbol, i=1 } GetNextNumber(i,j); // i=1,2 - if (eSetType == css::util::NumberFormat::FRACTION) // Fraction -1 = -1/1 + if (eSetType == SvNumFormatType::FRACTION) // Fraction -1 = -1/1 { if (nSign && !nNegCheck && // Sign +, - - eScannedType == css::util::NumberFormat::UNDEFINED && // not date or currency + eScannedType == SvNumFormatType::UNDEFINED && // not date or currency nDecPos == 0 && // no previous decimal separator (i >= nStringsCnt || // no end string nor decimal separator pFormatter->IsDecimalSep( sStrArray[i])) ) { - eScannedType = css::util::NumberFormat::FRACTION; + eScannedType = SvNumFormatType::FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; return true; } @@ -3182,14 +3183,14 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / { return false; } - if (eSetType == css::util::NumberFormat::FRACTION) // -1,200. as fraction + if (eSetType == SvNumFormatType::FRACTION) // -1,200. as fraction { if (!nNegCheck && // no sign '(' - eScannedType == css::util::NumberFormat::UNDEFINED && + eScannedType == SvNumFormatType::UNDEFINED && (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end ) { - eScannedType = css::util::NumberFormat::FRACTION; + eScannedType = SvNumFormatType::FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; return true; } @@ -3215,7 +3216,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / return false; } i++; // i=2,3 - if (eScannedType == css::util::NumberFormat::SCIENTIFIC) // E only at end + if (eScannedType == SvNumFormatType::SCIENTIFIC) // E only at end { return false; } @@ -3230,19 +3231,19 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / { return false; } - if (eSetType == css::util::NumberFormat::FRACTION) // -1,200,100. as fraction + if (eSetType == SvNumFormatType::FRACTION) // -1,200,100. as fraction { if (!nNegCheck && // no sign '(' - eScannedType == css::util::NumberFormat::UNDEFINED && + eScannedType == SvNumFormatType::UNDEFINED && (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end ) { - eScannedType = css::util::NumberFormat::FRACTION; + eScannedType = SvNumFormatType::FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; return true; } } - if ( eScannedType == css::util::NumberFormat::FRACTION && nDecPos ) + if ( eScannedType == SvNumFormatType::FRACTION && nDecPos ) { return false; // #36857# not a real fraction } @@ -3269,7 +3270,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / // but leave one number. { // Loop over group separators nThOld = nThousand; - if (eScannedType == css::util::NumberFormat::SCIENTIFIC) // E only at end + if (eScannedType == SvNumFormatType::SCIENTIFIC) // E only at end { return false; } @@ -3281,13 +3282,13 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / i++; } } - if (eScannedType == css::util::NumberFormat::DATE || // long date or - eScannedType == css::util::NumberFormat::TIME || // long time or - eScannedType == css::util::NumberFormat::UNDEFINED) // long number + if (eScannedType == SvNumFormatType::DATE || // long date or + eScannedType == SvNumFormatType::TIME || // long time or + eScannedType == SvNumFormatType::UNDEFINED) // long number { for (sal_uInt16 k = j; k < nNumericsCnt-1; k++) { - if (eScannedType == css::util::NumberFormat::SCIENTIFIC) // E only at endd + if (eScannedType == SvNumFormatType::SCIENTIFIC) // E only at endd { return false; } @@ -3304,26 +3305,26 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / { return false; } - if (eSetType == css::util::NumberFormat::FRACTION) // -1,200,100. as fraction + if (eSetType == SvNumFormatType::FRACTION) // -1,200,100. as fraction { if (!nNegCheck && // no sign '(' - eScannedType == css::util::NumberFormat::UNDEFINED && + eScannedType == SvNumFormatType::UNDEFINED && (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end ) { - eScannedType = css::util::NumberFormat::FRACTION; + eScannedType = SvNumFormatType::FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; return true; } } - if ( eScannedType == css::util::NumberFormat::FRACTION && nDecPos ) + if ( eScannedType == SvNumFormatType::FRACTION && nDecPos ) { return false; // #36857# not a real fraction } break; } - if (eScannedType == css::util::NumberFormat::UNDEFINED) + if (eScannedType == SvNumFormatType::UNDEFINED) { nMatchedAllStrings &= ~nMatchedVirgin; // did match including nMatchedUsedAsReturn @@ -3342,13 +3343,13 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / // A type DEFINED means that no category could be assigned to the // overall format because of mixed type subformats. Use the scan // matched subformat's type if any. - short eForType = eSetType; - if ((eForType == css::util::NumberFormat::UNDEFINED || eForType == css::util::NumberFormat::DEFINED) && pFormat) + SvNumFormatType eForType = eSetType; + if ((eForType == SvNumFormatType::UNDEFINED || eForType == SvNumFormatType::DEFINED) && pFormat) eForType = pFormat->GetNumForInfoScannedType( nStringScanNumFor); - if (eForType != css::util::NumberFormat::UNDEFINED && eForType != css::util::NumberFormat::DEFINED) + if (eForType != SvNumFormatType::UNDEFINED && eForType != SvNumFormatType::DEFINED) eScannedType = eForType; else - eScannedType = css::util::NumberFormat::NUMBER; + eScannedType = SvNumFormatType::NUMBER; } else if ( bDidMatch ) { @@ -3356,11 +3357,11 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / } else { - eScannedType = css::util::NumberFormat::NUMBER; + eScannedType = SvNumFormatType::NUMBER; // everything else should have been recognized by now } } - else if ( eScannedType == css::util::NumberFormat::DATE ) + else if ( eScannedType == SvNumFormatType::DATE ) { // the very relaxed date input checks may interfere with a preset format nMatchedAllStrings &= ~nMatchedVirgin; @@ -3380,10 +3381,10 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, / // overall format because of mixed type subformats. Do not override // the scanned type in this case. Otherwise in IsNumberFormat() the // first numeric particle would be accepted as number. - short eForType = eSetType; - if ((eForType == css::util::NumberFormat::UNDEFINED || eForType == css::util::NumberFormat::DEFINED) && pFormat) + SvNumFormatType eForType = eSetType; + if ((eForType == SvNumFormatType::UNDEFINED || eForType == SvNumFormatType::DEFINED) && pFormat) eForType = pFormat->GetNumForInfoScannedType( nStringScanNumFor); - if (eForType != css::util::NumberFormat::UNDEFINED && eForType != css::util::NumberFormat::DEFINED) + if (eForType != SvNumFormatType::UNDEFINED && eForType != SvNumFormatType::DEFINED) eScannedType = eForType; } else if ( bWasReturn ) @@ -3535,7 +3536,7 @@ void ImpSvNumberInputScan::ChangeNullDate( const sal_uInt16 Day, * Does rString represent a number (also date, time et al) */ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // string to be analyzed - short& F_Type, // IN: old type, OUT: new type + SvNumFormatType& F_Type, // IN: old type, OUT: new type double& fOutNumber, // OUT: number if convertible const SvNumberformat* pFormat ) // maybe a number format to match against { @@ -3570,8 +3571,8 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s // is year. // Accept only if the year immediately follows the sign character with // no space in between. - if (nSign && (eScannedType == css::util::NumberFormat::DATE || - eScannedType == css::util::NumberFormat::DATETIME) && mnEra == kDefaultEra && + if (nSign && (eScannedType == SvNumFormatType::DATE || + eScannedType == SvNumFormatType::DATETIME) && mnEra == kDefaultEra && (IsDatePatternNumberOfType(0,'Y') || (MayBeIso8601() && sStrArray[nNums[0]].getLength() >= 4))) { const sal_Unicode c = sStrArray[0][sStrArray[0].getLength()-1]; @@ -3584,8 +3585,8 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s } } if ( nNegCheck || // ')' not found for '(' - (nSign && (eScannedType == css::util::NumberFormat::DATE || - eScannedType == css::util::NumberFormat::DATETIME))) // signed date/datetime + (nSign && (eScannedType == SvNumFormatType::DATE || + eScannedType == SvNumFormatType::DATETIME))) // signed date/datetime { res = false; } @@ -3593,9 +3594,9 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s { // check count of partial number strings switch (eScannedType) { - case css::util::NumberFormat::PERCENT: - case css::util::NumberFormat::CURRENCY: - case css::util::NumberFormat::NUMBER: + case SvNumFormatType::PERCENT: + case SvNumFormatType::CURRENCY: + case SvNumFormatType::NUMBER: if (nDecPos == 1) // .05 { // matched MidStrings function like group separators @@ -3634,7 +3635,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s } break; - case css::util::NumberFormat::SCIENTIFIC: // 1.0e-2 + case SvNumFormatType::SCIENTIFIC: // 1.0e-2 if (nDecPos == 1) // .05 { if (nNumericsCnt != 2) @@ -3658,7 +3659,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s } break; - case css::util::NumberFormat::DATE: + case SvNumFormatType::DATE: if (nMonth < 0 && nDayOfWeek < 0 && nNumericsCnt == 3) { // If both, short month name and day of week name were @@ -3695,7 +3696,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s } break; - case css::util::NumberFormat::TIME: + case SvNumFormatType::TIME: if (nDecPos) { // hundredth seconds included if (nNumericsCnt > 4) @@ -3712,7 +3713,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s } break; - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: if (nMonth < 0 && nDayOfWeek < 0 && nNumericsCnt >= 5) { // If both, abbreviated month name and day of week name @@ -3774,7 +3775,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s { // we finally have a number switch (eScannedType) { - case css::util::NumberFormat::LOGICAL: + case SvNumFormatType::LOGICAL: if (nLogical == 1) { fOutNumber = 1.0; // True @@ -3789,11 +3790,11 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s } break; - case css::util::NumberFormat::PERCENT: - case css::util::NumberFormat::CURRENCY: - case css::util::NumberFormat::NUMBER: - case css::util::NumberFormat::SCIENTIFIC: - case css::util::NumberFormat::DEFINED: // if no category detected handle as number + case SvNumFormatType::PERCENT: + case SvNumFormatType::CURRENCY: + case SvNumFormatType::NUMBER: + case SvNumFormatType::SCIENTIFIC: + case SvNumFormatType::DEFINED: // if no category detected handle as number if ( nDecPos == 1 ) // . at start { sResString.append("0."); @@ -3806,7 +3807,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s if ( nDecPos == 2 && k < nNumericsCnt ) // . somewhere { sResString.append('.'); - sal_uInt16 nStop = (eScannedType == css::util::NumberFormat::SCIENTIFIC ? + sal_uInt16 nStop = (eScannedType == SvNumFormatType::SCIENTIFIC ? nNumericsCnt-1 : nNumericsCnt); for ( ; k < nStop; k++) { @@ -3814,7 +3815,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s } } - if (eScannedType != css::util::NumberFormat::SCIENTIFIC) + if (eScannedType != SvNumFormatType::SCIENTIFIC) { fOutNumber = StringToDouble(sResString.makeStringAndClear()); } @@ -3830,7 +3831,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s fOutNumber = ::rtl::math::stringToDouble( sResString.makeStringAndClear(), '.', ',', &eStatus ); if ( eStatus == rtl_math_ConversionStatus_OutOfRange ) { - F_Type = css::util::NumberFormat::TEXT; // overflow/underflow -> Text + F_Type = SvNumFormatType::TEXT; // overflow/underflow -> Text if (nESign == -1) { fOutNumber = 0.0; @@ -3859,13 +3860,13 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s fOutNumber = -fOutNumber; } - if (eScannedType == css::util::NumberFormat::PERCENT) + if (eScannedType == SvNumFormatType::PERCENT) { fOutNumber/= 100.0; } break; - case css::util::NumberFormat::FRACTION: + case SvNumFormatType::FRACTION: if (nNumericsCnt == 1) { fOutNumber = StringToDouble(sStrArray[nNums[0]]); @@ -3937,7 +3938,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s } break; - case css::util::NumberFormat::TIME: + case SvNumFormatType::TIME: res = GetTimeRef(fOutNumber, 0, nNumericsCnt); if ( nSign < 0 ) { @@ -3945,11 +3946,11 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s } break; - case css::util::NumberFormat::DATE: + case SvNumFormatType::DATE: res = GetDateRef( fOutNumber, k, pFormat ); break; - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: res = GetDateRef( fOutNumber, k, pFormat ); if ( res ) { @@ -3970,13 +3971,13 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s { if (fOutNumber < -DBL_MAX) // -1.7E308 { - F_Type = css::util::NumberFormat::TEXT; + F_Type = SvNumFormatType::TEXT; fOutNumber = -DBL_MAX; return true; } else if (fOutNumber > DBL_MAX) // 1.7E308 { - F_Type = css::util::NumberFormat::TEXT; + F_Type = SvNumFormatType::TEXT; fOutNumber = DBL_MAX; return true; } @@ -3984,7 +3985,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s if (!res) { - eScannedType = css::util::NumberFormat::TEXT; + eScannedType = SvNumFormatType::TEXT; fOutNumber = 0.0; } diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx index c257eed70608..58021ffff824 100644 --- a/svl/source/numbers/zforfind.hxx +++ b/svl/source/numbers/zforfind.hxx @@ -27,6 +27,7 @@ class Date; class SvNumberformat; class SvNumberFormatter; +enum class SvNumFormatType : sal_Int16; #define SV_MAX_COUNT_INPUT_STRINGS 20 // max count of substrings in input scanner @@ -45,7 +46,7 @@ public: /// convert input string to number bool IsNumberFormat( const OUString& rString, /// input string - short& F_Type, /// format type (in + out) + SvNumFormatType& F_Type, /// format type (in + out) double& fOutNumber, /// value determined (out) const SvNumberformat* pFormat); /// number format to which compare against @@ -113,8 +114,8 @@ private: sal_Int16 mnEra; // Era if date, 0 => BCE, 1 => CE (currently only Gregorian) sal_uInt16 nThousand; // Count of group (AKA thousand) separators sal_uInt16 nPosThousandString; // Position of concatenated 000,000,000 string - short eScannedType; // Scanned type - short eSetType; // Preset Type + SvNumFormatType eScannedType; // Scanned type + SvNumFormatType eSetType; // Preset Type sal_uInt16 nStringScanNumFor; // Fixed strings recognized in // pFormat->NumFor[nNumForStringScan] diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 2f3372cef55b..cc3bda8ce139 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -489,14 +489,14 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage ) pStringScanner, nCheckPos, eLge )); if ( nCheckPos == 0 ) { - short eCheckType = pNewEntry->GetType(); - if ( eCheckType != css::util::NumberFormat::UNDEFINED ) + SvNumFormatType eCheckType = pNewEntry->GetType(); + if ( eCheckType != SvNumFormatType::UNDEFINED ) { - pNewEntry->SetType( eCheckType | css::util::NumberFormat::DEFINED ); + pNewEntry->SetType( eCheckType | SvNumFormatType::DEFINED ); } else { - pNewEntry->SetType( css::util::NumberFormat::DEFINED ); + pNewEntry->SetType( SvNumFormatType::DEFINED ); } if ( aFTable.emplace( nKey, std::move(pNewEntry) ).second ) @@ -563,7 +563,7 @@ bool SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const bool SvNumberFormatter::PutEntry(OUString& rString, sal_Int32& nCheckPos, - short& nType, + SvNumFormatType& nType, sal_uInt32& nKey, // format key LanguageType eLnge) { @@ -589,16 +589,16 @@ bool SvNumberFormatter::PutEntry(OUString& rString, if (nCheckPos == 0) // Format ok { // Type comparison: - short eCheckType = p_Entry->GetType(); - if ( eCheckType != css::util::NumberFormat::UNDEFINED) + SvNumFormatType eCheckType = p_Entry->GetType(); + if ( eCheckType != SvNumFormatType::UNDEFINED) { - p_Entry->SetType(eCheckType | css::util::NumberFormat::DEFINED); + p_Entry->SetType(eCheckType | SvNumFormatType::DEFINED); nType = eCheckType; } else { - p_Entry->SetType(css::util::NumberFormat::DEFINED); - nType = css::util::NumberFormat::DEFINED; + p_Entry->SetType(SvNumFormatType::DEFINED); + nType = SvNumFormatType::DEFINED; } sal_uInt32 CLOffset = ImpGenerateCL(eLge); // create new standard formats if necessary @@ -629,7 +629,7 @@ bool SvNumberFormatter::PutEntry(OUString& rString, bool SvNumberFormatter::PutandConvertEntry(OUString& rString, sal_Int32& nCheckPos, - short& nType, + SvNumFormatType& nType, sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge, @@ -649,7 +649,7 @@ bool SvNumberFormatter::PutandConvertEntry(OUString& rString, bool SvNumberFormatter::PutandConvertEntrySystem(OUString& rString, sal_Int32& nCheckPos, - short& nType, + SvNumFormatType& nType, sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge) @@ -667,7 +667,7 @@ bool SvNumberFormatter::PutandConvertEntrySystem(OUString& rString, } sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( OUString & rString, LanguageType eLnge, - LanguageType eSysLnge, short & rType, + LanguageType eSysLnge, SvNumFormatType & rType, bool & rNewInserted, sal_Int32 & rCheckPos ) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); @@ -726,7 +726,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( OUString & rString, rType = GetType( nKey); // Convert any (!) old "automatic" currency format to new fixed currency // default format. - if ((rType & css::util::NumberFormat::CURRENCY) != 0) + if (rType & SvNumFormatType::CURRENCY) { const SvNumberformat* pFormat = GetEntry( nKey); if (!pFormat->HasNewCurrency()) @@ -736,7 +736,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( OUString & rString, DeleteEntry( nKey); // don't leave trails of rubbish rNewInserted = false; } - nKey = GetStandardFormat( css::util::NumberFormat::CURRENCY, eLnge); + nKey = GetStandardFormat( SvNumFormatType::CURRENCY, eLnge); } } return nKey; @@ -803,7 +803,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKe OUString aFormatStr; if (const SvNumberformat* pEntry = GetEntry( nKey)) { - if (pEntry->GetType() == css::util::NumberFormat::LOGICAL) + if (pEntry->GetType() == SvNumFormatType::LOGICAL) { // Build Boolean number format, which needs non-zero and zero // subformat codes with TRUE and FALSE strings. @@ -822,7 +822,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKe if (nLang != LANGUAGE_ENGLISH_US) { sal_Int32 nCheckPos; - short nType = css::util::NumberFormat::DEFINED; + SvNumFormatType nType = SvNumFormatType::DEFINED; sal_uInt32 nTempKey; OUString aTemp( pEntry->GetFormatstring()); rTempFormatter.PutandConvertEntry( aTemp, nCheckPos, nType, nTempKey, nLang, LANGUAGE_ENGLISH_US, true); @@ -913,13 +913,13 @@ sal_uInt32 SvNumberFormatter::ImpIsEntry(const OUString& rString, SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable( - short& eType, + SvNumFormatType& eType, sal_uInt32& FIndex, LanguageType& rLnge) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); - short eTypetmp = eType; - if (eType == css::util::NumberFormat::ALL) // empty cell or don't care + SvNumFormatType eTypetmp = eType; + if (eType == SvNumFormatType::ALL) // empty cell or don't care { rLnge = IniLnge; } @@ -929,22 +929,22 @@ SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable( if (!pFormat) { rLnge = IniLnge; - eType = css::util::NumberFormat::ALL; + eType = SvNumFormatType::ALL; eTypetmp = eType; } else { rLnge = pFormat->GetLanguage(); eType = pFormat->GetMaskedType(); - if (eType == 0) + if (eType == SvNumFormatType::ALL) { - eType = css::util::NumberFormat::DEFINED; + eType = SvNumFormatType::DEFINED; eTypetmp = eType; } - else if (eType == css::util::NumberFormat::DATETIME) + else if (eType == SvNumFormatType::DATETIME) { eTypetmp = eType; - eType = css::util::NumberFormat::DATE; + eType = SvNumFormatType::DATE; } else { @@ -1016,7 +1016,7 @@ sal_uInt32 SvNumberFormatter::ImpGenerateCL( LanguageType eLnge ) return CLOffset; } -SvNumberFormatTable& SvNumberFormatter::ChangeCL(short eType, +SvNumberFormatTable& SvNumberFormatter::ChangeCL(SvNumFormatType eType, sal_uInt32& FIndex, LanguageType eLnge) { @@ -1026,7 +1026,7 @@ SvNumberFormatTable& SvNumberFormatter::ChangeCL(short eType, } SvNumberFormatTable& SvNumberFormatter::GetEntryTable( - short eType, + SvNumFormatType eType, sal_uInt32& FIndex, LanguageType eLnge) { @@ -1048,7 +1048,7 @@ SvNumberFormatTable& SvNumberFormatter::GetEntryTable( auto it = aFTable.find( CLOffset); - if (eType == css::util::NumberFormat::ALL) + if (eType == SvNumFormatType::ALL) { while (it != aFTable.end() && it->second->GetLanguage() == ActLnge) { // copy all entries to output table @@ -1083,26 +1083,26 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString, { ::osl::MutexGuard aGuard( GetInstanceMutex() ); - short FType; + SvNumFormatType FType; const SvNumberformat* pFormat = ImpSubstituteEntry( GetFormatEntry(F_Index)); if (!pFormat) { ChangeIntl(IniLnge); - FType = css::util::NumberFormat::NUMBER; + FType = SvNumFormatType::NUMBER; } else { FType = pFormat->GetMaskedType(); - if (FType == 0) + if (FType == SvNumFormatType::ALL) { - FType = css::util::NumberFormat::DEFINED; + FType = SvNumFormatType::DEFINED; } ChangeIntl(pFormat->GetLanguage()); } bool res; - short RType = FType; - if (RType == css::util::NumberFormat::TEXT) + SvNumFormatType RType = FType; + if (RType == SvNumFormatType::TEXT) { res = false; // type text preset => no conversion to number } @@ -1114,7 +1114,7 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString, { switch ( RType ) { - case css::util::NumberFormat::DATE : + case SvNumFormatType::DATE : // Preserve ISO 8601 input. if (pStringScanner->CanForceToIso8601( DateOrder::Invalid)) { @@ -1125,7 +1125,7 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString, F_Index = GetStandardFormat( RType, ActLnge ); } break; - case css::util::NumberFormat::TIME : + case SvNumFormatType::TIME : if ( pStringScanner->GetDecPos() ) { // 100th seconds @@ -1161,13 +1161,13 @@ LanguageType SvNumberFormatter::GetLanguage() const } // static -bool SvNumberFormatter::IsCompatible(short eOldType, short eNewType) +bool SvNumberFormatter::IsCompatible(SvNumFormatType eOldType, SvNumFormatType eNewType) { if (eOldType == eNewType) { return true; } - else if (eOldType == css::util::NumberFormat::DEFINED) + else if (eOldType == SvNumFormatType::DEFINED) { return true; } @@ -1175,43 +1175,43 @@ bool SvNumberFormatter::IsCompatible(short eOldType, short eNewType) { switch (eNewType) { - case css::util::NumberFormat::NUMBER: + case SvNumFormatType::NUMBER: switch (eOldType) { - case css::util::NumberFormat::PERCENT: - case css::util::NumberFormat::CURRENCY: - case css::util::NumberFormat::SCIENTIFIC: - case css::util::NumberFormat::FRACTION: - case css::util::NumberFormat::DEFINED: + case SvNumFormatType::PERCENT: + case SvNumFormatType::CURRENCY: + case SvNumFormatType::SCIENTIFIC: + case SvNumFormatType::FRACTION: + case SvNumFormatType::DEFINED: return true; - case css::util::NumberFormat::LOGICAL: + case SvNumFormatType::LOGICAL: default: return false; } break; - case css::util::NumberFormat::DATE: + case SvNumFormatType::DATE: switch (eOldType) { - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: return true; default: return false; } break; - case css::util::NumberFormat::TIME: + case SvNumFormatType::TIME: switch (eOldType) { - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: return true; default: return false; } break; - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: switch (eOldType) { - case css::util::NumberFormat::TIME: - case css::util::NumberFormat::DATE: + case SvNumFormatType::TIME: + case SvNumFormatType::DATE: return true; default: return false; @@ -1224,25 +1224,25 @@ bool SvNumberFormatter::IsCompatible(short eOldType, short eNewType) } -sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType ) +sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( SvNumFormatType nType ) { sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge ); sal_uInt32 nSearch; switch( nType ) { - case css::util::NumberFormat::DATE: + case SvNumFormatType::DATE: nSearch = CLOffset + ZF_STANDARD_DATE; break; - case css::util::NumberFormat::TIME: + case SvNumFormatType::TIME: nSearch = CLOffset + ZF_STANDARD_TIME; break; - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: nSearch = CLOffset + ZF_STANDARD_DATETIME; break; - case css::util::NumberFormat::PERCENT: + case SvNumFormatType::PERCENT: nSearch = CLOffset + ZF_STANDARD_PERCENT; break; - case css::util::NumberFormat::SCIENTIFIC: + case SvNumFormatType::SCIENTIFIC: nSearch = CLOffset + ZF_STANDARD_SCIENTIFIC; break; default: @@ -1273,19 +1273,19 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType ) { // none found, use old fixed standards switch( nType ) { - case css::util::NumberFormat::DATE: + case SvNumFormatType::DATE: nDefaultFormat = CLOffset + ZF_STANDARD_DATE; break; - case css::util::NumberFormat::TIME: + case SvNumFormatType::TIME: nDefaultFormat = CLOffset + ZF_STANDARD_TIME+1; break; - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: nDefaultFormat = CLOffset + ZF_STANDARD_DATETIME; break; - case css::util::NumberFormat::PERCENT: + case SvNumFormatType::PERCENT: nDefaultFormat = CLOffset + ZF_STANDARD_PERCENT+1; break; - case css::util::NumberFormat::SCIENTIFIC: + case SvNumFormatType::SCIENTIFIC: nDefaultFormat = CLOffset + ZF_STANDARD_SCIENTIFIC; break; default: @@ -1298,7 +1298,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType ) } -sal_uInt32 SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge ) +sal_uInt32 SvNumberFormatter::GetStandardFormat( SvNumFormatType eType, LanguageType eLnge ) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); if (eLnge == LANGUAGE_DONTKNOW) @@ -1308,24 +1308,24 @@ sal_uInt32 SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge sal_uInt32 CLOffset = ImpGenerateCL(eLnge); switch(eType) { - case css::util::NumberFormat::CURRENCY: + case SvNumFormatType::CURRENCY: return ( eLnge == LANGUAGE_SYSTEM ) ? ImpGetDefaultSystemCurrencyFormat() : ImpGetDefaultCurrencyFormat(); - case css::util::NumberFormat::DATE: - case css::util::NumberFormat::TIME: - case css::util::NumberFormat::DATETIME: - case css::util::NumberFormat::PERCENT: - case css::util::NumberFormat::SCIENTIFIC: + case SvNumFormatType::DATE: + case SvNumFormatType::TIME: + case SvNumFormatType::DATETIME: + case SvNumFormatType::PERCENT: + case SvNumFormatType::SCIENTIFIC: return ImpGetDefaultFormat( eType ); - case css::util::NumberFormat::FRACTION: + case SvNumFormatType::FRACTION: return CLOffset + ZF_STANDARD_FRACTION; - case css::util::NumberFormat::LOGICAL: + case SvNumFormatType::LOGICAL: return CLOffset + ZF_STANDARD_LOGICAL; - case css::util::NumberFormat::TEXT: + case SvNumFormatType::TEXT: return CLOffset + ZF_STANDARD_TEXT; - case css::util::NumberFormat::ALL: - case css::util::NumberFormat::DEFINED: - case css::util::NumberFormat::NUMBER: - case css::util::NumberFormat::UNDEFINED: + case SvNumFormatType::ALL: + case SvNumFormatType::DEFINED: + case SvNumFormatType::NUMBER: + case SvNumFormatType::UNDEFINED: default: return CLOffset + ZF_STANDARD; } @@ -1342,7 +1342,7 @@ bool SvNumberFormatter::IsSpecialStandardFormat( sal_uInt32 nFIndex, ; } -sal_uInt32 SvNumberFormatter::GetStandardFormat( sal_uInt32 nFIndex, short eType, +sal_uInt32 SvNumberFormatter::GetStandardFormat( sal_uInt32 nFIndex, SvNumFormatType eType, LanguageType eLnge ) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); @@ -1376,12 +1376,12 @@ sal_uInt32 SvNumberFormatter::GetTimeFormat( double fNumber, LanguageType eLnge if ( bSign || fNumber >= 1.0 ) return GetFormatIndex( NF_TIME_HH_MMSS, eLnge ); else - return GetStandardFormat( css::util::NumberFormat::TIME, eLnge ); + return GetStandardFormat( SvNumFormatType::TIME, eLnge ); } } sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIndex, - short eType, LanguageType eLnge ) + SvNumFormatType eType, LanguageType eLnge ) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); if ( IsSpecialStandardFormat( nFIndex, eLnge ) ) @@ -1389,14 +1389,14 @@ sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIn switch( eType ) { - case css::util::NumberFormat::TIME : + case SvNumFormatType::TIME : return GetTimeFormat( fNumber, eLnge); default: return GetStandardFormat( eType, eLnge ); } } -sal_uInt32 SvNumberFormatter::GuessDateTimeFormat( short& rType, double fNumber, LanguageType eLnge ) +sal_uInt32 SvNumberFormatter::GuessDateTimeFormat( SvNumFormatType& rType, double fNumber, LanguageType eLnge ) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); // Categorize the format according to the implementation of @@ -1406,32 +1406,32 @@ sal_uInt32 SvNumberFormatter::GuessDateTimeFormat( short& rType, double fNumber, if (0.0 <= fNumber && fNumber < 1.0) { // Clearly a time. - rType = util::NumberFormat::TIME; + rType = SvNumFormatType::TIME; nRet = GetTimeFormat( fNumber, eLnge); } else if (fabs( fNumber) * 24 < 0x7fff) { // Assuming time within 32k hours or 3.7 years. - rType = util::NumberFormat::TIME; + rType = SvNumFormatType::TIME; nRet = GetTimeFormat( fNumber, eLnge); } else if (rtl::math::approxFloor( fNumber) != fNumber) { // Date+Time. - rType = util::NumberFormat::DATETIME; + rType = SvNumFormatType::DATETIME; nRet = GetFormatIndex( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, eLnge); } else { // Date only. - rType = util::NumberFormat::DATE; + rType = SvNumFormatType::DATE; nRet = GetFormatIndex( NF_DATE_SYS_DDMMYYYY, eLnge); } return nRet; } sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex, - short eType, LanguageType eLang, + SvNumFormatType eType, LanguageType eLang, SvNumberformat const * pFormat ) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); @@ -1439,7 +1439,7 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex, switch ( eType ) { // #61619# always edit using 4-digit year - case css::util::NumberFormat::DATE : + case SvNumFormatType::DATE : { // Preserve ISO 8601 format. bool bIsoDate = @@ -1465,7 +1465,7 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex, } } break; - case css::util::NumberFormat::TIME : + case SvNumFormatType::TIME : if (fNumber < 0.0 || fNumber >= 1.0) { /* XXX NOTE: this is a purely arbitrary value within the limits @@ -1482,7 +1482,7 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex, else nKey = GetStandardFormat( fNumber, nFIndex, eType, eLang ); break; - case css::util::NumberFormat::DATETIME : + case SvNumFormatType::DATETIME : if (nFIndex == GetFormatIndex( NF_DATETIME_ISO_YYYYMMDD_HHMMSS, eLang) || (pFormat && pFormat->IsIso8601( 0 ))) nKey = GetFormatIndex( NF_DATETIME_ISO_YYYYMMDD_HHMMSS, eLang ); else @@ -1510,8 +1510,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, LanguageType eLang = pFormat->GetLanguage(); ChangeIntl( eLang ); - short eType = pFormat->GetMaskedType(); - if (eType == 0) + SvNumFormatType eType = pFormat->GetMaskedType(); + if (eType == SvNumFormatType::ALL) { // Mixed types in subformats, use first. /* XXX we could choose a subformat according to fOutNumber and @@ -1522,15 +1522,15 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, sal_uInt16 nOldPrec = pFormatScanner->GetStandardPrec(); bool bPrecChanged = false; - if (eType == css::util::NumberFormat::NUMBER || - eType == css::util::NumberFormat::PERCENT || - eType == css::util::NumberFormat::CURRENCY || - eType == css::util::NumberFormat::SCIENTIFIC || - eType == css::util::NumberFormat::FRACTION) + if (eType == SvNumFormatType::NUMBER || + eType == SvNumFormatType::PERCENT || + eType == SvNumFormatType::CURRENCY || + eType == SvNumFormatType::SCIENTIFIC || + eType == SvNumFormatType::FRACTION) { - if (eType != css::util::NumberFormat::PERCENT) // special treatment of % later + if (eType != SvNumFormatType::PERCENT) // special treatment of % later { - eType = css::util::NumberFormat::NUMBER; + eType = SvNumFormatType::NUMBER; } ChangeStandardPrec(INPUTSTRING_PRECISION); bPrecChanged = true; @@ -1543,7 +1543,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, } if (pFormat) { - if ( eType == css::util::NumberFormat::TIME && pFormat->GetFormatPrecision() ) + if ( eType == SvNumFormatType::TIME && pFormat->GetFormatPrecision() ) { ChangeStandardPrec(INPUTSTRING_PRECISION); bPrecChanged = true; @@ -2277,7 +2277,7 @@ SvNumberformat* SvNumberFormatter::ImpSubstituteEntry( SvNumberformat* pFormat, sal_uInt32 nKey; if (pFormat->IsSystemTimeFormat()) /* TODO: should we have NF_TIME_SYSTEM for consistency? */ - nKey = GetStandardFormat( css::util::NumberFormat::TIME, LANGUAGE_SYSTEM); + nKey = GetStandardFormat( SvNumFormatType::TIME, LANGUAGE_SYSTEM); else if (pFormat->IsSystemLongDateFormat()) /* TODO: either that above, or have a long option for GetStandardFormat() */ nKey = GetFormatIndex( NF_DATE_SYSTEM_LONG, LANGUAGE_SYSTEM); @@ -2314,12 +2314,12 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio if (pStdFormat) { // This is _the_ standard format. - if (LocaleDataWrapper::areChecksEnabled() && pStdFormat->GetType() != css::util::NumberFormat::NUMBER) + if (LocaleDataWrapper::areChecksEnabled() && pStdFormat->GetType() != SvNumFormatType::NUMBER) { LocaleDataWrapper::outputCheckMessage( xLocaleData-> appendLocaleInfo( "SvNumberFormatter::ImpGenerateFormats: General format not NUMBER")); } - pStdFormat->SetType( css::util::NumberFormat::NUMBER ); + pStdFormat->SetType( SvNumFormatType::NUMBER ); pStdFormat->SetStandard(); pStdFormat->SetLastInsertKey( SV_MAX_COUNT_STANDARD_FORMATS, SvNumberformat::FormatterPrivateAccess() ); } @@ -2339,7 +2339,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio std::unique_ptr<SvNumberformat> pNewFormat(new SvNumberformat( aFormatCode, pFormatScanner, pStringScanner, nCheckPos, ActLnge )); - pNewFormat->SetType(css::util::NumberFormat::LOGICAL); + pNewFormat->SetType(SvNumFormatType::LOGICAL); pNewFormat->SetStandard(); if ( !aFTable.emplace(CLOffset + ZF_STANDARD_LOGICAL /* NF_BOOLEAN */, std::move(pNewFormat)).second ) @@ -2351,7 +2351,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio aFormatCode = "@"; pNewFormat.reset(new SvNumberformat( aFormatCode, pFormatScanner, pStringScanner, nCheckPos, ActLnge )); - pNewFormat->SetType(css::util::NumberFormat::TEXT); + pNewFormat->SetType(SvNumFormatType::TEXT); pNewFormat->SetStandard(); if ( !aFTable.emplace( CLOffset + ZF_STANDARD_TEXT /* NF_TEXT */, std::move(pNewFormat)).second ) @@ -2851,12 +2851,12 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, { eLnge = IniLnge; } - short eType = GetType(nIndex); + SvNumFormatType eType = GetType(nIndex); ImpGenerateCL(eLnge); // create new standard formats if necessary utl::DigitGroupingIterator aGrouping( xLocaleData->getDigitGrouping()); // always group of 3 for Engineering notation - const sal_Int32 nDigitsInFirstGroup = ( bThousand && (eType == css::util::NumberFormat::SCIENTIFIC) ) ? 3 : aGrouping.get(); + const sal_Int32 nDigitsInFirstGroup = ( bThousand && (eType == SvNumFormatType::SCIENTIFIC) ) ? 3 : aGrouping.get(); const OUString& rThSep = GetNumThousandSep(); SvNumberformat* pFormat = GetFormatEntry( nIndex ); @@ -2870,7 +2870,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, sString.append('#'); else { - if (eType == css::util::NumberFormat::SCIENTIFIC) + if (eType == SvNumFormatType::SCIENTIFIC) { // for scientific, bThousand is used for Engineering notation sString.append("###"); } @@ -2895,7 +2895,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, } if ( bThousand ) { - sal_Int32 nDigits = (eType == css::util::NumberFormat::SCIENTIFIC) ? 3*((nLeadingZeros-1)/3 + 1) : nDigitsInFirstGroup + 1; + sal_Int32 nDigits = (eType == SvNumFormatType::SCIENTIFIC) ? 3*((nLeadingZeros-1)/3 + 1) : nDigitsInFirstGroup + 1; for (sal_Int32 i = nLeadingZeros; i < nDigits; i++) { if ( i % nDigitsInFirstGroup == 0 ) @@ -2904,16 +2904,16 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, } } } - if (nPrecision > 0 && eType != css::util::NumberFormat::FRACTION ) + if (nPrecision > 0 && eType != SvNumFormatType::FRACTION ) { sString.append(GetNumDecimalSep()); padToLength(sString, sString.getLength() + nPrecision, '0'); } - if (eType == css::util::NumberFormat::PERCENT) + if (eType == SvNumFormatType::PERCENT) { sString.append('%'); } - else if (eType == css::util::NumberFormat::SCIENTIFIC) + else if (eType == SvNumFormatType::SCIENTIFIC) { OUStringBuffer sOldFormatString = pFormat->GetFormatstring(); sal_Int32 nIndexE = ImpPosToken( sOldFormatString, 'E' ); @@ -2926,7 +2926,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, sString.append( sOldFormatString.copy(nIndexE) ); } } - else if (eType == css::util::NumberFormat::CURRENCY) + else if (eType == SvNumFormatType::CURRENCY) { OUStringBuffer sNegStr(sString); OUString aCurr; @@ -2979,7 +2979,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, } sString.append(sNegStr.makeStringAndClear()); } - else if (eType == css::util::NumberFormat::FRACTION) + else if (eType == SvNumFormatType::FRACTION) { OUString aIntegerFractionDelimiterString = pFormat->GetIntegerFractionDelimiterString( 0 ); if ( aIntegerFractionDelimiterString == " " ) @@ -2997,10 +2997,10 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, else sString.append( '#' ); } - if (eType != css::util::NumberFormat::CURRENCY) + if (eType != SvNumFormatType::CURRENCY) { bool insertBrackets = false; - if ( eType != css::util::NumberFormat::UNDEFINED) + if ( eType != SvNumFormatType::UNDEFINED) { insertBrackets = pFormat->IsNegativeInBracket(); } @@ -3056,7 +3056,7 @@ bool SvNumberFormatter::IsUserDefined(const OUString& sStr, return true; } SvNumberformat* pEntry = GetFormatEntry( nKey ); - return pEntry && ((pEntry->GetType() & css::util::NumberFormat::DEFINED) != 0); + return pEntry && (pEntry->GetType() & SvNumFormatType::DEFINED); } sal_uInt32 SvNumberFormatter::GetEntryKey(const OUString& sStr, @@ -3078,24 +3078,24 @@ sal_uInt32 SvNumberFormatter::GetStandardIndex(LanguageType eLnge) { eLnge = IniLnge; } - return GetStandardFormat(css::util::NumberFormat::NUMBER, eLnge); + return GetStandardFormat(SvNumFormatType::NUMBER, eLnge); } -short SvNumberFormatter::GetType(sal_uInt32 nFIndex) const +SvNumFormatType SvNumberFormatter::GetType(sal_uInt32 nFIndex) const { ::osl::MutexGuard aGuard( GetInstanceMutex() ); - short eType; + SvNumFormatType eType; const SvNumberformat* pFormat = GetFormatEntry( nFIndex ); if (!pFormat) { - eType = css::util::NumberFormat::UNDEFINED; + eType = SvNumFormatType::UNDEFINED; } else { eType = pFormat->GetMaskedType(); - if (eType == 0) + if (eType == SvNumFormatType::ALL) { - eType = css::util::NumberFormat::DEFINED; + eType = SvNumFormatType::DEFINED; } } return eType; @@ -3448,7 +3448,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat() if ( nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) { sal_Int32 nCheck; - short nType; + SvNumFormatType nType; NfWSStringsDtor aCurrList; sal_uInt16 nDefault = GetCurrencyFormatStrings( aCurrList, GetCurrencyEntry( LANGUAGE_SYSTEM ), false ); @@ -3480,7 +3480,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat() while ( it2 != aFTable.end() && (nKey = it2->first) >= CLOffset && nKey < nStopKey ) { const SvNumberformat* pEntry = it2->second.get(); - if ( pEntry->IsStandard() && (pEntry->GetType() & css::util::NumberFormat::CURRENCY) ) + if ( pEntry->IsStandard() && (pEntry->GetType() & SvNumFormatType::CURRENCY) ) { nDefaultCurrencyFormat = nKey; break; // while @@ -3499,7 +3499,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat() { // if already loaded or user defined nDefaultSystemCurrencyFormat // will be set to the right value - short nType; + SvNumFormatType nType; PutEntry( aCurrList[ nDefault ], nCheck, nType, nDefaultCurrencyFormat, ActLnge ); DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" ); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index d9368ea7ea35..de4dd24398b3 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -269,7 +269,7 @@ sal_uInt8 SvNumberNatNum::MapNatNumToDBNum( sal_uInt8 nNatNum, LanguageType eLan ImpSvNumFor::ImpSvNumFor() { nStringsCnt = 0; - aI.eScannedType = css::util::NumberFormat::UNDEFINED; + aI.eScannedType = SvNumFormatType::UNDEFINED; aI.bThousand = false; aI.nThousand = 0; aI.nCntPre = 0; @@ -793,7 +793,7 @@ SvNumberformat::SvNumberformat(OUString& rString, fLimit2 = 0.0; eOp1 = NUMBERFORMAT_OP_NO; eOp2 = NUMBERFORMAT_OP_NO; - eType = css::util::NumberFormat::DEFINED; + eType = SvNumFormatType::DEFINED; bool bCancel = false; bool bCondition = false; @@ -840,10 +840,10 @@ SvNumberformat::SvNumberformat(OUString& rString, sal_Int32 nCntChars = ImpGetNumber(sBuff, nPos, sStr); if (nCntChars > 0) { - short F_Type = css::util::NumberFormat::UNDEFINED; + SvNumFormatType F_Type = SvNumFormatType::UNDEFINED; if (!pISc->IsNumberFormat(sStr, F_Type, fNumber, nullptr) || - ( F_Type != css::util::NumberFormat::NUMBER && - F_Type != css::util::NumberFormat::SCIENTIFIC) ) + ( F_Type != SvNumFormatType::NUMBER && + F_Type != SvNumFormatType::SCIENTIFIC) ) { fNumber = 0.0; nPos = nPos - nCntChars; @@ -1061,7 +1061,7 @@ SvNumberformat::SvNumberformat(OUString& rString, if (sStr.isEmpty()) { // Empty sub format. - NumFor[nIndex].Info().eScannedType = css::util::NumberFormat::EMPTY; + NumFor[nIndex].Info().eScannedType = SvNumFormatType::EMPTY; } else { @@ -1117,7 +1117,7 @@ SvNumberformat::SvNumberformat(OUString& rString, // format the omitted subformats act like they were // not specified and "inherited" the first format, // e.g. 0;@ behaves like 0;-0;0;@ - if (pSc->GetScannedType() == css::util::NumberFormat::TEXT) + if (pSc->GetScannedType() == SvNumFormatType::TEXT) { // Reset conditions, reverting any set above. if (nIndex == 1) @@ -1136,11 +1136,11 @@ SvNumberformat::SvNumberformat(OUString& rString, } else if (nIndex == 3) { // #77026# Everything recognized IS text - NumFor[nIndex].Info().eScannedType = css::util::NumberFormat::TEXT; + NumFor[nIndex].Info().eScannedType = SvNumFormatType::TEXT; } else if ( NumFor[nIndex].Info().eScannedType != eType) { - eType = css::util::NumberFormat::DEFINED; + eType = SvNumFormatType::DEFINED; } } else @@ -1190,7 +1190,7 @@ SvNumberformat::SvNumberformat(OUString& rString, { eOp2 = NUMBERFORMAT_OP_LT; // undefined condition, default: < 0 } - NumFor[nIndex+1].Info().eScannedType = css::util::NumberFormat::EMPTY; + NumFor[nIndex+1].Info().eScannedType = SvNumFormatType::EMPTY; if (sBuff[nPos-1] != ';') sBuff.insert( nPos++, ';'); } @@ -1198,13 +1198,13 @@ SvNumberformat::SvNumberformat(OUString& rString, { // #83510# A 4th subformat explicitly specified to be empty // hides any text. Need the type here for HasTextFormat() - NumFor[3].Info().eScannedType = css::util::NumberFormat::TEXT; + NumFor[3].Info().eScannedType = SvNumFormatType::TEXT; } bCancel = true; } if ( NumFor[nIndex].GetNatNum().IsSet() ) { - NumFor[nIndex].SetNatNumDate( (NumFor[nIndex].Info().eScannedType & css::util::NumberFormat::DATE) != 0 ); + NumFor[nIndex].SetNatNumDate( bool(NumFor[nIndex].Info().eScannedType & SvNumFormatType::DATE) ); } } @@ -1214,12 +1214,12 @@ SvNumberformat::SvNumberformat(OUString& rString, // substitute type. if (IsSystemTimeFormat()) { - if ((eType & ~css::util::NumberFormat::DEFINED) != css::util::NumberFormat::TIME) + if ((eType & ~SvNumFormatType::DEFINED) != SvNumFormatType::TIME) nCheckPos = std::max<sal_Int32>( sBuff.indexOf(']') + 1, 1); } else if (IsSystemLongDateFormat()) { - if ((eType & ~css::util::NumberFormat::DEFINED) != css::util::NumberFormat::DATE) + if ((eType & ~SvNumFormatType::DEFINED) != SvNumFormatType::DATE) nCheckPos = std::max<sal_Int32>( sBuff.indexOf(']') + 1, 1); } else @@ -1851,7 +1851,7 @@ void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter, { sal_Int32 nCheckPos; sal_uInt32 nKey; - short nType = eType; + SvNumFormatType nType = eType; OUString aFormatString( sFormatstring ); rConverter.PutandConvertEntry( aFormatString, nCheckPos, nType, nKey, eConvertFrom, eConvertTo ); @@ -2005,7 +2005,7 @@ void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, OUString& rOutS void SvNumberformat::ImpGetOutputInputLine(double fNumber, OUString& OutString) const { bool bModified = false; - if ( (eType & css::util::NumberFormat::PERCENT) && (fabs(fNumber) < D_MAX_D_BY_100)) + if ( (eType & SvNumFormatType::PERCENT) && (fabs(fNumber) < D_MAX_D_BY_100)) { if (fNumber == 0.0) { @@ -2027,7 +2027,7 @@ void SvNumberformat::ImpGetOutputInputLine(double fNumber, OUString& OutString) rtl_math_DecimalPlaces_Max, GetFormatter().GetNumDecimalSep()[0], true ); - if ( eType & css::util::NumberFormat::PERCENT && bModified) + if ( eType & SvNumFormatType::PERCENT && bModified) { OutString += "%"; } @@ -2088,7 +2088,7 @@ void SvNumberformat::GetOutputString(const OUString& sString, { OUStringBuffer sOutBuff; sal_uInt16 nIx; - if (eType & css::util::NumberFormat::TEXT) + if (eType & SvNumFormatType::TEXT) { nIx = 0; } @@ -2103,7 +2103,7 @@ void SvNumberformat::GetOutputString(const OUString& sString, } *ppColor = NumFor[nIx].GetColor(); const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - if (rInfo.eScannedType == css::util::NumberFormat::TEXT) + if (rInfo.eScannedType == SvNumFormatType::TEXT) { const sal_uInt16 nCnt = NumFor[nIx].GetCount(); for (sal_uInt16 i = 0; i < nCnt; i++) @@ -2256,7 +2256,7 @@ bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, OUSt { using namespace std; - if (eType != css::util::NumberFormat::NUMBER) + if (eType != SvNumFormatType::NUMBER) { return false; } @@ -2335,7 +2335,7 @@ bool SvNumberformat::GetOutputString(double fNumber, OUStringBuffer sBuff; OutString.clear(); *ppColor = nullptr; // No color change - if (eType & css::util::NumberFormat::LOGICAL) + if (eType & SvNumFormatType::LOGICAL) { if (fNumber) { @@ -2347,7 +2347,7 @@ bool SvNumberformat::GetOutputString(double fNumber, } return false; } - if (eType & css::util::NumberFormat::TEXT) + if (eType & SvNumFormatType::TEXT) { ImpGetOutputStandard(fNumber, sBuff); OutString = sBuff.makeStringAndClear(); @@ -2363,7 +2363,7 @@ bool SvNumberformat::GetOutputString(double fNumber, } switch (eType) { - case css::util::NumberFormat::NUMBER: // Standard number format + case SvNumFormatType::NUMBER: // Standard number format if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION) { if (::rtl::math::isSignBitSet(fNumber)) @@ -2401,18 +2401,19 @@ bool SvNumberformat::GetOutputString(double fNumber, ImpGetOutputStandard(fNumber, sBuff); bHadStandard = true; break; - case css::util::NumberFormat::DATE: + case SvNumFormatType::DATE: bRes |= ImpGetDateOutput(fNumber, 0, sBuff); bHadStandard = true; break; - case css::util::NumberFormat::TIME: + case SvNumFormatType::TIME: bRes |= ImpGetTimeOutput(fNumber, 0, sBuff); bHadStandard = true; break; - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: bRes |= ImpGetDateTimeOutput(fNumber, 0, sBuff); bHadStandard = true; break; + default: break; } } if ( !bHadStandard ) @@ -2427,7 +2428,7 @@ bool SvNumberformat::GetOutputString(double fNumber, *ppColor = NumFor[nIx].GetColor(); const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); const sal_uInt16 nCnt = NumFor[nIx].GetCount(); - if (nCnt == 0 && rInfo.eScannedType == css::util::NumberFormat::EMPTY) + if (nCnt == 0 && rInfo.eScannedType == SvNumFormatType::EMPTY) { return false; // Empty => nothing } @@ -2439,8 +2440,8 @@ bool SvNumberformat::GetOutputString(double fNumber, } switch (rInfo.eScannedType) { - case css::util::NumberFormat::TEXT: - case css::util::NumberFormat::DEFINED: + case SvNumFormatType::TEXT: + case SvNumFormatType::DEFINED: for (sal_uInt16 i = 0; i < nCnt; i++) { switch (rInfo.nTypeArray[i]) @@ -2470,26 +2471,27 @@ bool SvNumberformat::GetOutputString(double fNumber, } } break; - case css::util::NumberFormat::DATE: + case SvNumFormatType::DATE: bRes |= ImpGetDateOutput(fNumber, nIx, sBuff); break; - case css::util::NumberFormat::TIME: + case SvNumFormatType::TIME: bRes |= ImpGetTimeOutput(fNumber, nIx, sBuff); break; - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: bRes |= ImpGetDateTimeOutput(fNumber, nIx, sBuff); break; - case css::util::NumberFormat::NUMBER: - case css::util::NumberFormat::PERCENT: - case css::util::NumberFormat::CURRENCY: + case SvNumFormatType::NUMBER: + case SvNumFormatType::PERCENT: + case SvNumFormatType::CURRENCY: bRes |= ImpGetNumberOutput(fNumber, nIx, sBuff); break; - case css::util::NumberFormat::FRACTION: + case SvNumFormatType::FRACTION: bRes |= ImpGetFractionOutput(fNumber, nIx, sBuff); break; - case css::util::NumberFormat::SCIENTIFIC: + case SvNumFormatType::SCIENTIFIC: bRes |= ImpGetScientificOutput(fNumber, nIx, sBuff); break; + default: break; } } OutString = sBuff.makeStringAndClear(); @@ -3390,7 +3392,7 @@ void SvNumberformat::ImpAppendEraG( OUStringBuffer& OutString, bool SvNumberformat::ImpIsIso8601( const ImpSvNumFor& rNumFor ) const { bool bIsIso = false; - if ((eType & css::util::NumberFormat::DATE) == css::util::NumberFormat::DATE) + if (eType & SvNumFormatType::DATE) { enum State { @@ -4089,7 +4091,7 @@ bool SvNumberformat::ImpGetNumberOutput(double fNumber, } } const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - if (rInfo.eScannedType == css::util::NumberFormat::PERCENT) + if (rInfo.eScannedType == SvNumFormatType::PERCENT) { if (fNumber < D_MAX_D_BY_100) { @@ -4607,7 +4609,7 @@ void SvNumberformat::GetFormatSpecialInfo(bool& bThousand, { // as before: take info from nNumFor=0 for whole format (for dialog etc.) - short nDummyType; + SvNumFormatType nDummyType; GetNumForInfo( 0, nDummyType, bThousand, nPrecision, nLeadingCnt ); // "negative in red" is only useful for the whole format @@ -4617,7 +4619,7 @@ void SvNumberformat::GetFormatSpecialInfo(bool& bThousand, && (*pColor == ImpSvNumberformatScan::GetRedColor()); } -void SvNumberformat::GetNumForInfo( sal_uInt16 nNumFor, short& rScannedType, +void SvNumberformat::GetNumForInfo( sal_uInt16 nNumFor, SvNumFormatType& rScannedType, bool& bThousand, sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt ) const { // take info from a specified sub-format (for XML export) @@ -4630,14 +4632,14 @@ void SvNumberformat::GetNumForInfo( sal_uInt16 nNumFor, short& rScannedType, const ImpSvNumberformatInfo& rInfo = NumFor[nNumFor].Info(); rScannedType = rInfo.eScannedType; bThousand = rInfo.bThousand; - nPrecision = (rInfo.eScannedType == css::util::NumberFormat::FRACTION) + nPrecision = (rInfo.eScannedType == SvNumFormatType::FRACTION) ? rInfo.nCntExp // number of denominator digits for fraction : rInfo.nCntPost; sal_Int32 nPosHash = 1; - if ( rInfo.eScannedType == css::util::NumberFormat::FRACTION && + if ( rInfo.eScannedType == SvNumFormatType::FRACTION && ( (nPosHash += GetDenominatorString(nNumFor).indexOf('#')) > 0 ) ) nPrecision -= nPosHash; - if (bStandard && rInfo.eScannedType == css::util::NumberFormat::NUMBER) + if (bStandard && rInfo.eScannedType == SvNumFormatType::NUMBER) { // StandardFormat nLeadingCnt = 1; @@ -4781,7 +4783,7 @@ bool SvNumberformat::HasPositiveBracketPlaceholder() const DateOrder SvNumberformat::GetDateOrder() const { - if ( (eType & css::util::NumberFormat::DATE) == css::util::NumberFormat::DATE ) + if ( eType & SvNumFormatType::DATE ) { auto& rTypeArray = NumFor[0].Info().nTypeArray; sal_uInt16 nCnt = NumFor[0].GetCount(); @@ -4818,7 +4820,7 @@ DateOrder SvNumberformat::GetDateOrder() const sal_uInt32 SvNumberformat::GetExactDateOrder() const { sal_uInt32 nRet = 0; - if ( (eType & css::util::NumberFormat::DATE) != css::util::NumberFormat::DATE ) + if ( !(eType & SvNumFormatType::DATE) ) { SAL_WARN( "svl.numbers", "SvNumberformat::GetExactDateOrder: no date" ); return nRet; @@ -5004,7 +5006,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords, int nSub = 0; // subformats delimited so far for ( int n=0; n<4; n++ ) { - if ( n > 0 && NumFor[n].Info().eScannedType != css::util::NumberFormat::UNDEFINED ) + if ( n > 0 && NumFor[n].Info().eScannedType != SvNumFormatType::UNDEFINED ) { nSem++; } diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 3937896bce70..a78dbfdc0530 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -1238,7 +1238,7 @@ void ImpSvNumberformatScan::Reset() { nStringsCnt = 0; nResultStringsCnt = 0; - eScannedType = css::util::NumberFormat::UNDEFINED; + eScannedType = SvNumFormatType::UNDEFINED; bExp = false; bThousand = false; nThousand = 0; @@ -1269,7 +1269,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType() sal_Int32 nPos = 0; sal_uInt16 i = 0; - short eNewType; + SvNumFormatType eNewType; bool bMatchBracket = false; bool bHaveGeneral = false; // if General/Standard encountered bool bIsTimeDetected =false; // hour or second found in format @@ -1286,7 +1286,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType() switch (nTypeArray[i]) { case NF_KEY_E: // E - eNewType = css::util::NumberFormat::SCIENTIFIC; + eNewType = SvNumFormatType::SCIENTIFIC; break; case NF_KEY_H: // H case NF_KEY_HH: // HH @@ -1299,7 +1299,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType() SAL_FALLTHROUGH; case NF_KEY_AMPM: // AM,A,PM,P case NF_KEY_AP: - eNewType = css::util::NumberFormat::TIME; + eNewType = SvNumFormatType::TIME; break; case NF_KEY_M: // M case NF_KEY_MM: // MM @@ -1327,7 +1327,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType() bIsTimeDetected || // tdf#101147 PreviousChar(i) == '[' ) // [M { - eNewType = css::util::NumberFormat::TIME; + eNewType = SvNumFormatType::TIME; if ( nTypeArray[i] == NF_KEY_M || nTypeArray[i] == NF_KEY_MM ) { nTypeArray[i] -= 2; // 6 -> 4, 7 -> 5 @@ -1337,7 +1337,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType() } else { - eNewType = css::util::NumberFormat::DATE; + eNewType = SvNumFormatType::DATE; if ( nTypeArray[i] == NF_KEY_MI || nTypeArray[i] == NF_KEY_MMI ) { // follow resolution of tdf#33689 for Finnish nTypeArray[i] += 2; // 4 -> 6, 5 -> 7 @@ -1368,18 +1368,18 @@ sal_Int32 ImpSvNumberformatScan::ScanType() case NF_KEY_GGG : // GGG case NF_KEY_R : // R case NF_KEY_RR : // RR - eNewType = css::util::NumberFormat::DATE; + eNewType = SvNumFormatType::DATE; bIsTimeDetected = false; break; case NF_KEY_CCC: // CCC - eNewType = css::util::NumberFormat::CURRENCY; + eNewType = SvNumFormatType::CURRENCY; break; case NF_KEY_GENERAL: // Standard - eNewType = css::util::NumberFormat::NUMBER; + eNewType = SvNumFormatType::NUMBER; bHaveGeneral = true; break; default: - eNewType = css::util::NumberFormat::UNDEFINED; + eNewType = SvNumFormatType::UNDEFINED; break; } } @@ -1389,15 +1389,15 @@ sal_Int32 ImpSvNumberformatScan::ScanType() { case '#': case '?': - eNewType = css::util::NumberFormat::NUMBER; + eNewType = SvNumFormatType::NUMBER; break; case '0': - if ( (eScannedType & css::util::NumberFormat::TIME) == css::util::NumberFormat::TIME ) + if ( eScannedType & SvNumFormatType::TIME ) { if ( Is100SecZero( i, bDecSep ) ) { bDecSep = true; // subsequent 0's - eNewType = css::util::NumberFormat::TIME; + eNewType = SvNumFormatType::TIME; } else { @@ -1406,28 +1406,28 @@ sal_Int32 ImpSvNumberformatScan::ScanType() } else { - eNewType = css::util::NumberFormat::NUMBER; + eNewType = SvNumFormatType::NUMBER; } break; case '%': - eNewType = css::util::NumberFormat::PERCENT; + eNewType = SvNumFormatType::PERCENT; break; case '/': - eNewType = css::util::NumberFormat::FRACTION; + eNewType = SvNumFormatType::FRACTION; break; case '[': if ( i < nStringsCnt-1 && nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && sStrArray[i+1][0] == '$' ) { - eNewType = css::util::NumberFormat::CURRENCY; + eNewType = SvNumFormatType::CURRENCY; bMatchBracket = true; } else if ( i < nStringsCnt-1 && nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && sStrArray[i+1][0] == '~' ) { - eNewType = css::util::NumberFormat::DATE; + eNewType = SvNumFormatType::DATE; bMatchBracket = true; } else @@ -1439,7 +1439,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType() nIndexNex == NF_KEY_MM || // MM nIndexNex == NF_KEY_S || // S nIndexNex == NF_KEY_SS ) // SS - eNewType = css::util::NumberFormat::TIME; + eNewType = SvNumFormatType::TIME; else { return nPos; // Error @@ -1447,44 +1447,44 @@ sal_Int32 ImpSvNumberformatScan::ScanType() } break; case '@': - eNewType = css::util::NumberFormat::TEXT; + eNewType = SvNumFormatType::TEXT; break; default: if (pLoc->getTime100SecSep() == sStrArray[i]) { bDecSep = true; // for SS,0 } - eNewType = css::util::NumberFormat::UNDEFINED; + eNewType = SvNumFormatType::UNDEFINED; break; } } - if (eScannedType == css::util::NumberFormat::UNDEFINED) + if (eScannedType == SvNumFormatType::UNDEFINED) { eScannedType = eNewType; } - else if (eScannedType == css::util::NumberFormat::TEXT || eNewType == css::util::NumberFormat::TEXT) + else if (eScannedType == SvNumFormatType::TEXT || eNewType == SvNumFormatType::TEXT) { - eScannedType = css::util::NumberFormat::TEXT; // Text always remains text + eScannedType = SvNumFormatType::TEXT; // Text always remains text } - else if (eNewType == css::util::NumberFormat::UNDEFINED) + else if (eNewType == SvNumFormatType::UNDEFINED) { // Remains as is } else if (eScannedType != eNewType) { switch (eScannedType) { - case css::util::NumberFormat::DATE: + case SvNumFormatType::DATE: switch (eNewType) { - case css::util::NumberFormat::TIME: - eScannedType = css::util::NumberFormat::DATETIME; + case SvNumFormatType::TIME: + eScannedType = SvNumFormatType::DATETIME; break; - case css::util::NumberFormat::FRACTION: // DD/MM + case SvNumFormatType::FRACTION: // DD/MM break; default: if (nCurrPos >= 0) { - eScannedType = css::util::NumberFormat::UNDEFINED; + eScannedType = SvNumFormatType::UNDEFINED; } else if ( sStrArray[i] != pFormatter->GetDateSep() ) { @@ -1492,18 +1492,18 @@ sal_Int32 ImpSvNumberformatScan::ScanType() } } break; - case css::util::NumberFormat::TIME: + case SvNumFormatType::TIME: switch (eNewType) { - case css::util::NumberFormat::DATE: - eScannedType = css::util::NumberFormat::DATETIME; + case SvNumFormatType::DATE: + eScannedType = SvNumFormatType::DATETIME; break; - case css::util::NumberFormat::FRACTION: // MM/SS + case SvNumFormatType::FRACTION: // MM/SS break; default: if (nCurrPos >= 0) { - eScannedType = css::util::NumberFormat::UNDEFINED; + eScannedType = SvNumFormatType::UNDEFINED; } else if (pLoc->getTimeSep() != sStrArray[i]) { @@ -1512,18 +1512,18 @@ sal_Int32 ImpSvNumberformatScan::ScanType() break; } break; - case css::util::NumberFormat::DATETIME: + case SvNumFormatType::DATETIME: switch (eNewType) { - case css::util::NumberFormat::TIME: - case css::util::NumberFormat::DATE: + case SvNumFormatType::TIME: + case SvNumFormatType::DATE: break; - case css::util::NumberFormat::FRACTION: // DD/MM + case SvNumFormatType::FRACTION: // DD/MM break; default: if (nCurrPos >= 0) { - eScannedType = css::util::NumberFormat::UNDEFINED; + eScannedType = SvNumFormatType::UNDEFINED; } else if ( pFormatter->GetDateSep() != sStrArray[i] && pLoc->getTimeSep() != sStrArray[i] ) @@ -1532,37 +1532,37 @@ sal_Int32 ImpSvNumberformatScan::ScanType() } } break; - case css::util::NumberFormat::PERCENT: + case SvNumFormatType::PERCENT: switch (eNewType) { - case css::util::NumberFormat::NUMBER: // Only number to percent + case SvNumFormatType::NUMBER: // Only number to percent break; default: return nPos; } break; - case css::util::NumberFormat::SCIENTIFIC: + case SvNumFormatType::SCIENTIFIC: switch (eNewType) { - case css::util::NumberFormat::NUMBER: // Only number to E + case SvNumFormatType::NUMBER: // Only number to E break; default: return nPos; } break; - case css::util::NumberFormat::NUMBER: + case SvNumFormatType::NUMBER: switch (eNewType) { - case css::util::NumberFormat::SCIENTIFIC: - case css::util::NumberFormat::PERCENT: - case css::util::NumberFormat::FRACTION: - case css::util::NumberFormat::CURRENCY: + case SvNumFormatType::SCIENTIFIC: + case SvNumFormatType::PERCENT: + case SvNumFormatType::FRACTION: + case SvNumFormatType::CURRENCY: eScannedType = eNewType; break; default: if (nCurrPos >= 0) { - eScannedType = css::util::NumberFormat::UNDEFINED; + eScannedType = SvNumFormatType::UNDEFINED; } else { @@ -1570,10 +1570,10 @@ sal_Int32 ImpSvNumberformatScan::ScanType() } } break; - case css::util::NumberFormat::FRACTION: + case SvNumFormatType::FRACTION: switch (eNewType) { - case css::util::NumberFormat::NUMBER: // Only number to fraction + case SvNumFormatType::NUMBER: // Only number to fraction break; default: return nPos; @@ -1609,15 +1609,15 @@ sal_Int32 ImpSvNumberformatScan::ScanType() SkipStrings(i, nPos); } - if ((eScannedType == css::util::NumberFormat::NUMBER || - eScannedType == css::util::NumberFormat::UNDEFINED) && + if ((eScannedType == SvNumFormatType::NUMBER || + eScannedType == SvNumFormatType::UNDEFINED) && nCurrPos >= 0 && !bHaveGeneral) { - eScannedType = css::util::NumberFormat::CURRENCY; // old "automatic" currency + eScannedType = SvNumFormatType::CURRENCY; // old "automatic" currency } - if (eScannedType == css::util::NumberFormat::UNDEFINED) + if (eScannedType == SvNumFormatType::UNDEFINED) { - eScannedType = css::util::NumberFormat::DEFINED; + eScannedType = SvNumFormatType::DEFINED; } return 0; // All is fine } @@ -1765,8 +1765,8 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) switch (eScannedType) { - case css::util::NumberFormat::TEXT: - case css::util::NumberFormat::DEFINED: + case SvNumFormatType::TEXT: + case SvNumFormatType::DEFINED: while (i < nStringsCnt) { switch (nTypeArray[i]) @@ -1789,16 +1789,16 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) } // of while break; - case css::util::NumberFormat::NUMBER: - case css::util::NumberFormat::PERCENT: - case css::util::NumberFormat::CURRENCY: - case css::util::NumberFormat::SCIENTIFIC: - case css::util::NumberFormat::FRACTION: + case SvNumFormatType::NUMBER: + case SvNumFormatType::PERCENT: + case SvNumFormatType::CURRENCY: + case SvNumFormatType::SCIENTIFIC: + case SvNumFormatType::FRACTION: while (i < nStringsCnt) { // TODO: rechecking eScannedType is unnecessary. - // This switch-case is for eScannedType == css::util::NumberFormat::FRACTION anyway - if (eScannedType == css::util::NumberFormat::FRACTION && // special case + // This switch-case is for eScannedType == SvNumFormatType::FRACTION anyway + if (eScannedType == SvNumFormatType::FRACTION && // special case nTypeArray[i] == NF_SYMBOLTYPE_DEL && // # ### #/# StringEqualsChar( sOldThousandSep, ' ' ) && // e.g. France or Sweden StringEqualsChar( sStrArray[i], ' ' ) && @@ -1827,7 +1827,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) else if (nTypeArray[i] == NF_SYMBOLTYPE_STRING || // No Strings or nTypeArray[i] > 0) // Keywords { - if (eScannedType == css::util::NumberFormat::SCIENTIFIC && + if (eScannedType == SvNumFormatType::SCIENTIFIC && nTypeArray[i] == NF_KEY_E) // E+ { if (bExp) // Double @@ -1847,7 +1847,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) nCounter = 0; nTypeArray[i] = NF_SYMBOLTYPE_EXP; } - else if (eScannedType == css::util::NumberFormat::FRACTION && + else if (eScannedType == SvNumFormatType::FRACTION && (sStrArray[i][0] == ' ' || ( nTypeArray[i] == NF_SYMBOLTYPE_STRING && (sStrArray[i][0] < '0' || sStrArray[i][0] > '9') ) ) ) { if (!bBlank && !bFrac) // Not double or after a / @@ -1902,7 +1902,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) nCounter = nCntPre; } // don't artificially increment nCntPre for forced denominator - if ( ( eScannedType != css::util::NumberFormat::FRACTION ) && (!nCntPre) ) + if ( ( eScannedType != SvNumFormatType::FRACTION ) && (!nCntPre) ) { nCntPre++; } @@ -1988,7 +1988,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) // currency formats the last dash will be // interpreted literally as a minus sign. // Has to be this ugly. Period. - if ( eScannedType == css::util::NumberFormat::CURRENCY + if ( eScannedType == SvNumFormatType::CURRENCY && rStr.getLength() >= 2 && (i == nStringsCnt-1 || sStrArray[i+1][0] != '-') ) @@ -2186,7 +2186,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) else // . without meaning { if (cSaved == ' ' && - eScannedType == css::util::NumberFormat::FRACTION && + eScannedType == SvNumFormatType::FRACTION && StringEqualsChar( sStrArray[i], ' ' ) ) { if (!bBlank && !bFrac) // no dups @@ -2224,7 +2224,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) } break; case '/': - if (eScannedType == css::util::NumberFormat::FRACTION) + if (eScannedType == SvNumFormatType::FRACTION) { if ( i == 0 || (nTypeArray[i-1] != NF_SYMBOLTYPE_DIGIT && @@ -2254,7 +2254,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) } break; case '[' : - if ( eScannedType == css::util::NumberFormat::CURRENCY && + if ( eScannedType == SvNumFormatType::CURRENCY && i < nStringsCnt-1 && nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && sStrArray[i+1][0] == '$' ) @@ -2320,7 +2320,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) } break; default: // Other Dels - if (eScannedType == css::util::NumberFormat::PERCENT && cHere == '%') + if (eScannedType == SvNumFormatType::PERCENT && cHere == '%') { nTypeArray[i] = NF_SYMBOLTYPE_PERCENT; } @@ -2340,7 +2340,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) i++; } } // of while - if (eScannedType == css::util::NumberFormat::FRACTION) + if (eScannedType == SvNumFormatType::FRACTION) { if (bFrac) { @@ -2447,8 +2447,8 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) } } } - break; // of css::util::NumberFormat::NUMBER - case css::util::NumberFormat::DATE: + break; // of SvNumFormatType::NUMBER + case SvNumFormatType::DATE: while (i < nStringsCnt) { switch (nTypeArray[i]) @@ -2556,8 +2556,8 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) break; } } // of while - break; // of css::util::NumberFormat::DATE - case css::util::NumberFormat::TIME: + break; // of SvNumFormatType::DATE + case SvNumFormatType::TIME: while (i < nStringsCnt) { sal_Unicode cChar; @@ -2696,8 +2696,8 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) { nCntExp = 1; // Remembers AM/PM } - break; // of css::util::NumberFormat::TIME - case css::util::NumberFormat::DATETIME: + break; // of SvNumFormatType::TIME + case SvNumFormatType::DATETIME: while (i < nStringsCnt) { int nCalRet; @@ -2891,16 +2891,16 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) { nCntExp = 1; // Remembers AM/PM } - break; // of css::util::NumberFormat::DATETIME + break; // of SvNumFormatType::DATETIME default: break; } - if (eScannedType == css::util::NumberFormat::SCIENTIFIC && + if (eScannedType == SvNumFormatType::SCIENTIFIC && (nCntPre + nCntPost == 0 || nCntExp == 0)) { return nPos; } - else if (eScannedType == css::util::NumberFormat::FRACTION && (nCntExp > 8 || nCntExp == 0)) + else if (eScannedType == SvNumFormatType::FRACTION && (nCntExp > 8 || nCntExp == 0)) { return nPos; } @@ -3021,7 +3021,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) if ( nTypeArray[i] == NF_SYMBOLTYPE_STRING && sStrArray[i][0] != '\"' ) { - if ( bConvertSystemToSystem && eScannedType == css::util::NumberFormat::CURRENCY ) + if ( bConvertSystemToSystem && eScannedType == SvNumFormatType::CURRENCY ) { // don't stringize automatic currency, will be converted if ( sStrArray[i] == sOldCurSymbol ) @@ -3102,7 +3102,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) case ' ': case '.': case '/': - if (((eScannedType & css::util::NumberFormat::DATE) == 0) && + if (!(eScannedType & SvNumFormatType::DATE) && (StringEqualsChar( pFormatter->GetNumThousandSep(), c) || StringEqualsChar( pFormatter->GetNumDecimalSep(), c) || (c == ' ' && @@ -3111,18 +3111,18 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) { rString += sStrArray[i]; } - else if ((eScannedType & css::util::NumberFormat::DATE) && + else if ((eScannedType & SvNumFormatType::DATE) && StringEqualsChar( pFormatter->GetDateSep(), c)) { rString += sStrArray[i]; } - else if ((eScannedType & css::util::NumberFormat::TIME) && + else if ((eScannedType & SvNumFormatType::TIME) && (StringEqualsChar( pLoc->getTimeSep(), c) || StringEqualsChar( pLoc->getTime100SecSep(), c))) { rString += sStrArray[i]; } - else if (eScannedType & css::util::NumberFormat::FRACTION) + else if (eScannedType & SvNumFormatType::FRACTION) { rString += sStrArray[i]; } @@ -3142,7 +3142,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) if ( RemoveQuotes( sStrArray[i] ) > 0 ) { // update currency up to quoted string - if ( eScannedType == css::util::NumberFormat::CURRENCY ) + if ( eScannedType == SvNumFormatType::CURRENCY ) { // dM -> DM or DM -> $ in old automatic // currency formats, oh my ..., why did we ever introduce them? @@ -3185,7 +3185,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) { i--; // enter switch on next symbol again } - if ( eScannedType == css::util::NumberFormat::CURRENCY && nStringPos < rString.getLength() ) + if ( eScannedType == SvNumFormatType::CURRENCY && nStringPos < rString.getLength() ) { // same as above, since last RemoveQuotes OUString aTmp( pChrCls->uppercase( sStrArray[iPos], nArrPos, diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index d6da6d3daab6..309f963c9c21 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -168,7 +168,7 @@ public: SvNumberFormatter* GetNumberformatter() { return pFormatter; } // Access to formatter (for zformat.cxx) /// Get type scanned (so far). - short GetScannedType() const { return eScannedType; } + SvNumFormatType GetScannedType() const { return eScannedType; } private: // Private section NfKeywordTable sKeyword; // Syntax keywords @@ -186,7 +186,7 @@ private: // Private section short nTypeArray[NF_MAX_FORMAT_SYMBOLS]; // Array of infos // External Infos: sal_uInt16 nResultStringsCnt; // Result symbol count - short eScannedType; // Type according to scan + SvNumFormatType eScannedType; // Type according to scan bool bThousand; // With thousands marker sal_uInt16 nThousand; // Counts .... series sal_uInt16 nCntPre; // Counts digits of integral part |