cui/source/options/optgdlg.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+)
New commits: commit 29885b7723d49a78b123a2f1a19aa54df4cef9fc Author: Eike Rathke <er...@redhat.com> AuthorDate: Sun Oct 23 19:13:15 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Oct 24 12:10:57 2022 +0200 Related: tdf#147817 prevent date acceptance pattern with numeric ambiguity i.e. matching input with numeric decinmal separator, like M.D Change-Id: Ice977b3e92373829cd2f5df7c065d55bc49fc23e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141686 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit cdded98b23698e5e2a5cfffd5638e395098fcc4a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141707 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index f1e3fcf4bf45..b9402dfb23be 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -1719,6 +1719,18 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void ) bool bY, bM, bD; bY = bM = bD = false; bool bSep = true; + if (aPat.getLength() == 3) + { + // Disallow a pattern that would match a numeric input with + // decimal separator, like M.D + const LanguageType eLang = m_xLocaleSettingLB->get_active_id(); + const LocaleDataWrapper aLocaleWrapper(( LanguageTag(eLang))); + if ( aPat[1] == aLocaleWrapper.getNumDecimalSep().toChar() + || aPat[1] == aLocaleWrapper.getNumDecimalSepAlt().toChar()) + { + bValid = false; + } + } for (sal_Int32 i = 0; i < aPat.getLength() && bValid; /*nop*/) { const sal_Int32 j = i;