1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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>
16 #include <svtools/langtab.hxx>
17 #include <tools/extendapplicationenvironment.hxx>
18 #include <vcl/svapp.hxx>
21 using namespace com::sun::star
;
25 tools::extendApplicationEnvironment();
27 uno::Reference
<uno::XComponentContext
> xContext
=
28 cppu::defaultBootstrap_InitialComponentContext();
30 uno::Reference
<lang::XMultiComponentFactory
> xFactory
=
31 xContext
->getServiceManager();
33 uno::Reference
<lang::XMultiServiceFactory
> xSFactory(xFactory
,
34 uno::UNO_QUERY_THROW
);
36 comphelper::setProcessServiceFactory(xSFactory
);
41 SvtLanguageTable aTable
;
43 sal_uInt32 nCount
= aTable
.GetEntryCount();
44 for (sal_uInt32 i
= 0; i
< nCount
; ++i
)
46 LanguageType eLang
= aTable
.GetTypeAtIndex(i
);
48 if (eLang
== LANGUAGE_DONTKNOW
||
49 eLang
== LANGUAGE_NONE
||
50 eLang
== LANGUAGE_HID_HUMAN_INTERFACE_DEVICE
||
51 eLang
== LANGUAGE_SYSTEM
)
56 OUString
sTag( LanguageTag( eLang
).getBcp47());
58 std::cout
<< OUStringToOString(sTag
, osl_getThreadTextEncoding()).getStr()
65 uno::Reference
< lang::XComponent
>(xContext
, uno::UNO_QUERY_THROW
)->dispose();
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */