summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-06-13 17:15:07 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-06-16 16:22:22 +0200
commit29f5742bc8ff36741baac5b71082b3daee70ac18 (patch)
tree40ddfdeae899a9893b8d09a901e779500c6d3ec3 /i18npool
parent60086685c91dd5d356b492b34dac613a06639b3c (diff)
tdf#125154 i18npool,sw: fix group separators in numbers in formulas
Commit 776f7e7463de3e97f3056712ee567f49a314829d changed cclass_Unicode to reject group separators in numbers by default, but users are complaining that the neat "5.000" numbers in their existing documents are now considered invalid. * in SwCalc, use GROUP_SEPARATOR_IN_NUMBER * in cclass_Unicode::parseText(), reject a group separator if it is not followed by at least 3 digits With this, a number from tdf#42518 "0.19" is still considered invalid, while "5.000" is now valid again. Change-Id: If86f2ed4c27be16f866d7f4cee00789344e9ee2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153047 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/characterclassification/cclass_unicode_parser.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
index aed29ea1ce5b..9ed95e2f907a 100644
--- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
@@ -827,8 +827,16 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if (current == cGroupSep)
{
- if (getFlags(nextChar, eState) & ParserFlags::VALUE_DIGIT)
+ // accept only if it is followed by 3 digits
+ sal_Int32 tempIndex(index);
+ sal_uInt32 const nextChar2((tempIndex < rText.getLength()) ? rText.iterateCodePoints(&tempIndex) : 0);
+ sal_uInt32 const nextChar3((tempIndex < rText.getLength()) ? rText.iterateCodePoints(&tempIndex) : 0);
+ if (getFlags(nextChar, eState) & ParserFlags::VALUE_DIGIT
+ && getFlags(nextChar2, eState) & ParserFlags::VALUE_DIGIT
+ && getFlags(nextChar3, eState) & ParserFlags::VALUE_DIGIT)
+ {
nParseTokensType |= KParseTokens::GROUP_SEPARATOR_IN_NUMBER;
+ }
else
{
// Trailing group separator character is not a