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
This commit is contained in:
Caolán McNamara
2012-05-17 14:14:58 +01:00
parent 5dcf536b69
commit fdec471a7c
4 changed files with 33 additions and 6 deletions

View File

@@ -235,6 +235,7 @@ SpellDialog::SpellDialog(
aIgnoreAllPB ( this, CUI_RES( PB_IGNOREALL ) ), aIgnoreAllPB ( this, CUI_RES( PB_IGNOREALL ) ),
aIgnoreRulePB ( this, CUI_RES( PB_IGNORERULE ) ), aIgnoreRulePB ( this, CUI_RES( PB_IGNORERULE ) ),
aAddToDictMB ( this, CUI_RES( MB_ADDTODICT ) ), aAddToDictMB ( this, CUI_RES( MB_ADDTODICT ) ),
aAddToDictPB ( this, CUI_RES( PB_ADDTODICT ) ),
aChangePB ( this, CUI_RES( PB_CHANGE ) ), aChangePB ( this, CUI_RES( PB_CHANGE ) ),
aChangeAllPB ( this, CUI_RES( PB_CHANGEALL ) ), aChangeAllPB ( this, CUI_RES( PB_CHANGEALL ) ),
@@ -324,9 +325,9 @@ void SpellDialog::Init_Impl()
aSentenceED.SetModifyHdl(LINK ( this, SpellDialog, ModifyHdl) ); aSentenceED.SetModifyHdl(LINK ( this, SpellDialog, ModifyHdl) );
aAddToDictMB.SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictSelectHdl ) ); aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictSelectHdl ) );
aAddToDictMB.SetClickHdl(LINK ( this, SpellDialog, AddToDictClickHdl ) ); aAddToDictPB.SetClickHdl(LINK ( this, SpellDialog, AddToDictClickHdl ) );
aLanguageLB.SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) ); aLanguageLB.SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) );
aExplainLink.SetClickHdl( LINK( this, SpellDialog, HandleHyperlink ) ); aExplainLink.SetClickHdl( LINK( this, SpellDialog, HandleHyperlink ) );
@@ -368,7 +369,7 @@ void SpellDialog::UpdateBoxes_Impl()
else else
SetTitle_Impl( nAltLanguage ); SetTitle_Impl( nAltLanguage );
SetSelectedLang_Impl( nAltLanguage ); SetSelectedLang_Impl( nAltLanguage );
InitUserDicts(); int nDicts = InitUserDicts();
// enter alternatives // enter alternatives
const ::rtl::OUString *pNewWords = aNewWords.getConstArray(); const ::rtl::OUString *pNewWords = aNewWords.getConstArray();
@@ -399,7 +400,9 @@ void SpellDialog::UpdateBoxes_Impl()
aExplainFT.Show( !bShowChangeAll ); aExplainFT.Show( !bShowChangeAll );
aLanguageLB.Enable( bShowChangeAll ); aLanguageLB.Enable( bShowChangeAll );
aIgnoreAllPB.Show( bShowChangeAll ); aIgnoreAllPB.Show( bShowChangeAll );
aAddToDictMB.Show( bShowChangeAll );
aAddToDictMB.Show( bShowChangeAll && nDicts > 1);
aAddToDictPB.Show( bShowChangeAll && nDicts <= 1);
aIgnoreRulePB.Show( !bShowChangeAll ); aIgnoreRulePB.Show( !bShowChangeAll );
aIgnoreRulePB.Enable(pSpellErrorDescription && !pSpellErrorDescription->sRuleId.isEmpty()); aIgnoreRulePB.Enable(pSpellErrorDescription && !pSpellErrorDescription->sRuleId.isEmpty());
aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() ); aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() );
@@ -465,6 +468,7 @@ void SpellDialog::UpdateBoxes_Impl()
&aIgnoreAllPB, &aIgnoreAllPB,
&aIgnoreRulePB, &aIgnoreRulePB,
&aAddToDictMB, &aAddToDictMB,
&aAddToDictPB,
&aChangePB, &aChangePB,
&aChangeAllPB, &aChangeAllPB,
&aAutoCorrPB, &aAutoCorrPB,
@@ -939,7 +943,7 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang)
SetText( sTitle ); SetText( sTitle );
} }
void SpellDialog::InitUserDicts() int SpellDialog::InitUserDicts()
{ {
const LanguageType nLang = aLanguageLB.GetSelectLanguage(); const LanguageType nLang = aLanguageLB.GetSelectLanguage();
@@ -1002,6 +1006,14 @@ void SpellDialog::InitUserDicts()
} }
aAddToDictMB.SetPopupMenu(pMenu); aAddToDictMB.SetPopupMenu(pMenu);
aAddToDictMB.Enable( bEnable ); 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, &aIgnoreAllPB,
&aIgnoreRulePB, &aIgnoreRulePB,
&aAddToDictMB, &aAddToDictMB,
&aAddToDictPB,
&aChangePB, &aChangePB,
&aChangeAllPB, &aChangeAllPB,
&aAutoCorrPB, &aAutoCorrPB,
@@ -1753,6 +1766,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError )
pSpellDialog->aIgnoreAllPB.Enable(bRet); pSpellDialog->aIgnoreAllPB.Enable(bRet);
pSpellDialog->aAutoCorrPB.Enable(bRet); pSpellDialog->aAutoCorrPB.Enable(bRet);
pSpellDialog->aAddToDictMB.Enable(bRet); pSpellDialog->aAddToDictMB.Enable(bRet);
pSpellDialog->aAddToDictPB.Enable(bRet);
return bRet; return bRet;
} }
@@ -2118,6 +2132,7 @@ void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
&pSpellDialog->aLanguageFT, &pSpellDialog->aLanguageFT,
&pSpellDialog->aLanguageLB, &pSpellDialog->aLanguageLB,
&pSpellDialog->aAddToDictMB, &pSpellDialog->aAddToDictMB,
&pSpellDialog->aAddToDictPB,
&pSpellDialog->aAutoCorrPB, &pSpellDialog->aAutoCorrPB,
0 0
}; };

