diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-11-17 13:18:34 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-11-23 22:37:28 +0100 |
commit | 352966952641eed80ae94de57065b0e0896116a6 (patch) | |
tree | 5772aa93e4d7ef1e3d07f923b035954077266ad5 /sw/source/uibase/shells/textsh1.cxx | |
parent | 8eedef976ee5393137298756ad53d199a543fede (diff) |
SpellingPopup: Convert "IgnoreAll" menu item to use a slot ID (spelling).
When the popup is in spelling mode. "IgnoreAll_Spelling" rule
triggers this method.
Change-Id: Ia1e1877f8501beff29f09bc33621c8f03008b7e8
Reviewed-on: https://gerrit.libreoffice.org/83588
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sw/source/uibase/shells/textsh1.cxx')
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 510c25432e32..bff08a595f18 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -105,6 +105,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/linguistic2/ProofreadingResult.hpp> #include <com/sun/star/linguistic2/XDictionary.hpp> +#include <com/sun/star/linguistic2/XSpellAlternatives.hpp> #include <editeng/unolingu.hxx> #include <unotools/syslocaleoptions.hxx> #include <doc.hxx> @@ -126,6 +127,7 @@ #include <memory> #include <xmloff/odffields.hxx> #include <bookmrk.hxx> +#include <linguistic/misc.hxx> using namespace ::com::sun::star; using namespace com::sun::star::beans; @@ -1440,7 +1442,7 @@ void SwTextShell::Execute(SfxRequest &rReq) const OUString sIgnoreString("Ignore"); const OUString sIgnoreAllPrefix("IgnoreAll_"); - //const OUString sSpellingRule("Spelling"); + const OUString sSpellingRule("Spelling"); const OUString sGrammarRule("Grammar"); //const OUString aReplacePrefix("Replace_"); @@ -1466,7 +1468,7 @@ void SwTextShell::Execute(SfxRequest &rReq) bool bCorrectionRes = rWrtSh.GetGrammarCorrection( aGrammarCheckRes, nErrorPosInText, nErrorInResult, aSuggestions, nullptr, aToFill ); if(bCorrectionRes) { - try{ + try { uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList(); aGrammarCheckRes.xProofreader->ignoreRule( aGrammarCheckRes.aErrors[ nErrorInResult ].aRuleIdentifier, @@ -1484,6 +1486,19 @@ void SwTextShell::Execute(SfxRequest &rReq) } } } + else if (sApplyText == sSpellingRule) + { + SwRect aToFill; + uno::Reference< linguistic2::XSpellAlternatives > xSpellAlt( rWrtSh.GetCorrection(nullptr, aToFill) ); + uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList(); + OUString sWord(xSpellAlt->getWord()); + linguistic::DictionaryError nAddRes = linguistic::AddEntryToDic( xDictionary, + sWord, false, OUString() ); + if (linguistic::DictionaryError::NONE != nAddRes && !xDictionary->getEntry(sWord).is()) + { + SvxDicError(rWrtSh.GetView().GetFrameWeld(), nAddRes); + } + } } } break; |