summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-11-16 15:14:20 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-11-26 18:40:27 +0100
commit6f3d1ccaf0b02deeff82bbd8478a528f3b9a6b5c (patch)
treedb7a237fe2ee3c7a66610cf791222259b0a25ca0 /sw/source
parent7accd387e188e5ef989d86a97d2bd97f68a64dbe (diff)
SpellingPopup: Convert "Ignore" menu item to use a slot ID.
Introduced a new slot id SID_APPLY_SPELLING, which can be used to apply any spelling / grammar related changes (e.g. ignore, ignore all, replace with suggestion, add to dictionary). In this commit, only the simple ignore is implemented. Reviewed-on: https://gerrit.libreoffice.org/83583 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 51061b780ba42d2b7673de76a729a4084da5ed2b) Change-Id: I06ab84efeb955cc02ce3ff531bd8b5c20ddced9e
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/lingu/olmenu.cxx5
-rw-r--r--sw/source/uibase/shells/textsh1.cxx23
2 files changed, 25 insertions, 3 deletions
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index 9d1d42135357..0b444d8ea64e 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -717,9 +717,8 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
}
else if (nId == MN_IGNORE_SELECTION)
{
- SwPaM *pPaM = m_pSh->GetCursor();
- if (pPaM)
- SwEditShell::IgnoreGrammarErrorAt( *pPaM );
+ SfxStringItem aIgnoreString(FN_PARAM_1, "Ignore");
+ m_pSh->GetView().GetViewFrame()->GetDispatcher()->ExecuteList(SID_APPLY_SPELLCHECKING, SfxCallMode::SYNCHRON, { &aIgnoreString });
}
else if (nId == m_nIgnoreWordId)
{
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index bbfbe00e6d40..f2c8b5a55fde 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1418,6 +1418,29 @@ void SwTextShell::Execute(SfxRequest &rReq)
}
}
break;
+ case SID_APPLY_SPELLCHECKING:
+ {
+ OUString sApplyText;
+ const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
+ if (pItem2)
+ sApplyText = pItem2->GetValue();
+
+ const OUString sIgnoreString("Ignore");
+ //const OUString sIgnoreAllPrefix("IgnoreAll_");
+ //const OUString sSpellingRule("Spelling");
+ //const OUString sGrammarRule("Grammar");
+ //const OUString aReplacePrefix("Replace_");
+
+ // Ignore the word at the cursor pos
+ //sal_Int32 nPos = 0;
+ if (sApplyText == sIgnoreString)
+ {
+ SwPaM *pPaM = rWrtSh.GetCursor();
+ if (pPaM)
+ SwEditShell::IgnoreGrammarErrorAt( *pPaM );
+ }
+ }
+ break;
default:
OSL_ENSURE(false, "wrong dispatcher");
return;