Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Initial Developer of the Original Code is
16 : * Caolán McNamara <caolanm@redhat.com>
17 : * Portions created by the Initial Developer are Copyright (C) 2011 the
18 : * Initial Developer. All Rights Reserved.
19 : *
20 : * Contributor(s):
21 : * Caolán McNamara <caolanm@redhat.com>
22 : *
23 : * Alternatively, the contents of this file may be used under the terms of
24 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
25 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
26 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
27 : * instead of those above.
28 : */
29 :
30 : #include <com/sun/star/lang/XComponent.hpp>
31 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 : #include <comphelper/processfactory.hxx>
33 : #include <cppuhelper/bootstrap.hxx>
34 : #include <i18npool/languagetag.hxx>
35 : #include <sal/main.h>
36 : #include <svtools/langtab.hxx>
37 : #include <tools/extendapplicationenvironment.hxx>
38 : #include <vcl/svapp.hxx>
39 : #include <iostream>
40 :
41 : using namespace com::sun::star;
42 :
43 0 : SAL_IMPLEMENT_MAIN()
44 : {
45 0 : tools::extendApplicationEnvironment();
46 :
47 : uno::Reference<uno::XComponentContext> xContext =
48 0 : cppu::defaultBootstrap_InitialComponentContext();
49 :
50 : uno::Reference<lang::XMultiComponentFactory> xFactory =
51 0 : xContext->getServiceManager();
52 :
53 : uno::Reference<lang::XMultiServiceFactory> xSFactory(xFactory,
54 0 : uno::UNO_QUERY_THROW);
55 :
56 0 : comphelper::setProcessServiceFactory(xSFactory);
57 :
58 0 : InitVCL();
59 :
60 : {
61 0 : SvtLanguageTable aTable;
62 :
63 0 : sal_uInt32 nCount = aTable.GetEntryCount();
64 0 : for (sal_uInt32 i = 0; i < nCount; ++i)
65 : {
66 0 : LanguageType eLang = aTable.GetTypeAtIndex(i);
67 :
68 0 : if (eLang >= LANGUAGE_USER1 && eLang <= LANGUAGE_USER9)
69 0 : continue;
70 :
71 0 : if (eLang == LANGUAGE_DONTKNOW ||
72 : eLang == LANGUAGE_NONE ||
73 : eLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE ||
74 : eLang == LANGUAGE_SYSTEM)
75 : {
76 0 : continue;
77 : }
78 :
79 0 : rtl::OUString sTag( LanguageTag( eLang).getBcp47());
80 :
81 0 : std::cout << rtl::OUStringToOString(sTag, osl_getThreadTextEncoding()).getStr()
82 0 : << std::endl;
83 0 : }
84 : }
85 :
86 0 : DeInitVCL();
87 :
88 0 : uno::Reference< lang::XComponent >(xContext, uno::UNO_QUERY_THROW)->dispose();
89 :
90 0 : return 0;
91 0 : }
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|