1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
24 #include <com/sun/star/beans/NamedValue.hpp>
25 #include <com/sun/star/beans/Property.hpp>
26 #include <com/sun/star/beans/XProperty.hpp>
27 #include <com/sun/star/container/NoSuchElementException.hpp>
28 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
29 #include <com/sun/star/container/XNamed.hpp>
30 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/registry/InvalidRegistryException.hpp>
33 #include <com/sun/star/registry/InvalidValueException.hpp>
34 #include <com/sun/star/registry/MergeConflictException.hpp>
35 #include <com/sun/star/registry/RegistryKeyType.hpp>
36 #include <com/sun/star/registry/RegistryValueType.hpp>
37 #include <com/sun/star/registry/XRegistryKey.hpp>
38 #include <com/sun/star/registry/XSimpleRegistry.hpp>
39 #include <com/sun/star/uno/Any.hxx>
40 #include <com/sun/star/uno/DeploymentException.hpp>
41 #include <com/sun/star/uno/Exception.hpp>
42 #include <com/sun/star/uno/Reference.hxx>
43 #include <com/sun/star/uno/RuntimeException.hpp>
44 #include <com/sun/star/uno/Sequence.hxx>
45 #include <com/sun/star/uno/Type.hxx>
46 #include <com/sun/star/uno/TypeClass.hpp>
47 #include <com/sun/star/uno/XComponentContext.hpp>
48 #include <com/sun/star/uno/XInterface.hpp>
49 #include <com/sun/star/util/XFlushable.hpp>
50 #include <cppu/unotype.hxx>
51 #include <cppuhelper/implbase1.hxx>
52 #include <cppuhelper/implbase3.hxx>
53 #include <cppuhelper/supportsservice.hxx>
54 #include <cppuhelper/weak.hxx>
55 #include <osl/mutex.hxx>
56 #include <rtl/ustring.h>
57 #include <rtl/ustring.hxx>
58 #include <sal/types.h>
60 #include "configurationregistry.hxx"
62 namespace com
{ namespace sun
{ namespace star
{ namespace util
{
66 namespace configmgr
{ namespace configuration_registry
{
71 public cppu::WeakImplHelper3
<
72 css::lang::XServiceInfo
, css::registry::XSimpleRegistry
,
73 css::util::XFlushable
>
76 Service(css::uno::Reference
< css::uno::XComponentContext
> const & context
);
79 Service(const Service
&) SAL_DELETED_FUNCTION
;
80 Service
& operator=(const Service
&) SAL_DELETED_FUNCTION
;
84 virtual OUString SAL_CALL
getImplementationName()
85 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
86 { return configuration_registry::getImplementationName(); }
88 virtual sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
)
89 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
90 { return cppu::supportsService(this, ServiceName
); }
92 virtual css::uno::Sequence
< OUString
> SAL_CALL
93 getSupportedServiceNames() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
94 { return configuration_registry::getSupportedServiceNames(); }
96 virtual OUString SAL_CALL
getURL() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 virtual void SAL_CALL
open(
99 OUString
const & rURL
, sal_Bool bReadOnly
, sal_Bool
)
101 css::registry::InvalidRegistryException
,
102 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
104 virtual sal_Bool SAL_CALL
isValid() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
106 virtual void SAL_CALL
close()
108 css::registry::InvalidRegistryException
,
109 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual void SAL_CALL
destroy()
113 css::registry::InvalidRegistryException
,
114 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
116 virtual css::uno::Reference
< css::registry::XRegistryKey
> SAL_CALL
119 css::registry::InvalidRegistryException
,
120 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
122 virtual sal_Bool SAL_CALL
isReadOnly() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual void SAL_CALL
mergeKey(OUString
const &, OUString
const &)
126 css::registry::InvalidRegistryException
,
127 css::registry::MergeConflictException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 virtual void SAL_CALL
flush() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
131 virtual void SAL_CALL
addFlushListener(
132 css::uno::Reference
< css::util::XFlushListener
> const &)
133 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
135 virtual void SAL_CALL
removeFlushListener(
136 css::uno::Reference
< css::util::XFlushListener
> const &)
137 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 void checkValid_RuntimeException();
145 css::uno::Reference
< css::lang::XMultiServiceFactory
> provider_
;
147 css::uno::Reference
< css::uno::XInterface
> access_
;
151 friend class RegistryKey
;
155 public cppu::WeakImplHelper1
< css::registry::XRegistryKey
>
158 RegistryKey(Service
& service
, css::uno::Any
const & value
):
159 service_(service
), value_(value
) {}
162 RegistryKey(const RegistryKey
&) SAL_DELETED_FUNCTION
;
163 RegistryKey
& operator=(const RegistryKey
&) SAL_DELETED_FUNCTION
;
165 virtual ~RegistryKey() {}
167 virtual OUString SAL_CALL
getKeyName()
168 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
170 virtual sal_Bool SAL_CALL
isReadOnly()
172 css::registry::InvalidRegistryException
,
173 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
175 virtual sal_Bool SAL_CALL
isValid() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
177 virtual css::registry::RegistryKeyType SAL_CALL
getKeyType(
180 css::registry::InvalidRegistryException
,
181 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
183 virtual css::registry::RegistryValueType SAL_CALL
getValueType()
185 css::registry::InvalidRegistryException
,
186 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
188 virtual sal_Int32 SAL_CALL
getLongValue()
190 css::registry::InvalidRegistryException
,
191 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
193 virtual void SAL_CALL
setLongValue(sal_Int32
)
195 css::registry::InvalidRegistryException
,
196 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
198 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
getLongListValue()
200 css::registry::InvalidRegistryException
,
201 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
203 virtual void SAL_CALL
setLongListValue(
204 css::uno::Sequence
< sal_Int32
> const &)
206 css::registry::InvalidRegistryException
,
207 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
209 virtual OUString SAL_CALL
getAsciiValue()
211 css::registry::InvalidRegistryException
,
212 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
214 virtual void SAL_CALL
setAsciiValue(OUString
const &)
216 css::registry::InvalidRegistryException
,
217 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
219 virtual css::uno::Sequence
< OUString
> SAL_CALL
getAsciiListValue()
221 css::registry::InvalidRegistryException
,
222 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
224 virtual void SAL_CALL
setAsciiListValue(
225 css::uno::Sequence
< OUString
> const &)
227 css::registry::InvalidRegistryException
,
228 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
230 virtual OUString SAL_CALL
getStringValue()
232 css::registry::InvalidRegistryException
,
233 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
235 virtual void SAL_CALL
setStringValue(OUString
const &)
237 css::registry::InvalidRegistryException
,
238 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
240 virtual css::uno::Sequence
< OUString
> SAL_CALL
getStringListValue()
242 css::registry::InvalidRegistryException
,
243 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
245 virtual void SAL_CALL
setStringListValue(
246 css::uno::Sequence
< OUString
> const &)
248 css::registry::InvalidRegistryException
,
249 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
251 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getBinaryValue()
253 css::registry::InvalidRegistryException
,
254 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
256 virtual void SAL_CALL
setBinaryValue(css::uno::Sequence
< sal_Int8
> const &)
258 css::registry::InvalidRegistryException
,
259 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
261 virtual css::uno::Reference
< css::registry::XRegistryKey
> SAL_CALL
openKey(
262 OUString
const & aKeyName
)
264 css::registry::InvalidRegistryException
,
265 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
267 virtual css::uno::Reference
< css::registry::XRegistryKey
> SAL_CALL
268 createKey(OUString
const &)
270 css::registry::InvalidRegistryException
,
271 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
273 virtual void SAL_CALL
closeKey()
275 css::registry::InvalidRegistryException
,
276 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
278 virtual void SAL_CALL
deleteKey(OUString
const &)
280 css::registry::InvalidRegistryException
,
281 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
284 css::uno::Sequence
< css::uno::Reference
< css::registry::XRegistryKey
> >
287 css::registry::InvalidRegistryException
,
288 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
290 virtual css::uno::Sequence
< OUString
> SAL_CALL
getKeyNames()
292 css::registry::InvalidRegistryException
,
293 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
295 virtual sal_Bool SAL_CALL
createLink(
296 OUString
const &, OUString
const &)
298 css::registry::InvalidRegistryException
,
299 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
301 virtual void SAL_CALL
deleteLink(OUString
const &)
303 css::registry::InvalidRegistryException
,
304 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
306 virtual OUString SAL_CALL
getLinkTarget(OUString
const &)
308 css::registry::InvalidRegistryException
,
309 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
311 virtual OUString SAL_CALL
getResolvedName(
312 OUString
const & aKeyName
)
314 css::registry::InvalidRegistryException
,
315 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
318 css::uno::Any value_
;
322 css::uno::Reference
< css::uno::XComponentContext
> const & context
)
325 assert(context
.is());
327 provider_
= css::uno::Reference
< css::lang::XMultiServiceFactory
>(
328 context
->getServiceManager()->createInstanceWithContext(
329 "com.sun.star.configuration.DefaultProvider", context
),
330 css::uno::UNO_QUERY_THROW
);
331 } catch (css::uno::RuntimeException
&) {
333 } catch (css::uno::Exception
& e
) {
334 throw css::uno::DeploymentException(
335 ("component context fails to supply service"
336 " com.sun.star.configuration.DefaultProvider of type"
337 " com.sun.star.lang.XMultiServiceFactory: " + e
.Message
),
342 OUString
Service::getURL() throw (css::uno::RuntimeException
, std::exception
) {
343 osl::MutexGuard
g(mutex_
);
344 checkValid_RuntimeException();
348 void Service::open(OUString
const & rURL
, sal_Bool bReadOnly
, sal_Bool
)
349 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
352 osl::MutexGuard
g(mutex_
);
356 css::uno::Sequence
< css::uno::Any
> args(1);
357 args
[0] <<= css::beans::NamedValue("nodepath", css::uno::makeAny(rURL
));
359 access_
= provider_
->createInstanceWithArguments(
361 ? OUString("com.sun.star.configuration.ConfigurationAccess")
363 "com.sun.star.configuration.ConfigurationUpdateAccess")),
365 } catch (css::uno::RuntimeException
&) {
367 } catch (css::uno::Exception
& e
) {
368 throw css::uno::RuntimeException(
369 ("com.sun.star.configuration.ConfigurationRegistry: open failed: " +
371 static_cast< cppu::OWeakObject
* >(this));
374 readOnly_
= bReadOnly
;
377 sal_Bool
Service::isValid() throw (css::uno::RuntimeException
, std::exception
) {
378 osl::MutexGuard
g(mutex_
);
382 void Service::close()
383 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
385 osl::MutexGuard
g(mutex_
);
390 void Service::destroy()
391 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
393 throw css::uno::RuntimeException(
394 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
395 static_cast< cppu::OWeakObject
* >(this));
398 css::uno::Reference
< css::registry::XRegistryKey
> Service::getRootKey()
399 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
401 osl::MutexGuard
g(mutex_
);
403 return new RegistryKey(*this, css::uno::makeAny(access_
));
406 sal_Bool
Service::isReadOnly() throw (css::uno::RuntimeException
, std::exception
) {
407 osl::MutexGuard
g(mutex_
);
408 checkValid_RuntimeException();
412 void Service::mergeKey(OUString
const &, OUString
const &)
414 css::registry::InvalidRegistryException
,
415 css::registry::MergeConflictException
, css::uno::RuntimeException
, std::exception
)
417 throw css::uno::RuntimeException(
418 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
419 static_cast< cppu::OWeakObject
* >(this));
422 void Service::flush() throw (css::uno::RuntimeException
, std::exception
)
424 throw css::uno::RuntimeException(
425 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
426 static_cast< cppu::OWeakObject
* >(this));
429 void Service::addFlushListener(
430 css::uno::Reference
< css::util::XFlushListener
> const &)
431 throw (css::uno::RuntimeException
, std::exception
)
433 throw css::uno::RuntimeException(
434 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
435 static_cast< cppu::OWeakObject
* >(this));
438 void Service::removeFlushListener(
439 css::uno::Reference
< css::util::XFlushListener
> const &)
440 throw (css::uno::RuntimeException
, std::exception
)
442 throw css::uno::RuntimeException(
443 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
444 static_cast< cppu::OWeakObject
* >(this));
447 void Service::checkValid() {
449 throw css::registry::InvalidRegistryException(
450 "com.sun.star.configuration.ConfigurationRegistry: not valid",
451 static_cast< cppu::OWeakObject
* >(this));
455 void Service::checkValid_RuntimeException() {
457 throw css::uno::RuntimeException(
458 "com.sun.star.configuration.ConfigurationRegistry: not valid",
459 static_cast< cppu::OWeakObject
* >(this));
463 void Service::doClose() {
467 OUString
RegistryKey::getKeyName() throw (css::uno::RuntimeException
, std::exception
) {
468 osl::MutexGuard
g(service_
.mutex_
);
469 service_
.checkValid_RuntimeException();
470 css::uno::Reference
< css::container::XNamed
> named
;
471 if (value_
>>= named
) {
472 return named
->getName();
474 throw css::uno::RuntimeException(
475 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
476 static_cast< cppu::OWeakObject
* >(this));
479 sal_Bool
RegistryKey::isReadOnly()
480 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
482 osl::MutexGuard
g(service_
.mutex_
);
483 service_
.checkValid_RuntimeException();
484 return service_
.readOnly_
; //TODO: read-only sub-nodes in update access?
487 sal_Bool
RegistryKey::isValid() throw (css::uno::RuntimeException
, std::exception
) {
488 return service_
.isValid();
491 css::registry::RegistryKeyType
RegistryKey::getKeyType(OUString
const &)
492 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
494 osl::MutexGuard
g(service_
.mutex_
);
495 service_
.checkValid();
496 return css::registry::RegistryKeyType_KEY
;
499 css::registry::RegistryValueType
RegistryKey::getValueType()
500 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
502 osl::MutexGuard
g(service_
.mutex_
);
503 service_
.checkValid();
504 css::uno::Type
t(value_
.getValueType());
505 switch (t
.getTypeClass()) {
506 case css::uno::TypeClass_LONG
:
507 return css::registry::RegistryValueType_LONG
;
508 case css::uno::TypeClass_STRING
:
509 return css::registry::RegistryValueType_STRING
;
510 case css::uno::TypeClass_SEQUENCE
:
511 if (t
== cppu::UnoType
< css::uno::Sequence
< sal_Int8
> >::get()) {
512 return css::registry::RegistryValueType_BINARY
;
513 } else if (t
== cppu::UnoType
< css::uno::Sequence
< sal_Int32
> >::get())
515 return css::registry::RegistryValueType_LONGLIST
;
517 cppu::UnoType
< css::uno::Sequence
< OUString
> >::get())
519 return css::registry::RegistryValueType_STRINGLIST
;
523 return css::registry::RegistryValueType_NOT_DEFINED
;
527 sal_Int32
RegistryKey::getLongValue()
529 css::registry::InvalidRegistryException
,
530 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
)
532 osl::MutexGuard
g(service_
.mutex_
);
533 service_
.checkValid();
538 throw css::registry::InvalidValueException(
539 "com.sun.star.configuration.ConfigurationRegistry",
540 static_cast< cppu::OWeakObject
* >(this));
543 void RegistryKey::setLongValue(sal_Int32
)
544 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
546 throw css::uno::RuntimeException(
547 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
548 static_cast< cppu::OWeakObject
* >(this));
551 css::uno::Sequence
< sal_Int32
> RegistryKey::getLongListValue()
553 css::registry::InvalidRegistryException
,
554 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
)
556 osl::MutexGuard
g(service_
.mutex_
);
557 service_
.checkValid();
558 css::uno::Sequence
< sal_Int32
> v
;
562 throw css::registry::InvalidValueException(
563 "com.sun.star.configuration.ConfigurationRegistry",
564 static_cast< cppu::OWeakObject
* >(this));
567 void RegistryKey::setLongListValue(css::uno::Sequence
< sal_Int32
> const &)
568 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
570 throw css::uno::RuntimeException(
571 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
572 static_cast< cppu::OWeakObject
* >(this));
575 OUString
RegistryKey::getAsciiValue()
577 css::registry::InvalidRegistryException
,
578 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
)
580 osl::MutexGuard
g(service_
.mutex_
);
581 service_
.checkValid();
586 throw css::registry::InvalidValueException(
587 "com.sun.star.configuration.ConfigurationRegistry",
588 static_cast< cppu::OWeakObject
* >(this));
591 void RegistryKey::setAsciiValue(OUString
const &)
592 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
594 throw css::uno::RuntimeException(
595 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
596 static_cast< cppu::OWeakObject
* >(this));
599 css::uno::Sequence
< OUString
> RegistryKey::getAsciiListValue()
601 css::registry::InvalidRegistryException
,
602 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
)
604 osl::MutexGuard
g(service_
.mutex_
);
605 service_
.checkValid();
606 css::uno::Sequence
< OUString
> v
;
610 throw css::registry::InvalidValueException(
611 "com.sun.star.configuration.ConfigurationRegistry",
612 static_cast< cppu::OWeakObject
* >(this));
615 void RegistryKey::setAsciiListValue(css::uno::Sequence
< OUString
> const &)
616 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
618 throw css::uno::RuntimeException(
619 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
620 static_cast< cppu::OWeakObject
* >(this));
623 OUString
RegistryKey::getStringValue()
625 css::registry::InvalidRegistryException
,
626 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
)
628 osl::MutexGuard
g(service_
.mutex_
);
629 service_
.checkValid();
634 throw css::registry::InvalidValueException(
635 "com.sun.star.configuration.ConfigurationRegistry",
636 static_cast< cppu::OWeakObject
* >(this));
639 void RegistryKey::setStringValue(OUString
const &)
640 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
642 throw css::uno::RuntimeException(
643 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
644 static_cast< cppu::OWeakObject
* >(this));
647 css::uno::Sequence
< OUString
> RegistryKey::getStringListValue()
649 css::registry::InvalidRegistryException
,
650 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
)
652 osl::MutexGuard
g(service_
.mutex_
);
653 service_
.checkValid();
654 css::uno::Sequence
< OUString
> v
;
658 throw css::registry::InvalidValueException(
659 "com.sun.star.configuration.ConfigurationRegistry",
660 static_cast< cppu::OWeakObject
* >(this));
663 void RegistryKey::setStringListValue(
664 css::uno::Sequence
< OUString
> const &)
665 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
667 throw css::uno::RuntimeException(
668 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
669 static_cast< cppu::OWeakObject
* >(this));
672 css::uno::Sequence
< sal_Int8
> RegistryKey::getBinaryValue()
674 css::registry::InvalidRegistryException
,
675 css::registry::InvalidValueException
, css::uno::RuntimeException
, std::exception
)
677 osl::MutexGuard
g(service_
.mutex_
);
678 service_
.checkValid();
679 css::uno::Sequence
< sal_Int8
> v
;
683 throw css::registry::InvalidValueException(
684 "com.sun.star.configuration.ConfigurationRegistry",
685 static_cast< cppu::OWeakObject
* >(this));
688 void RegistryKey::setBinaryValue(css::uno::Sequence
< sal_Int8
> const &)
689 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
691 throw css::uno::RuntimeException(
692 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
693 static_cast< cppu::OWeakObject
* >(this));
696 css::uno::Reference
< css::registry::XRegistryKey
> RegistryKey::openKey(
697 OUString
const & aKeyName
)
698 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
700 osl::MutexGuard
g(service_
.mutex_
);
701 service_
.checkValid_RuntimeException();
702 css::uno::Reference
< css::container::XHierarchicalNameAccess
> access
;
703 if (value_
>>= access
) {
705 return new RegistryKey(
706 service_
, access
->getByHierarchicalName(aKeyName
));
707 } catch (css::container::NoSuchElementException
&) {}
709 return css::uno::Reference
< css::registry::XRegistryKey
>();
712 css::uno::Reference
< css::registry::XRegistryKey
> RegistryKey::createKey(
715 css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
717 throw css::uno::RuntimeException(
718 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
719 static_cast< cppu::OWeakObject
* >(this));
722 void RegistryKey::closeKey()
724 css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
726 osl::MutexGuard
g(service_
.mutex_
);
727 service_
.checkValid_RuntimeException();
730 void RegistryKey::deleteKey(OUString
const &)
731 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
733 throw css::uno::RuntimeException(
734 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
735 static_cast< cppu::OWeakObject
* >(this));
738 css::uno::Sequence
< css::uno::Reference
< css::registry::XRegistryKey
> >
739 RegistryKey::openKeys()
740 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
742 throw css::uno::RuntimeException(
743 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
744 static_cast< cppu::OWeakObject
* >(this));
747 css::uno::Sequence
< OUString
> RegistryKey::getKeyNames()
748 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
750 throw css::uno::RuntimeException(
751 "com.sun.star.configuration.ConfigurationRegistry: not implemented",
752 static_cast< cppu::OWeakObject
* >(this));
755 sal_Bool
RegistryKey::createLink(OUString
const &, OUString
const &)
756 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
758 osl::MutexGuard
g(service_
.mutex_
);
759 service_
.checkValid_RuntimeException();
763 void RegistryKey::deleteLink(OUString
const &)
764 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
766 osl::MutexGuard
g(service_
.mutex_
);
767 service_
.checkValid_RuntimeException();
770 OUString
RegistryKey::getLinkTarget(OUString
const &)
771 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
773 osl::MutexGuard
g(service_
.mutex_
);
774 service_
.checkValid_RuntimeException();
778 OUString
RegistryKey::getResolvedName(OUString
const & aKeyName
)
779 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
, std::exception
)
781 osl::MutexGuard
g(service_
.mutex_
);
782 service_
.checkValid_RuntimeException();
788 css::uno::Reference
< css::uno::XInterface
> create(
789 css::uno::Reference
< css::uno::XComponentContext
> const & context
)
791 return static_cast< cppu::OWeakObject
* >(new Service(context
));
794 OUString
getImplementationName() {
795 return OUString("com.sun.star.comp.configuration.ConfigurationRegistry");
798 css::uno::Sequence
< OUString
> getSupportedServiceNames() {
799 OUString
name("com.sun.star.configuration.ConfigurationRegistry");
800 return css::uno::Sequence
< OUString
>(&name
, 1);
805 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */