[Libreoffice-commits] core.git: 2 commits - desktop/source sd/source sw/source

Michael Meeks michael.meeks at collabora.com
Thu Sep 14 11:00:14 UTC 2017


 desktop/source/lib/init.cxx         |   24 ++++++++++++++++++++++++
 sd/source/core/drawdoc.cxx          |    4 +---
 sw/source/uibase/config/viewopt.cxx |    3 ---
 3 files changed, 25 insertions(+), 6 deletions(-)

New commits:
commit f2de8a282a131f0294c41fa994083df47d5d61f0
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Sep 14 10:29:32 2017 +0100

    Revert "Disable spellcheck when LOK is active"
    
    This reverts commit c92ebc850345924619a12327f36cc6ac9c0b09d1.
    
    Change-Id: Idd01cffbd71643d5a9132b518432c5e173b4787a
    Reviewed-on: https://gerrit.libreoffice.org/42270
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index b418f1ed7a2c..54b2474008b9 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -100,7 +100,6 @@
 
 #include <tools/tenccvt.hxx>
 #include <vcl/settings.hxx>
-#include <comphelper/lok.hxx>
 
 using namespace ::sd;
 using namespace ::com::sun::star;
@@ -229,8 +228,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
         SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL,
             css::i18n::ScriptType::COMPLEX), EE_CHAR_LANGUAGE_CTL );
 
-        if (!comphelper::LibreOfficeKit::isActive())
-            mbOnlineSpell = aOptions.bIsSpellAuto;
+        mbOnlineSpell = aOptions.bIsSpellAuto;
     }
 
     LanguageType eRealLanguage = MsLangId::getRealLanguage( meLanguage );
diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx
index ecb592979ad0..3a00aa3e7b4b 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -318,9 +318,6 @@ bool SwViewOption::IsAutoCompleteWords()
 
 void SwViewOption::SetOnlineSpell(bool b)
 {
-    if (comphelper::LibreOfficeKit::isActive())
-        return;
-
     b ? (m_nCoreOptions |= ViewOptFlags1::OnlineSpell ) : ( m_nCoreOptions &= ~ViewOptFlags1::OnlineSpell);
 }
 
commit 91cf85936aff8bcc3b837584a834a0f2d9f3ed3a
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Sep 13 16:16:11 2017 +0100

    Pre-load dictionaries for online.
    
    Change-Id: Ied81f20900060ff6a78704fa9195320b8fb86e45
    Reviewed-on: https://gerrit.libreoffice.org/42269
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6e8136d740a0..f9a825564c88 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -54,6 +54,9 @@
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/document/XRedlinesSupplier.hpp>
 
+#include <com/sun/star/linguistic2/LinguServiceManager.hpp>
+#include <com/sun/star/linguistic2/XSpellChecker.hpp>
+
 #include <editeng/fontitem.hxx>
 #include <editeng/flstitem.hxx>
 #include <sfx2/objsh.hxx>
@@ -3150,6 +3153,25 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit:
     }
 }
 
+static void preloadData()
+{
+    // First: sit down and read all dictionaries: yum.
+    css::uno::Reference<css::linguistic2::XLinguServiceManager> xLngSvcMgr =
+        css::linguistic2::LinguServiceManager::create(comphelper::getProcessComponentContext());
+    css::uno::Reference<linguistic2::XSpellChecker> xSpellChecker(xLngSvcMgr->getSpellChecker());
+
+    css::uno::Reference<linguistic2::XSupportedLocales> xLocales(xSpellChecker, css::uno::UNO_QUERY_THROW);
+    uno::Sequence< css::lang::Locale > aLocales = xLocales->getLocales();
+    SAL_INFO("lok", "Preloading #" << aLocales.getLength() << " dictionaries");
+    for (auto &it : aLocales)
+    {
+        SAL_INFO("lok", "    load " << it.Language << "_" << it.Country);
+        css::beans::PropertyValues aNone;
+        xSpellChecker->isValid("forcefed", it, aNone);
+    }
+    SAL_INFO("lok", "Preloading done");
+}
+
 static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfileUrl)
 {
     enum {
@@ -3261,6 +3283,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
                 // 3) InitVCL()
                 aService->initialize({css::uno::makeAny<OUString>("preload")});
 
+                preloadData();
+
                 // Release Solar Mutex, lo_startmain thread should acquire it.
                 Application::ReleaseSolarMutex();
             }


More information about the Libreoffice-commits mailing list