12#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
13#include <com/sun/star/lang/IllegalArgumentException.hpp>
14#include <com/sun/star/lang/NotInitializedException.hpp>
15#include <com/sun/star/lang/XInitialization.hpp>
16#include <com/sun/star/lang/XServiceInfo.hpp>
17#include <com/sun/star/uno/Any.hxx>
18#include <com/sun/star/uno/Reference.hxx>
19#include <com/sun/star/uno/RuntimeException.hpp>
20#include <com/sun/star/uno/Sequence.hxx>
21#include <com/sun/star/uno/XInterface.hpp>
26#include <rtl/ustring.hxx>
40 public cppu::WeakImplHelper<
41 css::lang::XServiceInfo, css::lang::XInitialization,
42 css::container::XHierarchicalNameAccess >
46 css::uno::Reference< css::uno::XComponentContext > context):
53 virtual ~Service()
override {}
56 {
return "com.sun.star.comp.configuration.ReadOnlyAccess"; }
61 virtual css::uno::Sequence< OUString > SAL_CALL
63 {
return {
"com.sun.star.configuration.ReadOnlyAccess" }; }
65 virtual void SAL_CALL initialize(
66 css::uno::Sequence< css::uno::Any >
const &
aArguments)
override;
68 virtual css::uno::Any SAL_CALL getByHierarchicalName(
69 OUString
const &
aName)
override
70 {
return getRoot()->getByHierarchicalName(
aName); }
72 virtual sal_Bool SAL_CALL hasByHierarchicalName(OUString
const &
aName)
override
73 {
return getRoot()->hasByHierarchicalName(
aName); }
77 css::uno::Reference< css::uno::XComponentContext >
context_;
83void Service::initialize(css::uno::Sequence< css::uno::Any >
const & aArguments)
87 throw css::lang::IllegalArgumentException(
88 "not exactly one string argument",
91 std::unique_lock g1(
mutex_);
93 throw css::uno::RuntimeException(
94 "already initialized", getXWeak());
96 osl::MutexGuard g2(*
lock());
98 root_ =
new RootAccess(components,
"/", locale,
false);
99 components.addRootAccess(
root_);
103 std::unique_lock g(
mutex_);
105 throw css::lang::NotInitializedException(
106 "not initialized", getXWeak());
114extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
116 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
118 return cppu::acquire(
new configmgr::read_only_access::Service(context));
static Components & getSingleton(css::uno::Reference< css::uno::XComponentContext > const &context)
Sequence< PropertyValue > aArguments
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
std::shared_ptr< osl::Mutex > const & lock()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
css::uno::Reference< css::uno::XComponentContext > context_
rtl::Reference< RootAccess > root_
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_configuration_ReadOnlyAccess_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
std::vector< uno::Reference< sheet::XSpreadsheetDocument > > Components