summaryrefslogtreecommitdiff
path: root/cui/source/dialogs/SpellDialog.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-11-13 09:56:01 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-11-13 10:17:26 +0000
commitb08b76774fbd253cba587207d471f9bf0c0b0a82 (patch)
tree49e80718b42c9c45dd7f72ab6ef7a3c89793c60a /cui/source/dialogs/SpellDialog.cxx
parent8325fcb56d014c12f35808ae6ad17f68b7a1cdd2 (diff)
Resolves: tdf#95682 spell dialog: add a button to open special character
Change-Id: I0d070dee9e940b93b294c6b2de180005a5c2248e
Diffstat (limited to 'cui/source/dialogs/SpellDialog.cxx')
-rw-r--r--cui/source/dialogs/SpellDialog.cxx43
1 files changed, 39 insertions, 4 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 )
{