diff options
author | Eike Rathke <erack@redhat.com> | 2022-10-23 18:06:43 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2022-10-23 18:58:25 +0200 |
commit | cf429e79367775a03c2ca89ed57d3de88bd2c6dc (patch) | |
tree | b04e268c338b45c65787e6380afd9be53e59baa0 /svl | |
parent | a97bae545d72d8b19f39aa9280c0f284c79d0f6c (diff) |
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 <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 56c929e44407..029b2b556d0f 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -1357,10 +1357,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) { |