xref: /aoo42x/main/desktop/source/app/langselect.hxx (revision 0a1e2f0e)
1*0a1e2f0eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*0a1e2f0eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*0a1e2f0eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*0a1e2f0eSAndrew Rist  * distributed with this work for additional information
6*0a1e2f0eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*0a1e2f0eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*0a1e2f0eSAndrew Rist  * "License"); you may not use this file except in compliance
9*0a1e2f0eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*0a1e2f0eSAndrew Rist  *
11*0a1e2f0eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*0a1e2f0eSAndrew Rist  *
13*0a1e2f0eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*0a1e2f0eSAndrew Rist  * software distributed under the License is distributed on an
15*0a1e2f0eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*0a1e2f0eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*0a1e2f0eSAndrew Rist  * specific language governing permissions and limitations
18*0a1e2f0eSAndrew Rist  * under the License.
19*0a1e2f0eSAndrew Rist  *
20*0a1e2f0eSAndrew Rist  *************************************************************/
21*0a1e2f0eSAndrew Rist 
22*0a1e2f0eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include <list>
25cdf0e10cSrcweir #include <sal/types.h>
26cdf0e10cSrcweir #include <tools/string.hxx>
27cdf0e10cSrcweir #include <rtl/ustring.hxx>
28cdf0e10cSrcweir #include <tools/resid.hxx>
29cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp>
30cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
31cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
32cdf0e10cSrcweir #include <svl/languageoptions.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace desktop
35cdf0e10cSrcweir {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class LanguageSelection
38cdf0e10cSrcweir {
39cdf0e10cSrcweir public:
40cdf0e10cSrcweir     enum LanguageSelectionStatus
41cdf0e10cSrcweir     {
42cdf0e10cSrcweir         LS_STATUS_OK,
43cdf0e10cSrcweir         LS_STATUS_CANNOT_DETERMINE_LANGUAGE,
44cdf0e10cSrcweir         LS_STATUS_CONFIGURATIONACCESS_BROKEN
45cdf0e10cSrcweir     };
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str);
48cdf0e10cSrcweir     static rtl::OUString getLanguageString();
49cdf0e10cSrcweir     static bool prepareLanguage();
50cdf0e10cSrcweir     static LanguageSelectionStatus getStatus();
51cdf0e10cSrcweir 
52cdf0e10cSrcweir private:
53cdf0e10cSrcweir     static const rtl::OUString usFallbackLanguage;
54cdf0e10cSrcweir     static rtl::OUString aFoundLanguage;
55cdf0e10cSrcweir     static sal_Bool bFoundLanguage;
56cdf0e10cSrcweir     static LanguageSelectionStatus m_eStatus;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
59cdf0e10cSrcweir         getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate=sal_False);
60cdf0e10cSrcweir     static com::sun::star::uno::Sequence< rtl::OUString > getInstalledLanguages();
61cdf0e10cSrcweir     static sal_Bool isInstalledLanguage(rtl::OUString& usLocale, sal_Bool bExact=sal_False);
62cdf0e10cSrcweir     static rtl::OUString getFirstInstalledLanguage();
63cdf0e10cSrcweir     static rtl::OUString getUserUILanguage();
64cdf0e10cSrcweir     static rtl::OUString getUserLanguage();
65cdf0e10cSrcweir     static rtl::OUString getSystemLanguage();
66cdf0e10cSrcweir     static void resetUserLanguage();
67cdf0e10cSrcweir     static void setDefaultLanguage(const rtl::OUString&);
68cdf0e10cSrcweir };
69cdf0e10cSrcweir 
70cdf0e10cSrcweir } //namespace desktop
71