From a4fa06be4f8cd4d2584a6f3e4c5bd02786e591ad Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Wed, 15 Jun 2022 12:23:11 +0200 Subject: Related: tdf#149325 tdf#52602 SvNumberFormatsObj::addNew accept differing ... resulting format code of an existing format as not attempting to add a duplicate. It makes no sense to insist on strictness if the client can't know the rules.. Change-Id: I0c8ca215984bf84487036ccf2b570128b1694d54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135898 Tested-by: Jenkins Reviewed-by: Eike Rathke --- svl/source/numbers/numfmuno.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'svl') diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index 4e1ffed5b21f..8743ab578b4b 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -485,6 +485,14 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const OUString& aFormat, { throw util::MalformedNumberFormatException(); // Invalid Format } + else if (aFormStr != aFormat) + { + // The format exists but with a different format code string, and if it + // was only uppercase vs lowercase keywords; but also syntax extensions + // are possible like resulting embedded LCIDs and what not the client + // doesn't know about. Silently accept instead of throwing an error. + nRet = nKey; + } else throw uno::RuntimeException(); // Other error (e.g. already added) -- cgit