From a2020262db475dc5e4af0c2692946e878ea4842a Mon Sep 17 00:00:00 2001 From: László Németh Date: Sat, 10 Nov 2012 16:37:55 +0100 Subject: fdo#56954: fix Ignore menu item of grammar mistakes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5cec602c686d5199b516a7e5135ababeb0751444 Reviewed-on: https://gerrit.libreoffice.org/1024 Reviewed-by: Németh László Tested-by: Németh László --- sw/source/ui/inc/olmenu.hxx | 3 +++ sw/source/ui/lingu/olmenu.cxx | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'sw') diff --git a/sw/source/ui/inc/olmenu.hxx b/sw/source/ui/inc/olmenu.hxx index 3da80f36238e..21744db98eab 100644 --- a/sw/source/ui/inc/olmenu.hxx +++ b/sw/source/ui/inc/olmenu.hxx @@ -51,6 +51,9 @@ class SwSpellPopup : public PopupMenu ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt; + ::com::sun::star::linguistic2::ProofreadingResult xGrammarResult; + sal_Int32 nGrammarError; + ::com::sun::star::uno::Sequence< rtl::OUString > aSuggestions; rtl::OUString sExplanationLink; diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 393585808b17..1617d63bd720 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -567,12 +567,14 @@ SwSpellPopup::SwSpellPopup( const String &rParaText ) : PopupMenu( SW_RES(MN_SPELL_POPUP) ), pSh( pWrtSh ), +xGrammarResult( rResult ), aSuggestions( rSuggestions ), sExplanationLink( ), bGrammarResults( true ), aInfo16( SW_RES(IMG_INFO_16) ) { nCheckedLanguage = SvxLocaleToLanguage( rResult.aLocale ); + nGrammarError = nErrorInResult; bool bUseImagesInMenus = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); sal_uInt16 nPos = 0; @@ -806,8 +808,20 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) else if (nId == MN_IGNORE_SELECTION) { SwPaM *pPaM = pSh->GetCrsr(); - if (pPaM) + if (pPaM) { + if (bGrammarResults) { + try + { + xGrammarResult.xProofreader->ignoreRule( + xGrammarResult.aErrors[ nGrammarError ].aRuleIdentifier, + xGrammarResult.aLocale ); + } + catch( const uno::Exception& ) + { + } + } pSh->IgnoreGrammarErrorAt( *pPaM ); + } } else if (nId == MN_IGNORE_WORD) { -- cgit v1.2.3