sw/source/uibase/shells/textsh1.cxx | 87 +++++++++++++++++------------------- 1 file changed, 42 insertions(+), 45 deletions(-)
New commits: commit 11395405d08ecb44a555fd26d0e16993cb5e13f6 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue Nov 26 16:34:20 2019 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Nov 26 20:07:59 2019 +0100 SpellingPopup: Fix Ignore All execution. Change-Id: I13520c1f14530cc1f04290d4d0b204cc45b124eb Reviewed-on: https://gerrit.libreoffice.org/83786 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 6cc1d1d7b0c8..1b048c9d16b7 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1474,58 +1474,55 @@ void SwTextShell::Execute(SfxRequest &rReq) break; case SID_SPELLCHECK_IGNORE_ALL: { - if(!rWrtSh.HasSelection()) - { - OUString sApplyText; - const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(FN_PARAM_1); - if (pItem2) - sApplyText = pItem2->GetValue(); + OUString sApplyText; + const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(FN_PARAM_1); + if (pItem2) + sApplyText = pItem2->GetValue(); - const OUString sGrammarType("Grammar"); - const OUString sSpellingType("Spelling"); + const OUString sGrammarType("Grammar"); + const OUString sSpellingType("Spelling"); - if(sApplyText == sGrammarType) - { - linguistic2::ProofreadingResult aGrammarCheckRes; - sal_Int32 nErrorInResult = -1; - uno::Sequence< OUString > aSuggestions; - sal_Int32 nErrorPosInText = -1; - SwRect aToFill; - bool bCorrectionRes = rWrtSh.GetGrammarCorrection( aGrammarCheckRes, nErrorPosInText, nErrorInResult, aSuggestions, nullptr, aToFill ); - if(bCorrectionRes) - { - try { - uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList(); - aGrammarCheckRes.xProofreader->ignoreRule( - aGrammarCheckRes.aErrors[ nErrorInResult ].aRuleIdentifier, - aGrammarCheckRes.aLocale ); - // refresh the layout of the actual paragraph (faster) - SwPaM *pPaM = rWrtSh.GetCursor(); - if (pPaM) - SwEditShell::IgnoreGrammarErrorAt( *pPaM ); - // refresh the layout of all paragraphs (workaround to launch a dictionary event) - xDictionary->setActive(false); - xDictionary->setActive(true); - } - catch( const uno::Exception& ) - { - } + if(sApplyText == sGrammarType) + { + linguistic2::ProofreadingResult aGrammarCheckRes; + sal_Int32 nErrorInResult = -1; + uno::Sequence< OUString > aSuggestions; + sal_Int32 nErrorPosInText = -1; + SwRect aToFill; + bool bCorrectionRes = rWrtSh.GetGrammarCorrection( aGrammarCheckRes, nErrorPosInText, nErrorInResult, aSuggestions, nullptr, aToFill ); + if(bCorrectionRes) + { + try { + uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList(); + aGrammarCheckRes.xProofreader->ignoreRule( + aGrammarCheckRes.aErrors[ nErrorInResult ].aRuleIdentifier, + aGrammarCheckRes.aLocale ); + // refresh the layout of the actual paragraph (faster) + SwPaM *pPaM = rWrtSh.GetCursor(); + if (pPaM) + SwEditShell::IgnoreGrammarErrorAt( *pPaM ); + // refresh the layout of all paragraphs (workaround to launch a dictionary event) + xDictionary->setActive(false); + xDictionary->setActive(true); } - } - else if (sApplyText == sSpellingType) - { - 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()) + catch( const uno::Exception& ) { - SvxDicError(rWrtSh.GetView().GetFrameWeld(), nAddRes); } } } + else if (sApplyText == sSpellingType) + { + 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; case SID_SPELLCHECK_APPLY_SUGGESTION: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits