include/svx/svxids.hrc | 1 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 5 ++ svx/sdi/svx.sdi | 17 +++++++ sw/sdi/_textsh.sdi | 6 ++ sw/source/uibase/lingu/olmenu.cxx | 11 +--- sw/source/uibase/shells/textsh1.cxx | 23 ++++++++++ 6 files changed, 56 insertions(+), 7 deletions(-)
New commits: commit 51061b780ba42d2b7673de76a729a4084da5ed2b Author: Tamás Zolnai <[email protected]> AuthorDate: Sat Nov 16 15:14:20 2019 +0100 Commit: Tamás Zolnai <[email protected]> CommitDate: Sat Nov 23 21:15:52 2019 +0100 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 Reviewed-on: https://gerrit.libreoffice.org/83583 Reviewed-by: Tamás Zolnai <[email protected]> Tested-by: Tamás Zolnai <[email protected]> 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; commit f71c99d24e210da41414203adde8d2d7872920b4 Author: Tamás Zolnai <[email protected]> AuthorDate: Sat Nov 16 13:30:30 2019 +0100 Commit: Tamás Zolnai <[email protected]> CommitDate: Sat Nov 23 21:15:22 2019 +0100 SpellingPopup: Move setting UPN_IS_GRAMMAR_INTERACTIVE to the constructor. Change-Id: Ief5470e0a61f0ca40549ab6d3768c795c3f04510 Reviewed-on: https://gerrit.libreoffice.org/83580 Reviewed-by: Tamás Zolnai <[email protected]> Tested-by: Tamás Zolnai <[email protected]> diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index ccb4beeb9895..23435104bfc5 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -578,6 +578,8 @@ SwSpellPopup::SwSpellPopup( checkRedline(); m_xPopupMenu->RemoveDisabledEntries(true, true); + + SvtLinguConfig().SetProperty( UPN_IS_GRAMMAR_INTERACTIVE, uno::makeAny( true )); } SwSpellPopup::~SwSpellPopup() {} @@ -697,10 +699,6 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) } else if (nId == m_nSpellDialogId) { - if (m_bGrammarResults) - { - SvtLinguConfig().SetProperty( UPN_IS_GRAMMAR_INTERACTIVE, uno::makeAny( true )); - } m_pSh->Left(CRSR_SKIP_CHARS, false, 1, false ); { m_pSh->GetView().GetViewFrame()->GetDispatcher()-> _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
