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

Jan Holesovsky kendy at collabora.com
Thu Jan 25 09:08:24 UTC 2018


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

New commits:
commit fa72a3379d3641565ddab561d32d0a7d03b83665
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 24 13:32:24 2018 +0100

    lok: Preload thesauri too.
    
    Change-Id: If2bfd3a024fc61900d3c12ff976df136d4e61bf6
    Reviewed-on: https://gerrit.libreoffice.org/48502
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 338d11221566..569960e82f02 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3637,13 +3637,13 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit:
 /// Used only by LibreOfficeKit when used by Online to pre-initialize
 static void preloadData()
 {
-    // First: sit down and read all dictionaries: yum.
+    // preload all available dictionaries
     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();
+    css::uno::Reference<linguistic2::XSupportedLocales> xSpellLocales(xSpellChecker, css::uno::UNO_QUERY_THROW);
+    uno::Sequence< css::lang::Locale > aLocales = xSpellLocales->getLocales();
     std::cerr << "Preloading dictionaries: ";
     for (auto &it : aLocales)
     {
@@ -3652,6 +3652,19 @@ static void preloadData()
         xSpellChecker->isValid("forcefed", it, aNone);
     }
     std::cerr << "\n";
+
+    // preload all available thesauri
+    css::uno::Reference<linguistic2::XThesaurus> xThesaurus(xLngSvcMgr->getThesaurus());
+    css::uno::Reference<linguistic2::XSupportedLocales> xThesLocales(xSpellChecker, css::uno::UNO_QUERY_THROW);
+    aLocales = xThesLocales->getLocales();
+    std::cerr << "Preloading thesauri: ";
+    for (auto &it : aLocales)
+    {
+        std::cerr << it.Language << "_" << it.Country << " ";
+        css::beans::PropertyValues aNone;
+        xThesaurus->queryMeanings("forcefed", it, aNone);
+    }
+    std::cerr << "\n";
 }
 
 static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfileUrl)


More information about the Libreoffice-commits mailing list