diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2020-03-16 19:36:38 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2020-03-17 11:41:30 +0100 |
commit | 6a670f1aa36630d493b53b19da875395b3173469 (patch) | |
tree | 91afba004f42988c731cc9936f6c92038e9d1f85 /sc | |
parent | ac83f2da9c21c3986fc50ee7203e43bc1f93cf31 (diff) |
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.zolnai@collabora.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/sdi/docsh.sdi | 1 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 24 |
2 files changed, 25 insertions, 0 deletions
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 |