Kaydet (Commit) c867a303 authored tarafından Rob Snelders's avatar Rob Snelders Kaydeden (comit) Caolán McNamara

fd0#40778 - Remove dictionary choice when adding new entry

Change-Id: Ieaaf2466474463d19f91c74ea7f164962ba19936
üst 2f5a85a6
...@@ -62,6 +62,7 @@ class SwSpellPopup : public PopupMenu ...@@ -62,6 +62,7 @@ class SwSpellPopup : public PopupMenu
std::map< sal_Int16, ::rtl::OUString > aLangTable_Paragraph; std::map< sal_Int16, ::rtl::OUString > aLangTable_Paragraph;
// std::map< sal_Int16, ::rtl::OUString > aLangTable_Document; // std::map< sal_Int16, ::rtl::OUString > aLangTable_Document;
String aDicNameSingle;
bool bGrammarResults; // show grammar results? Or show spellcheck results? bool bGrammarResults; // show grammar results? Or show spellcheck results?
Image aInfo16; Image aInfo16;
......
...@@ -460,8 +460,8 @@ SwSpellPopup::SwSpellPopup( ...@@ -460,8 +460,8 @@ SwSpellPopup::SwSpellPopup(
pMenu = GetPopupMenu(MN_ADD_TO_DIC); pMenu = GetPopupMenu(MN_ADD_TO_DIC);
pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); //! necessary to retrieve the correct dictionary name in 'Execute' below pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); //! necessary to retrieve the correct dictionary name in 'Execute' below
bEnable = sal_False; // enable MN_ADD_TO_DIC?
uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() );
sal_uInt16 nItemId = MN_DICTIONARIES_START;
if (xDicList.is()) if (xDicList.is())
{ {
// add the default positive dictionary to dic-list (if not already done). // add the default positive dictionary to dic-list (if not already done).
...@@ -475,7 +475,6 @@ SwSpellPopup::SwSpellPopup( ...@@ -475,7 +475,6 @@ SwSpellPopup::SwSpellPopup(
const uno::Reference< linguistic2::XDictionary > *pDic = aDics.getConstArray(); const uno::Reference< linguistic2::XDictionary > *pDic = aDics.getConstArray();
sal_uInt16 nDicCount = static_cast< sal_uInt16 >(aDics.getLength()); sal_uInt16 nDicCount = static_cast< sal_uInt16 >(aDics.getLength());
sal_uInt16 nItemId = MN_DICTIONARIES_START;
for( sal_uInt16 i = 0; i < nDicCount; i++ ) for( sal_uInt16 i = 0; i < nDicCount; i++ )
{ {
uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY );
...@@ -492,7 +491,7 @@ SwSpellPopup::SwSpellPopup( ...@@ -492,7 +491,7 @@ SwSpellPopup::SwSpellPopup(
// the extra 1 is because of the (possible) external // the extra 1 is because of the (possible) external
// linguistic entry above // linguistic entry above
pMenu->InsertItem( nItemId, xDicTmp->getName() ); pMenu->InsertItem( nItemId, xDicTmp->getName() );
bEnable = sal_True; aDicNameSingle = xDicTmp->getName();
uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY );
if (xSvcInfo.is()) if (xSvcInfo.is())
...@@ -510,7 +509,8 @@ SwSpellPopup::SwSpellPopup( ...@@ -510,7 +509,8 @@ SwSpellPopup::SwSpellPopup(
} }
} }
} }
EnableItem( MN_ADD_TO_DIC, bEnable ); EnableItem( MN_ADD_TO_DIC, ((nItemId - MN_DICTIONARIES_START) > 1)?sal_True:sal_False );
EnableItem( MN_ADD_TO_DIC_SINGLE, ((nItemId - MN_DICTIONARIES_START) == 1)?sal_True:sal_False );
//ADD NEW LANGUAGE MENU ITEM //ADD NEW LANGUAGE MENU ITEM
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -656,6 +656,7 @@ aInfo16( SW_RES(IMG_INFO_16) ) ...@@ -656,6 +656,7 @@ aInfo16( SW_RES(IMG_INFO_16) )
EnableItem( MN_IGNORE_WORD, false ); EnableItem( MN_IGNORE_WORD, false );
EnableItem( MN_ADD_TO_DIC, false ); EnableItem( MN_ADD_TO_DIC, false );
EnableItem( MN_ADD_TO_DIC_SINGLE, false );
//ADD NEW LANGUAGE MENU ITEM //ADD NEW LANGUAGE MENU ITEM
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -807,12 +808,18 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) ...@@ -807,12 +808,18 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
linguistic::AddEntryToDic( xDictionary, linguistic::AddEntryToDic( xDictionary,
xSpellAlt->getWord(), sal_False, aEmptyStr, LANGUAGE_NONE ); xSpellAlt->getWord(), sal_False, aEmptyStr, LANGUAGE_NONE );
} }
else if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) else if ((MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) || nId == MN_ADD_TO_DIC_SINGLE)
{ {
OUString aWord( xSpellAlt->getWord() ); OUString aWord( xSpellAlt->getWord() );
String aDicName;
PopupMenu *pMenu = GetPopupMenu(MN_ADD_TO_DIC); if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END)
String aDicName ( pMenu->GetItemText(nId) ); {
PopupMenu *pMenu = GetPopupMenu(MN_ADD_TO_DIC);
aDicName = pMenu->GetItemText(nId);
}
else
aDicName = aDicNameSingle;
uno::Reference< linguistic2::XDictionary > xDic; uno::Reference< linguistic2::XDictionary > xDic;
uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() );
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#define MN_SET_LANGUAGE_ALL_TEXT 207 #define MN_SET_LANGUAGE_ALL_TEXT 207
#define MN_SHORT_COMMENT 208 #define MN_SHORT_COMMENT 208
#define MN_EXPLANATION_LINK 209 #define MN_EXPLANATION_LINK 209
#define MN_ADD_TO_DIC_SINGLE 210
// id range for dictionaries sub menu // id range for dictionaries sub menu
#define MN_DICTIONARIES_START 300 #define MN_DICTIONARIES_START 300
......
...@@ -52,6 +52,12 @@ Menu MN_SPELL_POPUP ...@@ -52,6 +52,12 @@ Menu MN_SPELL_POPUP
Text [ en-US ] = "~Add" ; Text [ en-US ] = "~Add" ;
}; };
MenuItem MenuItem
{
Identifier = MN_ADD_TO_DIC_SINGLE ;
HelpID = HID_LINGU_ADD_WORD ;
Text [ en-US ] = "~Add" ;
};
MenuItem
{ {
Identifier = MN_AUTOCORR ; Identifier = MN_AUTOCORR ;
HelpID = HID_LINGU_AUTOCORR ; HelpID = HID_LINGU_AUTOCORR ;
......
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