Blame SOURCES/0001-Resolves-tdf-95682-spell-dialog-add-a-button-to-open.patch

f325b2
From f46860e84df8548daa12f180f27deef7a1d708d3 Mon Sep 17 00:00:00 2001
f325b2
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
f325b2
Date: Fri, 13 Nov 2015 09:56:01 +0000
f325b2
Subject: [PATCH] Resolves: tdf#95682 spell dialog: add a button to open
f325b2
 special character
f325b2
f325b2
(cherry picked from commit b08b76774fbd253cba587207d471f9bf0c0b0a82)
f325b2
f325b2
Change-Id: I0d070dee9e940b93b294c6b2de180005a5c2248e
f325b2
f325b2
Related: tdf#95682 set edit to modified after insert symbol/paste
f325b2
f325b2
Change-Id: If5892931649bde3d1fc00c0e5817149d0623cb1e
f325b2
(cherry picked from commit de0a391137080a18e73f315b6dc5342b5b078574)
f325b2
f325b2
clear VclPtr warning
f325b2
f325b2
Change-Id: I13f08989034a656bc6f0ae6b556272802f4b8fc2
f325b2
(cherry picked from commit 9c7d3345b02bcf69f28bdbc956a7cedaabe894a0)
f325b2
---
f325b2
 cui/source/dialogs/SpellDialog.cxx |  54 ++++++++++++--
f325b2
 cui/source/inc/SpellDialog.hxx     |   8 +++
f325b2
 cui/uiconfig/ui/spellingdialog.ui  | 143 ++++++++++++++++++++-----------------
f325b2
 3 files changed, 135 insertions(+), 70 deletions(-)
f325b2
f325b2
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
f325b2
index f8952df..7f09b7f 100644
f325b2
--- a/cui/source/dialogs/SpellDialog.cxx
f325b2
+++ b/cui/source/dialogs/SpellDialog.cxx
f325b2
@@ -222,6 +222,8 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
f325b2
     get(m_pOptionsPB, "options");
f325b2
     get(m_pUndoPB, "undo");
f325b2
     get(m_pClosePB, "close");
f325b2
+    get(m_pToolbar, "toolbar");
f325b2
+    m_pSentenceED->Init(m_pToolbar);
f325b2
     xSpell = LinguMgr::GetSpellChecker();
f325b2
     pImpl = new SpellDialog_Impl;
f325b2
 
f325b2
@@ -243,8 +245,6 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
f325b2
         LINK( this, SpellDialog, InitHdl ), NULL, true );
f325b2
 }
f325b2
 
f325b2
-
f325b2
-
f325b2
 SpellDialog::~SpellDialog()
f325b2
 {
f325b2
     disposeOnce();
f325b2
@@ -282,6 +282,7 @@ void SpellDialog::dispose()
f325b2
     m_pOptionsPB.clear();
f325b2
     m_pUndoPB.clear();
f325b2
     m_pClosePB.clear();
f325b2
+    m_pToolbar.clear();
f325b2
     SfxModelessDialog::dispose();
f325b2
 }
f325b2
 
f325b2
@@ -318,8 +319,6 @@ void SpellDialog::Init_Impl()
f325b2
     SvxGetChangeAllList()->clear();
f325b2
 }
f325b2
 
f325b2
-
f325b2
-
f325b2
 void SpellDialog::UpdateBoxes_Impl()
f325b2
 {
f325b2
     sal_Int32 i;
f325b2
@@ -443,6 +442,7 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrent
f325b2
  */
f325b2
 IMPL_LINK( SpellDialog, InitHdl, SpellDialog *, )
f325b2
 {
f325b2
+    m_pToolbar->Disable();
f325b2
     SetUpdateMode( false );
f325b2
     //show or hide AutoCorrect depending on the modules abilities
f325b2
     m_pAutoCorrPB->Show(rParent.HasAutoCorrection());
f325b2
@@ -1219,6 +1219,11 @@ SentenceEditWindow_Impl::SentenceEditWindow_Impl(vcl::Window * pParent, WinBits
f325b2
     DisableSelectionOnFocus();
f325b2
 }
f325b2
 
f325b2
+SentenceEditWindow_Impl::~SentenceEditWindow_Impl()
f325b2
+{
f325b2
+    disposeOnce();
f325b2
+}
f325b2
+
f325b2
 VCL_BUILDER_DECL_FACTORY(SentenceEditWindow)
f325b2
 {
f325b2
     (void)rMap;
f325b2
@@ -1559,9 +1564,50 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt )
f325b2
         else
f325b2
             bChange = false;
f325b2
     }
f325b2
+    else if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS && m_xToolbar)
f325b2
+    {
f325b2
+        m_xToolbar->Enable();
f325b2
+    }
f325b2
+    else if(rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && m_xToolbar)
f325b2
+    {
f325b2
+        m_xToolbar->Disable();
f325b2
+    }
f325b2
     return bChange || VclMultiLineEdit::PreNotify(rNEvt);
