diff options
author | Henry Castro <hcastro@collabora.com> | 2017-10-02 22:49:03 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2017-10-03 05:59:54 +0200 |
commit | f50bf3c5225b49b3c6f77f882e35305e5dc5ccd3 (patch) | |
tree | 36c443acfdeeb3aae2bebebd6f366577059cfe12 /comphelper | |
parent | 34e8fd7e99489e9f50a512b07c6f3923b358b4d3 (diff) |
lok: use getCommandValues to obtain a list of languages
Change-Id: I4a1f04b9dfe9e3ebbc174380db93c332e958ccfa
Reviewed-on: https://gerrit.libreoffice.org/43060
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/lok.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx index a4f60ac6c565..4e24ab9d391b 100644 --- a/comphelper/source/misc/lok.cxx +++ b/comphelper/source/misc/lok.cxx @@ -8,6 +8,11 @@ */ #include <comphelper/lok.hxx> +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> +#include <com/sun/star/linguistic2/XSpellChecker.hpp> + namespace comphelper { @@ -114,6 +119,16 @@ void statusIndicatorFinish() pStatusIndicatorCallback(pStatusIndicatorCallbackData, statusIndicatorCallbackType::Finish, 0); } +css::uno::Sequence< css::lang::Locale > getSpellLanguages() +{ + css::uno::Reference< css::uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); + css::uno::Reference< css::linguistic2::XLinguServiceManager2 > xLangSrv = css::linguistic2::LinguServiceManager::create(xContext); + css::uno::Reference< css::linguistic2::XSpellChecker > xSpell(xLangSrv.is() ? xLangSrv->getSpellChecker() : nullptr, css::uno::UNO_QUERY); + css::uno::Reference< css::linguistic2::XSupportedLocales > xLocales(xSpell, css::uno::UNO_QUERY); + css::uno::Sequence< css::lang::Locale > aLocales(xLocales.is() ? xLocales->getLocales() : css::uno::Sequence< css::lang::Locale >()); + return aLocales; +} + } // namespace LibreOfficeKit } // namespace comphelper |