[PATCH] fd0#40778 - Remove dictionary choice when adding new entry

Rob Snelders programming at ertai.nl
Thu May 17 08:47:20 PDT 2012


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



--------------000302030808070706030606--


More information about the LibreOffice mailing list