f325b2
 }
f325b2
 
f325b2
+void SentenceEditWindow_Impl::Init(VclPtr<ToolBox> &rToolbar)
f325b2
+{
f325b2
+    m_xToolbar = rToolbar;
f325b2
+    m_xToolbar->SetSelectHdl(LINK(this,SentenceEditWindow_Impl,ToolbarHdl));
f325b2
+}
f325b2
+
f325b2
+IMPL_LINK_NOARG_TYPED(SentenceEditWindow_Impl, ToolbarHdl, ToolBox *, void)
f325b2
+{
f325b2
+    const sal_uInt16 nCurItemId = m_xToolbar->GetCurItemId();
f325b2
+    if (nCurItemId == m_xToolbar->GetItemId("paste"))
f325b2
+    {
f325b2
+        Paste();
f325b2
+        CallModifyLink();
f325b2
+    }
f325b2
+    else if (nCurItemId == m_xToolbar->GetItemId("insert"))
f325b2
+    {
f325b2
+        if (Edit::GetGetSpecialCharsFunction())
f325b2
+        {
f325b2
+            OUString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() );
f325b2
+            if (!aChars.isEmpty())
f325b2
+            {
f325b2
+                ReplaceSelected(aChars);
f325b2
+                CallModifyLink();
f325b2
+            }
f325b2
+        }
f325b2
+    }
f325b2
+}
f325b2
+
f325b2
+void SentenceEditWindow_Impl::dispose()
f325b2
+{
f325b2
+    m_xToolbar.clear();
f325b2
+    VclMultiLineEdit::dispose();
f325b2
+}
f325b2
 
f325b2
 bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellChecker1> xSpell )
f325b2
 {
f325b2
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
f325b2
index 38a08cf..543581c 100644
f325b2
--- a/cui/source/inc/SpellDialog.hxx
f325b2
+++ b/cui/source/inc/SpellDialog.hxx
f325b2
@@ -29,6 +29,7 @@
f325b2
 #include <vcl/group.hxx>
f325b2
 #include <vcl/decoview.hxx>
f325b2
 #include <vcl/image.hxx>
f325b2
+#include <vcl/toolbox.hxx>
f325b2
 #include <com/sun/star/uno/Reference.hxx>
f325b2
 
f325b2
 
f325b2
@@ -62,6 +63,7 @@ class SentenceEditWindow_Impl : public VclMultiLineEdit
f325b2
 
f325b2
 private:
f325b2
     std::set< sal_uInt16 >      m_aIgnoreErrorsAt;
f325b2
+    VclPtr<ToolBox>     m_xToolbar;
f325b2
     sal_uInt16          m_nErrorStart;
f325b2
     sal_uInt16          m_nErrorEnd;
f325b2
     bool            m_bIsUndoEditMode;
f325b2
@@ -71,13 +73,17 @@ private:
f325b2
     void            CallModifyLink() {m_aModifyLink.Call(this);}
f325b2
 
f325b2
     inline SpellDialog* GetSpellDialog() const;
f325b2
+
f325b2
+    DECL_LINK_TYPED(ToolbarHdl, ToolBox*, void);
f325b2
 protected:
f325b2
     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
f325b2
 
f325b2
 public:
f325b2
     SentenceEditWindow_Impl(vcl::Window* pParent, WinBits nBits);
f325b2
+    ~SentenceEditWindow_Impl();
f325b2
 
f325b2
     void            SetModifyHdl(const Link<>& rLink) SAL_OVERRIDE { m_aModifyLink = rLink;}
f325b2
+    void            Init(VclPtr<ToolBox> &rToolbar);
f325b2
 
f325b2
     void            SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd );
f325b2
     void            SetText( const OUString& rStr ) SAL_OVERRIDE;
f325b2
@@ -96,6 +102,7 @@ public:
f325b2
 
f325b2
     void            ResetModified()   { GetTextEngine()->SetModified(false); m_bIsUndoEditMode = false;}
f325b2
     virtual bool    IsModified() const SAL_OVERRIDE { return GetTextEngine()->IsModified(); }
