diff options
-rw-r--r-- | cui/source/tabpages/numfmt.cxx | 2 | ||||
-rw-r--r-- | svx/source/items/numfmtsh.cxx | 12 |
2 files changed, 12 insertions, 2 deletions
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 ) { |