Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include "sal/config.h"
21 : :
22 : : #include <cassert>
23 : : #include <vector>
24 : :
25 : : #include "boost/noncopyable.hpp"
26 : : #include "com/sun/star/beans/NamedValue.hpp"
27 : : #include "com/sun/star/beans/PropertyValue.hpp"
28 : : #include "com/sun/star/lang/EventObject.hpp"
29 : : #include "com/sun/star/lang/Locale.hpp"
30 : : #include "com/sun/star/lang/XLocalizable.hpp"
31 : : #include "com/sun/star/lang/XMultiServiceFactory.hpp"
32 : : #include "com/sun/star/lang/XServiceInfo.hpp"
33 : : #include "com/sun/star/lang/XSingleComponentFactory.hpp"
34 : : #include "com/sun/star/uno/Any.hxx"
35 : : #include "com/sun/star/uno/DeploymentException.hpp"
36 : : #include "com/sun/star/uno/Exception.hpp"
37 : : #include "com/sun/star/uno/Reference.hxx"
38 : : #include "com/sun/star/uno/RuntimeException.hpp"
39 : : #include "com/sun/star/uno/Sequence.hxx"
40 : : #include "com/sun/star/uno/XComponentContext.hpp"
41 : : #include "com/sun/star/uno/XInterface.hpp"
42 : : #include "com/sun/star/util/XFlushListener.hpp"
43 : : #include "com/sun/star/util/XFlushable.hpp"
44 : : #include "com/sun/star/util/XRefreshListener.hpp"
45 : : #include "com/sun/star/util/XRefreshable.hpp"
46 : : #include "comphelper/locale.hxx"
47 : : #include "cppu/unotype.hxx"
48 : : #include "cppuhelper/compbase5.hxx"
49 : : #include "cppuhelper/factory.hxx"
50 : : #include "cppuhelper/implbase2.hxx"
51 : : #include "cppuhelper/interfacecontainer.hxx"
52 : : #include "cppuhelper/weak.hxx"
53 : : #include "osl/mutex.hxx"
54 : : #include "sal/types.h"
55 : : #include "rtl/ref.hxx"
56 : : #include "rtl/unload.h"
57 : : #include "rtl/ustring.h"
58 : : #include "rtl/ustring.hxx"
59 : :
60 : : #include "components.hxx"
61 : : #include "configurationprovider.hxx"
62 : : #include "lock.hxx"
63 : : #include "rootaccess.hxx"
64 : :
65 : : namespace configmgr { namespace configuration_provider {
66 : :
67 : : namespace {
68 : :
69 : : namespace css = com::sun::star;
70 : :
71 : : char const accessServiceName[] =
72 : : "com.sun.star.configuration.ConfigurationAccess";
73 : : char const updateAccessServiceName[] =
74 : : "com.sun.star.configuration.ConfigurationUpdateAccess";
75 : :
76 : 0 : void badNodePath() {
77 : : throw css::uno::Exception(
78 : : rtl::OUString(
79 : : RTL_CONSTASCII_USTRINGPARAM(
80 : : "com.sun.star.configuration.ConfigurationProvider expects a"
81 : : " single, non-empty, string nodepath argument")),
82 [ # # ][ # # ]: 0 : 0);
[ # # ]
83 : : }
84 : :
85 : : typedef
86 : : cppu::WeakComponentImplHelper5<
87 : : css::lang::XServiceInfo, css::lang::XMultiServiceFactory,
88 : : css::util::XRefreshable, css::util::XFlushable,
89 : : css::lang::XLocalizable >
90 : : ServiceBase;
91 : :
92 : : class Service:
93 : : private osl::Mutex, public ServiceBase, private boost::noncopyable
94 : : {
95 : : public:
96 : 270 : Service(
97 : : css::uno::Reference< css::uno::XComponentContext > const context,
98 : : rtl::OUString const & locale):
99 : : ServiceBase(*static_cast< osl::Mutex * >(this)), context_(context),
100 [ + - ]: 270 : locale_(locale)
101 : : {
102 [ + - ][ + - ]: 270 : lock_ = lock();
[ + - ]
103 : : assert(context.is());
104 : 270 : }
105 : :
106 : : private:
107 [ + - ][ + - ]: 486 : virtual ~Service() {}
[ - + ]
108 : :
109 : 270 : virtual void SAL_CALL disposing() { flushModifications(); }
110 : :
111 : 0 : virtual rtl::OUString SAL_CALL getImplementationName()
112 : : throw (css::uno::RuntimeException)
113 : 0 : { return configuration_provider::getImplementationName(); }
114 : :
115 : 0 : virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
116 : : throw (css::uno::RuntimeException)
117 [ # # ]: 0 : { return ServiceName == getSupportedServiceNames()[0]; } //TODO
118 : :
119 : : virtual css::uno::Sequence< rtl::OUString > SAL_CALL
120 : 0 : getSupportedServiceNames() throw (css::uno::RuntimeException)
121 : 0 : { return configuration_provider::getSupportedServiceNames(); }
122 : :
123 : : virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
124 : : rtl::OUString const & aServiceSpecifier)
125 : : throw (css::uno::Exception, css::uno::RuntimeException);
126 : :
127 : : virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
128 : : createInstanceWithArguments(
129 : : rtl::OUString const & ServiceSpecifier,
130 : : css::uno::Sequence< css::uno::Any > const & Arguments)
131 : : throw (css::uno::Exception, css::uno::RuntimeException);
132 : :
133 : : virtual css::uno::Sequence< rtl::OUString > SAL_CALL
134 : : getAvailableServiceNames() throw (css::uno::RuntimeException);
135 : :
136 : : virtual void SAL_CALL refresh() throw (css::uno::RuntimeException);
137 : :
138 : : virtual void SAL_CALL addRefreshListener(
139 : : css::uno::Reference< css::util::XRefreshListener > const & l)
140 : : throw (css::uno::RuntimeException);
141 : :
142 : : virtual void SAL_CALL removeRefreshListener(
143 : : css::uno::Reference< css::util::XRefreshListener > const & l)
144 : : throw (css::uno::RuntimeException);
145 : :
146 : : virtual void SAL_CALL flush() throw (css::uno::RuntimeException);
147 : :
148 : : virtual void SAL_CALL addFlushListener(
149 : : css::uno::Reference< css::util::XFlushListener > const & l)
150 : : throw (css::uno::RuntimeException);
151 : :
152 : : virtual void SAL_CALL removeFlushListener(
153 : : css::uno::Reference< css::util::XFlushListener > const & l)
154 : : throw (css::uno::RuntimeException);
155 : :
156 : : virtual void SAL_CALL setLocale(css::lang::Locale const & eLocale)
157 : : throw (css::uno::RuntimeException);
158 : :
159 : : virtual css::lang::Locale SAL_CALL getLocale()
160 : : throw (css::uno::RuntimeException);
161 : :
162 : : void flushModifications() const;
163 : :
164 : : css::uno::Reference< css::uno::XComponentContext > context_;
165 : : rtl::OUString locale_;
166 : : boost::shared_ptr<osl::Mutex> lock_;
167 : : };
168 : :
169 : 0 : css::uno::Reference< css::uno::XInterface > Service::createInstance(
170 : : rtl::OUString const & aServiceSpecifier)
171 : : throw (css::uno::Exception, css::uno::RuntimeException)
172 : : {
173 : : return createInstanceWithArguments(
174 [ # # ]: 0 : aServiceSpecifier, css::uno::Sequence< css::uno::Any >());
175 : : }
176 : :
177 : : css::uno::Reference< css::uno::XInterface >
178 : 100264 : Service::createInstanceWithArguments(
179 : : rtl::OUString const & ServiceSpecifier,
180 : : css::uno::Sequence< css::uno::Any > const & Arguments)
181 : : throw (css::uno::Exception, css::uno::RuntimeException)
182 : : {
183 : 100264 : rtl::OUString nodepath;
184 : 100264 : rtl::OUString locale;
185 [ + + ]: 224902 : for (sal_Int32 i = 0; i < Arguments.getLength(); ++i) {
186 : 124638 : css::beans::NamedValue v1;
187 : 124638 : css::beans::PropertyValue v2;
188 : 124638 : rtl::OUString name;
189 : 124638 : css::uno::Any value;
190 [ + + ][ + - ]: 124638 : if (Arguments[i] >>= v1) {
191 : 64163 : name = v1.Name;
192 : 64163 : value = v1.Value;
193 [ + - ][ + + ]: 60475 : } else if (Arguments[i] >>= v2) {
194 : 58862 : name = v2.Name;
195 : 58862 : value = v2.Value;
196 [ + - ][ + - ]: 1613 : } else if (Arguments.getLength() == 1 && (Arguments[i] >>= nodepath)) {
[ + - ]
197 : : // For backwards compatibility, allow a single string argument that
198 : : // denotes nodepath.
199 [ - + ]: 1613 : if (nodepath.isEmpty()) {
200 [ # # ]: 1613 : badNodePath();
201 : : }
202 : : break;
203 : : } else {
204 : : throw css::uno::Exception(
205 : : rtl::OUString(
206 : : RTL_CONSTASCII_USTRINGPARAM(
207 : : "com.sun.star.configuration.ConfigurationProvider"
208 : : " expects NamedValue or PropertyValue arguments")),
209 [ # # ][ # # ]: 0 : 0);
[ # # ]
210 : : }
211 : : // For backwards compatibility, allow "nodepath" and "Locale" in any
212 : : // case:
213 [ + + ]: 123025 : if (name.equalsIgnoreAsciiCaseAsciiL(
214 : 123025 : RTL_CONSTASCII_STRINGPARAM("nodepath")))
215 : : {
216 [ + - ]: 197302 : if (!nodepath.isEmpty() || !(value >>= nodepath) ||
[ + - - + ]
[ - + ]
217 : 98651 : nodepath.isEmpty())
218 : : {
219 [ # # ]: 0 : badNodePath();
220 : : }
221 [ + + ]: 24374 : } else if (name.equalsIgnoreAsciiCaseAsciiL(
222 : 24374 : RTL_CONSTASCII_STRINGPARAM("locale")))
223 : : {
224 [ + - ]: 6340 : if (!locale.isEmpty() || !(value >>= locale) ||
[ + - - + ]
[ - + ]
225 : 3170 : locale.isEmpty())
226 : : {
227 : : throw css::uno::Exception(
228 : : rtl::OUString(
229 : : RTL_CONSTASCII_USTRINGPARAM(
230 : : "com.sun.star.configuration.ConfigurationProvider"
231 : : " expects at most one, non-empty, string Locale"
232 : : " argument")),
233 [ # # ][ # # ]: 123025 : 0);
[ # # ]
234 : : }
235 : : }
236 [ + + ][ + + ]: 124638 : }
[ + + ][ + + ]
237 [ - + ]: 100264 : if (nodepath.isEmpty()) {
238 [ # # ]: 0 : badNodePath();
239 : : }
240 : : // For backwards compatibility, allow a nodepath that misses the leading
241 : : // slash:
242 [ + + ]: 100264 : if (nodepath[0] != '/') {
243 [ + - ]: 23047 : nodepath = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + nodepath;
244 : : }
245 [ + + ]: 100264 : if (locale.isEmpty()) {
246 : : //TODO: should the Access use the dynamically changing locale_ instead?
247 : 97094 : locale = locale_;
248 [ + + ]: 97094 : if (locale.isEmpty()) {
249 [ + - ]: 25325 : locale = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US"));
250 : : }
251 : : }
252 : : bool update;
253 [ + + ]: 100264 : if ( ServiceSpecifier == accessServiceName )
254 : : {
255 : 68281 : update = false;
256 [ + - ]: 31983 : } else if ( ServiceSpecifier == updateAccessServiceName )
257 : : {
258 : 31983 : update = true;
259 : : } else {
260 : : throw css::uno::Exception(
261 : : (rtl::OUString(
262 : : RTL_CONSTASCII_USTRINGPARAM(
263 : : "com.sun.star.configuration.ConfigurationProvider does not"
264 : : " support service ")) +
265 : : ServiceSpecifier),
266 [ # # ][ # # ]: 0 : static_cast< cppu::OWeakObject * >(this));
[ # # ]
267 : : }
268 [ + - ]: 100264 : osl::MutexGuard guard(*lock_);
269 [ + - ]: 100264 : Components & components = Components::getSingleton(context_);
270 : : rtl::Reference< RootAccess > root(
271 [ + - ]: 100264 : new RootAccess(components, nodepath, locale, update));
272 [ - + ][ + - ]: 100264 : if (root->isValue()) {
273 : : throw css::uno::Exception(
274 : : (rtl::OUString(
275 : : RTL_CONSTASCII_USTRINGPARAM(
276 : : "com.sun.star.configuration.ConfigurationProvider: there is"
277 : : " a leaf value at nodepath ")) +
278 : : nodepath),
279 [ # # ][ # # ]: 0 : static_cast< cppu::OWeakObject * >(this));
[ # # ]
280 : : }
281 [ + - ]: 100264 : components.addRootAccess(root);
282 [ + - ][ + - ]: 100264 : return static_cast< cppu::OWeakObject * >(root.get());
283 : : }
284 : :
285 : 4 : css::uno::Sequence< rtl::OUString > Service::getAvailableServiceNames()
286 : : throw (css::uno::RuntimeException)
287 : : {
288 : 4 : css::uno::Sequence< rtl::OUString > names(2);
289 [ + - ][ + - ]: 4 : names[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(accessServiceName));
290 [ + - ]: 4 : names[1] = rtl::OUString(
291 [ + - ]: 8 : RTL_CONSTASCII_USTRINGPARAM(updateAccessServiceName));
292 : 4 : return names;
293 : : }
294 : :
295 : 4 : void Service::refresh() throw (css::uno::RuntimeException) {
296 : : //TODO
297 : : cppu::OInterfaceContainerHelper * cont = rBHelper.getContainer(
298 : 4 : cppu::UnoType< css::util::XRefreshListener >::get());
299 [ + - ]: 4 : if (cont != 0) {
300 [ + - ][ + - ]: 4 : css::lang::EventObject ev(static_cast< cppu::OWeakObject * >(this));
301 [ + - ][ + - ]: 4 : cont->notifyEach(&css::util::XRefreshListener::refreshed, ev);
302 : : }
303 : 4 : }
304 : :
305 : 2 : void Service::addRefreshListener(
306 : : css::uno::Reference< css::util::XRefreshListener > const & l)
307 : : throw (css::uno::RuntimeException)
308 : : {
309 : : rBHelper.addListener(
310 : 2 : cppu::UnoType< css::util::XRefreshListener >::get(), l);
311 : 2 : }
312 : :
313 : 2 : void Service::removeRefreshListener(
314 : : css::uno::Reference< css::util::XRefreshListener > const & l)
315 : : throw (css::uno::RuntimeException)
316 : : {
317 : : rBHelper.removeListener(
318 : 2 : cppu::UnoType< css::util::XRefreshListener >::get(), l);
319 : 2 : }
320 : :
321 : 318 : void Service::flush() throw (css::uno::RuntimeException) {
322 : 318 : flushModifications();
323 : : cppu::OInterfaceContainerHelper * cont = rBHelper.getContainer(
324 : 318 : cppu::UnoType< css::util::XFlushListener >::get());
325 [ + + ]: 318 : if (cont != 0) {
326 [ + - ][ + - ]: 2 : css::lang::EventObject ev(static_cast< cppu::OWeakObject * >(this));
327 [ + - ][ + - ]: 2 : cont->notifyEach(&css::util::XFlushListener::flushed, ev);
328 : : }
329 : 318 : }
330 : :
331 : 4 : void Service::addFlushListener(
332 : : css::uno::Reference< css::util::XFlushListener > const & l)
333 : : throw (css::uno::RuntimeException)
334 : : {
335 : 4 : rBHelper.addListener(cppu::UnoType< css::util::XFlushListener >::get(), l);
336 : 4 : }
337 : :
338 : 2 : void Service::removeFlushListener(
339 : : css::uno::Reference< css::util::XFlushListener > const & l)
340 : : throw (css::uno::RuntimeException)
341 : : {
342 : : rBHelper.removeListener(
343 : 2 : cppu::UnoType< css::util::XFlushListener >::get(), l);
344 : 2 : }
345 : :
346 : 320 : void Service::setLocale(css::lang::Locale const & eLocale)
347 : : throw (css::uno::RuntimeException)
348 : : {
349 [ + - ]: 320 : osl::MutexGuard guard(*lock_);
350 : : locale_ = comphelper::Locale(
351 [ + - ][ + - ]: 320 : eLocale.Language, eLocale.Country, eLocale.Variant).toISO();
[ + - ][ + - ]
352 : 320 : }
353 : :
354 : 4820 : css::lang::Locale Service::getLocale() throw (css::uno::RuntimeException) {
355 [ + - ]: 4820 : osl::MutexGuard guard(*lock_);
356 : 4820 : css::lang::Locale loc;
357 [ + + ]: 4820 : if ( locale_ == "*" ) {
358 : 2 : loc.Language = locale_;
359 [ + + ]: 4818 : } else if (! locale_.isEmpty()) {
360 : : try {
361 [ + - ]: 2776 : comphelper::Locale l(locale_);
362 [ + - ]: 2776 : loc.Language = l.getLanguage();
363 [ + - ]: 2776 : loc.Country = l.getCountry();
364 [ + - ][ + - ]: 2776 : loc.Variant = l.getVariant();
365 [ # # ]: 0 : } catch (comphelper::Locale::MalFormedLocaleException & e) {
366 : : throw css::uno::RuntimeException(
367 : : (rtl::OUString(
368 : : RTL_CONSTASCII_USTRINGPARAM("MalformedLocaleException: ")) +
369 : : e.Message),
370 [ # # # # : 0 : static_cast< cppu::OWeakObject * >(this));
# # ]
371 : : }
372 : : }
373 [ + - ]: 4820 : return loc;
374 : : }
375 : :
376 : 588 : void Service::flushModifications() const {
377 : : Components * components;
378 : : {
379 [ + - ]: 588 : osl::MutexGuard guard(*lock_);
380 [ + - ][ + - ]: 588 : components = &Components::getSingleton(context_);
381 : : }
382 : 588 : components->flushModifications();
383 : 588 : }
384 : :
385 : : class Factory:
386 : : public cppu::WeakImplHelper2<
387 : : css::lang::XSingleComponentFactory, css::lang::XServiceInfo >,
388 : : private boost::noncopyable
389 : : {
390 : : public:
391 : 271 : Factory() {}
392 : :
393 : : private:
394 [ - + ]: 542 : virtual ~Factory() {}
395 : :
396 : : virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
397 : : createInstanceWithContext(
398 : : css::uno::Reference< css::uno::XComponentContext > const & Context)
399 : : throw (css::uno::Exception, css::uno::RuntimeException);
400 : :
401 : : virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
402 : : createInstanceWithArgumentsAndContext(
403 : : css::uno::Sequence< css::uno::Any > const & Arguments,
404 : : css::uno::Reference< css::uno::XComponentContext > const & Context)
405 : : throw (css::uno::Exception, css::uno::RuntimeException);
406 : :
407 : 0 : virtual rtl::OUString SAL_CALL getImplementationName()
408 : : throw (css::uno::RuntimeException)
409 : 0 : { return configuration_provider::getImplementationName(); }
410 : :
411 : 0 : virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
412 : : throw (css::uno::RuntimeException)
413 [ # # ]: 0 : { return ServiceName == getSupportedServiceNames()[0]; } //TODO
414 : :
415 : : virtual css::uno::Sequence< rtl::OUString > SAL_CALL
416 : 0 : getSupportedServiceNames() throw (css::uno::RuntimeException)
417 : 0 : { return configuration_provider::getSupportedServiceNames(); }
418 : : };
419 : :
420 : 77965 : css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
421 : : css::uno::Reference< css::uno::XComponentContext > const & Context)
422 : : throw (css::uno::Exception, css::uno::RuntimeException)
423 : : {
424 : : return createInstanceWithArgumentsAndContext(
425 [ + - ]: 77965 : css::uno::Sequence< css::uno::Any >(), Context);
426 : : }
427 : :
428 : : css::uno::Reference< css::uno::XInterface >
429 : 77967 : Factory::createInstanceWithArgumentsAndContext(
430 : : css::uno::Sequence< css::uno::Any > const & Arguments,
431 : : css::uno::Reference< css::uno::XComponentContext > const & Context)
432 : : throw (css::uno::Exception, css::uno::RuntimeException)
433 : : {
434 [ + + ]: 77967 : if (Arguments.getLength() == 0) {
435 : 77965 : css::uno::Reference< css::uno::XInterface > instance;
436 [ + - - + ]: 311860 : if (!(Context->getValueByName(
[ - + ][ + - ]
437 : : rtl::OUString(
438 : : RTL_CONSTASCII_USTRINGPARAM(
439 : : "/singletons/"
440 : 77965 : "com.sun.star.configuration.theDefaultProvider")))
441 [ + - ][ + - ]: 155930 : >>= instance) ||
[ + - ][ + - ]
[ + - ]
[ # # # # ]
442 : 77965 : !instance.is())
443 : : {
444 : : throw css::uno::DeploymentException(
445 : : rtl::OUString(
446 : : RTL_CONSTASCII_USTRINGPARAM(
447 : : "component context fails to supply singleton"
448 : : " com.sun.star.configuration.theDefaultProvider")),
449 [ # # ][ # # ]: 0 : Context);
450 : : }
451 : 77965 : return instance;
452 : : } else {
453 : 2 : rtl::OUString locale;
454 [ + + ]: 4 : for (sal_Int32 i = 0; i < Arguments.getLength(); ++i) {
455 : 2 : css::beans::NamedValue v1;
456 : 2 : css::beans::PropertyValue v2;
457 : 2 : rtl::OUString name;
458 : 2 : css::uno::Any value;
459 [ + - ][ + - ]: 2 : if (Arguments[i] >>= v1) {
460 : 2 : name = v1.Name;
461 : 2 : value = v1.Value;
462 [ # # ][ # # ]: 0 : } else if (Arguments[i] >>= v2) {
463 : 0 : name = v2.Name;
464 : 0 : value = v2.Value;
465 : : } else {
466 : : throw css::uno::Exception(
467 : : rtl::OUString(
468 : : RTL_CONSTASCII_USTRINGPARAM(
469 : : "com.sun.star.configuration.ConfigurationProvider"
470 : : " factory expects NamedValue or PropertyValue"
471 : : " arguments")),
472 [ # # ][ # # ]: 0 : 0);
[ # # ]
473 : : }
474 : : // For backwards compatibility, allow "Locale" and (ignored)
475 : : // "EnableAsync" in any case:
476 [ + - ]: 2 : if (name.equalsIgnoreAsciiCaseAsciiL(
477 : 2 : RTL_CONSTASCII_STRINGPARAM("locale")))
478 : : {
479 [ + - ]: 4 : if (!locale.isEmpty() || !(value >>= locale) ||
[ + - - + ]
[ - + ]
480 : 2 : locale.isEmpty())
481 : : {
482 : : throw css::uno::Exception(
483 : : rtl::OUString(
484 : : RTL_CONSTASCII_USTRINGPARAM(
485 : : "com.sun.star.configuration."
486 : : "ConfigurationProvider factory expects at most"
487 : : " one, non-empty, string Locale argument")),
488 [ # # ][ # # ]: 0 : 0);
[ # # ]
489 : : }
490 [ # # ]: 0 : } else if (!name.equalsIgnoreAsciiCaseAsciiL(
491 : 0 : RTL_CONSTASCII_STRINGPARAM("enableasync")))
492 : : {
493 : : throw css::uno::Exception(
494 : : rtl::OUString(
495 : : RTL_CONSTASCII_USTRINGPARAM(
496 : : "com.sun.star.configuration.ConfigurationProvider"
497 : : " factory: unknown argument ")) + name,
498 [ # # ][ # # ]: 0 : 0);
[ # # ]
499 : : }
500 : 2 : }
501 [ + - ][ + - ]: 77967 : return static_cast< cppu::OWeakObject * >(new Service(Context, locale));
502 : : }
503 : : }
504 : :
505 : : }
506 : :
507 : 268 : css::uno::Reference< css::uno::XInterface > createDefault(
508 : : css::uno::Reference< css::uno::XComponentContext > const & context)
509 : : {
510 : : return static_cast< cppu::OWeakObject * >(
511 [ + - ][ + - ]: 268 : new Service(context, rtl::OUString()));
512 : : }
513 : :
514 : 954 : rtl::OUString getImplementationName() {
515 : : return rtl::OUString(
516 : : RTL_CONSTASCII_USTRINGPARAM(
517 : 954 : "com.sun.star.comp.configuration.ConfigurationProvider"));
518 : : }
519 : :
520 : 271 : css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
521 : : rtl::OUString name(
522 : : RTL_CONSTASCII_USTRINGPARAM(
523 [ + - ]: 271 : "com.sun.star.configuration.ConfigurationProvider"));
524 [ + - ]: 271 : return css::uno::Sequence< rtl::OUString >(&name, 1);
525 : : }
526 : :
527 : : css::uno::Reference< css::lang::XSingleComponentFactory >
528 : 271 : createFactory(
529 : : SAL_UNUSED_PARAMETER cppu::ComponentFactoryFunc,
530 : : SAL_UNUSED_PARAMETER rtl::OUString const &,
531 : : SAL_UNUSED_PARAMETER css::uno::Sequence< rtl::OUString > const &,
532 : : SAL_UNUSED_PARAMETER rtl_ModuleCount *)
533 : : SAL_THROW(())
534 : : {
535 [ + - ][ + - ]: 271 : return new Factory;
536 : : }
537 : :
538 : : } }
539 : :
540 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|