From f46860e84df8548daa12f180f27deef7a1d708d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 13 Nov 2015 09:56:01 +0000 Subject: [PATCH] Resolves: tdf#95682 spell dialog: add a button to open special character (cherry picked from commit b08b76774fbd253cba587207d471f9bf0c0b0a82) Change-Id: I0d070dee9e940b93b294c6b2de180005a5c2248e Related: tdf#95682 set edit to modified after insert symbol/paste Change-Id: If5892931649bde3d1fc00c0e5817149d0623cb1e (cherry picked from commit de0a391137080a18e73f315b6dc5342b5b078574) clear VclPtr warning Change-Id: I13f08989034a656bc6f0ae6b556272802f4b8fc2 (cherry picked from commit 9c7d3345b02bcf69f28bdbc956a7cedaabe894a0) --- cui/source/dialogs/SpellDialog.cxx | 54 ++++++++++++-- cui/source/inc/SpellDialog.hxx | 8 +++ cui/uiconfig/ui/spellingdialog.ui | 143 ++++++++++++++++++++----------------- 3 files changed, 135 insertions(+), 70 deletions(-) diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index f8952df..7f09b7f 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -222,6 +222,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; @@ -243,8 +245,6 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow, LINK( this, SpellDialog, InitHdl ), NULL, true ); } - - SpellDialog::~SpellDialog() { disposeOnce(); @@ -282,6 +282,7 @@ void SpellDialog::dispose() m_pOptionsPB.clear(); m_pUndoPB.clear(); m_pClosePB.clear(); + m_pToolbar.clear(); SfxModelessDialog::dispose(); } @@ -318,8 +319,6 @@ void SpellDialog::Init_Impl() SvxGetChangeAllList()->clear(); } - - void SpellDialog::UpdateBoxes_Impl() { sal_Int32 i; @@ -443,6 +442,7 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrent */ IMPL_LINK( SpellDialog, InitHdl, SpellDialog *, ) { + m_pToolbar->Disable(); SetUpdateMode( false ); //show or hide AutoCorrect depending on the modules abilities m_pAutoCorrPB->Show(rParent.HasAutoCorrection()); @@ -1219,6 +1219,11 @@ SentenceEditWindow_Impl::SentenceEditWindow_Impl(vcl::Window * pParent, WinBits DisableSelectionOnFocus(); } +SentenceEditWindow_Impl::~SentenceEditWindow_Impl() +{ + disposeOnce(); +} + VCL_BUILDER_DECL_FACTORY(SentenceEditWindow) { (void)rMap; @@ -1559,9 +1564,50 @@ 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 &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(); + CallModifyLink(); + } + else if (nCurItemId == m_xToolbar->GetItemId("insert")) + { + if (Edit::GetGetSpecialCharsFunction()) + { + OUString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() ); + if (!aChars.isEmpty()) + { + ReplaceSelected(aChars); + CallModifyLink(); + } + } + } +} + +void SentenceEditWindow_Impl::dispose() +{ + m_xToolbar.clear(); + VclMultiLineEdit::dispose(); +} bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, com::sun::star::uno::Reference xSpell ) { diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index 38a08cf..543581c 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -62,6 +63,7 @@ class SentenceEditWindow_Impl : public VclMultiLineEdit private: std::set< sal_uInt16 > m_aIgnoreErrorsAt; + VclPtr m_xToolbar; sal_uInt16 m_nErrorStart; sal_uInt16 m_nErrorEnd; bool m_bIsUndoEditMode; @@ -71,13 +73,17 @@ private: void CallModifyLink() {m_aModifyLink.Call(this);} inline SpellDialog* GetSpellDialog() const; + + DECL_LINK_TYPED(ToolbarHdl, ToolBox*, void); protected: virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; public: SentenceEditWindow_Impl(vcl::Window* pParent, WinBits nBits); + ~SentenceEditWindow_Impl(); void SetModifyHdl(const Link<>& rLink) SAL_OVERRIDE { m_aModifyLink = rLink;} + void Init(VclPtr &rToolbar); void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd ); void SetText( const OUString& rStr ) SAL_OVERRIDE; @@ -96,6 +102,7 @@ public: void ResetModified() { GetTextEngine()->SetModified(false); m_bIsUndoEditMode = false;} virtual bool IsModified() const SAL_OVERRIDE { return GetTextEngine()->IsModified(); } + virtual void dispose() SAL_OVERRIDE; bool IsUndoEditMode() const { return m_bIsUndoEditMode;} void SetUndoEditMode(bool bSet); @@ -151,6 +158,7 @@ private: VclPtr m_pOptionsPB; VclPtr m_pUndoPB; VclPtr m_pClosePB; + VclPtr m_pToolbar; OUString m_sResumeST; OUString m_sIgnoreOnceST; diff --git a/cui/uiconfig/ui/spellingdialog.ui b/cui/uiconfig/ui/spellingdialog.ui index 5d89284..94b5307 100644 --- a/cui/uiconfig/ui/spellingdialog.ui +++ b/cui/uiconfig/ui/spellingdialog.ui @@ -1,8 +1,8 @@ - + - + False 6 @@ -103,24 +103,6 @@ 1 0 - 1 - 1 - - - - - True - False - 0 - _Not in dictionary - True - sentence - - - 0 - 2 - 3 - 1 @@ -135,8 +117,6 @@ 2 3 - 1 - 1 @@ -154,22 +134,6 @@ - - True - False - 0 - _Suggestions - True - suggestionslb - - - 0 - 8 - 3 - 1 - - - Co_rrect True @@ -181,8 +145,6 @@ 2 9 - 1 - 1 @@ -197,8 +159,6 @@ 2 10 - 1 - 1 @@ -213,8 +173,6 @@ 2 11 - 1 - 1 @@ -231,7 +189,6 @@ 0 12 3 - 1 @@ -246,8 +203,6 @@ 2 4 - 1 - 1 @@ -262,39 +217,34 @@ 2 5 - 1 - 1 True False - 0 Text languag_e: True languagelb + 0 0 0 - 1 - 1 False True - 0 True True + 0 0 1 2 - 1 @@ -309,8 +259,6 @@ 2 1 - 1 - 1 @@ -323,8 +271,6 @@ 0 13 - 1 - 1 @@ -337,8 +283,6 @@ 1 13 - 1 - 1 @@ -351,8 +295,6 @@ 2 13 - 1 - 1 @@ -384,8 +326,6 @@ 2 6 - 1 - 1 @@ -400,11 +340,82 @@ 2 7 - 1 - 1 + + True + False + _Suggestions + True + suggestionslb + 0 + + + 0 + 8 + 3 + + + + + True + False + True + _Not in dictionary + True + sentence + 0 + + + 0 + 2 + + + + + True + False + end + icons + + + True + False + paste + Paste + True + cmd/sc_paste.png + + + False + True + + + + + True + False + insert + Special Character + True + cmd/sc_insertsymbol.png + + + False + True + + + + + 1 + 2 + + + + + + -- 2.5.0