[Libreoffice-commits] .: cui/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Tue Apr 17 03:15:45 PDT 2012


 cui/source/dialogs/SpellDialog.cxx |   21 +++++++++++++++++----
 cui/source/inc/SpellDialog.hxx     |    4 +++-
 2 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit 808be9732e409789f9d26c13c15bbd899c408cd0
Author: Rob Snelders <rob at ertai.nl>
Date:   Sat Apr 14 13:17:04 2012 +0200

    fdo#40778 Remove dictionary choice when adding new entry to the spellchecker

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 04f8185..fe1e39d 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 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();


More information about the Libreoffice-commits mailing list