Branch data 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/mslangid.hxx>
35 : : #include <sal/main.h>
36 : : #include <svtools/langtab.hxx>
37 : : #include <tools/extendapplicationenvironment.hxx>
38 : : #include <ucbhelper/contentbroker.hxx>
39 : : #include <vcl/svapp.hxx>
40 : : #include <iostream>
41 : :
42 : : using namespace com::sun::star;
43 : :
44 : 0 : SAL_IMPLEMENT_MAIN()
45 : : {
46 : 0 : tools::extendApplicationEnvironment();
47 : :
48 : : uno::Reference<uno::XComponentContext> xContext =
49 : 0 : cppu::defaultBootstrap_InitialComponentContext();
50 : :
51 : : uno::Reference<lang::XMultiComponentFactory> xFactory =
52 : 0 : xContext->getServiceManager();
53 : :
54 : : uno::Reference<lang::XMultiServiceFactory> xSFactory(xFactory,
55 : 0 : uno::UNO_QUERY_THROW);
56 : :
57 : 0 : comphelper::setProcessServiceFactory(xSFactory);
58 : :
59 : 0 : InitVCL(xSFactory);
60 : :
61 : : {
62 : 0 : SvtLanguageTable aTable;
63 : :
64 : 0 : sal_uInt32 nCount = aTable.GetEntryCount();
65 : 0 : for (sal_uInt32 i = 0; i < nCount; ++i)
66 : : {
67 : 0 : LanguageType eLang = aTable.GetTypeAtIndex(i);
68 : :
69 : 0 : if (eLang >= LANGUAGE_USER1 && eLang <= LANGUAGE_USER9)
70 : 0 : continue;
71 : :
72 : 0 : if (eLang == LANGUAGE_DONTKNOW ||
73 : : eLang == LANGUAGE_NONE ||
74 : : eLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE ||
75 : : eLang == LANGUAGE_SYSTEM)
76 : : {
77 : 0 : continue;
78 : : }
79 : :
80 : 0 : lang::Locale aLocale;
81 : :
82 : 0 : MsLangId::convertLanguageToLocale(eLang, aLocale);
83 : :
84 : 0 : rtl::OUStringBuffer aBuf(aLocale.Language);
85 : 0 : if (!aLocale.Country.isEmpty())
86 : 0 : aBuf.append('-').append(aLocale.Country);
87 : 0 : rtl::OUString sTag = aBuf.makeStringAndClear();
88 : :
89 : 0 : std::cout << rtl::OUStringToOString(sTag, osl_getThreadTextEncoding()).getStr()
90 : 0 : << std::endl;
91 : 0 : }
92 : : }
93 : :
94 : 0 : DeInitVCL();
95 : :
96 : 0 : uno::Reference< lang::XComponent >(xContext, uno::UNO_QUERY_THROW)->dispose();
97 : :
98 : 0 : return 0;
99 : 0 : }
100 : :
101 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|