diff options
Diffstat (limited to 'svl/source/numbers/zforfind.cxx')
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 448 |
1 files changed, 224 insertions, 224 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 8c63ed903825..ed845372b76e 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -61,11 +61,11 @@ #endif -const BYTE ImpSvNumberInputScan::nMatchedEndString = 0x01; -const BYTE ImpSvNumberInputScan::nMatchedMidString = 0x02; -const BYTE ImpSvNumberInputScan::nMatchedStartString = 0x04; -const BYTE ImpSvNumberInputScan::nMatchedVirgin = 0x08; -const BYTE ImpSvNumberInputScan::nMatchedUsedAsReturn = 0x10; +const sal_uInt8 ImpSvNumberInputScan::nMatchedEndString = 0x01; +const sal_uInt8 ImpSvNumberInputScan::nMatchedMidString = 0x02; +const sal_uInt8 ImpSvNumberInputScan::nMatchedStartString = 0x04; +const sal_uInt8 ImpSvNumberInputScan::nMatchedVirgin = 0x08; +const sal_uInt8 ImpSvNumberInputScan::nMatchedUsedAsReturn = 0x10; /* It is not clear how we want timezones to be handled. Convert them to local * time isn't wanted, as it isn't done in any other place and timezone @@ -117,11 +117,11 @@ void ImpSvNumberInputScan::Reset() // ER 16.06.97 18:56 Vorbelegung erfolgt jetzt in NumberStringDivision, // wozu immer alles loeschen wenn einiges wieder benutzt oder gar nicht // gebraucht wird.. - for (USHORT i = 0; i < SV_MAX_ANZ_INPUT_STRINGS; i++) + for (sal_uInt16 i = 0; i < SV_MAX_ANZ_INPUT_STRINGS; i++) { sStrArray[i].Erase(); nNums[i] = SV_MAX_ANZ_INPUT_STRINGS-1; - IsNum[i] = FALSE; + IsNum[i] = sal_False; } #endif nMonth = 0; @@ -149,7 +149,7 @@ void ImpSvNumberInputScan::Reset() //--------------------------------------------------------------------------- // // static -inline BOOL ImpSvNumberInputScan::MyIsdigit( sal_Unicode c ) +inline sal_Bool ImpSvNumberInputScan::MyIsdigit( sal_Unicode c ) { // If the input string wouldn't be converted using TransformInput() we'd // to use something similar to the following and to adapt many places. @@ -158,7 +158,7 @@ inline BOOL ImpSvNumberInputScan::MyIsdigit( sal_Unicode c ) if ( c < 128 ) return isdigit( (unsigned char) c ) != 0; if ( c < 256 ) - return FALSE; + return sal_False; String aTmp( c ); return pFormatter->GetCharClass()->isDigit( aTmp, 0 ); #else @@ -190,19 +190,19 @@ void ImpSvNumberInputScan::TransformInput( String& rStr ) // Only simple unsigned floating point values without any error detection, // decimal separator has to be '.' -double ImpSvNumberInputScan::StringToDouble( const String& rStr, BOOL bForceFraction ) +double ImpSvNumberInputScan::StringToDouble( const String& rStr, sal_Bool bForceFraction ) { double fNum = 0.0; double fFrac = 0.0; int nExp = 0; xub_StrLen nPos = 0; xub_StrLen nLen = rStr.Len(); - BOOL bPreSep = !bForceFraction; + sal_Bool bPreSep = !bForceFraction; while (nPos < nLen) { if (rStr.GetChar(nPos) == '.') - bPreSep = FALSE; + bPreSep = sal_False; else if (bPreSep) fNum = fNum * 10.0 + (double) (rStr.GetChar(nPos) - '0'); else @@ -246,11 +246,11 @@ enum ScanState // States der Turing-Maschine SsGetString = 3 }; -BOOL ImpSvNumberInputScan::NextNumberStringSymbol( +sal_Bool ImpSvNumberInputScan::NextNumberStringSymbol( const sal_Unicode*& pStr, String& rSymbol ) { - BOOL isNumber = FALSE; + sal_Bool isNumber = sal_False; sal_Unicode cToken; ScanState eState = SsStart; register const sal_Unicode* pHere = pStr; @@ -265,7 +265,7 @@ BOOL ImpSvNumberInputScan::NextNumberStringSymbol( if ( MyIsdigit( cToken ) ) { eState = SsGetValue; - isNumber = TRUE; + isNumber = sal_True; } else eState = SsGetString; @@ -311,11 +311,11 @@ BOOL ImpSvNumberInputScan::NextNumberStringSymbol( // FIXME: should be grouping; it is only used though in case nAnzStrings is // near SV_MAX_ANZ_INPUT_STRINGS, in NumberStringDivision(). -BOOL ImpSvNumberInputScan::SkipThousands( +sal_Bool ImpSvNumberInputScan::SkipThousands( const sal_Unicode*& pStr, String& rSymbol ) { - BOOL res = FALSE; + sal_Bool res = sal_False; sal_Unicode cToken; const String& rThSep = pFormatter->GetNumThousandSep(); register const sal_Unicode* pHere = pStr; @@ -348,7 +348,7 @@ BOOL ImpSvNumberInputScan::SkipThousands( if (nCounter == 3) { eState = SsStart; - res = TRUE; // .000 combination found + res = sal_True; // .000 combination found } } else @@ -385,7 +385,7 @@ void ImpSvNumberInputScan::NumberStringDivision( const String& rString ) { if ( NextNumberStringSymbol( pStr, sStrArray[nAnzStrings] ) ) { // Zahl - IsNum[nAnzStrings] = TRUE; + IsNum[nAnzStrings] = sal_True; nNums[nAnzNums] = nAnzStrings; nAnzNums++; if (nAnzStrings >= SV_MAX_ANZ_INPUT_STRINGS - 7 && @@ -395,7 +395,7 @@ void ImpSvNumberInputScan::NumberStringDivision( const String& rString ) } else { - IsNum[nAnzStrings] = FALSE; + IsNum[nAnzStrings] = sal_False; } nAnzStrings++; } @@ -405,34 +405,34 @@ void ImpSvNumberInputScan::NumberStringDivision( const String& rString ) //--------------------------------------------------------------------------- // Whether rString contains rWhat at nPos -BOOL ImpSvNumberInputScan::StringContainsImpl( const String& rWhat, +sal_Bool ImpSvNumberInputScan::StringContainsImpl( const String& rWhat, const String& rString, xub_StrLen nPos ) { if ( nPos + rWhat.Len() <= rString.Len() ) return StringPtrContainsImpl( rWhat, rString.GetBuffer(), nPos ); - return FALSE; + return sal_False; } //--------------------------------------------------------------------------- // Whether pString contains rWhat at nPos -BOOL ImpSvNumberInputScan::StringPtrContainsImpl( const String& rWhat, +sal_Bool ImpSvNumberInputScan::StringPtrContainsImpl( const String& rWhat, const sal_Unicode* pString, xub_StrLen nPos ) { if ( rWhat.Len() == 0 ) - return FALSE; + return sal_False; register const sal_Unicode* pWhat = rWhat.GetBuffer(); register const sal_Unicode* const pEnd = pWhat + rWhat.Len(); register const sal_Unicode* pStr = pString + nPos; while ( pWhat < pEnd ) { if ( *pWhat != *pStr ) - return FALSE; + return sal_False; pWhat++; pStr++; } - return TRUE; + return sal_True; } @@ -441,15 +441,15 @@ BOOL ImpSvNumberInputScan::StringPtrContainsImpl( const String& rWhat, // // ueberspringt genau das angegebene Zeichen -inline BOOL ImpSvNumberInputScan::SkipChar( sal_Unicode c, const String& rString, +inline sal_Bool ImpSvNumberInputScan::SkipChar( sal_Unicode c, const String& rString, xub_StrLen& nPos ) { if ((nPos < rString.Len()) && (rString.GetChar(nPos) == c)) { nPos++; - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } @@ -478,15 +478,15 @@ inline void ImpSvNumberInputScan::SkipBlanks( const String& rString, // // jump over rWhat in rString at nPos -inline BOOL ImpSvNumberInputScan::SkipString( const String& rWhat, +inline sal_Bool ImpSvNumberInputScan::SkipString( const String& rWhat, const String& rString, xub_StrLen& nPos ) { if ( StringContains( rWhat, rString, nPos ) ) { nPos = nPos + rWhat.Len(); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } @@ -495,10 +495,10 @@ inline BOOL ImpSvNumberInputScan::SkipString( const String& rWhat, // // recognizes exactly ,111 in {3} and {3,2} or ,11 in {3,2} grouping -inline BOOL ImpSvNumberInputScan::GetThousandSep( +inline sal_Bool ImpSvNumberInputScan::GetThousandSep( const String& rString, xub_StrLen& nPos, - USHORT nStringPos ) + sal_uInt16 nStringPos ) { const String& rSep = pFormatter->GetNumThousandSep(); // Is it an ordinary space instead of a non-breaking space? @@ -507,7 +507,7 @@ inline BOOL ImpSvNumberInputScan::GetThousandSep( if (!( (rString == rSep || bSpaceBreak) // nothing else && nStringPos < nAnzStrings - 1 // safety first! && IsNum[nStringPos+1] )) // number follows - return FALSE; // no? => out + return sal_False; // no? => out utl::DigitGroupingIterator aGrouping( pFormatter->GetLocaleData()->getDigitGrouping()); @@ -524,9 +524,9 @@ inline BOOL ImpSvNumberInputScan::GetThousandSep( ) { nPos = nPos + rSep.Len(); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } @@ -534,8 +534,8 @@ inline BOOL ImpSvNumberInputScan::GetThousandSep( // GetLogical // // Conversion of text to logial value -// "TRUE" => 1: -// "FALSE"=> -1: +// "sal_True" => 1: +// "sal_False"=> -1: // else => 0: short ImpSvNumberInputScan::GetLogical( const String& rString ) @@ -642,10 +642,10 @@ int ImpSvNumberInputScan::GetDayOfWeek( const String& rString, xub_StrLen& nPos // GetCurrency // // Lesen eines Waehrungssysmbols -// '$' => TRUE -// sonst => FALSE +// '$' => sal_True +// sonst => sal_False -BOOL ImpSvNumberInputScan::GetCurrency( const String& rString, xub_StrLen& nPos, +sal_Bool ImpSvNumberInputScan::GetCurrency( const String& rString, xub_StrLen& nPos, const SvNumberformat* pFormat ) { if ( rString.Len() > nPos ) @@ -660,7 +660,7 @@ BOOL ImpSvNumberInputScan::GetCurrency( const String& rString, xub_StrLen& nPos, if ( StringContains( aUpperCurrSymbol, rString, nPos ) ) { nPos = nPos + aUpperCurrSymbol.Len(); - return TRUE; + return sal_True; } if ( pFormat ) { @@ -673,14 +673,14 @@ BOOL ImpSvNumberInputScan::GetCurrency( const String& rString, xub_StrLen& nPos, if ( StringContains( aSymbol, rString, nPos ) ) { nPos = nPos + aSymbol.Len(); - return TRUE; + return sal_True; } } } } } - return FALSE; + return sal_False; } @@ -690,15 +690,15 @@ BOOL ImpSvNumberInputScan::GetCurrency( const String& rString, xub_StrLen& nPos, // Lesen des Zeitsymbols (AM od. PM) f. kurze Zeitangabe // // Rueckgabe: -// "AM" od. "PM" => TRUE -// sonst => FALSE +// "AM" od. "PM" => sal_True +// sonst => sal_False // // nAmPos: // "AM" => 1 // "PM" => -1 // sonst => 0 -BOOL ImpSvNumberInputScan::GetTimeAmPm( const String& rString, xub_StrLen& nPos ) +sal_Bool ImpSvNumberInputScan::GetTimeAmPm( const String& rString, xub_StrLen& nPos ) { if ( rString.Len() > nPos ) @@ -709,17 +709,17 @@ BOOL ImpSvNumberInputScan::GetTimeAmPm( const String& rString, xub_StrLen& nPos { nAmPm = 1; nPos = nPos + pLoc->getTimeAM().Len(); - return TRUE; + return sal_True; } else if ( StringContains( pChr->upper( pLoc->getTimePM() ), rString, nPos ) ) { nAmPm = -1; nPos = nPos + pLoc->getTimePM().Len(); - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } @@ -727,10 +727,10 @@ BOOL ImpSvNumberInputScan::GetTimeAmPm( const String& rString, xub_StrLen& nPos // GetDecSep // // Lesen eines Dezimaltrenners (',') -// ',' => TRUE -// sonst => FALSE +// ',' => sal_True +// sonst => sal_False -inline BOOL ImpSvNumberInputScan::GetDecSep( const String& rString, xub_StrLen& nPos ) +inline sal_Bool ImpSvNumberInputScan::GetDecSep( const String& rString, xub_StrLen& nPos ) { if ( rString.Len() > nPos ) { @@ -738,17 +738,17 @@ inline BOOL ImpSvNumberInputScan::GetDecSep( const String& rString, xub_StrLen& if ( rString.Equals( rSep, nPos, rSep.Len() ) ) { nPos = nPos + rSep.Len(); - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } //--------------------------------------------------------------------------- // read a hundredth seconds separator -inline BOOL ImpSvNumberInputScan::GetTime100SecSep( const String& rString, xub_StrLen& nPos ) +inline sal_Bool ImpSvNumberInputScan::GetTime100SecSep( const String& rString, xub_StrLen& nPos ) { if ( rString.Len() > nPos ) { @@ -756,10 +756,10 @@ inline BOOL ImpSvNumberInputScan::GetTime100SecSep( const String& rString, xub_S if ( rString.Equals( rSep, nPos, rSep.Len() ) ) { nPos = nPos + rSep.Len(); - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } @@ -827,15 +827,15 @@ short ImpSvNumberInputScan::GetESign( const String& rString, xub_StrLen& nPos ) // i counts string portions, j counts numbers thereof. // It should had been called SkipNumber instead. -inline BOOL ImpSvNumberInputScan::GetNextNumber( USHORT& i, USHORT& j ) +inline sal_Bool ImpSvNumberInputScan::GetNextNumber( sal_uInt16& i, sal_uInt16& j ) { if ( i < nAnzStrings && IsNum[i] ) { j++; i++; - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } @@ -844,19 +844,19 @@ inline BOOL ImpSvNumberInputScan::GetNextNumber( USHORT& i, USHORT& j ) void ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, - USHORT nIndex, // j-value of the first numeric time part of input, default 0 - USHORT nAnz ) // count of numeric time parts + sal_uInt16 nIndex, // j-value of the first numeric time part of input, default 0 + sal_uInt16 nAnz ) // count of numeric time parts { - USHORT nHour; - USHORT nMinute = 0; - USHORT nSecond = 0; + sal_uInt16 nHour; + sal_uInt16 nMinute = 0; + sal_uInt16 nSecond = 0; double fSecond100 = 0.0; - USHORT nStartIndex = nIndex; + sal_uInt16 nStartIndex = nIndex; if (nTimezonePos) { // find first timezone number index and adjust count - for (USHORT j=0; j<nAnzNums; ++j) + for (sal_uInt16 j=0; j<nAnzNums; ++j) { if (nNums[j] == nTimezonePos) { @@ -871,7 +871,7 @@ void ImpSvNumberInputScan::GetTimeRef( if (nDecPos == 2 && (nAnz == 3 || nAnz == 2)) // 20:45.5 or 45.5 nHour = 0; else if (nIndex - nStartIndex < nAnz) - nHour = (USHORT) sStrArray[nNums[nIndex++]].ToInt32(); + nHour = (sal_uInt16) sStrArray[nNums[nIndex++]].ToInt32(); else { nHour = 0; @@ -880,11 +880,11 @@ void ImpSvNumberInputScan::GetTimeRef( if (nDecPos == 2 && nAnz == 2) // 45.5 nMinute = 0; else if (nIndex - nStartIndex < nAnz) - nMinute = (USHORT) sStrArray[nNums[nIndex++]].ToInt32(); + nMinute = (sal_uInt16) sStrArray[nNums[nIndex++]].ToInt32(); if (nIndex - nStartIndex < nAnz) - nSecond = (USHORT) sStrArray[nNums[nIndex++]].ToInt32(); + nSecond = (sal_uInt16) sStrArray[nNums[nIndex++]].ToInt32(); if (nIndex - nStartIndex < nAnz) - fSecond100 = StringToDouble( sStrArray[nNums[nIndex]], TRUE ); + fSecond100 = StringToDouble( sStrArray[nNums[nIndex]], sal_True ); if (nAmPm == -1 && nHour != 12) // PM nHour += 12; else if (nAmPm == 1 && nHour == 12) // 12 AM @@ -900,13 +900,13 @@ void ImpSvNumberInputScan::GetTimeRef( //--------------------------------------------------------------------------- // ImplGetDay -USHORT ImpSvNumberInputScan::ImplGetDay( USHORT nIndex ) +sal_uInt16 ImpSvNumberInputScan::ImplGetDay( sal_uInt16 nIndex ) { - USHORT nRes = 0; + sal_uInt16 nRes = 0; if (sStrArray[nNums[nIndex]].Len() <= 2) { - USHORT nNum = (USHORT) sStrArray[nNums[nIndex]].ToInt32(); + sal_uInt16 nNum = (sal_uInt16) sStrArray[nNums[nIndex]].ToInt32(); if (nNum <= 31) nRes = nNum; } @@ -918,14 +918,14 @@ USHORT ImpSvNumberInputScan::ImplGetDay( USHORT nIndex ) //--------------------------------------------------------------------------- // ImplGetMonth -USHORT ImpSvNumberInputScan::ImplGetMonth( USHORT nIndex ) +sal_uInt16 ImpSvNumberInputScan::ImplGetMonth( sal_uInt16 nIndex ) { // preset invalid month number - USHORT nRes = pFormatter->GetCalendar()->getNumberOfMonthsInYear(); + sal_uInt16 nRes = pFormatter->GetCalendar()->getNumberOfMonthsInYear(); if (sStrArray[nNums[nIndex]].Len() <= 2) { - USHORT nNum = (USHORT) sStrArray[nNums[nIndex]].ToInt32(); + sal_uInt16 nNum = (sal_uInt16) sStrArray[nNums[nIndex]].ToInt32(); if ( 0 < nNum && nNum <= nRes ) nRes = nNum - 1; // zero based for CalendarFieldIndex::MONTH } @@ -939,13 +939,13 @@ USHORT ImpSvNumberInputScan::ImplGetMonth( USHORT nIndex ) // // 30 -> 1930, 29 -> 2029, oder 56 -> 1756, 55 -> 1855, ... -USHORT ImpSvNumberInputScan::ImplGetYear( USHORT nIndex ) +sal_uInt16 ImpSvNumberInputScan::ImplGetYear( sal_uInt16 nIndex ) { - USHORT nYear = 0; + sal_uInt16 nYear = 0; if (sStrArray[nNums[nIndex]].Len() <= 4) { - nYear = (USHORT) sStrArray[nNums[nIndex]].ToInt32(); + nYear = (sal_uInt16) sStrArray[nNums[nIndex]].ToInt32(); nYear = SvNumberFormatter::ExpandTwoDigitYear( nYear, nYear2000 ); } @@ -970,7 +970,7 @@ bool ImpSvNumberInputScan::MayBeIso8601() //--------------------------------------------------------------------------- // GetDateRef -BOOL ImpSvNumberInputScan::GetDateRef( double& fDays, USHORT& nCounter, +sal_Bool ImpSvNumberInputScan::GetDateRef( double& fDays, sal_uInt16& nCounter, const SvNumberformat* pFormat ) { using namespace ::com::sun::star::i18n; @@ -997,7 +997,7 @@ BOOL ImpSvNumberInputScan::GetDateRef( double& fDays, USHORT& nCounter, eEDF = NF_EVALDATEFORMAT_INTL; nFormatOrder = 1; } - BOOL res = TRUE; + sal_Bool res = sal_True; const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); CalendarWrapper* pCal = pFormatter->GetCalendar(); @@ -1006,45 +1006,45 @@ BOOL ImpSvNumberInputScan::GetDateRef( double& fDays, USHORT& nCounter, pCal->setGregorianDateTime( Date() ); // today String aOrgCalendar; // empty => not changed yet DateFormat DateFmt; - BOOL bFormatTurn; + sal_Bool bFormatTurn; switch ( eEDF ) { case NF_EVALDATEFORMAT_INTL : - bFormatTurn = FALSE; + bFormatTurn = sal_False; DateFmt = pLoc->getDateFormat(); break; case NF_EVALDATEFORMAT_FORMAT : - bFormatTurn = TRUE; + bFormatTurn = sal_True; DateFmt = pFormat->GetDateOrder(); break; case NF_EVALDATEFORMAT_INTL_FORMAT : if ( nTryOrder == 1 ) { - bFormatTurn = FALSE; + bFormatTurn = sal_False; DateFmt = pLoc->getDateFormat(); } else { - bFormatTurn = TRUE; + bFormatTurn = sal_True; DateFmt = pFormat->GetDateOrder(); } break; case NF_EVALDATEFORMAT_FORMAT_INTL : if ( nTryOrder == 2 ) { - bFormatTurn = FALSE; + bFormatTurn = sal_False; DateFmt = pLoc->getDateFormat(); } else { - bFormatTurn = TRUE; + bFormatTurn = sal_True; DateFmt = pFormat->GetDateOrder(); } break; default: DBG_ERROR( "ImpSvNumberInputScan::GetDateRef: unknown NfEvalDateFormat" ); DateFmt = YMD; - bFormatTurn = FALSE; + bFormatTurn = sal_False; } if ( bFormatTurn ) { @@ -1083,7 +1083,7 @@ input for the following reasons: #endif } - res = TRUE; + res = sal_True; nCounter = 0; // For incomplete dates, always assume first day of month if not specified. pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 ); @@ -1094,7 +1094,7 @@ input for the following reasons: if (nMonthPos) // only month (Jan) pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); else - res = FALSE; + res = sal_False; break; case 1: // only one number @@ -1116,7 +1116,7 @@ input for the following reasons: pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); break; default: - res = FALSE; + res = sal_False; break; } break; @@ -1131,12 +1131,12 @@ input for the following reasons: pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); break; default: - res = FALSE; + res = sal_False; break; } break; default: - res = FALSE; + res = sal_False; break; } // switch (nMonthPos) break; @@ -1223,7 +1223,7 @@ input for the following reasons: } break; default: - res = FALSE; + res = sal_False; break; } } @@ -1262,12 +1262,12 @@ input for the following reasons: pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); break; default: - res = FALSE; + res = sal_False; break; } break; default: // else, e.g. month at the end (94 10 Jan) - res = FALSE; + res = sal_False; break; } // switch (nMonthPos) break; @@ -1280,7 +1280,7 @@ input for the following reasons: nCounter = 3; if ( nTimePos > 1 ) { // find first time number index (should only be 3 or 2 anyway) - for ( USHORT j = 0; j < nAnzNums; j++ ) + for ( sal_uInt16 j = 0; j < nAnzNums; j++ ) { if ( nNums[j] == nTimePos - 2 ) { @@ -1312,7 +1312,7 @@ input for the following reasons: pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); break; default: - res = FALSE; + res = sal_False; break; } } @@ -1327,7 +1327,7 @@ input for the following reasons: pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); break; default: - res = FALSE; + res = sal_False; break; } break; @@ -1345,13 +1345,13 @@ input for the following reasons: pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); break; default: - res = FALSE; + res = sal_False; break; } break; default: // else, e.g. month at the end (94 10 Jan 8:23) nCounter = 2; - res = FALSE; + res = sal_False; break; } // switch (nMonthPos) break; @@ -1365,7 +1365,7 @@ input for the following reasons: nTryOrder = nFormatOrder; // break for } else - res = FALSE; + res = sal_False; if ( aOrgCalendar.Len() ) pCal->loadCalendar( aOrgCalendar, pLoc->getLocale() ); // restore calendar @@ -1463,10 +1463,10 @@ input for the following reasons: // ScanStartString // // ersten String analysieren -// Alles weg => TRUE -// sonst => FALSE +// Alles weg => sal_True +// sonst => sal_False -BOOL ImpSvNumberInputScan::ScanStartString( const String& rString, +sal_Bool ImpSvNumberInputScan::ScanStartString( const String& rString, const SvNumberformat* pFormat ) { xub_StrLen nPos = 0; @@ -1485,7 +1485,7 @@ BOOL ImpSvNumberInputScan::ScanStartString( const String& rString, { // Match against format in any case, so later on for a "x1-2-3" input // we may distinguish between a xy-m-d (or similar) date and a x0-0-0 // format. No sign detection here! - if ( ScanStringNumFor( rString, nPos, pFormat, 0, TRUE ) ) + if ( ScanStringNumFor( rString, nPos, pFormat, 0, sal_True ) ) nMatchedAllStrings |= nMatchedStartString; else nMatchedAllStrings = 0; @@ -1558,7 +1558,7 @@ BOOL ImpSvNumberInputScan::ScanStartString( const String& rString, return MatchedReturn(); } - return TRUE; + return sal_True; } @@ -1566,11 +1566,11 @@ BOOL ImpSvNumberInputScan::ScanStartString( const String& rString, // ScanMidString // // String in der Mitte analysieren -// Alles weg => TRUE -// sonst => FALSE +// Alles weg => sal_True +// sonst => sal_False -BOOL ImpSvNumberInputScan::ScanMidString( const String& rString, - USHORT nStringPos, const SvNumberformat* pFormat ) +sal_Bool ImpSvNumberInputScan::ScanMidString( const String& rString, + sal_uInt16 nStringPos, const SvNumberformat* pFormat ) { xub_StrLen nPos = 0; short eOldScannedType = eScannedType; @@ -1800,10 +1800,10 @@ BOOL ImpSvNumberInputScan::ScanMidString( const String& rString, if ( nMatchedAllStrings & ~nMatchedVirgin ) eScannedType = eOldScannedType; else - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } @@ -1811,10 +1811,10 @@ BOOL ImpSvNumberInputScan::ScanMidString( const String& rString, // ScanEndString // // Schlussteil analysieren -// Alles weg => TRUE -// sonst => FALSE +// Alles weg => sal_True +// sonst => sal_False -BOOL ImpSvNumberInputScan::ScanEndString( const String& rString, +sal_Bool ImpSvNumberInputScan::ScanEndString( const String& rString, const SvNumberformat* pFormat ) { xub_StrLen nPos = 0; @@ -2045,30 +2045,30 @@ BOOL ImpSvNumberInputScan::ScanEndString( const String& rString, { // does input EndString equal EndString in Format? if ( !ScanStringNumFor( rString, nPos, pFormat, 0xFFFF ) ) - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } -BOOL ImpSvNumberInputScan::ScanStringNumFor( +sal_Bool ImpSvNumberInputScan::ScanStringNumFor( const String& rString, // String to scan xub_StrLen nPos, // Position until which was consumed const SvNumberformat* pFormat, // The format to match - USHORT nString, // Substring of format, 0xFFFF => last - BOOL bDontDetectNegation // Suppress sign detection + sal_uInt16 nString, // Substring of format, 0xFFFF => last + sal_Bool bDontDetectNegation // Suppress sign detection ) { if ( !pFormat ) - return FALSE; + return sal_False; const ::utl::TransliterationWrapper* pTransliteration = pFormatter->GetTransliteration(); const String* pStr; String aString( rString ); - BOOL bFound = FALSE; - BOOL bFirst = TRUE; - BOOL bContinue = TRUE; - USHORT nSub; + sal_Bool bFound = sal_False; + sal_Bool bFirst = sal_True; + sal_Bool bContinue = sal_True; + sal_uInt16 nSub; do { // Don't try "lower" subformats ff the very first match was the second @@ -2077,22 +2077,22 @@ BOOL ImpSvNumberInputScan::ScanStringNumFor( do { // Step through subformats, first positive, then negative, then // other, but not the last (text) subformat. - pStr = pFormat->GetNumForString( nSub, nString, TRUE ); + pStr = pFormat->GetNumForString( nSub, nString, sal_True ); if ( pStr && pTransliteration->isEqual( aString, *pStr ) ) { - bFound = TRUE; - bContinue = FALSE; + bFound = sal_True; + bContinue = sal_False; } else if ( nSub < 2 ) ++nSub; else - bContinue = FALSE; + bContinue = sal_False; } while ( bContinue ); if ( !bFound && bFirst && nPos ) { // try remaining substring - bFirst = FALSE; + bFirst = sal_False; aString.Erase( 0, nPos ); - bContinue = TRUE; + bContinue = sal_True; } } while ( bContinue ); @@ -2104,13 +2104,13 @@ BOOL ImpSvNumberInputScan::ScanStringNumFor( aString.EraseAllChars( ' ' ); if ( (aString.Len() == 1) && (aString.GetChar(0) == '-') ) { - bFound = TRUE; + bFound = sal_True; nStringScanSign = -1; nSub = 0; //! not 1 } } if ( !bFound ) - return FALSE; + return sal_False; } else if ( !bDontDetectNegation && (nSub == 1) && pFormat->IsNegativeRealNegative() ) @@ -2138,7 +2138,7 @@ BOOL ImpSvNumberInputScan::ScanStringNumFor( nStringScanSign = -1; } nStringScanNumFor = nSub; - return TRUE; + return sal_True; } @@ -2146,9 +2146,9 @@ BOOL ImpSvNumberInputScan::ScanStringNumFor( // IsNumberFormatMain // // Recognizes types of number, exponential, fraction, percent, currency, date, time. -// Else text => return FALSE +// Else text => return sal_False -BOOL ImpSvNumberInputScan::IsNumberFormatMain( +sal_Bool ImpSvNumberInputScan::IsNumberFormatMain( const String& rString, // string to be analyzed double& , // OUT: result as number, if possible const SvNumberformat* pFormat ) // maybe number format set to match against @@ -2156,7 +2156,7 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( Reset(); NumberStringDivision( rString ); // breakdown into strings and numbers if (nAnzStrings >= SV_MAX_ANZ_INPUT_STRINGS) // too many elements - return FALSE; // Njet, Nope, ... + return sal_False; // Njet, Nope, ... if (nAnzNums == 0) // no number in input { @@ -2172,17 +2172,17 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( { eScannedType = NUMBERFORMAT_LOGICAL; // !!! it's a BOOLEAN nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; + return sal_True; } else - return FALSE; // simple text + return sal_False; // simple text } else - return FALSE; // simple text + return sal_False; // simple text } - USHORT i = 0; // mark any symbol - USHORT j = 0; // mark only numbers + sal_uInt16 i = 0; // mark any symbol + sal_uInt16 j = 0; // mark only numbers switch ( nAnzNums ) { @@ -2197,14 +2197,14 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( { eScannedType = NUMBERFORMAT_FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; + return sal_True; } } } else { // Analyze start string if (!ScanStartString( sStrArray[i], pFormat )) // i=0 - return FALSE; // already an error + return sal_False; // already an error i++; // next symbol, i=1 } GetNextNumber(i,j); // i=1,2 @@ -2219,11 +2219,11 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( { eScannedType = NUMBERFORMAT_FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; + return sal_True; } } if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) - return FALSE; + return sal_False; } break; case 2 : // Exactly 2 numbers in input @@ -2231,16 +2231,16 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( if (!GetNextNumber(i,j)) // i=1,0 { // Analyze start string if (!ScanStartString( sStrArray[i], pFormat )) - return FALSE; // already an error + return sal_False; // already an error i++; // i=1 } GetNextNumber(i,j); // i=1,2 if ( !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; + return sal_False; i++; // next symbol, i=2,3 GetNextNumber(i,j); // i=3,4 if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) - return FALSE; + return sal_False; if (eSetType == NUMBERFORMAT_FRACTION) // -1,200. as fraction { if (!nNegCheck && // no sign '(' @@ -2250,7 +2250,7 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( { eScannedType = NUMBERFORMAT_FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; + return sal_True; } } } @@ -2260,24 +2260,24 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( if (!GetNextNumber(i,j)) // i=1,0 { // Analyze start string if (!ScanStartString( sStrArray[i], pFormat )) - return FALSE; // already an error + return sal_False; // already an error i++; // i=1 if (nDecPos == 1) // decimal separator at start => error - return FALSE; + return sal_False; } GetNextNumber(i,j); // i=1,2 if ( !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; + return sal_False; i++; // i=2,3 if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at end - return FALSE; + return sal_False; GetNextNumber(i,j); // i=3,4 if ( !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; + return sal_False; i++; // i=4,5 GetNextNumber(i,j); // i=5,6 if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) - return FALSE; + return sal_False; if (eSetType == NUMBERFORMAT_FRACTION) // -1,200,100. as fraction { if (!nNegCheck && // no sign '(' @@ -2287,11 +2287,11 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( { eScannedType = NUMBERFORMAT_FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; + return sal_True; } } if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos ) - return FALSE; // #36857# not a real fraction + return sal_False; // #36857# not a real fraction } break; default: // More than 3 numbers in input @@ -2299,45 +2299,45 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( if (!GetNextNumber(i,j)) // i=1,0 { // Analyze startstring if (!ScanStartString( sStrArray[i], pFormat )) - return FALSE; // already an error + return sal_False; // already an error i++; // i=1 if (nDecPos == 1) // decimal separator at start => error - return FALSE; + return sal_False; } GetNextNumber(i,j); // i=1,2 if ( !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; + return sal_False; i++; // i=2,3 - USHORT nThOld = 10; // just not 0 or 1 + sal_uInt16 nThOld = 10; // just not 0 or 1 while (nThOld != nThousand && j < nAnzNums-1) // Execute at least one time // but leave one number. { // Loop over group separators nThOld = nThousand; if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at end - return FALSE; + return sal_False; GetNextNumber(i,j); if ( i < nAnzStrings && !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; + return sal_False; i++; } if (eScannedType == NUMBERFORMAT_DATE || // long date or eScannedType == NUMBERFORMAT_TIME || // long time or eScannedType == NUMBERFORMAT_UNDEFINED) // long number { - for (USHORT k = j; k < nAnzNums-1; k++) + for (sal_uInt16 k = j; k < nAnzNums-1; k++) { if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at endd - return FALSE; + return sal_False; GetNextNumber(i,j); if ( i < nAnzStrings && !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; + return sal_False; i++; } } GetNextNumber(i,j); if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) - return FALSE; + return sal_False; if (eSetType == NUMBERFORMAT_FRACTION) // -1,200,100. as fraction { if (!nNegCheck && // no sign '(' @@ -2347,11 +2347,11 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( { eScannedType = NUMBERFORMAT_FRACTION; nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; + return sal_True; } } if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos ) - return FALSE; // #36857# not a real fraction + return sal_False; // #36857# not a real fraction } } @@ -2359,18 +2359,18 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( { nMatchedAllStrings &= ~nMatchedVirgin; // did match including nMatchedUsedAsReturn - BOOL bDidMatch = (nMatchedAllStrings != 0); + sal_Bool bDidMatch = (nMatchedAllStrings != 0); if ( nMatchedAllStrings ) { - BOOL bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual( - nStringScanNumFor, nAnzStrings, nAnzNums ) : FALSE); + sal_Bool bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual( + nStringScanNumFor, nAnzStrings, nAnzNums ) : sal_False); if ( !bMatch ) nMatchedAllStrings = 0; } if ( nMatchedAllStrings ) eScannedType = eSetType; else if ( bDidMatch ) - return FALSE; + return sal_False; else eScannedType = NUMBERFORMAT_NUMBER; // everything else should have been recognized by now @@ -2378,36 +2378,36 @@ BOOL ImpSvNumberInputScan::IsNumberFormatMain( else if ( eScannedType == NUMBERFORMAT_DATE ) { // the very relaxed date input checks may interfere with a preset format nMatchedAllStrings &= ~nMatchedVirgin; - BOOL bWasReturn = ((nMatchedAllStrings & nMatchedUsedAsReturn) != 0); + sal_Bool bWasReturn = ((nMatchedAllStrings & nMatchedUsedAsReturn) != 0); if ( nMatchedAllStrings ) { - BOOL bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual( - nStringScanNumFor, nAnzStrings, nAnzNums ) : FALSE); + sal_Bool bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual( + nStringScanNumFor, nAnzStrings, nAnzNums ) : sal_False); if ( !bMatch ) nMatchedAllStrings = 0; } if ( nMatchedAllStrings ) eScannedType = eSetType; else if ( bWasReturn ) - return FALSE; + return sal_False; } else nMatchedAllStrings = 0; // reset flag to no substrings matched - return TRUE; + return sal_True; } //--------------------------------------------------------------------------- -// return TRUE or FALSE depending on the nMatched... state and remember usage -BOOL ImpSvNumberInputScan::MatchedReturn() +// return sal_True or sal_False depending on the nMatched... state and remember usage +sal_Bool ImpSvNumberInputScan::MatchedReturn() { if ( nMatchedAllStrings & ~nMatchedVirgin ) { nMatchedAllStrings |= nMatchedUsedAsReturn; - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } @@ -2442,7 +2442,7 @@ void ImpSvNumberInputScan::InitText() pUpperDayText[j] = pChrCls->upper( xElems[j].FullName ); pUpperAbbrevDayText[j] = pChrCls->upper( xElems[j].AbbrevName ); } - bTextInitialized = TRUE; + bTextInitialized = sal_True; } @@ -2461,7 +2461,7 @@ void ImpSvNumberInputScan::ChangeIntl() cDecSep == '/' || cDecSep == '.' || cDecSep == pFormatter->GetDateSep().GetChar(0) ); - bTextInitialized = FALSE; + bTextInitialized = sal_False; aUpperCurrSymbol.Erase(); } @@ -2470,9 +2470,9 @@ void ImpSvNumberInputScan::ChangeIntl() // ChangeNullDate void ImpSvNumberInputScan::ChangeNullDate( - const USHORT Day, - const USHORT Month, - const USHORT Year ) + const sal_uInt16 Day, + const sal_uInt16 Month, + const sal_uInt16 Year ) { if ( pNullDate ) *pNullDate = Date(Day, Month, Year); @@ -2486,7 +2486,7 @@ void ImpSvNumberInputScan::ChangeNullDate( // // => does rString represent a number (also date, time et al) -BOOL ImpSvNumberInputScan::IsNumberFormat( +sal_Bool ImpSvNumberInputScan::IsNumberFormat( const String& rString, // string to be analyzed short& F_Type, // IN: old type, OUT: new type double& fOutNumber, // OUT: number if convertable @@ -2494,13 +2494,13 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( { String sResString; String aString; - BOOL res; // return value + sal_Bool res; // return value eSetType = F_Type; // old type set if ( !rString.Len() ) - res = FALSE; + res = sal_False; else if (rString.Len() > 308) // arbitrary - res = FALSE; + res = sal_False; else { // NoMoreUpperNeeded, all comparisons on UpperCase @@ -2516,7 +2516,7 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( || (nSign && (eScannedType == NUMBERFORMAT_DATE || eScannedType == NUMBERFORMAT_DATETIME)) ) // signed date/datetime - res = FALSE; + res = sal_False; else { // check count of partial number strings switch (eScannedType) @@ -2530,7 +2530,7 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if ( nMatchedAllStrings ) nThousand = nAnzNums - 1; else if ( nAnzNums != 1 ) - res = FALSE; + res = sal_False; } else if (nDecPos == 2) // 1.05 { @@ -2538,7 +2538,7 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if ( nMatchedAllStrings ) nThousand = nAnzNums - 1; else if ( nAnzNums != nThousand+2 ) - res = FALSE; + res = sal_False; } else // 1,100 or 1,100. { @@ -2546,7 +2546,7 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if ( nMatchedAllStrings ) nThousand = nAnzNums - 1; else if ( nAnzNums != nThousand+1 ) - res = FALSE; + res = sal_False; } break; @@ -2554,17 +2554,17 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if (nDecPos == 1) // .05 { if (nAnzNums != 2) - res = FALSE; + res = sal_False; } else if (nDecPos == 2) // 1.05 { if (nAnzNums != nThousand+3) - res = FALSE; + res = sal_False; } else // 1,100 or 1,100. { if (nAnzNums != nThousand+2) - res = FALSE; + res = sal_False; } break; @@ -2572,12 +2572,12 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if (nMonth) { // month name and numbers if (nAnzNums > 2) - res = FALSE; + res = sal_False; } else { if (nAnzNums > 3) - res = FALSE; + res = sal_False; } break; @@ -2585,12 +2585,12 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if (nDecPos) { // hundredth seconds included if (nAnzNums > 4) - res = FALSE; + res = sal_False; } else { if (nAnzNums > 3) - res = FALSE; + res = sal_False; } break; @@ -2600,12 +2600,12 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if (nDecPos) { // hundredth seconds included if (nAnzNums > 6) - res = FALSE; + res = sal_False; } else { if (nAnzNums > 5) - res = FALSE; + res = sal_False; } } else @@ -2613,12 +2613,12 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if (nDecPos) { // hundredth seconds included if (nAnzNums > 7) - res = FALSE; + res = sal_False; } else { if (nAnzNums > 6) - res = FALSE; + res = sal_False; } } break; @@ -2639,7 +2639,7 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( else if (nLogical == -1) fOutNumber = 0.0; // False else - res = FALSE; // Oops + res = sal_False; // Oops break; case NUMBERFORMAT_PERCENT: @@ -2652,13 +2652,13 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( sResString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "0." ) ); else sResString.Erase(); - USHORT k; + sal_uInt16 k; for ( k = 0; k <= nThousand; k++) sResString += sStrArray[nNums[k]]; // integer part if ( nDecPos == 2 && k < nAnzNums ) // . somewhere { sResString += '.'; - USHORT nStop = (eScannedType == NUMBERFORMAT_SCIENTIFIC ? + sal_uInt16 nStop = (eScannedType == NUMBERFORMAT_SCIENTIFIC ? nAnzNums-1 : nAnzNums); for ( ; k < nStop; k++) sResString += sStrArray[nNums[k]]; // fractional part @@ -2682,7 +2682,7 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( fOutNumber = 0.0; else fOutNumber = DBL_MAX; -/*!*/ return TRUE; +/*!*/ return sal_True; } } @@ -2719,12 +2719,12 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if (fNenner != 0.0) fOutNumber = fZaehler/fNenner; else - res = FALSE; + res = sal_False; } } else // nAnzNums > 2 { - USHORT k = 1; + sal_uInt16 k = 1; sResString = sStrArray[nNums[0]]; if (nThousand > 0) for (k = 1; k <= nThousand; k++) @@ -2738,7 +2738,7 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( if (fNenner != 0.0) fOutNumber += fZaehler/fNenner; else - res = FALSE; + res = sal_False; } } @@ -2761,14 +2761,14 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( case NUMBERFORMAT_DATE: { - USHORT nCounter = 0; // dummy here + sal_uInt16 nCounter = 0; // dummy here res = GetDateRef( fOutNumber, nCounter, pFormat ); } break; case NUMBERFORMAT_DATETIME: { - USHORT nCounter = 0; // needed here + sal_uInt16 nCounter = 0; // needed here res = GetDateRef( fOutNumber, nCounter, pFormat ); if ( res ) { @@ -2792,17 +2792,17 @@ BOOL ImpSvNumberInputScan::IsNumberFormat( { F_Type = NUMBERFORMAT_TEXT; fOutNumber = -DBL_MAX; - return TRUE; + return sal_True; } else if (fOutNumber > DBL_MAX) // 1.7E308 { F_Type = NUMBERFORMAT_TEXT; fOutNumber = DBL_MAX; - return TRUE; + return sal_True; } } - if (res == FALSE) + if (res == sal_False) { eScannedType = NUMBERFORMAT_TEXT; fOutNumber = 0.0; |