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 <erack@redhat.com>
Tested-by: Jenkins
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index d58176f..7b887b4 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;