[Libreoffice-commits] core.git: cui/source svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 4 13:02:39 UTC 2018
cui/source/tabpages/numfmt.cxx | 2 +-
svx/source/items/numfmtsh.cxx | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
New commits:
commit e607f1da329a2d4dd91904053d7ff86ac05c77bf
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Wed Oct 3 00:00:08 2018 +0200
Commit: Eike Rathke <erack at redhat.com>
CommitDate: Thu Oct 4 15:02:13 2018 +0200
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 at redhat.com>
Tested-by: Jenkins
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 4257799ae311..19d103c6fd71 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -1489,7 +1489,7 @@ void SvxNumberFormatTabPage::EditHdl_Impl(const weld::Entry* pEdFormat)
if (nTmpCurPos != sal_uInt16(-1))
set_active_currency(nTmpCurPos);
}
- short nPosi=pNumFmtShell->GetListPos4Entry(aFormat);
+ short nPosi=pNumFmtShell->GetListPos4Entry( nCurKey);
if(nPosi>=0)
m_xLbFormat->select(static_cast<sal_uInt16>(nPosi));
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 )
{
More information about the Libreoffice-commits
mailing list