From 4020945651b4f3c636980e2103db440b5c55459c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 24 Sep 2017 17:55:19 -0300 Subject: tdf#111739 fix Selecting a custom character as a bullet symbol insertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I638ef2467f27bd6214cde092be5a3055fd539ebc Reviewed-on: https://gerrit.libreoffice.org/42727 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai --- cui/source/dialogs/cuicharmap.cxx | 24 +++++++++++++++--------- cui/source/inc/cuicharmap.hxx | 3 ++- cui/source/tabpages/numpages.cxx | 2 +- cui/uiconfig/ui/specialcharacters.ui | 20 ++++++++++++++++++-- 4 files changed, 36 insertions(+), 13 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index 770cd82a1ce7..5234d75ef287 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -54,17 +54,19 @@ using namespace css; // class SvxCharacterMap ================================================= -SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, const SfxItemSet* pSet ) +SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, const SfxItemSet* pSet, bool bInsert ) : SfxModalDialog(pParent, "SpecialCharactersDialog", "cui/ui/specialcharacters.ui") , pSubsetMap( nullptr ) , isSearchMode(true) + , m_bHasInsert(bInsert) , mxContext(comphelper::getProcessComponentContext()) { get(m_pShowSet, "showcharset"); get(m_pSearchSet, "searchcharset"); get(m_pShowChar, "showchar"); m_pShowChar->SetCentered(true); - get(m_pOKBtn, "ok"); + if (m_bHasInsert) get(m_pOKBtn, "insert"); + else get(m_pOKBtn, "ok"); get(m_pFontText, "fontft"); get(m_pFontLB, "fontlb"); m_pFontLB->SetStyle(m_pFontLB->GetStyle() | WB_SORT); @@ -475,6 +477,8 @@ void SvxCharacterMap::init() m_pFontLB->SetSelectHdl( LINK( this, SvxCharacterMap, FontSelectHdl ) ); m_pSubsetLB->SetSelectHdl( LINK( this, SvxCharacterMap, SubsetSelectHdl ) ); m_pOKBtn->SetClickHdl( LINK( this, SvxCharacterMap, InsertClickHdl ) ); + m_pOKBtn->Show(); + m_pShowSet->SetDoubleClickHdl( LINK( this, SvxCharacterMap, CharDoubleClickHdl ) ); m_pShowSet->SetSelectHdl( LINK( this, SvxCharacterMap, CharSelectHdl ) ); @@ -619,15 +623,17 @@ void SvxCharacterMap::insertCharToDoc(const OUString& sGlyph) if(sGlyph.isEmpty()) return; - uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + if (m_bHasInsert) { + uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); - uno::Sequence aArgs(2); - aArgs[0].Name = "Symbols"; - aArgs[0].Value <<= sGlyph; + uno::Sequence aArgs(2); + aArgs[0].Name = "Symbols"; + aArgs[0].Value <<= sGlyph; - aArgs[1].Name = "FontName"; - aArgs[1].Value <<= aFont.GetFamilyName(); - comphelper::dispatchCommand(".uno:InsertSymbol", aArgs); + aArgs[1].Name = "FontName"; + aArgs[1].Value <<= aFont.GetFamilyName(); + comphelper::dispatchCommand(".uno:InsertSymbol", aArgs); + } updateRecentCharacterList(sGlyph, aFont.GetFamilyName()); } diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx index 2ba12e34f212..b1a06b4540e3 100644 --- a/cui/source/inc/cuicharmap.hxx +++ b/cui/source/inc/cuicharmap.hxx @@ -89,6 +89,7 @@ private: vcl::Font aFont; const SubsetMap* pSubsetMap; bool isSearchMode; + bool m_bHasInsert; std::deque maRecentCharList; std::deque maRecentCharFontList; @@ -128,7 +129,7 @@ private: void selectCharByCode(Radix radix); public: - SvxCharacterMap( vcl::Window* pParent, const SfxItemSet* pSet=nullptr ); + SvxCharacterMap( vcl::Window* pParent, const SfxItemSet* pSet=nullptr, const bool bInsert=true); virtual ~SvxCharacterMap() override; virtual short Execute() override; virtual void dispose() override; diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index fd4a5368e4b9..4327294ba998 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -2074,7 +2074,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, MenuButton *, void) IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, Button*, void) { - VclPtrInstance< SvxCharacterMap > pMap( this ); + VclPtrInstance< SvxCharacterMap > pMap( this, nullptr, false ); sal_uInt16 nMask = 1; const vcl::Font* pFmtFont = nullptr; diff --git a/cui/uiconfig/ui/specialcharacters.ui b/cui/uiconfig/ui/specialcharacters.ui index ba978fc37929..cd1c0402ddb0 100644 --- a/cui/uiconfig/ui/specialcharacters.ui +++ b/cui/uiconfig/ui/specialcharacters.ui @@ -18,10 +18,26 @@ False end + + + + _Insert + False + True + True + True + True + + + False + True + 0 + + - _Insert - True + Ok + False True True True -- cgit