Kaydet (Commit) fdec471a authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst 5dcf536b
......@@ -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
};
......
......@@ -51,3 +51,4 @@
#define LINK_EXPLAIN 55
#define FT_EXPLAIN 56
#define PB_IGNORERULE 59
#define PB_ADDTODICT 60
......@@ -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";
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment