unotest,sw: introduce queryDispatchStatus()
[LibreOffice.git] / svtools / langsupport / langsupport.cxx
blob711669c8c3f84b371397a6d75c3408433b088e88
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <com/sun/star/lang/XComponent.hpp>
11 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
12 #include <com/sun/star/uno/XComponentContext.hpp>
13 #include <comphelper/processfactory.hxx>
14 #include <cppuhelper/bootstrap.hxx>
15 #include <i18nlangtag/languagetag.hxx>
16 #include <sal/main.h>
17 #include <svtools/langtab.hxx>
18 #include <comphelper/diagnose_ex.hxx>
19 #include <tools/extendapplicationenvironment.hxx>
20 #include <vcl/svapp.hxx>
21 #include <iostream>
22 #include <sal/log.hxx>
24 using namespace com::sun::star;
26 SAL_IMPLEMENT_MAIN()
28 try
30 tools::extendApplicationEnvironment();
32 uno::Reference<uno::XComponentContext> xContext =
33 cppu::defaultBootstrap_InitialComponentContext();
35 uno::Reference<lang::XMultiComponentFactory> xFactory =
36 xContext->getServiceManager();
38 uno::Reference<lang::XMultiServiceFactory> xSFactory(xFactory,
39 uno::UNO_QUERY_THROW);
41 comphelper::setProcessServiceFactory(xSFactory);
43 InitVCL();
46 sal_uInt32 nCount = SvtLanguageTable::GetLanguageEntryCount();
47 for (sal_uInt32 i = 0; i < nCount; ++i)
49 LanguageType eLang = SvtLanguageTable::GetLanguageTypeAtIndex(i);
51 if (eLang == LANGUAGE_DONTKNOW ||
52 eLang == LANGUAGE_NONE ||
53 eLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE ||
54 eLang == LANGUAGE_SYSTEM)
56 continue;
59 OUString sTag( LanguageTag::convertToBcp47( eLang));
61 std::cout << sTag << std::endl;
65 DeInitVCL();
67 uno::Reference< lang::XComponent >(xContext, uno::UNO_QUERY_THROW)->dispose();
69 catch (const uno::Exception&)
71 TOOLS_WARN_EXCEPTION("vcl.app", "Fatal");
72 return 1;
74 catch (const std::exception &e)
76 SAL_WARN("vcl.app", "Fatal: " << e.what());
77 return 1;
80 return 0;
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */