summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/dialogs/SpellDialog.cxx21
-rw-r--r--cui/source/inc/SpellDialog.hxx4
2 files changed, 20 insertions, 5 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 04f8185cd716..fe1e39d86774 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -324,7 +324,10 @@ void SpellDialog::Init_Impl()
aSuggestionLB.SetDoubleClickHdl( LINK( this, SpellDialog, ChangeHdl ) );
aSentenceED.SetModifyHdl(LINK ( this, SpellDialog, ModifyHdl) );
- aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictionaryHdl ) );
+
+ aAddToDictMB.SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
+ aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictSelectHdl ) );
+ aAddToDictMB.SetClickHdl(LINK ( this, SpellDialog, AddToDictClickHdl ) );
aLanguageLB.SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) );
aExplainLink.SetClickHdl( LINK( this, SpellDialog, HandleHyperlink ) );
@@ -1003,7 +1006,19 @@ void SpellDialog::InitUserDicts()
}
//-----------------------------------------------------------------------
-IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton )
+IMPL_LINK(SpellDialog, AddToDictClickHdl, MenuButton*, pButton )
+{
+ return AddToDictionaryExecute(1, pButton->GetPopupMenu());
+}
+
+//-----------------------------------------------------------------------
+IMPL_LINK(SpellDialog, AddToDictSelectHdl, MenuButton*, pButton )
+{
+ return AddToDictionaryExecute(pButton->GetCurItemId(), pButton->GetPopupMenu());
+}
+
+//-----------------------------------------------------------------------
+int SpellDialog::AddToDictionaryExecute( sal_uInt16 nItemId, PopupMenu *pMenu )
{
aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
@@ -1011,8 +1026,6 @@ IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton )
//manually changed
const String aNewWord= aSentenceED.GetErrorText();
- sal_uInt16 nItemId = pButton->GetCurItemId();
- PopupMenu *pMenu = pButton->GetPopupMenu();
String aDicName ( pMenu->GetItemText( nItemId ) );
uno::Reference< linguistic2::XDictionary > xDic;
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 2d9383bf33c1..f302e1f4acfd 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -212,13 +212,15 @@ private:
DECL_LINK(CancelHdl, void *);
DECL_LINK( ModifyHdl, SentenceEditWindow_Impl *);
DECL_LINK(UndoHdl, void *);
- DECL_LINK( AddToDictionaryHdl, MenuButton* );
+ DECL_LINK( AddToDictSelectHdl, MenuButton* );
+ DECL_LINK( AddToDictClickHdl, MenuButton* );
DECL_LINK( LanguageSelectHdl, SvxLanguageBox* );
DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* );
DECL_LINK( HandleHyperlink, svt::FixedHyperlink * );
DECL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog * );
+ int AddToDictionaryExecute( sal_uInt16 ItemId, PopupMenu *pMenu );
void StartSpellOptDlg_Impl();
void InitUserDicts();
void UpdateBoxes_Impl();