svl/source/numbers/zforfind.cxx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
New commits: commit 1e7c707282d28e60c7667e4c4dcdb9b2348fe862 Author: Eike Rathke <er...@redhat.com> AuthorDate: Sun Oct 23 18:06:43 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Oct 24 12:12:24 2022 +0200 Resolves: tdf#147817 ignore date acceptance pattern with numeric ambiguity i.e. if it matches numeric with decimal separator; may had been added as user-defined pattern to configuration or resulted from locale merge of default locale and format's locale. Change-Id: Ie42a65fac26e8ddc6898a53ee3bec8695ace9a70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141684 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit cf429e79367775a03c2ca89ed57d3de88bd2c6dc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141706 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 8bf00b3e196b..e3d8c752eeb1 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -1356,10 +1356,22 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt ) for (sal_Int32 nPattern=0; nPattern < sDateAcceptancePatterns.getLength(); ++nPattern) { + const OUString& rPat = sDateAcceptancePatterns[nPattern]; + if (rPat.getLength() == 3) + { + // Ignore a pattern that would match numeric input with decimal + // separator. It may had been read from configuration or resulted + // from the locales' patterns concatenation above. + if ( rPat[1] == pFormatter->GetLocaleData()->getNumDecimalSep().toChar() + || rPat[1] == pFormatter->GetLocaleData()->getNumDecimalSepAlt().toChar()) + { + SAL_WARN("svl.numbers", "ignoring date acceptance pattern with decimal separator ambiguity: " << rPat); + continue; // for, next pattern + } + } sal_uInt16 nNext = nDatePatternStart; nDatePatternNumbers = 0; bool bOk = true; - const OUString& rPat = sDateAcceptancePatterns[nPattern]; sal_Int32 nPat = 0; for ( ; nPat < rPat.getLength() && bOk && nNext < nStringsCnt; ++nPat, ++nNext) {