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 .
23 #include <com/sun/star/lang/XTypeProvider.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XMultiServiceFactory.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/beans/XPropertyContainer.hpp>
32 #include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
33 #include <com/sun/star/beans/XPropertyAccess.hpp>
34 #include <com/sun/star/lang/XComponent.hpp>
35 #include <com/sun/star/lang/XInitialization.hpp>
36 #include <cppuhelper/weak.hxx>
37 #include <ucbhelper/macros.hxx>
39 //=========================================================================
41 #define STORE_SERVICE_NAME "com.sun.star.ucb.Store"
42 #define PROPSET_REG_SERVICE_NAME "com.sun.star.ucb.PropertySetRegistry"
43 #define PERS_PROPSET_SERVICE_NAME "com.sun.star.ucb.PersistentPropertySet"
45 //=========================================================================
50 public cppu::OWeakObject
,
51 public com::sun::star::lang::XTypeProvider
,
52 public com::sun::star::lang::XServiceInfo
,
53 public com::sun::star::ucb::XPropertySetRegistryFactory
,
54 public com::sun::star::lang::XInitialization
56 com::sun::star::uno::Reference
<
57 com::sun::star::lang::XMultiServiceFactory
> m_xSMgr
;
58 UcbStore_Impl
* m_pImpl
;
62 const com::sun::star::uno::Reference
<
63 com::sun::star::lang::XMultiServiceFactory
>& rXSMgr
);
75 // XPropertySetRegistryFactory
76 virtual com::sun::star::uno::Reference
<
77 com::sun::star::ucb::XPropertySetRegistry
> SAL_CALL
78 createPropertySetRegistry( const OUString
& URL
)
79 throw( com::sun::star::uno::RuntimeException
);
83 initialize( const ::com::sun::star::uno::Sequence
<
84 ::com::sun::star::uno::Any
>& aArguments
)
85 throw( ::com::sun::star::uno::Exception
,
86 ::com::sun::star::uno::RuntimeException
);
88 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>&
92 //=========================================================================
94 struct PropertySetRegistry_Impl
;
95 class PersistentPropertySet
;
97 class PropertySetRegistry
:
98 public cppu::OWeakObject
,
99 public com::sun::star::lang::XTypeProvider
,
100 public com::sun::star::lang::XServiceInfo
,
101 public com::sun::star::ucb::XPropertySetRegistry
,
102 public com::sun::star::container::XNameAccess
104 friend class PersistentPropertySet
;
106 com::sun::star::uno::Reference
<
107 com::sun::star::lang::XMultiServiceFactory
> m_xSMgr
;
108 PropertySetRegistry_Impl
* m_pImpl
;
111 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>
114 void add ( PersistentPropertySet
* pSet
);
115 void remove( PersistentPropertySet
* pSet
);
117 void renamePropertySet( const OUString
& rOldKey
,
118 const OUString
& rNewKey
);
122 const com::sun::star::uno::Reference
<
123 com::sun::star::lang::XMultiServiceFactory
>& rXSMgr
,
124 const ::com::sun::star::uno::Sequence
<
125 ::com::sun::star::uno::Any
>& rInitArgs
);
126 virtual ~PropertySetRegistry();
135 XSERVICEINFO_NOFACTORY_DECL()
137 // XPropertySetRegistry
138 virtual com::sun::star::uno::Reference
<
139 com::sun::star::ucb::XPersistentPropertySet
> SAL_CALL
140 openPropertySet( const OUString
& key
, sal_Bool create
)
141 throw( com::sun::star::uno::RuntimeException
);
142 virtual void SAL_CALL
143 removePropertySet( const OUString
& key
)
144 throw( com::sun::star::uno::RuntimeException
);
146 // XElementAccess ( XNameAccess is derived from it )
147 virtual com::sun::star::uno::Type SAL_CALL
149 throw( com::sun::star::uno::RuntimeException
);
150 virtual sal_Bool SAL_CALL
152 throw( com::sun::star::uno::RuntimeException
);
155 virtual com::sun::star::uno::Any SAL_CALL
156 getByName( const OUString
& aName
)
157 throw( com::sun::star::container::NoSuchElementException
,
158 com::sun::star::lang::WrappedTargetException
,
159 com::sun::star::uno::RuntimeException
);
160 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
162 throw( com::sun::star::uno::RuntimeException
);
163 virtual sal_Bool SAL_CALL
164 hasByName( const OUString
& aName
)
165 throw( com::sun::star::uno::RuntimeException
);
167 // Non-interface methods
168 com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
>
169 getRootConfigReadAccess();
170 com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
>
171 getConfigWriteAccess( const OUString
& rPath
);
174 //=========================================================================
176 struct PersistentPropertySet_Impl
;
178 class PersistentPropertySet
:
179 public cppu::OWeakObject
,
180 public com::sun::star::lang::XTypeProvider
,
181 public com::sun::star::lang::XServiceInfo
,
182 public com::sun::star::lang::XComponent
,
183 public com::sun::star::ucb::XPersistentPropertySet
,
184 public com::sun::star::container::XNamed
,
185 public com::sun::star::beans::XPropertyContainer
,
186 public com::sun::star::beans::XPropertySetInfoChangeNotifier
,
187 public com::sun::star::beans::XPropertyAccess
189 com::sun::star::uno::Reference
<
190 com::sun::star::lang::XMultiServiceFactory
> m_xSMgr
;
191 PersistentPropertySet_Impl
* m_pImpl
;
194 void notifyPropertyChangeEvent(
195 const com::sun::star::beans::PropertyChangeEvent
& rEvent
) const;
196 void notifyPropertySetInfoChange(
197 const com::sun::star::beans::PropertySetInfoChangeEvent
& evt
) const;
200 PersistentPropertySet(
201 const com::sun::star::uno::Reference
<
202 com::sun::star::lang::XMultiServiceFactory
>& rXSMgr
,
203 PropertySetRegistry
& rCreator
,
204 const OUString
& rKey
);
205 virtual ~PersistentPropertySet();
214 XSERVICEINFO_NOFACTORY_DECL()
217 virtual void SAL_CALL
219 throw( com::sun::star::uno::RuntimeException
);
220 virtual void SAL_CALL
221 addEventListener( const com::sun::star::uno::Reference
<
222 com::sun::star::lang::XEventListener
>& Listener
)
223 throw( com::sun::star::uno::RuntimeException
);
224 virtual void SAL_CALL
225 removeEventListener( const com::sun::star::uno::Reference
<
226 com::sun::star::lang::XEventListener
>& Listener
)
227 throw( com::sun::star::uno::RuntimeException
);
230 virtual com::sun::star::uno::Reference
<
231 com::sun::star::beans::XPropertySetInfo
> SAL_CALL
233 throw( com::sun::star::uno::RuntimeException
);
234 virtual void SAL_CALL
235 setPropertyValue( const OUString
& aPropertyName
,
236 const com::sun::star::uno::Any
& aValue
)
237 throw( com::sun::star::beans::UnknownPropertyException
,
238 com::sun::star::beans::PropertyVetoException
,
239 com::sun::star::lang::IllegalArgumentException
,
240 com::sun::star::lang::WrappedTargetException
,
241 com::sun::star::uno::RuntimeException
);
242 virtual com::sun::star::uno::Any SAL_CALL
243 getPropertyValue( const OUString
& PropertyName
)
244 throw( com::sun::star::beans::UnknownPropertyException
,
245 com::sun::star::lang::WrappedTargetException
,
246 com::sun::star::uno::RuntimeException
);
247 virtual void SAL_CALL
248 addPropertyChangeListener( const OUString
& aPropertyName
,
249 const com::sun::star::uno::Reference
<
250 com::sun::star::beans::XPropertyChangeListener
>& xListener
)
251 throw( com::sun::star::beans::UnknownPropertyException
,
252 com::sun::star::lang::WrappedTargetException
,
253 com::sun::star::uno::RuntimeException
);
254 virtual void SAL_CALL
255 removePropertyChangeListener( const OUString
& aPropertyName
,
256 const com::sun::star::uno::Reference
<
257 com::sun::star::beans::XPropertyChangeListener
>& aListener
)
258 throw( com::sun::star::beans::UnknownPropertyException
,
259 com::sun::star::lang::WrappedTargetException
,
260 com::sun::star::uno::RuntimeException
);
261 virtual void SAL_CALL
262 addVetoableChangeListener( const OUString
& PropertyName
,
263 const com::sun::star::uno::Reference
<
264 com::sun::star::beans::XVetoableChangeListener
>& aListener
)
265 throw( com::sun::star::beans::UnknownPropertyException
,
266 com::sun::star::lang::WrappedTargetException
,
267 com::sun::star::uno::RuntimeException
);
268 virtual void SAL_CALL
269 removeVetoableChangeListener( const OUString
& PropertyName
,
270 const com::sun::star::uno::Reference
<
271 com::sun::star::beans::XVetoableChangeListener
>& aListener
)
272 throw( com::sun::star::beans::UnknownPropertyException
,
273 com::sun::star::lang::WrappedTargetException
,
274 com::sun::star::uno::RuntimeException
);
276 // XPersistentPropertySet
277 virtual com::sun::star::uno::Reference
<
278 com::sun::star::ucb::XPropertySetRegistry
> SAL_CALL
280 throw( com::sun::star::uno::RuntimeException
);
281 virtual OUString SAL_CALL
283 throw( com::sun::star::uno::RuntimeException
);
286 virtual OUString SAL_CALL
288 throw( ::com::sun::star::uno::RuntimeException
);
289 virtual void SAL_CALL
290 setName( const OUString
& aName
)
291 throw( ::com::sun::star::uno::RuntimeException
);
293 // XPropertyContainer
294 virtual void SAL_CALL
295 addProperty( const OUString
& Name
,
296 sal_Int16 Attributes
,
297 const com::sun::star::uno::Any
& DefaultValue
)
298 throw( com::sun::star::beans::PropertyExistException
,
299 com::sun::star::beans::IllegalTypeException
,
300 com::sun::star::lang::IllegalArgumentException
,
301 com::sun::star::uno::RuntimeException
);
302 virtual void SAL_CALL
303 removeProperty( const OUString
& Name
)
304 throw( com::sun::star::beans::UnknownPropertyException
,
305 com::sun::star::beans::NotRemoveableException
,
306 com::sun::star::uno::RuntimeException
);
308 // XPropertySetInfoChangeNotifier
309 virtual void SAL_CALL
310 addPropertySetInfoChangeListener( const com::sun::star::uno::Reference
<
311 com::sun::star::beans::XPropertySetInfoChangeListener
>& Listener
)
312 throw( com::sun::star::uno::RuntimeException
);
313 virtual void SAL_CALL
314 removePropertySetInfoChangeListener( const com::sun::star::uno::Reference
<
315 com::sun::star::beans::XPropertySetInfoChangeListener
>& Listener
)
316 throw( com::sun::star::uno::RuntimeException
);
319 virtual com::sun::star::uno::Sequence
<
320 com::sun::star::beans::PropertyValue
> SAL_CALL
322 throw( com::sun::star::uno::RuntimeException
);
323 virtual void SAL_CALL
324 setPropertyValues( const com::sun::star::uno::Sequence
<
325 com::sun::star::beans::PropertyValue
>& aProps
)
326 throw( com::sun::star::beans::UnknownPropertyException
,
327 com::sun::star::beans::PropertyVetoException
,
328 com::sun::star::lang::IllegalArgumentException
,
329 com::sun::star::lang::WrappedTargetException
,
330 com::sun::star::uno::RuntimeException
);
332 // Non-interface methods.
333 PropertySetRegistry
& getPropertySetRegistry();
334 const OUString
& getFullKey();
337 #endif /* !_UCBSTORE_HXX */
339 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */