[Libreoffice-commits] .: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 13 05:02:53 PST 2012


 sw/source/ui/inc/olmenu.hxx   |    3 +++
 sw/source/ui/lingu/olmenu.cxx |   16 +++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit a2020262db475dc5e4af0c2692946e878ea4842a
Author: László Németh <nemeth at numbertext.org>
Date:   Sat Nov 10 16:37:55 2012 +0100

    fdo#56954: fix Ignore menu item of grammar mistakes
    
    Change-Id: I5cec602c686d5199b516a7e5135ababeb0751444
    Reviewed-on: https://gerrit.libreoffice.org/1024
    Reviewed-by: Németh László <nemeth at numbertext.org>
    Tested-by: Németh László <nemeth at numbertext.org>

diff --git a/sw/source/ui/inc/olmenu.hxx b/sw/source/ui/inc/olmenu.hxx
index 3da80f3..21744db 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 3935858..1617d63 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)
     {


More information about the Libreoffice-commits mailing list