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 #ifndef INCLUDED_UCB_SOURCE_CORE_UCBSTORE_HXX
21 #define INCLUDED_UCB_SOURCE_CORE_UCBSTORE_HXX
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
26 #include <com/sun/star/container/XNamed.hpp>
27 #include <com/sun/star/container/XNameAccess.hpp>
28 #include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
29 #include <com/sun/star/ucb/XPropertySetRegistry.hpp>
30 #include <com/sun/star/ucb/XPersistentPropertySet.hpp>
31 #include <com/sun/star/uno/XComponentContext.hpp>
32 #include <com/sun/star/beans/XPropertyContainer.hpp>
33 #include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
34 #include <com/sun/star/beans/XPropertyAccess.hpp>
35 #include <com/sun/star/lang/XComponent.hpp>
36 #include <com/sun/star/lang/XInitialization.hpp>
37 #include <cppuhelper/compbase.hxx>
38 #include <cppuhelper/basemutex.hxx>
44 using UcbStore_Base
= cppu::WeakComponentImplHelper
<
45 css::lang::XServiceInfo
,
46 css::ucb::XPropertySetRegistryFactory
,
47 css::lang::XInitialization
>;
49 class UcbStore
: public cppu::BaseMutex
, public UcbStore_Base
51 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
52 std::unique_ptr
<UcbStore_Impl
> m_pImpl
;
55 explicit UcbStore( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
56 virtual ~UcbStore() override
;
59 virtual OUString SAL_CALL
getImplementationName() override
;
60 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
61 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
63 // XPropertySetRegistryFactory
64 virtual css::uno::Reference
< css::ucb::XPropertySetRegistry
> SAL_CALL
65 createPropertySetRegistry( const OUString
& URL
) override
;
69 initialize( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
73 struct PropertySetRegistry_Impl
;
74 class PersistentPropertySet
;
76 class PropertySetRegistry
: public cppu::WeakImplHelper
<
77 css::lang::XServiceInfo
,
78 css::ucb::XPropertySetRegistry
,
79 css::container::XNameAccess
>
81 friend class PersistentPropertySet
;
83 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
84 std::unique_ptr
<PropertySetRegistry_Impl
> m_pImpl
;
87 css::uno::Reference
< css::lang::XMultiServiceFactory
>
90 void add ( PersistentPropertySet
* pSet
);
91 void remove( PersistentPropertySet
* pSet
);
93 void renamePropertySet( const OUString
& rOldKey
,
94 const OUString
& rNewKey
);
98 const css::uno::Reference
< css::uno::XComponentContext
>& xContext
,
99 const css::uno::Sequence
< css::uno::Any
>& rInitArgs
);
100 virtual ~PropertySetRegistry() override
;
104 virtual OUString SAL_CALL
getImplementationName() override
;
105 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
106 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
108 // XPropertySetRegistry
109 virtual css::uno::Reference
< css::ucb::XPersistentPropertySet
> SAL_CALL
110 openPropertySet( const OUString
& key
, sal_Bool create
) override
;
111 virtual void SAL_CALL
112 removePropertySet( const OUString
& key
) override
;
114 // XElementAccess ( XNameAccess is derived from it )
115 virtual css::uno::Type SAL_CALL
116 getElementType() override
;
117 virtual sal_Bool SAL_CALL
118 hasElements() override
;
121 virtual css::uno::Any SAL_CALL
122 getByName( const OUString
& aName
) override
;
123 virtual css::uno::Sequence
< OUString
> SAL_CALL
124 getElementNames() override
;
125 virtual sal_Bool SAL_CALL
126 hasByName( const OUString
& aName
) override
;
128 // Non-interface methods
129 css::uno::Reference
< css::uno::XInterface
>
130 getRootConfigReadAccess();
131 css::uno::Reference
< css::uno::XInterface
>
132 getConfigWriteAccess( const OUString
& rPath
);
136 struct PersistentPropertySet_Impl
;
138 class PersistentPropertySet
: public cppu::WeakImplHelper
<
139 css::lang::XServiceInfo
,
140 css::lang::XComponent
,
141 css::ucb::XPersistentPropertySet
,
142 css::container::XNamed
,
143 css::beans::XPropertyContainer
,
144 css::beans::XPropertySetInfoChangeNotifier
,
145 css::beans::XPropertyAccess
>
147 std::unique_ptr
<PersistentPropertySet_Impl
> m_pImpl
;
150 void notifyPropertyChangeEvent(
151 const css::beans::PropertyChangeEvent
& rEvent
) const;
152 void notifyPropertySetInfoChange(
153 const css::beans::PropertySetInfoChangeEvent
& evt
) const;
156 PersistentPropertySet(
157 PropertySetRegistry
& rCreator
,
158 const OUString
& rKey
);
159 virtual ~PersistentPropertySet() override
;
162 virtual OUString SAL_CALL
getImplementationName() override
;
163 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
164 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
167 virtual void SAL_CALL
169 virtual void SAL_CALL
170 addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& Listener
) override
;
171 virtual void SAL_CALL
172 removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& Listener
) override
;
175 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
176 getPropertySetInfo() override
;
177 virtual void SAL_CALL
178 setPropertyValue( const OUString
& aPropertyName
,
179 const css::uno::Any
& aValue
) override
;
180 virtual css::uno::Any SAL_CALL
181 getPropertyValue( const OUString
& PropertyName
) override
;
182 virtual void SAL_CALL
183 addPropertyChangeListener( const OUString
& aPropertyName
,
184 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
185 virtual void SAL_CALL
186 removePropertyChangeListener( const OUString
& aPropertyName
,
187 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
188 virtual void SAL_CALL
189 addVetoableChangeListener( const OUString
& PropertyName
,
190 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
191 virtual void SAL_CALL
192 removeVetoableChangeListener( const OUString
& PropertyName
,
193 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
195 // XPersistentPropertySet
196 virtual css::uno::Reference
< css::ucb::XPropertySetRegistry
> SAL_CALL
197 getRegistry() override
;
198 virtual OUString SAL_CALL
202 virtual OUString SAL_CALL
204 virtual void SAL_CALL
205 setName( const OUString
& aName
) override
;
207 // XPropertyContainer
208 virtual void SAL_CALL
209 addProperty( const OUString
& Name
,
210 sal_Int16 Attributes
,
211 const css::uno::Any
& DefaultValue
) override
;
212 virtual void SAL_CALL
213 removeProperty( const OUString
& Name
) override
;
215 // XPropertySetInfoChangeNotifier
216 virtual void SAL_CALL
217 addPropertySetInfoChangeListener( const css::uno::Reference
< css::beans::XPropertySetInfoChangeListener
>& Listener
) override
;
218 virtual void SAL_CALL
219 removePropertySetInfoChangeListener( const css::uno::Reference
< css::beans::XPropertySetInfoChangeListener
>& Listener
) override
;
222 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
223 getPropertyValues() override
;
224 virtual void SAL_CALL
225 setPropertyValues( const css::uno::Sequence
< css::beans::PropertyValue
>& aProps
) override
;
227 // Non-interface methods.
228 PropertySetRegistry
& getPropertySetRegistry();
229 const OUString
& getFullKey();
232 #endif // INCLUDED_UCB_SOURCE_CORE_UCBSTORE_HXX
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */