desktop/source/lib/init.cxx |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 6a2ed798348c4c4b53a1813c7d2fc94b0f5d605e
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Dec 23 13:57:01 2022 -0400
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Jan 2 08:16:44 2023 +0000

    lok: disable spell if remote language tool enabled
    
    .
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: I73158c3feaa84af4d713d3f1b1fc9a60dcf95463
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144785
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3f18763818fa..617d5926dc0b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -56,6 +56,7 @@
 #include <rtl/strbuf.hxx>
 #include <rtl/uri.hxx>
 #include <svl/zforlist.hxx>
+#include <linguistic/misc.hxx>
 #include <cppuhelper/bootstrap.hxx>
 #include <comphelper/base64.hxx>
 #include <comphelper/dispatchcommand.hxx>
@@ -7026,6 +7027,24 @@ void setLanguageToolConfig()
                 rLanguageOpts.setUsername(aUsername);
                 rLanguageOpts.setApiKey(aApiKey);
             }
+
+            css::uno::Reference<css::linguistic2::XLinguServiceManager2> 
xLangSrv =
+                css::linguistic2::LinguServiceManager::create(xContext);
+            if (xLangSrv.is())
+            {
+                css::uno::Reference<css::linguistic2::XSpellChecker> xSpell = 
xLangSrv->getSpellChecker();
+                if (xSpell.is())
+                {
+                    Sequence<OUString> aEmpty;
+                    constexpr OUStringLiteral cSpell(SN_SPELLCHECKER);
+                    Sequence<css::lang::Locale> aLocales = 
xSpell->getLocales();
+
+                    for (int itLocale = 0; itLocale < aLocales.getLength(); 
itLocale++)
+                    {
+                        xLangSrv->setConfiguredServices(cSpell, 
aLocales[itLocale], aEmpty);
+                    }
+                }
+            }
         }
         catch(uno::Exception const& rException)
         {

Reply via email to