diff options
Diffstat (limited to 'cui/source/dialogs/cuicharmap.cxx')
-rw-r--r-- | cui/source/dialogs/cuicharmap.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index 2b9fe879ab28..b2ac8ee93b9e 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -47,6 +47,8 @@ #include <editeng/fontitem.hxx> #include "strings.hrc" #include "macroass.hxx" +#include <unicode/uchar.h> +#include <unicode/utypes.h> using namespace css; @@ -71,6 +73,9 @@ SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, const SfxItemSet* pSet ) m_pSubsetLB->set_width_request(m_pSubsetLB->get_preferred_size().Width()); get(m_pHexCodeText, "hexvalue"); get(m_pDecimalCodeText, "decimalvalue"); get(m_pFavouritesBtn, "favbtn"); + get(m_pCharName, "charname"); + m_pCharName->set_height_request(m_pCharName->GetTextHeight()*3); + m_pCharName->SetPaintTransparent(true); //lock the size request of this widget to the width of the original .ui string m_pHexCodeText->set_width_request(m_pHexCodeText->get_preferred_size().Width()); @@ -177,6 +182,7 @@ void SvxCharacterMap::dispose() m_pShowChar.clear(); m_pHexCodeText.clear(); m_pDecimalCodeText.clear(); + m_pCharName.clear(); maRecentCharList.clear(); maRecentCharFontList.clear(); @@ -498,6 +504,15 @@ void SvxCharacterMap::init() m_pFavCharView[i]->setClearAllClickHdl(LINK(this,SvxCharacterMap, FavClearAllClickHdl)); m_pFavCharView[i]->SetLoseFocusHdl(LINK(this,SvxCharacterMap, LoseFocusHdl)); } + + char buffer[100]; + UErrorCode errorCode = U_ZERO_ERROR;; + + /* get the character name */ + u_charName((UChar32)90, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode); + + if(U_SUCCESS(errorCode)) + m_pCharName->SetText(OUString::createFromAscii(buffer)); } bool SvxCharacterMap::isFavChar(const OUString& sTitle, const OUString& rFont) @@ -651,6 +666,17 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, ListBox&, void) m_pSubsetLB->Enable(bNeedSubset); } +void SvxCharacterMap::setCharName(char decimal[]) +{ + int nDecimalValue = std::stoi(decimal); + char buffer[100]; + UErrorCode errorCode; + + /* get the character name */ + errorCode=U_ZERO_ERROR; + u_charName((UChar32)nDecimalValue, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode); + m_pCharName->SetText(OUString::createFromAscii(buffer)); +} IMPL_LINK_NOARG(SvxCharacterMap, SubsetSelectHdl, ListBox&, void) { @@ -765,6 +791,7 @@ IMPL_LINK(SvxCharacterMap, CharClickHdl, SvxCharView*, rView, void) m_pHexCodeText->SetText( aHexText ); m_pDecimalCodeText->SetText( aDecimalText ); + setCharName(aDecBuf); rView->Invalidate(); m_pOKBtn->Enable(); @@ -853,6 +880,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void) char aDecBuf[32]; snprintf( aDecBuf, sizeof(aDecBuf), "%u", static_cast<unsigned>(cChar) ); aDecimalText = OUString::createFromAscii(aDecBuf); + setCharName(aDecBuf); } // Update the hex and decimal codes only if necessary |