summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2020-03-16 17:20:22 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2020-03-17 11:17:25 +0100
commita00a3d681ec95841a5f6a879b05c6438d18161b4 (patch)
tree1a1195ca8c80cfca5d3b6eea04f42e658bc3d30f
parent268327c2fb37ff553a2c348a6beca4e309b0653f (diff)
sd lok: Implement execution of SID_SPELLCHECK_APPLY_SUGGESTION
Used by online spellchecking context menu. Change-Id: I9d7430b4ef45af1641fc985cf4588d45ba497ee9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90598 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--sd/sdi/_docsh.sdi6
-rw-r--r--sd/source/ui/docshell/docshel3.cxx21
2 files changed, 27 insertions, 0 deletions
diff --git a/sd/sdi/_docsh.sdi b/sd/sdi/_docsh.sdi
index 8644b752702c..02de70858ab0 100644
--- a/sd/sdi/_docsh.sdi
+++ b/sd/sdi/_docsh.sdi
@@ -83,5 +83,11 @@ interface DrawDocument
ExecMethod = Execute ;
StateMethod = GetState ;
]
+
+ SID_SPELLCHECK_APPLY_SUGGESTION
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
}
diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx
index 66b0daaa0736..eeef7c8dbe8c 100644
--- a/sd/source/ui/docshell/docshel3.cxx
+++ b/sd/source/ui/docshell/docshel3.cxx
@@ -381,6 +381,27 @@ void DrawDocShell::Execute( SfxRequest& rReq )
}
}
break;
+ case SID_SPELLCHECK_APPLY_SUGGESTION:
+ {
+ SdrView* pSdrView = mpViewShell->GetDrawView();
+ if (!pSdrView)
+ return;
+
+ EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView();
+ 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(), "");
+ rEditView.InsertText( sApplyText );
+ }
+ }
+ break;
case SID_NOTEBOOKBAR:
{