1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _FIXEDVALUEBACKEND_HXX_
25 #define _FIXEDVALUEBACKEND_HXX_
26 
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <cppuhelper/implbase2.hxx>
30 #include <rtl/string.hxx>
31 
32 
33 namespace css = com::sun::star ;
34 namespace uno = css::uno ;
35 namespace lang = css::lang ;
36 
37 class LocaleBackend : public ::cppu::WeakImplHelper2 <
38         css::beans::XPropertySet,
39         lang::XServiceInfo > {
40 
41     public :
42 
43         static LocaleBackend* createInstance();
44 
45         // XServiceInfo
46         virtual rtl::OUString SAL_CALL
47             getImplementationName(  )
48                 throw (uno::RuntimeException) ;
49 
50         virtual sal_Bool SAL_CALL
51             supportsService( const rtl::OUString& aServiceName )
52                 throw (uno::RuntimeException) ;
53 
54         virtual uno::Sequence<rtl::OUString> SAL_CALL
55             getSupportedServiceNames(  )
56                 throw (uno::RuntimeException) ;
57 
58         /**
59           Provides the implementation name.
60 
61           @return   implementation name
62           */
63         static rtl::OUString SAL_CALL getBackendName(void) ;
64         /**
65           Provides the supported services names
66 
67           @return   service names
68           */
69         static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
70 
71         // XPropertySet
72         virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo()73         getPropertySetInfo() throw (css::uno::RuntimeException)
74         { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
75 
76         virtual void SAL_CALL setPropertyValue(
77             rtl::OUString const &, css::uno::Any const &)
78             throw (
79                 css::beans::UnknownPropertyException,
80                 css::beans::PropertyVetoException,
81                 css::lang::IllegalArgumentException,
82                 css::lang::WrappedTargetException, css::uno::RuntimeException);
83 
84         virtual css::uno::Any SAL_CALL getPropertyValue(
85             rtl::OUString const & PropertyName)
86             throw (
87                 css::beans::UnknownPropertyException,
88                 css::lang::WrappedTargetException, css::uno::RuntimeException);
89 
addPropertyChangeListener(rtl::OUString const &,css::uno::Reference<css::beans::XPropertyChangeListener> const &)90         virtual void SAL_CALL addPropertyChangeListener(
91             rtl::OUString const &,
92             css::uno::Reference< css::beans::XPropertyChangeListener > const &)
93             throw (
94                 css::beans::UnknownPropertyException,
95                 css::lang::WrappedTargetException, css::uno::RuntimeException)
96         {}
97 
removePropertyChangeListener(rtl::OUString const &,css::uno::Reference<css::beans::XPropertyChangeListener> const &)98         virtual void SAL_CALL removePropertyChangeListener(
99             rtl::OUString const &,
100             css::uno::Reference< css::beans::XPropertyChangeListener > const &)
101             throw (
102                 css::beans::UnknownPropertyException,
103                 css::lang::WrappedTargetException, css::uno::RuntimeException)
104         {}
105 
addVetoableChangeListener(rtl::OUString const &,css::uno::Reference<css::beans::XVetoableChangeListener> const &)106         virtual void SAL_CALL addVetoableChangeListener(
107             rtl::OUString const &,
108             css::uno::Reference< css::beans::XVetoableChangeListener > const &)
109             throw (
110                 css::beans::UnknownPropertyException,
111                 css::lang::WrappedTargetException, css::uno::RuntimeException)
112         {}
113 
removeVetoableChangeListener(rtl::OUString const &,css::uno::Reference<css::beans::XVetoableChangeListener> const &)114         virtual void SAL_CALL removeVetoableChangeListener(
115             rtl::OUString const &,
116             css::uno::Reference< css::beans::XVetoableChangeListener > const &)
117             throw (
118                 css::beans::UnknownPropertyException,
119                 css::lang::WrappedTargetException, css::uno::RuntimeException)
120         {}
121 
122     protected:
123         /**
124           Service constructor from a service factory.
125 
126           @param xContext   component context
127           */
128         LocaleBackend();
129 
130         /** Destructor */
131         ~LocaleBackend(void) ;
132 
133     private:
134         // Returns the user locale
135         static rtl::OUString getLocale(void);
136 
137         // Returns the user UI locale
138         static rtl::OUString getUILocale(void);
139 
140         // Returns the system default locale
141         static rtl::OUString getSystemLocale(void);
142 } ;
143 
144 
145 #endif // _FIXEDVALUEBACKEND_HXX_
146