diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-06-13 17:15:07 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-06-23 22:47:39 +0200 |
commit | 38fc8636e4e7a79bbf59acea05f188220f22cf95 (patch) | |
tree | 537c7470a7561096cfd8d9c2778f1c925892e7d3 /i18npool | |
parent | 845a359609fccfa2d5b5d7e57f504074aafd3caf (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>
(cherry picked from commit 29f5742bc8ff36741baac5b71082b3daee70ac18)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153145
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/source/characterclassification/cclass_unicode_parser.cxx | 10 |
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 |