diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-17 14:14:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-17 14:14:58 +0100 |
commit | fdec471a7caca3b5065676e3f31aeaa91b0f238f (patch) | |
tree | be7cc82990d84077e63f99668045cf7f496b643f /cui | |
parent | merge the 5 ConstAsciiString duplicate classes together (diff) | |
download | core-fdec471a7caca3b5065676e3f31aeaa91b0f238f.tar.gz core-fdec471a7caca3b5065676e3f31aeaa91b0f238f.zip |
Related: fdo#40778 use simple pushbutton for add to single user dict
for "add" an unknown word to user-defined dictionaries
a) use a normal button when there's only one user-defined dictionary
b) use a dropdown when there's more than one user-defined dictionary
Change-Id: I8a8eb3fff6c4582341d8322df403b73a517a5560
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/SpellDialog.cxx | 25 | ||||
-rw-r--r-- | cui/source/dialogs/SpellDialog.hrc | 1 | ||||
-rw-r--r-- | cui/source/dialogs/SpellDialog.src | 10 | ||||
-rw-r--r-- | cui/source/inc/SpellDialog.hxx | 3 |
4 files changed, 33 insertions, 6 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 200cd398da7f..64df45d5d386 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -235,6 +235,7 @@ SpellDialog::SpellDialog( aIgnoreAllPB ( this, CUI_RES( PB_IGNOREALL ) ), aIgnoreRulePB ( this, CUI_RES( PB_IGNORERULE ) ), aAddToDictMB ( this, CUI_RES( MB_ADDTODICT ) ), + aAddToDictPB ( this, CUI_RES( PB_ADDTODICT ) ), aChangePB ( this, CUI_RES( PB_CHANGE ) ), aChangeAllPB ( this, CUI_RES( PB_CHANGEALL ) ), @@ -324,9 +325,9 @@ void SpellDialog::Init_Impl() aSentenceED.SetModifyHdl(LINK ( this, SpellDialog, ModifyHdl) ); - aAddToDictMB.SetMenuMode( MENUBUTTON_MENUMODE_TIMED ); aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictSelectHdl ) ); - aAddToDictMB.SetClickHdl(LINK ( this, SpellDialog, AddToDictClickHdl ) ); + aAddToDictPB.SetClickHdl(LINK ( this, SpellDialog, AddToDictClickHdl ) ); + aLanguageLB.SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) ); aExplainLink.SetClickHdl( LINK( this, SpellDialog, HandleHyperlink ) ); @@ -368,7 +369,7 @@ void SpellDialog::UpdateBoxes_Impl() else SetTitle_Impl( nAltLanguage ); SetSelectedLang_Impl( nAltLanguage ); - InitUserDicts(); + int nDicts = InitUserDicts(); // enter alternatives const ::rtl::OUString *pNewWords = aNewWords.getConstArray(); @@ -399,7 +400,9 @@ void SpellDialog::UpdateBoxes_Impl() aExplainFT.Show( !bShowChangeAll ); aLanguageLB.Enable( bShowChangeAll ); aIgnoreAllPB.Show( bShowChangeAll ); - aAddToDictMB.Show( bShowChangeAll ); + + aAddToDictMB.Show( bShowChangeAll && nDicts > 1); + aAddToDictPB.Show( bShowChangeAll && nDicts <= 1); aIgnoreRulePB.Show( !bShowChangeAll ); aIgnoreRulePB.Enable(pSpellErrorDescription && !pSpellErrorDescription->sRuleId.isEmpty()); aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() ); @@ -465,6 +468,7 @@ void SpellDialog::UpdateBoxes_Impl() &aIgnoreAllPB, &aIgnoreRulePB, &aAddToDictMB, + &aAddToDictPB, &aChangePB, &aChangeAllPB, &aAutoCorrPB, @@ -939,7 +943,7 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang) SetText( sTitle ); } -void SpellDialog::InitUserDicts() +int SpellDialog::InitUserDicts() { const LanguageType nLang = aLanguageLB.GetSelectLanguage(); @@ -1002,6 +1006,14 @@ void SpellDialog::InitUserDicts() } aAddToDictMB.SetPopupMenu(pMenu); aAddToDictMB.Enable( bEnable ); + aAddToDictPB.Enable( bEnable ); + + int nDicts = nItemId-1; + + aAddToDictMB.Show( nDicts > 1 ); + aAddToDictPB.Show( nDicts <= 1 ); + + return nDicts; } //----------------------------------------------------------------------- @@ -1154,6 +1166,7 @@ void SpellDialog::InvalidateDialog() &aIgnoreAllPB, &aIgnoreRulePB, &aAddToDictMB, + &aAddToDictPB, &aChangePB, &aChangeAllPB, &aAutoCorrPB, @@ -1753,6 +1766,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError ) pSpellDialog->aIgnoreAllPB.Enable(bRet); pSpellDialog->aAutoCorrPB.Enable(bRet); pSpellDialog->aAddToDictMB.Enable(bRet); + pSpellDialog->aAddToDictPB.Enable(bRet); return bRet; } @@ -2118,6 +2132,7 @@ void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet) &pSpellDialog->aLanguageFT, &pSpellDialog->aLanguageLB, &pSpellDialog->aAddToDictMB, + &pSpellDialog->aAddToDictPB, &pSpellDialog->aAutoCorrPB, 0 }; diff --git a/cui/source/dialogs/SpellDialog.hrc b/cui/source/dialogs/SpellDialog.hrc index 36b6c56d584d..ac03c24e9279 100644 --- a/cui/source/dialogs/SpellDialog.hrc +++ b/cui/source/dialogs/SpellDialog.hrc @@ -51,3 +51,4 @@ #define LINK_EXPLAIN 55 #define FT_EXPLAIN 56 #define PB_IGNORERULE 59 +#define PB_ADDTODICT 60 diff --git a/cui/source/dialogs/SpellDialog.src b/cui/source/dialogs/SpellDialog.src index 4a5b2c9c127f..9781ae10868f 100644 --- a/cui/source/dialogs/SpellDialog.src +++ b/cui/source/dialogs/SpellDialog.src @@ -129,6 +129,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK Size = MAP_APPFONT( 55, 14 ); Text [ en-US ] = "I~gnore All" ; }; + PushButton PB_IGNORERULE { HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORERULE"; @@ -137,6 +138,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK Text [ en-US ] = "I~gnore Rule" ; Hide = TRUE; }; + MenuButton MB_ADDTODICT { HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT"; @@ -145,6 +147,14 @@ ModelessDialog RID_SVXDLG_SPELLCHECK Text [ en-US ] = "~Add" ; }; + PushButton PB_ADDTODICT + { + HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT"; + Pos = MAP_APPFONT( 209, 91 ); + Size = MAP_APPFONT( 55, 14 ); + Text [ en-US ] = "~Add" ; + }; + PushButton PB_CHANGE { HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGE"; diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index f302e1f4acfd..1343b044a168 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -165,6 +165,7 @@ private: PushButton aIgnoreAllPB; PushButton aIgnoreRulePB; MenuButton aAddToDictMB; + PushButton aAddToDictPB; PushButton aChangePB; PushButton aChangeAllPB; @@ -222,7 +223,7 @@ private: int AddToDictionaryExecute( sal_uInt16 ItemId, PopupMenu *pMenu ); void StartSpellOptDlg_Impl(); - void InitUserDicts(); + int InitUserDicts(); void UpdateBoxes_Impl(); void Init_Impl(); void SpellContinue_Impl(bool UseSavedSentence = false, bool bIgnoreCurrentError = false ); |