1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove
25*b1cdbd2cSJim Jagielski #include "precompiled_shell.hxx"
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski #include "localebackend.hxx"
28*b1cdbd2cSJim Jagielski #include <com/sun/star/beans/Optional.hpp>
29*b1cdbd2cSJim Jagielski #include <osl/time.h>
30*b1cdbd2cSJim Jagielski
31*b1cdbd2cSJim Jagielski #include <stdio.h>
32*b1cdbd2cSJim Jagielski
33*b1cdbd2cSJim Jagielski #if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(OS2)
34*b1cdbd2cSJim Jagielski
35*b1cdbd2cSJim Jagielski #include <rtl/ustrbuf.hxx>
36*b1cdbd2cSJim Jagielski #include <locale.h>
37*b1cdbd2cSJim Jagielski #include <string.h>
38*b1cdbd2cSJim Jagielski
39*b1cdbd2cSJim Jagielski /*
40*b1cdbd2cSJim Jagielski * Note: setlocale is not at all thread safe, so is this code. It could
41*b1cdbd2cSJim Jagielski * especially interfere with the stuff VCL is doing, so make sure this
42*b1cdbd2cSJim Jagielski * is called from the main thread only.
43*b1cdbd2cSJim Jagielski */
44*b1cdbd2cSJim Jagielski
ImplGetLocale(int category)45*b1cdbd2cSJim Jagielski static rtl::OUString ImplGetLocale(int category)
46*b1cdbd2cSJim Jagielski {
47*b1cdbd2cSJim Jagielski const char *locale = setlocale(category, "");
48*b1cdbd2cSJim Jagielski
49*b1cdbd2cSJim Jagielski // Return "en-US" for C locales
50*b1cdbd2cSJim Jagielski if( (locale == NULL) || ( locale[0] == 'C' && locale[1] == '\0' ) )
51*b1cdbd2cSJim Jagielski return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en-US" ) );
52*b1cdbd2cSJim Jagielski
53*b1cdbd2cSJim Jagielski
54*b1cdbd2cSJim Jagielski const char *cp;
55*b1cdbd2cSJim Jagielski const char *uscore = NULL;
56*b1cdbd2cSJim Jagielski
57*b1cdbd2cSJim Jagielski // locale string have the format lang[_ctry][.encoding][@modifier]
58*b1cdbd2cSJim Jagielski // we are only interested in the first two items, so we handle
59*b1cdbd2cSJim Jagielski // '.' and '@' as string end.
60*b1cdbd2cSJim Jagielski for (cp = locale; *cp; cp++)
61*b1cdbd2cSJim Jagielski {
62*b1cdbd2cSJim Jagielski if (*cp == '_')
63*b1cdbd2cSJim Jagielski uscore = cp;
64*b1cdbd2cSJim Jagielski if (*cp == '.' || *cp == '@')
65*b1cdbd2cSJim Jagielski break;
66*b1cdbd2cSJim Jagielski }
67*b1cdbd2cSJim Jagielski
68*b1cdbd2cSJim Jagielski rtl::OUStringBuffer aLocaleBuffer;
69*b1cdbd2cSJim Jagielski if( uscore != NULL )
70*b1cdbd2cSJim Jagielski {
71*b1cdbd2cSJim Jagielski aLocaleBuffer.appendAscii(locale, uscore++ - locale);
72*b1cdbd2cSJim Jagielski aLocaleBuffer.appendAscii("-");
73*b1cdbd2cSJim Jagielski aLocaleBuffer.appendAscii(uscore, cp - uscore);
74*b1cdbd2cSJim Jagielski }
75*b1cdbd2cSJim Jagielski else
76*b1cdbd2cSJim Jagielski {
77*b1cdbd2cSJim Jagielski aLocaleBuffer.appendAscii(locale, cp - locale);
78*b1cdbd2cSJim Jagielski }
79*b1cdbd2cSJim Jagielski
80*b1cdbd2cSJim Jagielski return aLocaleBuffer.makeStringAndClear();
81*b1cdbd2cSJim Jagielski }
82*b1cdbd2cSJim Jagielski
83*b1cdbd2cSJim Jagielski #elif defined(MACOSX)
84*b1cdbd2cSJim Jagielski
85*b1cdbd2cSJim Jagielski #include <rtl/ustrbuf.hxx>
86*b1cdbd2cSJim Jagielski #include <locale.h>
87*b1cdbd2cSJim Jagielski #include <string.h>
88*b1cdbd2cSJim Jagielski
89*b1cdbd2cSJim Jagielski #include <premac.h>
90*b1cdbd2cSJim Jagielski #include <CoreServices/CoreServices.h>
91*b1cdbd2cSJim Jagielski #include <CoreFoundation/CoreFoundation.h>
92*b1cdbd2cSJim Jagielski #include <postmac.h>
93*b1cdbd2cSJim Jagielski
94*b1cdbd2cSJim Jagielski namespace /* private */
95*b1cdbd2cSJim Jagielski {
96*b1cdbd2cSJim Jagielski
OUStringBufferAppendCFString(rtl::OUStringBuffer & buffer,const CFStringRef s)97*b1cdbd2cSJim Jagielski void OUStringBufferAppendCFString(rtl::OUStringBuffer& buffer, const CFStringRef s)
98*b1cdbd2cSJim Jagielski {
99*b1cdbd2cSJim Jagielski CFIndex lstr = CFStringGetLength(s);
100*b1cdbd2cSJim Jagielski for (CFIndex i = 0; i < lstr; i++)
101*b1cdbd2cSJim Jagielski buffer.append(CFStringGetCharacterAtIndex(s, i));
102*b1cdbd2cSJim Jagielski }
103*b1cdbd2cSJim Jagielski
104*b1cdbd2cSJim Jagielski template <typename T>
105*b1cdbd2cSJim Jagielski class CFGuard
106*b1cdbd2cSJim Jagielski {
107*b1cdbd2cSJim Jagielski public:
CFGuard(T & rT)108*b1cdbd2cSJim Jagielski explicit CFGuard(T& rT) : rT_(rT) {}
~CFGuard()109*b1cdbd2cSJim Jagielski ~CFGuard() { if (rT_) CFRelease(rT_); }
110*b1cdbd2cSJim Jagielski private:
111*b1cdbd2cSJim Jagielski T& rT_;
112*b1cdbd2cSJim Jagielski };
113*b1cdbd2cSJim Jagielski
114*b1cdbd2cSJim Jagielski typedef CFGuard<CFArrayRef> CFArrayGuard;
115*b1cdbd2cSJim Jagielski typedef CFGuard<CFStringRef> CFStringGuard;
116*b1cdbd2cSJim Jagielski typedef CFGuard<CFTypeRef> CFTypeRefGuard;
117*b1cdbd2cSJim Jagielski
118*b1cdbd2cSJim Jagielski /* For more information on the Apple locale concept please refer to
119*b1cdbd2cSJim Jagielski http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFLocales/Articles/CFLocaleConcepts.html
120*b1cdbd2cSJim Jagielski According to this documentation a locale identifier has the format: language[_country][_variant]*
121*b1cdbd2cSJim Jagielski e.g. es_ES_PREEURO -> spain prior Euro support
122*b1cdbd2cSJim Jagielski Note: The calling code should be able to handle locales with only language information e.g. 'en' for certain
123*b1cdbd2cSJim Jagielski UI languages just the language code will be returned.
124*b1cdbd2cSJim Jagielski */
125*b1cdbd2cSJim Jagielski
ImplGetAppPreference(const char * pref)126*b1cdbd2cSJim Jagielski CFStringRef ImplGetAppPreference(const char* pref)
127*b1cdbd2cSJim Jagielski {
128*b1cdbd2cSJim Jagielski CFStringRef csPref = CFStringCreateWithCString(NULL, pref, kCFStringEncodingASCII);
129*b1cdbd2cSJim Jagielski CFStringGuard csRefGuard(csPref);
130*b1cdbd2cSJim Jagielski
131*b1cdbd2cSJim Jagielski CFTypeRef ref = CFPreferencesCopyAppValue(csPref, kCFPreferencesCurrentApplication);
132*b1cdbd2cSJim Jagielski CFTypeRefGuard refGuard(ref);
133*b1cdbd2cSJim Jagielski
134*b1cdbd2cSJim Jagielski if (ref == NULL)
135*b1cdbd2cSJim Jagielski return NULL;
136*b1cdbd2cSJim Jagielski
137*b1cdbd2cSJim Jagielski CFStringRef sref = (CFGetTypeID(ref) == CFArrayGetTypeID()) ? (CFStringRef)CFArrayGetValueAtIndex((CFArrayRef)ref, 0) : (CFStringRef)ref;
138*b1cdbd2cSJim Jagielski
139*b1cdbd2cSJim Jagielski // NOTE: this API is only available with Mac OS X >=10.3. We need to use it because
140*b1cdbd2cSJim Jagielski // Apple used non-ISO values on systems <10.2 like "German" for instance but didn't
141*b1cdbd2cSJim Jagielski // upgrade those values during upgrade to newer Mac OS X versions. See also #i54337#
142*b1cdbd2cSJim Jagielski return CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault, sref);
143*b1cdbd2cSJim Jagielski }
144*b1cdbd2cSJim Jagielski
ImplGetLocale(const char * pref)145*b1cdbd2cSJim Jagielski rtl::OUString ImplGetLocale(const char* pref)
146*b1cdbd2cSJim Jagielski {
147*b1cdbd2cSJim Jagielski CFStringRef sref = ImplGetAppPreference(pref);
148*b1cdbd2cSJim Jagielski CFStringGuard srefGuard(sref);
149*b1cdbd2cSJim Jagielski
150*b1cdbd2cSJim Jagielski rtl::OUStringBuffer aLocaleBuffer;
151*b1cdbd2cSJim Jagielski aLocaleBuffer.appendAscii("en-US"); // initialize with fallback value
152*b1cdbd2cSJim Jagielski
153*b1cdbd2cSJim Jagielski if (sref != NULL)
154*b1cdbd2cSJim Jagielski {
155*b1cdbd2cSJim Jagielski // split the string into substrings; the first two (if there are two) substrings
156*b1cdbd2cSJim Jagielski // are language and country
157*b1cdbd2cSJim Jagielski CFArrayRef subs = CFStringCreateArrayBySeparatingStrings(NULL, sref, CFSTR("_"));
158*b1cdbd2cSJim Jagielski CFArrayGuard subsGuard(subs);
159*b1cdbd2cSJim Jagielski
160*b1cdbd2cSJim Jagielski if (subs != NULL)
161*b1cdbd2cSJim Jagielski {
162*b1cdbd2cSJim Jagielski aLocaleBuffer.setLength(0); // clear buffer which still contains fallback value
163*b1cdbd2cSJim Jagielski
164*b1cdbd2cSJim Jagielski CFStringRef lang = (CFStringRef)CFArrayGetValueAtIndex(subs, 0);
165*b1cdbd2cSJim Jagielski OUStringBufferAppendCFString(aLocaleBuffer, lang);
166*b1cdbd2cSJim Jagielski
167*b1cdbd2cSJim Jagielski // country also available? Assumption: if the array contains more than one
168*b1cdbd2cSJim Jagielski // value the second value is always the country!
169*b1cdbd2cSJim Jagielski if (CFArrayGetCount(subs) > 1)
170*b1cdbd2cSJim Jagielski {
171*b1cdbd2cSJim Jagielski aLocaleBuffer.appendAscii("-");
172*b1cdbd2cSJim Jagielski CFStringRef country = (CFStringRef)CFArrayGetValueAtIndex(subs, 1);
173*b1cdbd2cSJim Jagielski OUStringBufferAppendCFString(aLocaleBuffer, country);
174*b1cdbd2cSJim Jagielski }
175*b1cdbd2cSJim Jagielski }
176*b1cdbd2cSJim Jagielski }
177*b1cdbd2cSJim Jagielski return aLocaleBuffer.makeStringAndClear();
178*b1cdbd2cSJim Jagielski }
179*b1cdbd2cSJim Jagielski
180*b1cdbd2cSJim Jagielski } // namespace /* private */
181*b1cdbd2cSJim Jagielski
182*b1cdbd2cSJim Jagielski #endif
183*b1cdbd2cSJim Jagielski
184*b1cdbd2cSJim Jagielski // -------------------------------------------------------------------------------
185*b1cdbd2cSJim Jagielski
186*b1cdbd2cSJim Jagielski #ifdef WNT
187*b1cdbd2cSJim Jagielski
188*b1cdbd2cSJim Jagielski #ifdef WINVER
189*b1cdbd2cSJim Jagielski #undef WINVER
190*b1cdbd2cSJim Jagielski #endif
191*b1cdbd2cSJim Jagielski #define WINVER 0x0501
192*b1cdbd2cSJim Jagielski
193*b1cdbd2cSJim Jagielski #if defined _MSC_VER
194*b1cdbd2cSJim Jagielski #pragma warning(push, 1)
195*b1cdbd2cSJim Jagielski #endif
196*b1cdbd2cSJim Jagielski #include <windows.h>
197*b1cdbd2cSJim Jagielski #if defined _MSC_VER
198*b1cdbd2cSJim Jagielski #pragma warning(pop)
199*b1cdbd2cSJim Jagielski #endif
200*b1cdbd2cSJim Jagielski
ImplGetLocale(LCID lcid)201*b1cdbd2cSJim Jagielski rtl::OUString ImplGetLocale(LCID lcid)
202*b1cdbd2cSJim Jagielski {
203*b1cdbd2cSJim Jagielski TCHAR buffer[8];
204*b1cdbd2cSJim Jagielski LPTSTR cp = buffer;
205*b1cdbd2cSJim Jagielski
206*b1cdbd2cSJim Jagielski cp += GetLocaleInfo( lcid, LOCALE_SISO639LANGNAME , buffer, 4 );
207*b1cdbd2cSJim Jagielski if( cp > buffer )
208*b1cdbd2cSJim Jagielski {
209*b1cdbd2cSJim Jagielski if( 0 < GetLocaleInfo( lcid, LOCALE_SISO3166CTRYNAME, cp, buffer + 8 - cp) )
210*b1cdbd2cSJim Jagielski // #i50822# minus character must be written before cp
211*b1cdbd2cSJim Jagielski *(cp - 1) = '-';
212*b1cdbd2cSJim Jagielski
213*b1cdbd2cSJim Jagielski return rtl::OUString::createFromAscii(buffer);
214*b1cdbd2cSJim Jagielski }
215*b1cdbd2cSJim Jagielski
216*b1cdbd2cSJim Jagielski return rtl::OUString();
217*b1cdbd2cSJim Jagielski }
218*b1cdbd2cSJim Jagielski
219*b1cdbd2cSJim Jagielski #endif // WNT
220*b1cdbd2cSJim Jagielski
221*b1cdbd2cSJim Jagielski // -------------------------------------------------------------------------------
222*b1cdbd2cSJim Jagielski
LocaleBackend()223*b1cdbd2cSJim Jagielski LocaleBackend::LocaleBackend()
224*b1cdbd2cSJim Jagielski {
225*b1cdbd2cSJim Jagielski }
226*b1cdbd2cSJim Jagielski
227*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------------
228*b1cdbd2cSJim Jagielski
~LocaleBackend(void)229*b1cdbd2cSJim Jagielski LocaleBackend::~LocaleBackend(void)
230*b1cdbd2cSJim Jagielski {
231*b1cdbd2cSJim Jagielski }
232*b1cdbd2cSJim Jagielski
233*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------------
234*b1cdbd2cSJim Jagielski
createInstance()235*b1cdbd2cSJim Jagielski LocaleBackend* LocaleBackend::createInstance()
236*b1cdbd2cSJim Jagielski {
237*b1cdbd2cSJim Jagielski return new LocaleBackend;
238*b1cdbd2cSJim Jagielski }
239*b1cdbd2cSJim Jagielski
240*b1cdbd2cSJim Jagielski // ---------------------------------------------------------------------------------------
241*b1cdbd2cSJim Jagielski
getLocale(void)242*b1cdbd2cSJim Jagielski rtl::OUString LocaleBackend::getLocale(void)
243*b1cdbd2cSJim Jagielski {
244*b1cdbd2cSJim Jagielski #if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(OS2)
245*b1cdbd2cSJim Jagielski return ImplGetLocale(LC_CTYPE);
246*b1cdbd2cSJim Jagielski #elif defined (MACOSX)
247*b1cdbd2cSJim Jagielski return ImplGetLocale("AppleLocale");
248*b1cdbd2cSJim Jagielski #elif defined WNT
249*b1cdbd2cSJim Jagielski return ImplGetLocale( GetUserDefaultLCID() );
250*b1cdbd2cSJim Jagielski #endif
251*b1cdbd2cSJim Jagielski }
252*b1cdbd2cSJim Jagielski
253*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------------
254*b1cdbd2cSJim Jagielski
getUILocale(void)255*b1cdbd2cSJim Jagielski rtl::OUString LocaleBackend::getUILocale(void)
256*b1cdbd2cSJim Jagielski {
257*b1cdbd2cSJim Jagielski #if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(OS2)
258*b1cdbd2cSJim Jagielski return ImplGetLocale(LC_MESSAGES);
259*b1cdbd2cSJim Jagielski #elif defined(MACOSX)
260*b1cdbd2cSJim Jagielski return ImplGetLocale("AppleLanguages");
261*b1cdbd2cSJim Jagielski #elif defined WNT
262*b1cdbd2cSJim Jagielski return ImplGetLocale( MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT) );
263*b1cdbd2cSJim Jagielski #endif
264*b1cdbd2cSJim Jagielski }
265*b1cdbd2cSJim Jagielski
266*b1cdbd2cSJim Jagielski // ---------------------------------------------------------------------------------------
267*b1cdbd2cSJim Jagielski
getSystemLocale(void)268*b1cdbd2cSJim Jagielski rtl::OUString LocaleBackend::getSystemLocale(void)
269*b1cdbd2cSJim Jagielski {
270*b1cdbd2cSJim Jagielski // note: the implementation differs from getLocale() only on Windows
271*b1cdbd2cSJim Jagielski #if defined WNT
272*b1cdbd2cSJim Jagielski return ImplGetLocale( GetSystemDefaultLCID() );
273*b1cdbd2cSJim Jagielski #else
274*b1cdbd2cSJim Jagielski return getLocale();
275*b1cdbd2cSJim Jagielski #endif
276*b1cdbd2cSJim Jagielski }
277*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------------
278*b1cdbd2cSJim Jagielski
setPropertyValue(rtl::OUString const &,css::uno::Any const &)279*b1cdbd2cSJim Jagielski void LocaleBackend::setPropertyValue(
280*b1cdbd2cSJim Jagielski rtl::OUString const &, css::uno::Any const &)
281*b1cdbd2cSJim Jagielski throw (
282*b1cdbd2cSJim Jagielski css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
283*b1cdbd2cSJim Jagielski css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
284*b1cdbd2cSJim Jagielski css::uno::RuntimeException)
285*b1cdbd2cSJim Jagielski {
286*b1cdbd2cSJim Jagielski throw css::lang::IllegalArgumentException(
287*b1cdbd2cSJim Jagielski rtl::OUString(
288*b1cdbd2cSJim Jagielski RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
289*b1cdbd2cSJim Jagielski static_cast< cppu::OWeakObject * >(this), -1);
290*b1cdbd2cSJim Jagielski }
291*b1cdbd2cSJim Jagielski
getPropertyValue(rtl::OUString const & PropertyName)292*b1cdbd2cSJim Jagielski css::uno::Any LocaleBackend::getPropertyValue(
293*b1cdbd2cSJim Jagielski rtl::OUString const & PropertyName)
294*b1cdbd2cSJim Jagielski throw (
295*b1cdbd2cSJim Jagielski css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
296*b1cdbd2cSJim Jagielski css::uno::RuntimeException)
297*b1cdbd2cSJim Jagielski {
298*b1cdbd2cSJim Jagielski if (PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Locale"))) {
299*b1cdbd2cSJim Jagielski return css::uno::makeAny(
300*b1cdbd2cSJim Jagielski css::beans::Optional< css::uno::Any >(
301*b1cdbd2cSJim Jagielski true, css::uno::makeAny(getLocale())));
302*b1cdbd2cSJim Jagielski } else if (PropertyName.equalsAsciiL(
303*b1cdbd2cSJim Jagielski RTL_CONSTASCII_STRINGPARAM("SystemLocale")))
304*b1cdbd2cSJim Jagielski {
305*b1cdbd2cSJim Jagielski return css::uno::makeAny(
306*b1cdbd2cSJim Jagielski css::beans::Optional< css::uno::Any >(
307*b1cdbd2cSJim Jagielski true, css::uno::makeAny(getSystemLocale())));
308*b1cdbd2cSJim Jagielski } else if (PropertyName.equalsAsciiL(
309*b1cdbd2cSJim Jagielski RTL_CONSTASCII_STRINGPARAM("UILocale")))
310*b1cdbd2cSJim Jagielski {
311*b1cdbd2cSJim Jagielski return css::uno::makeAny(
312*b1cdbd2cSJim Jagielski css::beans::Optional< css::uno::Any >(
313*b1cdbd2cSJim Jagielski true, css::uno::makeAny(getUILocale())));
314*b1cdbd2cSJim Jagielski } else {
315*b1cdbd2cSJim Jagielski throw css::beans::UnknownPropertyException(
316*b1cdbd2cSJim Jagielski PropertyName, static_cast< cppu::OWeakObject * >(this));
317*b1cdbd2cSJim Jagielski }
318*b1cdbd2cSJim Jagielski }
319*b1cdbd2cSJim Jagielski
320*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------------
321*b1cdbd2cSJim Jagielski
getBackendName(void)322*b1cdbd2cSJim Jagielski rtl::OUString SAL_CALL LocaleBackend::getBackendName(void) {
323*b1cdbd2cSJim Jagielski return rtl::OUString::createFromAscii("com.sun.star.comp.configuration.backend.LocaleBackend") ;
324*b1cdbd2cSJim Jagielski }
325*b1cdbd2cSJim Jagielski
326*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------------
327*b1cdbd2cSJim Jagielski
getImplementationName(void)328*b1cdbd2cSJim Jagielski rtl::OUString SAL_CALL LocaleBackend::getImplementationName(void)
329*b1cdbd2cSJim Jagielski throw (uno::RuntimeException)
330*b1cdbd2cSJim Jagielski {
331*b1cdbd2cSJim Jagielski return getBackendName() ;
332*b1cdbd2cSJim Jagielski }
333*b1cdbd2cSJim Jagielski
334*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------------
335*b1cdbd2cSJim Jagielski
getBackendServiceNames(void)336*b1cdbd2cSJim Jagielski uno::Sequence<rtl::OUString> SAL_CALL LocaleBackend::getBackendServiceNames(void)
337*b1cdbd2cSJim Jagielski {
338*b1cdbd2cSJim Jagielski uno::Sequence<rtl::OUString> aServiceNameList(1);
339*b1cdbd2cSJim Jagielski aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.LocaleBackend")) ;
340*b1cdbd2cSJim Jagielski return aServiceNameList ;
341*b1cdbd2cSJim Jagielski }
342*b1cdbd2cSJim Jagielski
343*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------------
344*b1cdbd2cSJim Jagielski
supportsService(const rtl::OUString & aServiceName)345*b1cdbd2cSJim Jagielski sal_Bool SAL_CALL LocaleBackend::supportsService(const rtl::OUString& aServiceName)
346*b1cdbd2cSJim Jagielski throw (uno::RuntimeException)
347*b1cdbd2cSJim Jagielski {
348*b1cdbd2cSJim Jagielski uno::Sequence< rtl::OUString > const svc = getBackendServiceNames();
349*b1cdbd2cSJim Jagielski
350*b1cdbd2cSJim Jagielski for(sal_Int32 i = 0; i < svc.getLength(); ++i )
351*b1cdbd2cSJim Jagielski if(svc[i] == aServiceName)
352*b1cdbd2cSJim Jagielski return true;
353*b1cdbd2cSJim Jagielski
354*b1cdbd2cSJim Jagielski return false;
355*b1cdbd2cSJim Jagielski }
356*b1cdbd2cSJim Jagielski
357*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------------
358*b1cdbd2cSJim Jagielski
getSupportedServiceNames(void)359*b1cdbd2cSJim Jagielski uno::Sequence<rtl::OUString> SAL_CALL LocaleBackend::getSupportedServiceNames(void)
360*b1cdbd2cSJim Jagielski throw (uno::RuntimeException)
361*b1cdbd2cSJim Jagielski {
362*b1cdbd2cSJim Jagielski return getBackendServiceNames() ;
363*b1cdbd2cSJim Jagielski }
364