sc/sdi/docsh.sdi                 |    1 +
 sc/source/ui/docshell/docsh4.cxx |   24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)

New commits:
commit 6a670f1aa36630d493b53b19da875395b3173469
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Mon Mar 16 19:36:38 2020 +0100
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Tue Mar 17 11:41:30 2020 +0100

    sc lok: Implement execution of SID_SPELLCHECK_APPLY_SUGGESTION
    
    Used by online spellchecking context menu.
    
    Change-Id: Id065d366d5ef2ddb3ecf78d202a7264b6962ec8a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90601
    Tested-by: Tamás Zolnai <tamas.zol...@collabora.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/sc/sdi/docsh.sdi b/sc/sdi/docsh.sdi
index 364bd3adaa69..99019d55ff6f 100644
--- a/sc/sdi/docsh.sdi
+++ b/sc/sdi/docsh.sdi
@@ -76,6 +76,7 @@ interface TableDocument
     SID_NOTEBOOKBAR         [ ExecMethod = Execute; StateMethod = GetState; ]
     SID_LANGUAGE_STATUS     [ ExecMethod = Execute; StateMethod = GetState; ]
     SID_SPELLCHECK_IGNORE_ALL     [ ExecMethod = Execute; StateMethod = 
GetState; ]
+    SID_SPELLCHECK_APPLY_SUGGESTION     [ ExecMethod = Execute; StateMethod = 
GetState; ]
 }
 
 
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index b35ce4ddc964..14058badaa02 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1305,6 +1305,30 @@ void ScDocShell::Execute( SfxRequest& rReq )
             }
         }
         break;
+        case SID_SPELLCHECK_APPLY_SUGGESTION:
+        {
+            ScViewData* pViewData = GetViewData();
+            if (!pViewData)
+                return;
+
+            EditView* pEditView = 
pViewData->GetEditView(pViewData->GetActivePart());
+            if (!pEditView)
+                return;
+
+            OUString sApplyText;
+            const SfxStringItem* pItem2 = 
rReq.GetArg<SfxStringItem>(FN_PARAM_1);
+            if (pItem2)
+                sApplyText = pItem2->GetValue();
+
+            const OUString sSpellingRule("Spelling_");
+            sal_Int32 nPos = 0;
+            if(-1 != (nPos = sApplyText.indexOf( sSpellingRule )))
+            {
+                sApplyText = sApplyText.replaceAt(nPos, 
sSpellingRule.getLength(), "");
+                pEditView->InsertText( sApplyText );
+            }
+        }
+        break;
         default:
         {
             // small (?) hack -> forwarding of the slots to TabViewShell
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to