[PATCH] fdo#40778 Remove dictionary choice when adding new entry to the spellchecker
Rob Snelders (none)
ertai at idefix.
Sat Apr 14 04:17:04 PDT 2012
---
cui/source/dialogs/SpellDialog.cxx | 21 +++++++++++++++++----
cui/source/inc/SpellDialog.hxx | 4 +++-
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 23b3aa4..1681d67 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 ) );
@@ -1009,7 +1012,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 );
@@ -1017,8 +1032,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 2d9383b..f302e1f 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();
--
1.7.5.4
--------------050803040800060801080509--
More information about the LibreOffice
mailing list