1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _FIXEDVALUEBACKEND_HXX_
29 #define _FIXEDVALUEBACKEND_HXX_
30 
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <cppuhelper/implbase2.hxx>
34 #include <rtl/string.hxx>
35 
36 
37 namespace css = com::sun::star ;
38 namespace uno = css::uno ;
39 namespace lang = css::lang ;
40 
41 class LocaleBackend : public ::cppu::WeakImplHelper2 <
42         css::beans::XPropertySet,
43         lang::XServiceInfo > {
44 
45     public :
46 
47         static LocaleBackend* createInstance();
48 
49         // XServiceInfo
50         virtual rtl::OUString SAL_CALL
51             getImplementationName(  )
52                 throw (uno::RuntimeException) ;
53 
54         virtual sal_Bool SAL_CALL
55             supportsService( const rtl::OUString& aServiceName )
56                 throw (uno::RuntimeException) ;
57 
58         virtual uno::Sequence<rtl::OUString> SAL_CALL
59             getSupportedServiceNames(  )
60                 throw (uno::RuntimeException) ;
61 
62         /**
63           Provides the implementation name.
64 
65           @return   implementation name
66           */
67         static rtl::OUString SAL_CALL getBackendName(void) ;
68         /**
69           Provides the supported services names
70 
71           @return   service names
72           */
73         static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
74 
75         // XPropertySet
76         virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
77         getPropertySetInfo() throw (css::uno::RuntimeException)
78         { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
79 
80         virtual void SAL_CALL setPropertyValue(
81             rtl::OUString const &, css::uno::Any const &)
82             throw (
83                 css::beans::UnknownPropertyException,
84                 css::beans::PropertyVetoException,
85                 css::lang::IllegalArgumentException,
86                 css::lang::WrappedTargetException, css::uno::RuntimeException);
87 
88         virtual css::uno::Any SAL_CALL getPropertyValue(
89             rtl::OUString const & PropertyName)
90             throw (
91                 css::beans::UnknownPropertyException,
92                 css::lang::WrappedTargetException, css::uno::RuntimeException);
93 
94         virtual void SAL_CALL addPropertyChangeListener(
95             rtl::OUString const &,
96             css::uno::Reference< css::beans::XPropertyChangeListener > const &)
97             throw (
98                 css::beans::UnknownPropertyException,
99                 css::lang::WrappedTargetException, css::uno::RuntimeException)
100         {}
101 
102         virtual void SAL_CALL removePropertyChangeListener(
103             rtl::OUString const &,
104             css::uno::Reference< css::beans::XPropertyChangeListener > const &)
105             throw (
106                 css::beans::UnknownPropertyException,
107                 css::lang::WrappedTargetException, css::uno::RuntimeException)
108         {}
109 
110         virtual void SAL_CALL addVetoableChangeListener(
111             rtl::OUString const &,
112             css::uno::Reference< css::beans::XVetoableChangeListener > const &)
113             throw (
114                 css::beans::UnknownPropertyException,
115                 css::lang::WrappedTargetException, css::uno::RuntimeException)
116         {}
117 
118         virtual void SAL_CALL removeVetoableChangeListener(
119             rtl::OUString const &,
120             css::uno::Reference< css::beans::XVetoableChangeListener > const &)
121             throw (
122                 css::beans::UnknownPropertyException,
123                 css::lang::WrappedTargetException, css::uno::RuntimeException)
124         {}
125 
126     protected:
127         /**
128           Service constructor from a service factory.
129 
130           @param xContext   component context
131           */
132         LocaleBackend();
133 
134         /** Destructor */
135         ~LocaleBackend(void) ;
136 
137     private:
138         // Returns the user locale
139         static rtl::OUString getLocale(void);
140 
141         // Returns the user UI locale
142         static rtl::OUString getUILocale(void);
143 
144         // Returns the system default locale
145         static rtl::OUString getSystemLocale(void);
146 } ;
147 
148 
149 #endif // _FIXEDVALUEBACKEND_HXX_
150