2010-10-27 07:11:31 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2003-11-07 07:52:05 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 21:41:13 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2003-11-07 07:52:05 -06:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2003-11-07 07:52:05 -06:00
|
|
|
*
|
2008-04-10 21:41:13 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-11-07 07:52:05 -06:00
|
|
|
*
|
2008-04-10 21:41:13 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2003-11-07 07:52:05 -06:00
|
|
|
*
|
2008-04-10 21:41:13 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2003-11-07 07:52:05 -06:00
|
|
|
*
|
2008-04-10 21:41:13 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2003-11-07 07:52:05 -06:00
|
|
|
*
|
2008-04-10 21:41:13 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2003-11-07 07:52:05 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <list>
|
2004-08-20 08:13:00 -05:00
|
|
|
#include <sal/types.h>
|
2003-11-07 07:52:05 -06:00
|
|
|
#include <tools/string.hxx>
|
2004-06-25 06:24:58 -05:00
|
|
|
#include <rtl/ustring.hxx>
|
2004-01-20 08:48:03 -06:00
|
|
|
#include <tools/resid.hxx>
|
|
|
|
#include <com/sun/star/lang/Locale.hpp>
|
2004-08-20 08:13:00 -05:00
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
2009-10-15 17:05:16 -05:00
|
|
|
#include <svl/languageoptions.hxx>
|
2003-11-07 07:52:05 -06:00
|
|
|
|
|
|
|
namespace desktop
|
|
|
|
{
|
|
|
|
|
2004-01-20 08:48:03 -06:00
|
|
|
class LanguageSelection
|
|
|
|
{
|
2010-06-22 10:08:07 -05:00
|
|
|
public:
|
|
|
|
enum LanguageSelectionStatus
|
|
|
|
{
|
|
|
|
LS_STATUS_OK,
|
|
|
|
LS_STATUS_CANNOT_DETERMINE_LANGUAGE,
|
|
|
|
LS_STATUS_CONFIGURATIONACCESS_BROKEN
|
|
|
|
};
|
|
|
|
|
|
|
|
static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str);
|
|
|
|
static rtl::OUString getLanguageString();
|
|
|
|
static bool prepareLanguage();
|
|
|
|
static LanguageSelectionStatus getStatus();
|
|
|
|
|
2004-01-20 08:48:03 -06:00
|
|
|
private:
|
2004-08-20 08:13:00 -05:00
|
|
|
static const rtl::OUString usFallbackLanguage;
|
|
|
|
static rtl::OUString aFoundLanguage;
|
|
|
|
static sal_Bool bFoundLanguage;
|
2010-06-22 10:08:07 -05:00
|
|
|
static LanguageSelectionStatus m_eStatus;
|
2003-11-07 07:52:05 -06:00
|
|
|
|
2004-08-20 08:13:00 -05:00
|
|
|
static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
|
|
|
|
getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate=sal_False);
|
|
|
|
static com::sun::star::uno::Sequence< rtl::OUString > getInstalledLanguages();
|
|
|
|
static sal_Bool isInstalledLanguage(rtl::OUString& usLocale, sal_Bool bExact=sal_False);
|
|
|
|
static rtl::OUString getFirstInstalledLanguage();
|
2010-03-29 04:28:28 -05:00
|
|
|
static rtl::OUString getUserUILanguage();
|
2004-06-25 06:24:58 -05:00
|
|
|
static rtl::OUString getUserLanguage();
|
2004-08-20 08:13:00 -05:00
|
|
|
static rtl::OUString getSystemLanguage();
|
|
|
|
static void resetUserLanguage();
|
2009-09-17 06:26:03 -05:00
|
|
|
static void setDefaultLanguage(const rtl::OUString&);
|
2003-11-07 07:52:05 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
} //namespace desktop
|
2010-10-27 07:11:31 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|