[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/source

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 27 12:07:45 UTC 2019


 sw/source/uibase/shells/textsh1.cxx |   87 +++++++++++++++++-------------------
 1 file changed, 42 insertions(+), 45 deletions(-)

New commits:
commit 596164f9a68cce74c106ad79cde3a5b5ad550800
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Nov 26 16:34:20 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Nov 27 13:06:37 2019 +0100

    SpellingPopup: Fix Ignore All execution.
    
    Change-Id: I13520c1f14530cc1f04290d4d0b204cc45b124eb
    Reviewed-on: https://gerrit.libreoffice.org/83786
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit 11395405d08ecb44a555fd26d0e16993cb5e13f6)
    Reviewed-on: https://gerrit.libreoffice.org/83891
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index cb92a7312e93..7e071c41adcf 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1463,58 +1463,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:


More information about the Libreoffice-commits mailing list