From fa17a6021f79374ba0e4e010587fa01774805da5 Mon Sep 17 00:00:00 2001 From: himajin100000 Date: Tue, 20 Mar 2018 05:41:35 +0900 Subject: tdf#114549:entering hex/dec code should change char sample by checking has_focus() for m_xHexCodeText and m_xDecimalCodeText. Also,CharHighlightHdl and SearchCharHighlightHdl now look alike. Also add case for missing glyph for entered hex/dec code. Change-Id: I32c782ac09756462f11b209afa12183d5ae7ac1f Reviewed-on: https://gerrit.libreoffice.org/51616 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- cui/inc/strings.hrc | 1 + cui/source/dialogs/cuicharmap.cxx | 42 +++++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 17 deletions(-) mode change 100644 => 100755 cui/source/dialogs/cuicharmap.cxx diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index 5ee718467f54..66da2d39506d 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -97,6 +97,7 @@ #define RID_SVXSTR_SELECTOR_RUN NC_("RID_SVXSTR_SELECTOR_RUN", "Run") #define RID_SVXSTR_ROW NC_("RID_SVXSTR_ROW", "Insert Rows") #define RID_SVXSTR_REMOVE_FAVORITES NC_("RID_SVXSTR_REMOVE_FAVORITES", "Remove from Favorites") +#define RID_SVXSTR_MISSING_GLYPH NC_("RID_SVXSTR_MISSING_GLYPH", "Missing Glyph") #define RID_SVXSTR_ADD_FAVORITES NC_("RID_SVXSTR_ADD_FAVORITES", "Add to Favorites") // PPI is pixel per inch, %1 is a number #define RID_SVXSTR_PPI NC_("RID_SVXSTR_PPI", "(%1 PPI)") diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx old mode 100644 new mode 100755 index ae4eedfb84ba..4727baca0fc2 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -935,6 +935,17 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void) { // using the new UCS4 constructor aText = OUString( &cChar, 1 ); + // Get the hexadecimal code + aHexText = OUString::number(cChar, 16).toAsciiUpperCase(); + // Get the decimal code + aDecimalText = OUString::number(cChar); + setCharName(cChar); + + // Update the hex and decimal codes only if necessary + if (m_xHexCodeText->get_text() != aHexText) + m_xHexCodeText->set_text( aHexText ); + if (m_xDecimalCodeText->get_text() != aDecimalText) + m_xDecimalCodeText->set_text( aDecimalText ); const Subset* pSubset = nullptr; if( pSubsetMap ) @@ -945,7 +956,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void) m_xSubsetLB->set_active(-1); } - if (m_xShowSet->HasFocus()) + if(m_xShowSet->HasFocus() || m_xHexCodeText->has_focus() || m_xDecimalCodeText->has_focus() ) { m_xShowChar->SetText( aText ); m_xShowChar->SetFont( aFont ); @@ -953,22 +964,6 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void) setFavButtonState(aText, aFont.GetFamilyName()); } - - // show char codes - if ( bSelect ) - { - // Get the hexadecimal code - aHexText = OUString::number(cChar, 16).toAsciiUpperCase(); - // Get the decimal code - aDecimalText = OUString::number(cChar); - setCharName(cChar); - } - - // Update the hex and decimal codes only if necessary - if (m_xHexCodeText->get_text() != aHexText) - m_xHexCodeText->set_text( aHexText ); - if (m_xDecimalCodeText->get_text() != aDecimalText) - m_xDecimalCodeText->set_text( aDecimalText ); } IMPL_LINK_NOARG(SvxCharacterMap, SearchCharHighlightHdl, SvxShowCharSet*, void) @@ -1034,6 +1029,19 @@ void SvxCharacterMap::selectCharByCode(Radix radix) if (xFontCharMap->HasChar(cChar)) // Select the corresponding character SetChar(cChar); + else { + m_xCharName->set_label(CuiResId(RID_SVXSTR_MISSING_GLYPH)); + m_xShowChar->SetText(" "); + switch(radix) + { + case Radix::decimal: + m_xHexCodeText->set_text(OUString::number(cChar, 16)); + break; + case Radix::hexadecimal: + m_xDecimalCodeText->set_text(OUString::number(cChar)); + break; + } + } } IMPL_LINK_NOARG(SvxCharacterMap, DecimalCodeChangeHdl, weld::Entry&, void) -- cgit