summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorMert Tumer <mert.tumer@collabora.com>2022-05-10 13:06:06 +0300
committerMert Tumer <mert.tumer@collabora.com>2022-06-14 10:04:28 +0200
commitc3ed41752237a7a70c856dfb0d618f1c2eacea5a (patch)
treead37006db63d89b20bc018e2af354a36ed5ce770 /unotools
parent7353b79dfb7c206e99865e345c31b4da27111715 (diff)
Load the locales from config file for languagetool
Locales needs to be read again in the Preferences/Writing Aids section and since this is a network operation it can cause a problem. Better to list all the supported locales in the xcu and load it right away. Signed-off-by: Mert Tumer <mert.tumer@collabora.com> Change-Id: Ifff624334627f7be259b677f9b416d6ddedfb2c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135598 Tested-by: Jenkins
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/lingucfg.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index a38fb51b61b7..03ad0747ad34 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -926,6 +926,27 @@ bool SvtLinguConfig::GetSupportedDictionaryFormatsFor(
return bSuccess;
}
+bool SvtLinguConfig::GetLocaleListFor( const OUString &rSetName, const OUString &rSetEntry, css::uno::Sequence< OUString > &rLocaleList ) const
+{
+ if (rSetName.isEmpty() || rSetEntry.isEmpty())
+ return false;
+ bool bSuccess = false;
+ try
+ {
+ uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW );
+ if (xNA->getByName( "Locales" ) >>= rLocaleList)
+ bSuccess = true;
+ DBG_ASSERT( rLocaleList.hasElements(), "Locale list is empty" );
+ }
+ catch (uno::Exception &)
+ {
+ }
+ return bSuccess;
+}
+
static bool lcl_GetFileUrlFromOrigin(
OUString /*out*/ &rFileUrl,
const OUString &rOrigin )