summaryrefslogtreecommitdiff
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-23 15:38:43 +0100
commit816f7c4bbb9ecd2c0fca68e8fc7a276b7e793153 (patch)
tree589ab431f255bc123f2722d4ec9a847d87a8defe
parenta5b2583cfa41852d526ffe360e3887c71174744a (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. Change-Id: I06ab84efeb955cc02ce3ff531bd8b5c20ddced9e
-rw-r--r--include/svx/svxids.hrc1
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu5
-rw-r--r--svx/sdi/svx.sdi17
-rw-r--r--sw/sdi/_textsh.sdi6
-rw-r--r--sw/source/uibase/lingu/olmenu.cxx5
-rw-r--r--sw/source/uibase/shells/textsh1.cxx23
6 files changed, 54 insertions, 3 deletions
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 100d2f4fbaf8..6e9cd310f9ad 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -355,6 +355,7 @@ class SvxSetItem;
#define SID_SPELL_DIALOG ( SID_SVX_START + 243 )
#define SID_INSERT_DRAW ( SID_SVX_START + 244 )
#define SID_THESAURUS ( SID_SVX_START + 245 )
+#define SID_APPLY_SPELLCHECKING ( SID_SVX_START + 246 )
// CAUTION! Range <250 .. 250> used by EditEngine (!)
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 58114eef36c7..aa5173877eae 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2678,6 +2678,11 @@
<value xml:lang="en-US">Language Status</value>
</prop>
</node>
+ <node oor:name=".uno:ApplySpellChecking" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Apply Spell Checking</value>
+ </prop>
+ </node>
<node oor:name=".uno:ChooseControls" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Insert Controls</value>
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index b501e546e7bb..d417b2ef9967 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -12169,3 +12169,20 @@ SfxVoidItem EditQrCode SID_EDIT_QRCODE
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Edit;
]
+
+SfxVoidItem ApplySpellChecking SID_APPLY_SPELLCHECKING
+(SfxStringItem ApplyRule FN_PARAM_1)
+[
+ AutoUpdate = FALSE,
+ FastCall = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = SfxGroupId::Format;
+]
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index bfd47719ca35..94bcc81cd5ac 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1740,5 +1740,11 @@ interface BaseText
StateMethod = GetState ;
]
+ SID_APPLY_SPELLCHECKING
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
} // end of interface text
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index 23435104bfc5..e627534fdf6e 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -711,9 +711,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 41d2fbded1da..fc940da44737 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1429,6 +1429,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;