[Libreoffice-commits] core.git: cui/source cui/uiconfig

Daniel danielfaleirosilva at gmail.com
Mon Sep 25 23:08:09 UTC 2017


 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(-)

New commits:
commit 4020945651b4f3c636980e2103db440b5c55459c
Author: Daniel <danielfaleirosilva at gmail.com>
Date:   Sun Sep 24 17:55:19 2017 -0300

    tdf#111739 fix Selecting a custom character as a bullet symbol insertion
    
    Change-Id: I638ef2467f27bd6214cde092be5a3055fd539ebc
    Reviewed-on: https://gerrit.libreoffice.org/42727
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

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<beans::PropertyValue> aArgs(2);
-    aArgs[0].Name = "Symbols";
-    aArgs[0].Value <<= sGlyph;
+      uno::Sequence<beans::PropertyValue> 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<OUString> maRecentCharList;
     std::deque<OUString> 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 @@
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
+            <!-- Ok and Insert buttons are the same button. The correct one is set to visible incode. -->
+            <child>
+              <object class="GtkButton" id="insert">
+                <property name="label" translatable="yes" context="specialcharacters|insert">_Insert</property>
+                <property name="visible">False</property>
+                <property name="can_focus">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkButton" id="ok">
-                <property name="label" translatable="yes" context="specialcharacters|ok">_Insert</property>
-                <property name="visible">True</property>
+                <property name="label" translatable="yes" context="specialcharacters|ok">Ok</property>
+                <property name="visible">False</property>
                 <property name="can_focus">True</property>
                 <property name="has_default">True</property>
                 <property name="receives_default">True</property>


More information about the Libreoffice-commits mailing list