diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-13 09:56:01 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-13 10:17:26 +0000 |
commit | b08b76774fbd253cba587207d471f9bf0c0b0a82 (patch) | |
tree | 49e80718b42c9c45dd7f72ab6ef7a3c89793c60a /cui | |
parent | 8325fcb56d014c12f35808ae6ad17f68b7a1cdd2 (diff) |
Resolves: tdf#95682 spell dialog: add a button to open special character
Change-Id: I0d070dee9e940b93b294c6b2de180005a5c2248e
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/SpellDialog.cxx | 43 | ||||
-rw-r--r-- | cui/source/inc/SpellDialog.hxx | 7 | ||||
-rw-r--r-- | cui/uiconfig/ui/spellingdialog.ui | 143 |
3 files changed, 123 insertions, 70 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index fbb23b8b0c85..d632fd546dc2 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -221,6 +221,8 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow, get(m_pOptionsPB, "options"); get(m_pUndoPB, "undo"); get(m_pClosePB, "close"); + get(m_pToolbar, "toolbar"); + m_pSentenceED->Init(m_pToolbar); xSpell = LinguMgr::GetSpellChecker(); pImpl = new SpellDialog_Impl; @@ -242,8 +244,6 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow, LINK( this, SpellDialog, InitHdl ), nullptr, true ); } - - SpellDialog::~SpellDialog() { disposeOnce(); @@ -281,6 +281,7 @@ void SpellDialog::dispose() m_pOptionsPB.clear(); m_pUndoPB.clear(); m_pClosePB.clear(); + m_pToolbar.clear(); SfxModelessDialog::dispose(); } @@ -317,8 +318,6 @@ void SpellDialog::Init_Impl() SvxGetChangeAllList()->clear(); } - - void SpellDialog::UpdateBoxes_Impl() { sal_Int32 i; @@ -442,6 +441,7 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrent */ IMPL_LINK_NOARG_TYPED( SpellDialog, InitHdl, void*, void) { + m_pToolbar->Disable(); SetUpdateMode( false ); //show or hide AutoCorrect depending on the modules abilities m_pAutoCorrPB->Show(rParent.HasAutoCorrection()); @@ -1537,9 +1537,44 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt ) else bChange = false; } + else if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS && m_xToolbar) + { + m_xToolbar->Enable(); + } + else if(rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && m_xToolbar) + { + m_xToolbar->Disable(); + } return bChange || VclMultiLineEdit::PreNotify(rNEvt); } +void SentenceEditWindow_Impl::Init(VclPtr<ToolBox> &rToolbar) +{ + m_xToolbar = rToolbar; + m_xToolbar->SetSelectHdl(LINK(this,SentenceEditWindow_Impl,ToolbarHdl)); +} + +IMPL_LINK_NOARG_TYPED(SentenceEditWindow_Impl, ToolbarHdl, ToolBox *, void) +{ + const sal_uInt16 nCurItemId = m_xToolbar->GetCurItemId(); + if (nCurItemId == m_xToolbar->GetItemId("paste")) + Paste(); + else if (nCurItemId == m_xToolbar->GetItemId("insert")) + { + if (Edit::GetGetSpecialCharsFunction()) + { + OUString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() ); + if (!aChars.isEmpty()) + ReplaceSelected(aChars); + } + } +} + +void SentenceEditWindow_Impl::dispose() +{ + m_xToolbar.clear(); + VclMultiLineEdit::dispose(); +} bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, css::uno::Reference<css::linguistic2::XSpellChecker1> xSpell ) { diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index 449271d5b2fd..c6b5ef8b0c0e 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -29,6 +29,7 @@ #include <vcl/group.hxx> #include <vcl/decoview.hxx> #include <vcl/image.hxx> +#include <vcl/toolbox.hxx> #include <com/sun/star/uno/Reference.hxx> @@ -62,6 +63,7 @@ class SentenceEditWindow_Impl : public VclMultiLineEdit private: std::set< sal_uInt16 > m_aIgnoreErrorsAt; + VclPtr<ToolBox> m_xToolbar; sal_uInt16 m_nErrorStart; sal_uInt16 m_nErrorEnd; bool m_bIsUndoEditMode; @@ -71,12 +73,15 @@ private: void CallModifyLink() {m_aModifyLink.Call(*this);} inline SpellDialog* GetSpellDialog() const; + + DECL_LINK_TYPED(ToolbarHdl, ToolBox*, void); protected: virtual bool PreNotify( NotifyEvent& rNEvt ) override; public: SentenceEditWindow_Impl(vcl::Window* pParent, WinBits nBits); + void Init(VclPtr<ToolBox> &rToolbar); void SetModifyHdl(const Link<Edit&,void>& rLink) override { m_aModifyLink = rLink;} void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd ); @@ -96,6 +101,7 @@ public: void ResetModified() { GetTextEngine()->SetModified(false); m_bIsUndoEditMode = false;} virtual bool IsModified() const override { return GetTextEngine()->IsModified(); } + virtual void dispose() override; bool IsUndoEditMode() const { return m_bIsUndoEditMode;} void SetUndoEditMode(bool bSet); @@ -151,6 +157,7 @@ private: VclPtr<PushButton> m_pOptionsPB; VclPtr<PushButton> m_pUndoPB; VclPtr<CloseButton> m_pClosePB; + VclPtr<ToolBox> m_pToolbar; OUString m_sResumeST; OUString m_sIgnoreOnceST; diff --git a/cui/uiconfig/ui/spellingdialog.ui b/cui/uiconfig/ui/spellingdialog.ui index 5d89284312b0..94b530770678 100644 --- a/cui/uiconfig/ui/spellingdialog.ui +++ b/cui/uiconfig/ui/spellingdialog.ui @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.19.0 --> <interface> <requires lib="gtk+" version="3.0"/> - <!-- interface-requires LibreOffice 1.0 --> + <requires lib="LibreOffice" version="1.0"/> <object class="GtkDialog" id="SpellingDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> @@ -103,24 +103,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="notindictft"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Not in dictionary</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">sentence</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">3</property> - <property name="height">1</property> </packing> </child> <child> @@ -135,8 +117,6 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -154,22 +134,6 @@ </packing> </child> <child> - <object class="GtkLabel" id="suggestionsft"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Suggestions</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">suggestionslb</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">8</property> - <property name="width">3</property> - <property name="height">1</property> - </packing> - </child> - <child> <object class="GtkButton" id="change"> <property name="label" translatable="yes">Co_rrect</property> <property name="visible">True</property> @@ -181,8 +145,6 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">9</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -197,8 +159,6 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">10</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -213,8 +173,6 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">11</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -231,7 +189,6 @@ <property name="left_attach">0</property> <property name="top_attach">12</property> <property name="width">3</property> - <property name="height">1</property> </packing> </child> <child> @@ -246,8 +203,6 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -262,39 +217,34 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="languageft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes">Text languag_e:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">languagelb</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="explain"> <property name="can_focus">False</property> <property name="no_show_all">True</property> - <property name="xalign">0</property> <property name="use_underline">True</property> <property name="wrap">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> <property name="width">2</property> - <property name="height">1</property> </packing> </child> <child> @@ -309,8 +259,6 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -323,8 +271,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">13</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -337,8 +283,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">13</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -351,8 +295,6 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">13</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -384,8 +326,6 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">6</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -400,11 +340,82 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">7</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> + <object class="GtkLabel" id="suggestionsft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Suggestions</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">suggestionslb</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">8</property> + <property name="width">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="notindictft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes">_Not in dictionary</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">sentence</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkToolbar" id="toolbar"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="toolbar_style">icons</property> + <child> + <object class="GtkToolButton" id="paste"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">paste</property> + <property name="label" translatable="yes">Paste</property> + <property name="use_underline">True</property> + <property name="icon_name">cmd/sc_paste.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="insert"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">insert</property> + <property name="label" translatable="yes">Special Character</property> + <property name="use_underline">True</property> + <property name="icon_name">cmd/sc_insertsymbol.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> <placeholder/> </child> </object> |