View File

@@ -51,3 +51,4 @@
#define LINK_EXPLAIN 55 #define LINK_EXPLAIN 55
#define FT_EXPLAIN 56 #define FT_EXPLAIN 56
#define PB_IGNORERULE 59 #define PB_IGNORERULE 59
#define PB_ADDTODICT 60

View File

@@ -129,6 +129,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "I~gnore All" ; Text [ en-US ] = "I~gnore All" ;
}; };
PushButton PB_IGNORERULE PushButton PB_IGNORERULE
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORERULE"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORERULE";
@@ -137,6 +138,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
Text [ en-US ] = "I~gnore Rule" ; Text [ en-US ] = "I~gnore Rule" ;
Hide = TRUE; Hide = TRUE;
}; };
MenuButton MB_ADDTODICT MenuButton MB_ADDTODICT
{ {
HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT"; HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT";
@@ -145,6 +147,14 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
Text [ en-US ] = "~Add" ; 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 PushButton PB_CHANGE
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGE"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGE";

View File

@@ -165,6 +165,7 @@ private:
PushButton aIgnoreAllPB; PushButton aIgnoreAllPB;
PushButton aIgnoreRulePB; PushButton aIgnoreRulePB;
MenuButton aAddToDictMB; MenuButton aAddToDictMB;
PushButton aAddToDictPB;
PushButton aChangePB; PushButton aChangePB;
PushButton aChangeAllPB; PushButton aChangeAllPB;
@@ -222,7 +223,7 @@ private:
int AddToDictionaryExecute( sal_uInt16 ItemId, PopupMenu *pMenu ); int AddToDictionaryExecute( sal_uInt16 ItemId, PopupMenu *pMenu );
void StartSpellOptDlg_Impl(); void StartSpellOptDlg_Impl();
void InitUserDicts(); int InitUserDicts();
void UpdateBoxes_Impl(); void UpdateBoxes_Impl();
void Init_Impl(); void Init_Impl();
void SpellContinue_Impl(bool UseSavedSentence = false, bool bIgnoreCurrentError = false ); void SpellContinue_Impl(bool UseSavedSentence = false, bool bIgnoreCurrentError = false );