f325b2
+    virtual void    dispose() SAL_OVERRIDE;
f325b2
 
f325b2
     bool            IsUndoEditMode() const { return m_bIsUndoEditMode;}
f325b2
     void            SetUndoEditMode(bool bSet);
f325b2
@@ -151,6 +158,7 @@ private:
f325b2
     VclPtr<PushButton>     m_pOptionsPB;
f325b2
     VclPtr<PushButton>     m_pUndoPB;
f325b2
     VclPtr<CloseButton>    m_pClosePB;
f325b2
+    VclPtr<ToolBox>        m_pToolbar;
f325b2
 
f325b2
     OUString        m_sResumeST;
f325b2
     OUString        m_sIgnoreOnceST;
f325b2
diff --git a/cui/uiconfig/ui/spellingdialog.ui b/cui/uiconfig/ui/spellingdialog.ui
f325b2
index 5d89284..94b5307 100644
f325b2
--- a/cui/uiconfig/ui/spellingdialog.ui
f325b2
+++ b/cui/uiconfig/ui/spellingdialog.ui
f325b2
@@ -1,8 +1,8 @@
f325b2
 
f325b2
-
f325b2
+
f325b2
 <interface>
f325b2
   <requires lib="gtk+" version="3.0"/>
f325b2
-  
f325b2
+  <requires lib="LibreOffice" version="1.0"/>
f325b2
   <object class="GtkDialog" id="SpellingDialog">
f325b2
     <property name="can_focus">False</property>
f325b2
     <property name="border_width">6</property>
f325b2
@@ -103,24 +103,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">1</property>
f325b2
                 <property name="top_attach">0</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
-              </packing>
f325b2
-            </child>
f325b2
-            <child>
f325b2
-              <object class="GtkLabel" id="notindictft">
f325b2
-                <property name="visible">True</property>
f325b2
-                <property name="can_focus">False</property>
f325b2
-                <property name="xalign">0</property>
f325b2
-                <property name="label" translatable="yes">_Not in dictionary</property>
f325b2
-                <property name="use_underline">True</property>
f325b2
-                <property name="mnemonic_widget">sentence</property>
f325b2
-              </object>
f325b2
-              <packing>
f325b2
-                <property name="left_attach">0</property>
f325b2
-                <property name="top_attach">2</property>
f325b2
-                <property name="width">3</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -135,8 +117,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">3</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -154,22 +134,6 @@
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
-              <object class="GtkLabel" id="suggestionsft">
f325b2
-                <property name="visible">True</property>
f325b2
-                <property name="can_focus">False</property>
f325b2
-                <property name="xalign">0</property>
f325b2
-                <property name="label" translatable="yes">_Suggestions</property>
f325b2
-                <property name="use_underline">True</property>
f325b2
-                <property name="mnemonic_widget">suggestionslb</property>
f325b2
-              </object>
f325b2
-              <packing>
f325b2
-                <property name="left_attach">0</property>
f325b2
-                <property name="top_attach">8</property>
f325b2
-                <property name="width">3</property>
f325b2
-                <property name="height">1</property>
f325b2
-              </packing>
f325b2
-            </child>
f325b2
-            <child>
f325b2
               <object class="GtkButton" id="change">
f325b2
                 <property name="label" translatable="yes">Co_rrect</property>
f325b2
                 <property name="visible">True</property>
f325b2
@@ -181,8 +145,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">9</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -197,8 +159,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">10</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -213,8 +173,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">11</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -231,7 +189,6 @@
f325b2
                 <property name="left_attach">0</property>
f325b2
                 <property name="top_attach">12</property>
f325b2
                 <property name="width">3</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -246,8 +203,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">4</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -262,39 +217,34 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">5</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
               <object class="GtkLabel" id="languageft">
f325b2
                 <property name="visible">True</property>
f325b2
                 <property name="can_focus">False</property>
f325b2
-                <property name="xalign">0</property>
f325b2
                 <property name="label" translatable="yes">Text languag_e:</property>
f325b2
                 <property name="use_underline">True</property>
f325b2
                 <property name="mnemonic_widget">languagelb</property>
f325b2
+                <property name="xalign">0</property>
f325b2
               </object>
f325b2
               <packing>
f325b2
                 <property name="left_attach">0</property>
f325b2
                 <property name="top_attach">0</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
               <object class="GtkLabel" id="explain">
f325b2
                 <property name="can_focus">False</property>
f325b2
                 <property name="no_show_all">True</property>
f325b2
-                <property name="xalign">0</property>
f325b2
                 <property name="use_underline">True</property>
f325b2
                 <property name="wrap">True</property>
f325b2
+                <property name="xalign">0</property>
f325b2
               </object>
f325b2
               <packing>
f325b2
                 <property name="left_attach">0</property>
f325b2
                 <property name="top_attach">1</property>
f325b2
                 <property name="width">2</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -309,8 +259,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">1</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -323,8 +271,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">0</property>
f325b2
                 <property name="top_attach">13</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -337,8 +283,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">1</property>
f325b2
                 <property name="top_attach">13</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -351,8 +295,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">13</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -384,8 +326,6 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">6</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
@@ -400,11 +340,82 @@
f325b2
               <packing>
f325b2
                 <property name="left_attach">2</property>
f325b2
                 <property name="top_attach">7</property>
f325b2
-                <property name="width">1</property>
f325b2
-                <property name="height">1</property>
f325b2
               </packing>
f325b2
             </child>
f325b2
             <child>
f325b2
+              <object class="GtkLabel" id="suggestionsft">
f325b2
+                <property name="visible">True</property>
f325b2
+                <property name="can_focus">False</property>
f325b2
+                <property name="label" translatable="yes">_Suggestions</property>
f325b2
+                <property name="use_underline">True</property>
f325b2
+                <property name="mnemonic_widget">suggestionslb</property>
f325b2
+                <property name="xalign">0</property>
f325b2
+              </object>
f325b2
+              <packing>
f325b2
+                <property name="left_attach">0</property>
f325b2
+                <property name="top_attach">8</property>
f325b2
+                <property name="width">3</property>
f325b2
+              </packing>
f325b2
+            </child>
f325b2
+            <child>
f325b2
+              <object class="GtkLabel" id="notindictft">
f325b2
+                <property name="visible">True</property>
f325b2
+                <property name="can_focus">False</property>
f325b2
+                <property name="hexpand">True</property>
f325b2
+                <property name="label" translatable="yes">_Not in dictionary</property>
f325b2
+                <property name="use_underline">True</property>
f325b2
+                <property name="mnemonic_widget">sentence</property>
f325b2
+                <property name="xalign">0</property>
f325b2
+              </object>
f325b2
+              <packing>
f325b2
+                <property name="left_attach">0</property>
f325b2
+                <property name="top_attach">2</property>
f325b2
+              </packing>
f325b2
+            </child>
f325b2
+            <child>
f325b2
+              <object class="GtkToolbar" id="toolbar">
f325b2
+                <property name="visible">True</property>
f325b2
+                <property name="can_focus">False</property>
f325b2
+                <property name="halign">end</property>
f325b2
+                <property name="toolbar_style">icons</property>
f325b2
+                <child>
f325b2
+                  <object class="GtkToolButton" id="paste">
f325b2
+                    <property name="visible">True</property>
f325b2
+                    <property name="can_focus">False</property>
f325b2
+                    <property name="action_name">paste</property>
f325b2
+                    <property name="label" translatable="yes">Paste</property>
f325b2
+                    <property name="use_underline">True</property>
f325b2
+                    <property name="icon_name">cmd/sc_paste.png</property>
f325b2
+                  </object>
f325b2
+                  <packing>
f325b2
+                    <property name="expand">False</property>
f325b2
+                    <property name="homogeneous">True</property>
f325b2
+                  </packing>
f325b2
+                </child>
f325b2
+                <child>
f325b2
+                  <object class="GtkToolButton" id="insert">
f325b2
+                    <property name="visible">True</property>
f325b2
+                    <property name="can_focus">False</property>
f325b2
+                    <property name="action_name">insert</property>
f325b2
+                    <property name="label" translatable="yes">Special Character</property>
f325b2
+                    <property name="use_underline">True</property>
f325b2
+                    <property name="icon_name">cmd/sc_insertsymbol.png</property>
f325b2
+                  </object>
f325b2
+                  <packing>
f325b2
+                    <property name="expand">False</property>
f325b2
+                    <property name="homogeneous">True</property>
f325b2
+                  </packing>
f325b2
+                </child>
f325b2
+              </object>
f325b2
+              <packing>
f325b2
+                <property name="left_attach">1</property>
f325b2
+                <property name="top_attach">2</property>
f325b2
+              </packing>
f325b2
+            </child>
f325b2
+            <child>
f325b2
+              <placeholder/>
f325b2
+            </child>
f325b2
+            <child>
f325b2
               <placeholder/>
f325b2
             </child>
f325b2
           </object>
f325b2
-- 
f325b2
2.5.0
f325b2