Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #include <com/sun/star/lang/XComponent.hpp>
11 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
12 : #include <comphelper/processfactory.hxx>
13 : #include <cppuhelper/bootstrap.hxx>
14 : #include <i18nlangtag/languagetag.hxx>
15 : #include <sal/main.h>
16 : #include <svtools/langtab.hxx>
17 : #include <tools/extendapplicationenvironment.hxx>
18 : #include <vcl/svapp.hxx>
19 : #include <iostream>
20 :
21 : using namespace com::sun::star;
22 :
23 0 : SAL_IMPLEMENT_MAIN()
24 : {
25 0 : tools::extendApplicationEnvironment();
26 :
27 : uno::Reference<uno::XComponentContext> xContext =
28 0 : cppu::defaultBootstrap_InitialComponentContext();
29 :
30 : uno::Reference<lang::XMultiComponentFactory> xFactory =
31 0 : xContext->getServiceManager();
32 :
33 : uno::Reference<lang::XMultiServiceFactory> xSFactory(xFactory,
34 0 : uno::UNO_QUERY_THROW);
35 :
36 0 : comphelper::setProcessServiceFactory(xSFactory);
37 :
38 0 : InitVCL();
39 :
40 : {
41 0 : SvtLanguageTable aTable;
42 :
43 0 : sal_uInt32 nCount = aTable.GetEntryCount();
44 0 : for (sal_uInt32 i = 0; i < nCount; ++i)
45 : {
46 0 : LanguageType eLang = aTable.GetTypeAtIndex(i);
47 :
48 0 : if (eLang == LANGUAGE_DONTKNOW ||
49 0 : eLang == LANGUAGE_NONE ||
50 0 : eLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE ||
51 : eLang == LANGUAGE_SYSTEM)
52 : {
53 0 : continue;
54 : }
55 :
56 0 : OUString sTag( LanguageTag::convertToBcp47( eLang));
57 :
58 0 : std::cout << OUStringToOString(sTag, osl_getThreadTextEncoding()).getStr()
59 0 : << std::endl;
60 0 : }
61 : }
62 :
63 0 : DeInitVCL();
64 :
65 0 : uno::Reference< lang::XComponent >(xContext, uno::UNO_QUERY_THROW)->dispose();
66 :
67 0 : return 0;
68 0 : }
69 :
70 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|