28#include <com/sun/star/i18n/NumberFormatCode.hpp>
29#include <com/sun/star/i18n/NumberFormatMapper.hpp>
116 static const std::u16string_view sGermanColorNames[]{
u"FARBE",
u"SCHWARZ",
u"BLAU",
117 u"GRÜN",
u"CYAN",
u"ROT",
118 u"MAGENTA",
u"BRAUN",
u"GRAU",
121 return sGermanColorNames[
i];
125 : maNullDate( 30, 12, 1899)
173 SAL_WARN(
"svl.numbers",
"InitSpecialKeyword: TRUE_WORD?" );
182 SAL_WARN(
"svl.numbers",
"InitSpecialKeyword: FALSE_WORD?" );
187 SAL_WARN(
"svl.numbers",
"InitSpecialKeyword: unknown request" );
219 while (
p < pStop && !bDone)
251 aStr = rCode.copy( pBeg - rCode.getStr(),
p - pBeg);
414 else if ( eLang.
anyOf(
484 else if ( eLang.
anyOf(
505 else if ( eLang.
anyOf(
522 Date aDate(nDay, nMonth, nYear);
526 SAL_WARN(
"svl.numbers",
"ImpSvNumberformatScan::ChangeNullDate - not valid"
527 " d: " << nDay <<
" m: " << nMonth <<
" y: " << nYear <<
" normalized to"
572 enum ColorKeywordConversion
577 } eColorKeywordConversion(
None);
593 if (bFromGerman && !bToGerman)
594 eColorKeywordConversion = ColorKeywordConversion::GermanToEnglish;
595 else if (!bFromGerman && bToGerman)
596 eColorKeywordConversion = ColorKeywordConversion::EnglishToGerman;
599 const Color* pResult =
nullptr;
604 if ((bL10n = sString.startsWith(rColorWord)) ||
609 sStr = sStr.copy(
nPos);
611 switch (eColorKeywordConversion)
613 case ColorKeywordConversion::None:
614 sStr = rColorWord + sStr;
616 case ColorKeywordConversion::GermanToEnglish:
619 case ColorKeywordConversion::EnglishToGerman:
623 sString = sString.copy(
nPos);
628 sal_Int32
nIndex = sString.toInt32();
639 switch (eColorKeywordConversion)
641 case ColorKeywordConversion::None:
644 case ColorKeywordConversion::GermanToEnglish:
647 case ColorKeywordConversion::EnglishToGerman:
668 rbFoundEnglish =
true;
676 while (
i > 0 && !sString.startsWith( rKeyword[
i]))
760 OUString& sSymbol )
const
766 ScanState eState = SsStart;
767 OUStringBuffer sSymbolBuffer;
768 while (
nPos < rStr.getLength() && eState != SsStop )
782 (
nPos <= 1 || rStr[
nPos-2] !=
'[') )
810 sSymbolBuffer.append(OUStringChar(cToken));
815 sSymbolBuffer.append(OUStringChar(cToken));
820 sSymbolBuffer.append(OUStringChar(cToken));
825 eState = SsGetString;
826 sSymbolBuffer.append(OUStringChar(cToken));
831 sSymbolBuffer.append(OUStringChar(cToken));
839 sSymbolBuffer.append(OUStringChar(cToken));
850 sSymbolBuffer.append(OUStringChar(cToken));
855 bool bFoundEnglish =
false;
859 bool bCurrency =
false;
875 sSymbolBuffer.append(OUStringChar(cToken));
894 sSymbolBuffer = rStr.subView(
nPos-1, nLen);
903 sSymbolBuffer.append(OUStringChar(cNext));
921 sSymbolBuffer.append(OUStringChar(cToken));
928 sSymbolBuffer.append(OUStringChar(cToken));
934 sSymbolBuffer.append(OUStringChar(cToken));
942 sSymbolBuffer.append(OUStringChar(cToken));
947 bool bFoundEnglish =
false;
958 sSymbolBuffer.append(OUStringChar(cToken));
963 bool bDontStop =
false;
968 if (
nPos < rStr.getLength())
971 if ( cNext ==
'P' || cNext ==
'p' )
973 sal_Int32 nLen = sSymbolBuffer.getLength();
975 (sSymbolBuffer[0] ==
'A' || sSymbolBuffer[0] ==
'a') &&
977 (nLen == 2 && (sSymbolBuffer[1] ==
'M' || sSymbolBuffer[1] ==
'm')
978 && (rStr[
nPos + 1] ==
'M' || rStr[
nPos + 1] ==
'm'))))
980 sSymbolBuffer.append(OUStringChar(cToken));
998 sSymbolBuffer.append(OUStringChar(cToken));
1002 sSymbolBuffer.append(OUStringChar(cToken));
1008 if (eState == SsGetWord)
1012 sSymbol = sSymbolBuffer.makeStringAndClear();
1021 sal_Int32 nCPos = 0;
1022 while (nCPos >= 0 && nCPos < sString.getLength())
1033 ((c = sString[nCPos-1]) !=
'"'
1055 const sal_Int32 nLen = rString.getLength();
1256 bool bMatchBracket =
false;
1257 bool bHaveGeneral =
false;
1258 bool bIsTimeDetected =
false;
1259 bool bHaveMinute =
false;
1266 sal_uInt16 nIndexPre;
1267 sal_uInt16 nIndexNex;
1276 bIsTimeDetected =
true;
1281 bIsTimeDetected =
true;
1318 bIsTimeDetected =
false;
1355 bIsTimeDetected =
false;
1365 bHaveGeneral =
true;
1410 bMatchBracket =
true;
1417 bMatchBracket =
true;
1470 else if (
sStrArray[
i][0] ==
']' && i < nStringsCnt - 1 && pLoc->getTime100SecSep() ==
sStrArray[
i+1] )
1607 if ( bMatchBracket )
1614 bMatchBracket =
false;
1623 if ( bMatchBracket )
1674 sal_uInt16& rResultStringsCnt )
1687 rResultStringsCnt--;
1701 rResultStringsCnt--;
1747 sal_uInt16 nDayPos, nMonthPos, nYearPos;
1756 sOldThousandSep.getLength() == 1 )
1758 sOldThousandSep =
" ";
1760 bool bNewDateOrder =
false;
1778 sal_uInt16 nCounter = 0;
1781 bool bThaiT =
false;
1782 bool bTimePart =
false;
1783 bool bDenomin =
false;
1889 else if (
bFrac && ( nCounter > 0 ) )
1906 assert(j > 0 &&
"if i is 0, first iteration through loop is guaranteed by surrounding if condition");
1907 if (std::u16string_view(OUString::number(sDiv.toInt32())) == sDiv)
1934 if (
bFrac && ( nCounter > 0 ) )
1957 cSimplified = cHere;
1962 switch ( cSimplified )
2011 && rStr.getLength() >= 2 &&
2054 if (
bFrac && (nCounter > 0) )
2059 (cPre ==
'#' || cPre ==
'0' || cPre ==
'?') &&
2060 ((cNext =
NextChar(
i)) ==
'#' || cNext ==
'0' || cNext ==
'?'))
2072 else if (
i > 0 && (cPre ==
'#' || cPre ==
'0' || cPre ==
'?')
2207 if (cSaved ==
' ' &&
2222 if (
bFrac && (nCounter > 0) )
2230 if (
bFrac && (nCounter > 0) )
2295 bool bHadDash =
false;
2357 SAL_WARN(
"svl.numbers",
"unknown NF_SYMBOLTYPE_..." );
2421 size_t nFirstDigitSymbol = nMaxPos;
2422 size_t nFirstGroupingSymbol = nMaxPos;
2428 nFirstDigitSymbol =
i;
2434 "ImpSvNumberformatScan::FinalScan: combined digits in group separator insertion");
2441 nFirstDigitSymbol =
i + 1;
2442 nFirstGroupingSymbol =
i;
2448 if (nFirstGroupingSymbol < nFirstDigitSymbol)
2549 bNewDateOrder =
false;
2556 bNewDateOrder =
false;
2563 bNewDateOrder =
false;
2612 nPos += rStr.getLength();
2629 if ( cChar == cOldKeyH )
2633 else if ( cChar == cOldKeyMI )
2637 else if ( cChar == cOldKeyS )
2666 else if (
sStrArray[
i] == sOldTime100SecSep )
2761 nPos += rStr.getLength();
2783 else if (
sStrArray[
i] == sOldTime100SecSep )
2874 bNewDateOrder =
false;
2881 bNewDateOrder =
false;
2888 bNewDateOrder =
false;
2933 if (bNewDateOrder && sOldDateSep ==
"-")
2940 bNewDateOrder =
false;
2946 bNewDateOrder =
false;
2958 switch (eOldDateOrder)
2960 case DateOrder::DMY:
2963 case DateOrder::MDY:
2971 case DateOrder::YMD:
2987 case DateOrder::MDY:
2990 case DateOrder::DMY:
2997 case DateOrder::YMD:
3011 case DateOrder::YMD:
3014 case DateOrder::DMY:
3026 case DateOrder::MDY:
3064 sal_uInt16 j =
i + 1;
3065 while ( aTmp.getLength() < sOldCurSymbol.getLength() &&
3071 if ( pChrCls->
uppercase( aTmp ) == sOldCurString )
3085 sal_Int32 nLen = rStr.getLength();
3086 for ( sal_Int32 j = 0; j < nLen; j++ )
3088 bool bFoundEnglish =
false;
3089 if ( (j == 0 || rStr[j - 1] !=
'\\') &&
GetKeyWord( rStr, j, bFoundEnglish) )
3091 rStr =
"\"" + rStr +
"\"";
3103 sal_Int32 nStringPos;
3104 sal_Int32 nArrPos = 0;
3105 sal_uInt16 iPos =
i;
3110 nStringPos = rString.getLength();
3128 rString += OUStringChar(c);
3159 rString += OUStringChar(c);
3178 sStrArray[iPos].getLength()-nArrPos ) );
3179 sal_Int32 nCPos = aTmp.indexOf( sOldCurString );
3185 sOldCurString.getLength(),
3187 rString = rString.replaceAt( nStringPos + nCPos,
3188 sOldCurString.getLength(),
3191 nStringPos = rString.getLength();
3220 sStrArray[iPos].getLength()-nArrPos ) );
3221 sal_Int32 nCPos = aTmp.indexOf( sOldCurString );
3227 sOldCurString.getLength(),
3229 rString = rString.replaceAt( nStringPos + nCPos,
3230 sOldCurString.getLength(), rCur );
3263 if ( rStr.getLength() > 1 )
3266 sal_Int32
n = rStr.getLength() - 1;
3267 if ( c ==
'"' && rStr[
n] ==
'"' )
3269 rStr = rStr.copy( 1,
n-1);
3272 else if ( c ==
'\\' )
3274 rStr = rStr.copy(1);
static bool isAsciiNumeric(std::u16string_view rStr)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
bool isLetter(const OUString &rStr, sal_Int32 nPos) const
sal_Int16 GetYear() const
sal_uInt16 GetDay() const
sal_uInt16 GetMonth() const
LanguageType getLanguageType(bool bResolveSystem=true) const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
const OUString & getTime100SecSep() const
const OUString & getTimeSep() const
const OUString & getFalseWord() const
LanguageTag getLoadedLanguageTag() const
DateOrder getDateOrder() const
const OUString & getTrueWord() const
const css::uno::Sequence< sal_Int32 > & getDigitGrouping() const
static LanguageType getRealLanguage(LanguageType nLang)
DigitGroupingIterator & advance()
constexpr ::Color COL_LIGHTRED(0xFF, 0x00, 0x00)
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTCYAN(0x00, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTMAGENTA(0xFF, 0x00, 0xFF)
constexpr ::Color COL_BROWN(0x80, 0x80, 0x00)
constexpr ::Color COL_YELLOW(0xFF, 0xFF, 0x00)
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
constexpr ::Color COL_LIGHTGREEN(0x00, 0xFF, 0x00)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define DBG_ASSERT(sCon, aError)
#define LANGUAGE_GERMAN_AUSTRIAN
#define LANGUAGE_SPANISH_PARAGUAY
#define LANGUAGE_GERMAN_SWISS
#define LANGUAGE_SPANISH_BOLIVIA
#define LANGUAGE_SPANISH_ECUADOR
#define LANGUAGE_FRENCH_LUXEMBOURG
#define LANGUAGE_PORTUGUESE
#define LANGUAGE_SWEDISH_FINLAND
#define LANGUAGE_GERMAN_LUXEMBOURG
#define LANGUAGE_ITALIAN_SWISS
#define LANGUAGE_SPANISH_VENEZUELA
#define LANGUAGE_FRENCH_SWISS
#define LANGUAGE_SPANISH_COLOMBIA
#define LANGUAGE_SPANISH_PANAMA
#define LANGUAGE_SPANISH_NICARAGUA
#define LANGUAGE_SPANISH_GUATEMALA
#define LANGUAGE_SPANISH_COSTARICA
#define LANGUAGE_SPANISH_PERU
#define LANGUAGE_FRENCH_MONACO
#define LANGUAGE_SPANISH_CHILE
#define LANGUAGE_SPANISH_MODERN
#define LANGUAGE_SPANISH_EL_SALVADOR
#define LANGUAGE_FRENCH_CANADIAN
#define LANGUAGE_SPANISH_DATED
#define LANGUAGE_SPANISH_PUERTO_RICO
#define LANGUAGE_FRENCH_BELGIAN
#define LANGUAGE_DONTKNOW
#define LANGUAGE_SPANISH_DOMINICAN_REPUBLIC
#define LANGUAGE_NORWEGIAN
#define LANGUAGE_NORWEGIAN_NYNORSK
#define LANGUAGE_NORWEGIAN_BOKMAL
#define LANGUAGE_SPANISH_HONDURAS
#define LANGUAGE_GERMAN_LIECHTENSTEIN
#define LANGUAGE_SPANISH_ARGENTINA
#define LANGUAGE_SPANISH_MEXICAN
#define LANGUAGE_PORTUGUESE_BRAZILIAN
#define LANGUAGE_DUTCH_BELGIAN
#define LANGUAGE_SPANISH_URUGUAY
#define LANGUAGE_ENGLISH_US
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
double getLength(const B2DPolygon &rCandidate)
OString strip(const OString &rIn, char c)
NfSymbolType
Number formatter's symbol types of a token, if not key words, which are >0.
@ NF_SYMBOLTYPE_FRACBLANK
@ NF_SYMBOLTYPE_TIME100SECSEP
@ NF_SYMBOLTYPE_FRAC_FDIV
::std::array< OUString, NF_KEYWORD_ENTRIES_COUNT > NfKeywordTable
NfKeywordIndex
For ImpSvNumberformatScan: first the short symbols, then the long symbols! e.g.
bool anyOf(strong_int v) const
constexpr size_t NF_MAX_FORMAT_SYMBOLS
SvNumFormatType
MAX_ULONG.
@ UNDEFINED
is used as a return value if no format exists.
@ TIME
selects time formats.
@ NUMBER
selects decimal number formats.
@ LOGICAL
selects boolean number formats.
@ CURRENCY
selects currency formats.
@ FRACTION
selects number formats for fractions.
@ TEXT
selects text number formats.
@ DATE
selects date formats.
@ PERCENT
selects percentage number formats.
@ DATETIME
selects number formats which contain date and time.
@ SCIENTIFIC
selects scientific number formats.
@ DEFINED
selects only user-defined number formats.
const sal_Unicode cNoBreakSpace
const sal_Unicode cNarrowNoBreakSpace
static OUString lcl_extractStandardGeneralName(const OUString &rCode)
Extract the name of General, Standard, Whatever, ignoring leading modifiers such as [NatNum1].
static const std::u16string_view & GermanColorName(size_t i)
const sal_uInt16 FLAG_STANDARD_IN_FORMAT
const size_t NF_MAX_DEFAULT_COLORS