summaryrefslogtreecommitdiff
path: root/svx/source/items
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-10-03 00:00:08 +0200
committerEike Rathke <erack@redhat.com>2018-10-04 15:02:13 +0200
commite607f1da329a2d4dd91904053d7ff86ac05c77bf (patch)
tree6d06f033090ac61791355438f25e7f42b791e8f9 /svx/source/items
parent689b6a6ceb88b2c074b77c1030bc2396a1816eea (diff)
Select the current format if multiple instead of first matching format code
This never worked.. Change-Id: I79b8687dde4faac383121abeda70931d0192b33d Reviewed-on: https://gerrit.libreoffice.org/61290 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'svx/source/items')
-rw-r--r--svx/source/items/numfmtsh.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 8d8547fce33b..8a92fba7b816 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -486,7 +486,17 @@ bool SvxNumberFormatShell::IsUserDefined( const OUString& rFmtString )
bool SvxNumberFormatShell::FindEntry( const OUString& rFmtString, sal_uInt32* pAt /* = NULL */ )
{
bool bRes=false;
- sal_uInt32 nFound = pFormatter->TestNewString( rFmtString, eCurLanguage );
+
+ sal_uInt32 nFound = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ // There may be multiple builtin entries with the same format code, first
+ // try if the current key matches.
+ const SvNumberformat* pEntry = pFormatter->GetEntry( nCurFormatKey);
+ if (pEntry && pEntry->GetLanguage() == eCurLanguage && pEntry->GetFormatstring() == rFmtString)
+ nFound = nCurFormatKey;
+
+ if (nFound == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ // Find the first matching format code.
+ nFound = pFormatter->TestNewString( rFmtString, eCurLanguage );
if ( nFound == NUMBERFORMAT_ENTRY_NOT_FOUND )
{