diff options
author | Rob Snelders <programming@ertai.nl> | 2012-05-17 16:50:34 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-18 16:31:00 +0100 |
commit | c867a3037dbe01eeecdd7512e3a02249231cbacd (patch) | |
tree | 7b49cb77ef11df81b7a7a2c8011cfd0e93ea3b49 /sw/source/ui/lingu | |
parent | 2f5a85a68d256018f11b0cca21f36a625e6a0851 (diff) |
fd0#40778 - Remove dictionary choice when adding new entry
Change-Id: Ieaaf2466474463d19f91c74ea7f164962ba19936
Diffstat (limited to 'sw/source/ui/lingu')
-rw-r--r-- | sw/source/ui/lingu/olmenu.cxx | 21 | ||||
-rw-r--r-- | sw/source/ui/lingu/olmenu.hrc | 1 | ||||
-rw-r--r-- | sw/source/ui/lingu/olmenu.src | 6 |
3 files changed, 21 insertions, 7 deletions
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 6abb921c2a9d..1d53314bc524 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -460,8 +460,8 @@ SwSpellPopup::SwSpellPopup( pMenu = GetPopupMenu(MN_ADD_TO_DIC); 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() ); + sal_uInt16 nItemId = MN_DICTIONARIES_START; if (xDicList.is()) { // add the default positive dictionary to dic-list (if not already done). @@ -475,7 +475,6 @@ SwSpellPopup::SwSpellPopup( const uno::Reference< linguistic2::XDictionary > *pDic = aDics.getConstArray(); sal_uInt16 nDicCount = static_cast< sal_uInt16 >(aDics.getLength()); - sal_uInt16 nItemId = MN_DICTIONARIES_START; for( sal_uInt16 i = 0; i < nDicCount; i++ ) { uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); @@ -492,7 +491,7 @@ SwSpellPopup::SwSpellPopup( // the extra 1 is because of the (possible) external // linguistic entry above pMenu->InsertItem( nItemId, xDicTmp->getName() ); - bEnable = sal_True; + aDicNameSingle = xDicTmp->getName(); uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); if (xSvcInfo.is()) @@ -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 /////////////////////////////////////////////////////////////////////////// @@ -656,6 +656,7 @@ aInfo16( SW_RES(IMG_INFO_16) ) EnableItem( MN_IGNORE_WORD, false ); EnableItem( MN_ADD_TO_DIC, false ); + EnableItem( MN_ADD_TO_DIC_SINGLE, false ); //ADD NEW LANGUAGE MENU ITEM /////////////////////////////////////////////////////////////////////////// @@ -807,12 +808,18 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) linguistic::AddEntryToDic( xDictionary, 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() ); + String aDicName; - PopupMenu *pMenu = GetPopupMenu(MN_ADD_TO_DIC); - String aDicName ( pMenu->GetItemText(nId) ); + if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) + { + PopupMenu *pMenu = GetPopupMenu(MN_ADD_TO_DIC); + aDicName = pMenu->GetItemText(nId); + } + else + aDicName = aDicNameSingle; uno::Reference< linguistic2::XDictionary > xDic; uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); diff --git a/sw/source/ui/lingu/olmenu.hrc b/sw/source/ui/lingu/olmenu.hrc index 1d65bbfa0ff7..73fbac09804f 100644 --- a/sw/source/ui/lingu/olmenu.hrc +++ b/sw/source/ui/lingu/olmenu.hrc @@ -54,6 +54,7 @@ #define MN_SET_LANGUAGE_ALL_TEXT 207 #define MN_SHORT_COMMENT 208 #define MN_EXPLANATION_LINK 209 +#define MN_ADD_TO_DIC_SINGLE 210 // id range for dictionaries sub menu #define MN_DICTIONARIES_START 300 diff --git a/sw/source/ui/lingu/olmenu.src b/sw/source/ui/lingu/olmenu.src index 5b2d8b79460a..581bc1d7c602 100644 --- a/sw/source/ui/lingu/olmenu.src +++ b/sw/source/ui/lingu/olmenu.src @@ -53,6 +53,12 @@ Menu MN_SPELL_POPUP }; MenuItem { + Identifier = MN_ADD_TO_DIC_SINGLE ; + HelpID = HID_LINGU_ADD_WORD ; + Text [ en-US ] = "~Add" ; + }; + MenuItem + { Identifier = MN_AUTOCORR ; HelpID = HID_LINGU_AUTOCORR ; SubMenu = Menu |