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

New commits:
commit f9810114c2b4dd452f85cf07293921d0c5249944
Author:     Henry Castro <[email protected]>
AuthorDate: Fri Dec 23 13:57:01 2022 -0400
Commit:     Andras Timar <[email protected]>
CommitDate: Sat Jan 28 09:25:21 2023 +0000

    lok: disable spell if remote language tool enabled
    
    .
    
    Signed-off-by: Henry Castro <[email protected]>
    Change-Id: I73158c3feaa84af4d713d3f1b1fc9a60dcf95463
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144785
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145612
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ab97df3f7c23..1fbe2ab4162b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -53,6 +53,8 @@
 #include <rtl/bootstrap.hxx>
 #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>
@@ -7049,6 +7051,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