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 "boost/noncopyable.hpp"
25 #include "com/sun/star/beans/NamedValue.hpp"
26 #include "com/sun/star/beans/Property.hpp"
27 #include "com/sun/star/beans/XProperty.hpp"
28 #include "com/sun/star/container/NoSuchElementException.hpp"
29 #include "com/sun/star/container/XHierarchicalNameAccess.hpp"
30 #include "com/sun/star/container/XNamed.hpp"
31 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
32 #include "com/sun/star/lang/XServiceInfo.hpp"
33 #include "com/sun/star/registry/InvalidRegistryException.hpp"
34 #include "com/sun/star/registry/InvalidValueException.hpp"
35 #include "com/sun/star/registry/MergeConflictException.hpp"
36 #include "com/sun/star/registry/RegistryKeyType.hpp"
37 #include "com/sun/star/registry/RegistryValueType.hpp"
38 #include "com/sun/star/registry/XRegistryKey.hpp"
39 #include "com/sun/star/registry/XSimpleRegistry.hpp"
40 #include "com/sun/star/uno/Any.hxx"
41 #include "com/sun/star/uno/DeploymentException.hpp"
42 #include "com/sun/star/uno/Exception.hpp"
43 #include "com/sun/star/uno/Reference.hxx"
44 #include "com/sun/star/uno/RuntimeException.hpp"
45 #include "com/sun/star/uno/Sequence.hxx"
46 #include "com/sun/star/uno/Type.hxx"
47 #include "com/sun/star/uno/TypeClass.hpp"
48 #include "com/sun/star/uno/XComponentContext.hpp"
49 #include "com/sun/star/uno/XInterface.hpp"
50 #include "com/sun/star/util/XFlushable.hpp"
51 #include "cppu/unotype.hxx"
52 #include "cppuhelper/implbase1.hxx"
53 #include "cppuhelper/implbase3.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
>,
74 private boost::noncopyable
77 Service(css::uno::Reference
< css::uno::XComponentContext
> const & context
);
82 virtual rtl::OUString SAL_CALL
getImplementationName()
83 throw (css::uno::RuntimeException
)
84 { return configuration_registry::getImplementationName(); }
86 virtual sal_Bool SAL_CALL
supportsService(rtl::OUString
const & ServiceName
)
87 throw (css::uno::RuntimeException
)
88 { return ServiceName
== getSupportedServiceNames()[0]; } //TODO
90 virtual css::uno::Sequence
< rtl::OUString
> SAL_CALL
91 getSupportedServiceNames() throw (css::uno::RuntimeException
)
92 { return configuration_registry::getSupportedServiceNames(); }
94 virtual rtl::OUString SAL_CALL
getURL() throw (css::uno::RuntimeException
);
96 virtual void SAL_CALL
open(
97 rtl::OUString
const & rURL
, sal_Bool bReadOnly
, sal_Bool
)
99 css::registry::InvalidRegistryException
,
100 css::uno::RuntimeException
);
102 virtual sal_Bool SAL_CALL
isValid() throw (css::uno::RuntimeException
);
104 virtual void SAL_CALL
close()
106 css::registry::InvalidRegistryException
,
107 css::uno::RuntimeException
);
109 virtual void SAL_CALL
destroy()
111 css::registry::InvalidRegistryException
,
112 css::uno::RuntimeException
);
114 virtual css::uno::Reference
< css::registry::XRegistryKey
> SAL_CALL
117 css::registry::InvalidRegistryException
,
118 css::uno::RuntimeException
);
120 virtual sal_Bool SAL_CALL
isReadOnly() throw (css::uno::RuntimeException
);
122 virtual void SAL_CALL
mergeKey(rtl::OUString
const &, rtl::OUString
const &)
124 css::registry::InvalidRegistryException
,
125 css::registry::MergeConflictException
, css::uno::RuntimeException
);
127 virtual void SAL_CALL
flush() throw (css::uno::RuntimeException
);
129 virtual void SAL_CALL
addFlushListener(
130 css::uno::Reference
< css::util::XFlushListener
> const &)
131 throw (css::uno::RuntimeException
);
133 virtual void SAL_CALL
removeFlushListener(
134 css::uno::Reference
< css::util::XFlushListener
> const &)
135 throw (css::uno::RuntimeException
);
139 void checkValid_RuntimeException();
143 css::uno::Reference
< css::lang::XMultiServiceFactory
> provider_
;
145 css::uno::Reference
< css::uno::XInterface
> access_
;
149 friend class RegistryKey
;
153 public cppu::WeakImplHelper1
< css::registry::XRegistryKey
>,
154 private boost::noncopyable
157 RegistryKey(Service
& service
, css::uno::Any
const & value
):
158 service_(service
), value_(value
) {}
161 virtual ~RegistryKey() {}
163 virtual rtl::OUString SAL_CALL
getKeyName()
164 throw (css::uno::RuntimeException
);
166 virtual sal_Bool SAL_CALL
isReadOnly()
168 css::registry::InvalidRegistryException
,
169 css::uno::RuntimeException
);
171 virtual sal_Bool SAL_CALL
isValid() throw (css::uno::RuntimeException
);
173 virtual css::registry::RegistryKeyType SAL_CALL
getKeyType(
174 rtl::OUString
const &)
176 css::registry::InvalidRegistryException
,
177 css::uno::RuntimeException
);
179 virtual css::registry::RegistryValueType SAL_CALL
getValueType()
181 css::registry::InvalidRegistryException
,
182 css::uno::RuntimeException
);
184 virtual sal_Int32 SAL_CALL
getLongValue()
186 css::registry::InvalidRegistryException
,
187 css::registry::InvalidValueException
, css::uno::RuntimeException
);
189 virtual void SAL_CALL
setLongValue(sal_Int32
)
191 css::registry::InvalidRegistryException
,
192 css::uno::RuntimeException
);
194 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
getLongListValue()
196 css::registry::InvalidRegistryException
,
197 css::registry::InvalidValueException
, css::uno::RuntimeException
);
199 virtual void SAL_CALL
setLongListValue(
200 css::uno::Sequence
< sal_Int32
> const &)
202 css::registry::InvalidRegistryException
,
203 css::uno::RuntimeException
);
205 virtual rtl::OUString SAL_CALL
getAsciiValue()
207 css::registry::InvalidRegistryException
,
208 css::registry::InvalidValueException
, css::uno::RuntimeException
);
210 virtual void SAL_CALL
setAsciiValue(rtl::OUString
const &)
212 css::registry::InvalidRegistryException
,
213 css::uno::RuntimeException
);
215 virtual css::uno::Sequence
< rtl::OUString
> SAL_CALL
getAsciiListValue()
217 css::registry::InvalidRegistryException
,
218 css::registry::InvalidValueException
, css::uno::RuntimeException
);
220 virtual void SAL_CALL
setAsciiListValue(
221 css::uno::Sequence
< rtl::OUString
> const &)
223 css::registry::InvalidRegistryException
,
224 css::uno::RuntimeException
);
226 virtual rtl::OUString SAL_CALL
getStringValue()
228 css::registry::InvalidRegistryException
,
229 css::registry::InvalidValueException
, css::uno::RuntimeException
);
231 virtual void SAL_CALL
setStringValue(rtl::OUString
const &)
233 css::registry::InvalidRegistryException
,
234 css::uno::RuntimeException
);
236 virtual css::uno::Sequence
< rtl::OUString
> SAL_CALL
getStringListValue()
238 css::registry::InvalidRegistryException
,
239 css::registry::InvalidValueException
, css::uno::RuntimeException
);
241 virtual void SAL_CALL
setStringListValue(
242 css::uno::Sequence
< rtl::OUString
> const &)
244 css::registry::InvalidRegistryException
,
245 css::uno::RuntimeException
);
247 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getBinaryValue()
249 css::registry::InvalidRegistryException
,
250 css::registry::InvalidValueException
, css::uno::RuntimeException
);
252 virtual void SAL_CALL
setBinaryValue(css::uno::Sequence
< sal_Int8
> const &)
254 css::registry::InvalidRegistryException
,
255 css::uno::RuntimeException
);
257 virtual css::uno::Reference
< css::registry::XRegistryKey
> SAL_CALL
openKey(
258 rtl::OUString
const & aKeyName
)
260 css::registry::InvalidRegistryException
,
261 css::uno::RuntimeException
);
263 virtual css::uno::Reference
< css::registry::XRegistryKey
> SAL_CALL
264 createKey(rtl::OUString
const &)
266 css::registry::InvalidRegistryException
,
267 css::uno::RuntimeException
);
269 virtual void SAL_CALL
closeKey()
271 css::registry::InvalidRegistryException
,
272 css::uno::RuntimeException
);
274 virtual void SAL_CALL
deleteKey(rtl::OUString
const &)
276 css::registry::InvalidRegistryException
,
277 css::uno::RuntimeException
);
280 css::uno::Sequence
< css::uno::Reference
< css::registry::XRegistryKey
> >
283 css::registry::InvalidRegistryException
,
284 css::uno::RuntimeException
);
286 virtual css::uno::Sequence
< rtl::OUString
> SAL_CALL
getKeyNames()
288 css::registry::InvalidRegistryException
,
289 css::uno::RuntimeException
);
291 virtual sal_Bool SAL_CALL
createLink(
292 rtl::OUString
const &, rtl::OUString
const &)
294 css::registry::InvalidRegistryException
,
295 css::uno::RuntimeException
);
297 virtual void SAL_CALL
deleteLink(rtl::OUString
const &)
299 css::registry::InvalidRegistryException
,
300 css::uno::RuntimeException
);
302 virtual rtl::OUString SAL_CALL
getLinkTarget(rtl::OUString
const &)
304 css::registry::InvalidRegistryException
,
305 css::uno::RuntimeException
);
307 virtual rtl::OUString SAL_CALL
getResolvedName(
308 rtl::OUString
const & aKeyName
)
310 css::registry::InvalidRegistryException
,
311 css::uno::RuntimeException
);
314 css::uno::Any value_
;
318 css::uno::Reference
< css::uno::XComponentContext
> const & context
)
320 assert(context
.is());
322 provider_
= css::uno::Reference
< css::lang::XMultiServiceFactory
>(
323 context
->getServiceManager()->createInstanceWithContext(
325 RTL_CONSTASCII_USTRINGPARAM(
326 "com.sun.star.configuration.DefaultProvider")),
328 css::uno::UNO_QUERY_THROW
);
329 } catch (css::uno::RuntimeException
&) {
331 } catch (css::uno::Exception
& e
) {
332 throw css::uno::DeploymentException(
334 RTL_CONSTASCII_USTRINGPARAM(
335 "component context fails to supply service"
336 " com.sun.star.configuration.DefaultProvider of type"
337 " com.sun.star.lang.XMultiServiceFactory: ")) +
343 rtl::OUString
Service::getURL() throw (css::uno::RuntimeException
) {
344 osl::MutexGuard
g(mutex_
);
345 checkValid_RuntimeException();
349 void Service::open(rtl::OUString
const & rURL
, sal_Bool bReadOnly
, sal_Bool
)
350 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
353 osl::MutexGuard
g(mutex_
);
357 css::uno::Sequence
< css::uno::Any
> args(1);
358 args
[0] <<= css::beans::NamedValue(
359 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")),
360 css::uno::makeAny(rURL
));
362 access_
= provider_
->createInstanceWithArguments(
365 RTL_CONSTASCII_USTRINGPARAM(
366 "com.sun.star.configuration.ConfigurationAccess"))
368 RTL_CONSTASCII_USTRINGPARAM(
369 "com.sun.star.configuration.ConfigurationUpdateAccess"))),
371 } catch (css::uno::RuntimeException
&) {
373 } catch (css::uno::Exception
& e
) {
374 throw css::uno::RuntimeException(
376 RTL_CONSTASCII_USTRINGPARAM(
377 "com.sun.star.configuration.ConfigurationRegistry: open"
380 static_cast< cppu::OWeakObject
* >(this));
383 readOnly_
= bReadOnly
;
386 sal_Bool
Service::isValid() throw (css::uno::RuntimeException
) {
387 osl::MutexGuard
g(mutex_
);
391 void Service::close()
392 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
394 osl::MutexGuard
g(mutex_
);
399 void Service::destroy()
400 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
402 throw css::uno::RuntimeException(
404 RTL_CONSTASCII_USTRINGPARAM(
405 "com.sun.star.configuration.ConfigurationRegistry: not"
407 static_cast< cppu::OWeakObject
* >(this));
410 css::uno::Reference
< css::registry::XRegistryKey
> Service::getRootKey()
411 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
413 osl::MutexGuard
g(mutex_
);
415 return new RegistryKey(*this, css::uno::makeAny(access_
));
418 sal_Bool
Service::isReadOnly() throw (css::uno::RuntimeException
) {
419 osl::MutexGuard
g(mutex_
);
420 checkValid_RuntimeException();
424 void Service::mergeKey(rtl::OUString
const &, rtl::OUString
const &)
426 css::registry::InvalidRegistryException
,
427 css::registry::MergeConflictException
, css::uno::RuntimeException
)
429 throw css::uno::RuntimeException(
431 RTL_CONSTASCII_USTRINGPARAM(
432 "com.sun.star.configuration.ConfigurationRegistry: not"
434 static_cast< cppu::OWeakObject
* >(this));
437 void Service::flush() throw (css::uno::RuntimeException
)
439 throw css::uno::RuntimeException(
441 RTL_CONSTASCII_USTRINGPARAM(
442 "com.sun.star.configuration.ConfigurationRegistry: not"
444 static_cast< cppu::OWeakObject
* >(this));
447 void Service::addFlushListener(
448 css::uno::Reference
< css::util::XFlushListener
> const &)
449 throw (css::uno::RuntimeException
)
451 throw css::uno::RuntimeException(
453 RTL_CONSTASCII_USTRINGPARAM(
454 "com.sun.star.configuration.ConfigurationRegistry: not"
456 static_cast< cppu::OWeakObject
* >(this));
459 void Service::removeFlushListener(
460 css::uno::Reference
< css::util::XFlushListener
> const &)
461 throw (css::uno::RuntimeException
)
463 throw css::uno::RuntimeException(
465 RTL_CONSTASCII_USTRINGPARAM(
466 "com.sun.star.configuration.ConfigurationRegistry: not"
468 static_cast< cppu::OWeakObject
* >(this));
471 void Service::checkValid() {
473 throw css::registry::InvalidRegistryException(
475 RTL_CONSTASCII_USTRINGPARAM(
476 "com.sun.star.configuration.ConfigurationRegistry: not"
478 static_cast< cppu::OWeakObject
* >(this));
482 void Service::checkValid_RuntimeException() {
484 throw css::uno::RuntimeException(
486 RTL_CONSTASCII_USTRINGPARAM(
487 "com.sun.star.configuration.ConfigurationRegistry: not"
489 static_cast< cppu::OWeakObject
* >(this));
493 void Service::doClose() {
497 rtl::OUString
RegistryKey::getKeyName() throw (css::uno::RuntimeException
) {
498 osl::MutexGuard
g(service_
.mutex_
);
499 service_
.checkValid_RuntimeException();
500 css::uno::Reference
< css::container::XNamed
> named
;
501 if (value_
>>= named
) {
502 return named
->getName();
504 throw css::uno::RuntimeException(
506 RTL_CONSTASCII_USTRINGPARAM(
507 "com.sun.star.configuration.ConfigurationRegistry: not"
509 static_cast< cppu::OWeakObject
* >(this));
512 sal_Bool
RegistryKey::isReadOnly()
513 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
515 osl::MutexGuard
g(service_
.mutex_
);
516 service_
.checkValid_RuntimeException();
517 return service_
.readOnly_
; //TODO: read-only sub-nodes in update access?
520 sal_Bool
RegistryKey::isValid() throw (css::uno::RuntimeException
) {
521 return service_
.isValid();
524 css::registry::RegistryKeyType
RegistryKey::getKeyType(rtl::OUString
const &)
525 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
527 osl::MutexGuard
g(service_
.mutex_
);
528 service_
.checkValid();
529 return css::registry::RegistryKeyType_KEY
;
532 css::registry::RegistryValueType
RegistryKey::getValueType()
533 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
535 osl::MutexGuard
g(service_
.mutex_
);
536 service_
.checkValid();
537 css::uno::Type
t(value_
.getValueType());
538 switch (t
.getTypeClass()) {
539 case css::uno::TypeClass_LONG
:
540 return css::registry::RegistryValueType_LONG
;
541 case css::uno::TypeClass_STRING
:
542 return css::registry::RegistryValueType_STRING
;
543 case css::uno::TypeClass_SEQUENCE
:
544 if (t
== cppu::UnoType
< css::uno::Sequence
< sal_Int8
> >::get()) {
545 return css::registry::RegistryValueType_BINARY
;
546 } else if (t
== cppu::UnoType
< css::uno::Sequence
< sal_Int32
> >::get())
548 return css::registry::RegistryValueType_LONGLIST
;
550 cppu::UnoType
< css::uno::Sequence
< rtl::OUString
> >::get())
552 return css::registry::RegistryValueType_STRINGLIST
;
556 return css::registry::RegistryValueType_NOT_DEFINED
;
560 sal_Int32
RegistryKey::getLongValue()
562 css::registry::InvalidRegistryException
,
563 css::registry::InvalidValueException
, css::uno::RuntimeException
)
565 osl::MutexGuard
g(service_
.mutex_
);
566 service_
.checkValid();
571 throw css::registry::InvalidValueException(
573 RTL_CONSTASCII_USTRINGPARAM(
574 "com.sun.star.configuration.ConfigurationRegistry")),
575 static_cast< cppu::OWeakObject
* >(this));
578 void RegistryKey::setLongValue(sal_Int32
)
579 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
581 throw css::uno::RuntimeException(
583 RTL_CONSTASCII_USTRINGPARAM(
584 "com.sun.star.configuration.ConfigurationRegistry: not"
586 static_cast< cppu::OWeakObject
* >(this));
589 css::uno::Sequence
< sal_Int32
> RegistryKey::getLongListValue()
591 css::registry::InvalidRegistryException
,
592 css::registry::InvalidValueException
, css::uno::RuntimeException
)
594 osl::MutexGuard
g(service_
.mutex_
);
595 service_
.checkValid();
596 css::uno::Sequence
< sal_Int32
> v
;
600 throw css::registry::InvalidValueException(
602 RTL_CONSTASCII_USTRINGPARAM(
603 "com.sun.star.configuration.ConfigurationRegistry")),
604 static_cast< cppu::OWeakObject
* >(this));
607 void RegistryKey::setLongListValue(css::uno::Sequence
< sal_Int32
> const &)
608 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
610 throw css::uno::RuntimeException(
612 RTL_CONSTASCII_USTRINGPARAM(
613 "com.sun.star.configuration.ConfigurationRegistry: not"
615 static_cast< cppu::OWeakObject
* >(this));
618 rtl::OUString
RegistryKey::getAsciiValue()
620 css::registry::InvalidRegistryException
,
621 css::registry::InvalidValueException
, css::uno::RuntimeException
)
623 osl::MutexGuard
g(service_
.mutex_
);
624 service_
.checkValid();
629 throw css::registry::InvalidValueException(
631 RTL_CONSTASCII_USTRINGPARAM(
632 "com.sun.star.configuration.ConfigurationRegistry")),
633 static_cast< cppu::OWeakObject
* >(this));
636 void RegistryKey::setAsciiValue(rtl::OUString
const &)
637 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
639 throw css::uno::RuntimeException(
641 RTL_CONSTASCII_USTRINGPARAM(
642 "com.sun.star.configuration.ConfigurationRegistry: not"
644 static_cast< cppu::OWeakObject
* >(this));
647 css::uno::Sequence
< rtl::OUString
> RegistryKey::getAsciiListValue()
649 css::registry::InvalidRegistryException
,
650 css::registry::InvalidValueException
, css::uno::RuntimeException
)
652 osl::MutexGuard
g(service_
.mutex_
);
653 service_
.checkValid();
654 css::uno::Sequence
< rtl::OUString
> v
;
658 throw css::registry::InvalidValueException(
660 RTL_CONSTASCII_USTRINGPARAM(
661 "com.sun.star.configuration.ConfigurationRegistry")),
662 static_cast< cppu::OWeakObject
* >(this));
665 void RegistryKey::setAsciiListValue(css::uno::Sequence
< rtl::OUString
> const &)
666 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
668 throw css::uno::RuntimeException(
670 RTL_CONSTASCII_USTRINGPARAM(
671 "com.sun.star.configuration.ConfigurationRegistry: not"
673 static_cast< cppu::OWeakObject
* >(this));
676 rtl::OUString
RegistryKey::getStringValue()
678 css::registry::InvalidRegistryException
,
679 css::registry::InvalidValueException
, css::uno::RuntimeException
)
681 osl::MutexGuard
g(service_
.mutex_
);
682 service_
.checkValid();
687 throw css::registry::InvalidValueException(
689 RTL_CONSTASCII_USTRINGPARAM(
690 "com.sun.star.configuration.ConfigurationRegistry")),
691 static_cast< cppu::OWeakObject
* >(this));
694 void RegistryKey::setStringValue(rtl::OUString
const &)
695 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
697 throw css::uno::RuntimeException(
699 RTL_CONSTASCII_USTRINGPARAM(
700 "com.sun.star.configuration.ConfigurationRegistry: not"
702 static_cast< cppu::OWeakObject
* >(this));
705 css::uno::Sequence
< rtl::OUString
> RegistryKey::getStringListValue()
707 css::registry::InvalidRegistryException
,
708 css::registry::InvalidValueException
, css::uno::RuntimeException
)
710 osl::MutexGuard
g(service_
.mutex_
);
711 service_
.checkValid();
712 css::uno::Sequence
< rtl::OUString
> v
;
716 throw css::registry::InvalidValueException(
718 RTL_CONSTASCII_USTRINGPARAM(
719 "com.sun.star.configuration.ConfigurationRegistry")),
720 static_cast< cppu::OWeakObject
* >(this));
723 void RegistryKey::setStringListValue(
724 css::uno::Sequence
< rtl::OUString
> const &)
725 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
727 throw css::uno::RuntimeException(
729 RTL_CONSTASCII_USTRINGPARAM(
730 "com.sun.star.configuration.ConfigurationRegistry: not"
732 static_cast< cppu::OWeakObject
* >(this));
735 css::uno::Sequence
< sal_Int8
> RegistryKey::getBinaryValue()
737 css::registry::InvalidRegistryException
,
738 css::registry::InvalidValueException
, css::uno::RuntimeException
)
740 osl::MutexGuard
g(service_
.mutex_
);
741 service_
.checkValid();
742 css::uno::Sequence
< sal_Int8
> v
;
746 throw css::registry::InvalidValueException(
748 RTL_CONSTASCII_USTRINGPARAM(
749 "com.sun.star.configuration.ConfigurationRegistry")),
750 static_cast< cppu::OWeakObject
* >(this));
753 void RegistryKey::setBinaryValue(css::uno::Sequence
< sal_Int8
> const &)
754 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
756 throw css::uno::RuntimeException(
758 RTL_CONSTASCII_USTRINGPARAM(
759 "com.sun.star.configuration.ConfigurationRegistry: not"
761 static_cast< cppu::OWeakObject
* >(this));
764 css::uno::Reference
< css::registry::XRegistryKey
> RegistryKey::openKey(
765 rtl::OUString
const & aKeyName
)
766 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
768 osl::MutexGuard
g(service_
.mutex_
);
769 service_
.checkValid_RuntimeException();
770 css::uno::Reference
< css::container::XHierarchicalNameAccess
> access
;
771 if (value_
>>= access
) {
773 return new RegistryKey(
774 service_
, access
->getByHierarchicalName(aKeyName
));
775 } catch (css::container::NoSuchElementException
&) {}
777 return css::uno::Reference
< css::registry::XRegistryKey
>();
780 css::uno::Reference
< css::registry::XRegistryKey
> RegistryKey::createKey(
781 rtl::OUString
const &)
783 css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
785 throw css::uno::RuntimeException(
787 RTL_CONSTASCII_USTRINGPARAM(
788 "com.sun.star.configuration.ConfigurationRegistry: not"
790 static_cast< cppu::OWeakObject
* >(this));
793 void RegistryKey::closeKey()
795 css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
797 osl::MutexGuard
g(service_
.mutex_
);
798 service_
.checkValid_RuntimeException();
801 void RegistryKey::deleteKey(rtl::OUString
const &)
802 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
804 throw css::uno::RuntimeException(
806 RTL_CONSTASCII_USTRINGPARAM(
807 "com.sun.star.configuration.ConfigurationRegistry: not"
809 static_cast< cppu::OWeakObject
* >(this));
812 css::uno::Sequence
< css::uno::Reference
< css::registry::XRegistryKey
> >
813 RegistryKey::openKeys()
814 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
816 throw css::uno::RuntimeException(
818 RTL_CONSTASCII_USTRINGPARAM(
819 "com.sun.star.configuration.ConfigurationRegistry: not"
821 static_cast< cppu::OWeakObject
* >(this));
824 css::uno::Sequence
< rtl::OUString
> RegistryKey::getKeyNames()
825 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
827 throw css::uno::RuntimeException(
829 RTL_CONSTASCII_USTRINGPARAM(
830 "com.sun.star.configuration.ConfigurationRegistry: not"
832 static_cast< cppu::OWeakObject
* >(this));
835 sal_Bool
RegistryKey::createLink(rtl::OUString
const &, rtl::OUString
const &)
836 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
838 osl::MutexGuard
g(service_
.mutex_
);
839 service_
.checkValid_RuntimeException();
843 void RegistryKey::deleteLink(rtl::OUString
const &)
844 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
846 osl::MutexGuard
g(service_
.mutex_
);
847 service_
.checkValid_RuntimeException();
850 rtl::OUString
RegistryKey::getLinkTarget(rtl::OUString
const &)
851 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
853 osl::MutexGuard
g(service_
.mutex_
);
854 service_
.checkValid_RuntimeException();
855 return rtl::OUString();
858 rtl::OUString
RegistryKey::getResolvedName(rtl::OUString
const & aKeyName
)
859 throw (css::registry::InvalidRegistryException
, css::uno::RuntimeException
)
861 osl::MutexGuard
g(service_
.mutex_
);
862 service_
.checkValid_RuntimeException();
868 css::uno::Reference
< css::uno::XInterface
> create(
869 css::uno::Reference
< css::uno::XComponentContext
> const & context
)
871 return static_cast< cppu::OWeakObject
* >(new Service(context
));
874 rtl::OUString
getImplementationName() {
875 return rtl::OUString(
876 RTL_CONSTASCII_USTRINGPARAM(
877 "com.sun.star.comp.configuration.ConfigurationRegistry"));
880 css::uno::Sequence
< rtl::OUString
> getSupportedServiceNames() {
882 RTL_CONSTASCII_USTRINGPARAM(
883 "com.sun.star.configuration.ConfigurationRegistry"));
884 return css::uno::Sequence
< rtl::OUString
>(&name
, 1);
889 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */