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 #include +#include +#include + #include #include #include @@ -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 xLngSvcMgr = + css::linguistic2::LinguServiceManager::create(comphelper::getProcessComponentContext()); + css::uno::Reference xSpellChecker(xLngSvcMgr->getSpellChecker()); + + css::uno::Reference 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("preload")}); + preloadData(); + // Release Solar Mutex, lo_startmain thread should acquire it. Application::ReleaseSolarMutex(); }