summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-10-03 10:48:26 +0200
committerJan Holesovsky <kendy@collabora.com>2017-10-03 10:50:48 +0200
commitd785b4dd8c5e1c7f08ef7dfaa92ab09fcebb300e (patch)
tree1550e997cb014cd2ba9870eb0509411fbc5f1044 /desktop
parent409c230ed70707eeb5e6fcd4ab904bb4a411608a (diff)
lok: Fix declaration of ‘xContext’ shadows a global declaration.
Change-Id: Iab3c142cd85ca54bf3c37a0710ce7da7a5d77a35
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9a0bd8737925..70e2372097b1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2420,11 +2420,20 @@ static void doc_resetSelection(LibreOfficeKitDocument* pThis)
static char* getLanguages(const char* pCommand)
{
- 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 >());
+ css::uno::Sequence< css::lang::Locale > aLocales;
+
+ if (xContext.is())
+ {
+ css::uno::Reference<css::linguistic2::XLinguServiceManager2> xLangSrv = css::linguistic2::LinguServiceManager::create(xContext);
+ if (xLangSrv.is())
+ {
+ css::uno::Reference<css::linguistic2::XSpellChecker> xSpell(xLangSrv->getSpellChecker(), css::uno::UNO_QUERY);
+ css::uno::Reference<css::linguistic2::XSupportedLocales> xLocales(xSpell, css::uno::UNO_QUERY);
+
+ if (xLocales.is())
+ aLocales = xLocales->getLocales();
+ }
+ }
boost::property_tree::ptree aTree;
aTree.put("commandName", pCommand);