Hi All,
Here 2 patches related to bug 40778.
Patch 1 removes the submenu of adding new words to the dictionary when
there is only 1 dictionary in the spellcheck-popupmenu in writer.
Patch 2 does the same for the popupmenu in the other programs.
--
Greetings,
Rob Snelders
From e8389662048074533b30e4db52129121a1cf3f86 Mon Sep 17 00:00:00 2001
From: Rob Snelders <programming@ertai.nl>
Date: Thu, 17 May 2012 16:50:34 +0200
Subject: [PATCH] fd0#40778 - Remove dictionary choice when adding new entry
Change-Id: Ieaaf2466474463d19f91c74ea7f164962ba19936
---
sw/source/ui/inc/olmenu.hxx | 1 +
sw/source/ui/lingu/olmenu.cxx | 21 ++++++++++++++-------
sw/source/ui/lingu/olmenu.hrc | 1 +
sw/source/ui/lingu/olmenu.src | 6 ++++++
4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/sw/source/ui/inc/olmenu.hxx b/sw/source/ui/inc/olmenu.hxx
index d0d45b7..3da80f3 100644
--- a/sw/source/ui/inc/olmenu.hxx
+++ b/sw/source/ui/inc/olmenu.hxx
@@ -62,6 +62,7 @@ class SwSpellPopup : public PopupMenu
std::map< sal_Int16, ::rtl::OUString > aLangTable_Paragraph;
// std::map< sal_Int16, ::rtl::OUString > aLangTable_Document;
+ String aDicNameSingle;
bool bGrammarResults; // show grammar results? Or show spellcheck results?
Image aInfo16;
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx
index 6abb921..1d53314 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 1d65bbf..73fbac0 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 5b2d8b7..581bc1d 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
--
1.7.5.4
From de1714d05ebc833fd9bc2af116d71edbef8c640f Mon Sep 17 00:00:00 2001
From: Rob Snelders <programming@ertai.nl>
Date: Thu, 17 May 2012 17:47:20 +0200
Subject: [PATCH] fd0#40778 - Remove dictionary choice when adding new entry
Change-Id: Id7bd039b505d30e71065c2cdf27eba1cb466be56
---
editeng/inc/editeng.hrc | 1 +
editeng/inc/editeng/editview.hxx | 1 +
editeng/source/editeng/editeng.src | 6 ++++++
editeng/source/editeng/editview.cxx | 14 ++++++++++----
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/editeng/inc/editeng.hrc b/editeng/inc/editeng.hrc
index cc1f45c..453bf5c 100644
--- a/editeng/inc/editeng.hrc
+++ b/editeng/inc/editeng.hrc
@@ -35,6 +35,7 @@
#define MN_AUTOCORR 4
#define MN_WORDLANGUAGE 5
#define MN_PARALANGUAGE 6
+#define MN_INSERT_SINGLE 7
#define MN_ALTSTART 1000
#define MN_AUTOSTART 2000
diff --git a/editeng/inc/editeng/editview.hxx b/editeng/inc/editeng/editview.hxx
index 8e034c8..92b6d30 100644
--- a/editeng/inc/editeng/editview.hxx
+++ b/editeng/inc/editeng/editview.hxx
@@ -82,6 +82,7 @@ public: // Needed for Undo
private:
ImpEditView* pImpEditView;
+ String aDicNameSingle;
EDITENG_DLLPRIVATE EditView( const EditView& );
EDITENG_DLLPRIVATE EditView& operator=( const EditView& );
diff --git a/editeng/source/editeng/editeng.src b/editeng/source/editeng/editeng.src
index add1054..896f66f 100644
--- a/editeng/source/editeng/editeng.src
+++ b/editeng/source/editeng/editeng.src
@@ -95,6 +95,12 @@ Menu RID_MENU_SPELL
};
MenuItem
{
+ Identifier = MN_INSERT_SINGLE ;
+ HelpId = HID_EDITENG_SPELLER_ADDWORD;
+ Text [ en-US ] = "~Add" ;
+ };
+ MenuItem
+ {
Identifier = MN_IGNORE ;
HelpId = HID_EDITENG_SPELLER_IGNORE;
Text [ en-US ] = "Ignore All" ;
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 9e0fd27..8ff692f 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1037,6 +1037,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
// linguistic entry above
sal_uInt16 nPos = MN_DICTSTART + i;
pInsertMenu->InsertItem( nPos, xDicTmp->getName() );
+ aDicNameSingle = xDicTmp->getName();
uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY );
if (xSvcInfo.is())
@@ -1052,8 +1053,9 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
}
}
}
-
- if ( !pInsertMenu->GetItemCount() )
+ if ( pInsertMenu->GetItemCount() != 1)
+ aPopupMenu.EnableItem( MN_INSERT_SINGLE, sal_False );
+ if ( pInsertMenu->GetItemCount() < 2 )
aPopupMenu.EnableItem( MN_INSERT, sal_False );
aPopupMenu.RemoveDisabledEntries( sal_True, sal_True );
@@ -1121,9 +1123,13 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
pCallBack->Call( &aInf );
}
}
- else if ( nId >= MN_DICTSTART )
+ else if ( nId >= MN_DICTSTART || nId == MN_INSERT_SINGLE )
{
- String aDicName ( pInsertMenu->GetItemText(nId) );
+ String aDicName;
+ if (nId >= MN_DICTSTART)
+ aDicName = pInsertMenu->GetItemText(nId);
+ else
+ aDicName = aDicNameSingle;
uno::Reference< linguistic2::XDictionary > xDic;
if (xDicList.is())
--
1.7.5.4
Context
- [PATCH] fdo#40778 - Remove dictionary choice when adding new entry to the spellchecker · Rob Snelders
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.