1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CPPUHELPER_PROPSHLP_HXX
25 #define _CPPUHELPER_PROPSHLP_HXX
26 
27 #include <rtl/alloc.h>
28 
29 #include <cppuhelper/interfacecontainer.hxx>
30 #include "cppuhelper/cppuhelperdllapi.h"
31 
32 #include <com/sun/star/beans/XPropertySet.hpp>
33 #include <com/sun/star/beans/XMultiPropertySet.hpp>
34 #include <com/sun/star/beans/XFastPropertySet.hpp>
35 
36 #include <memory>
37 
38 
39 namespace cppu
40 {
41 
42 
43 /*************************************************************************
44 *************************************************************************/
45 
46 
47 /**
48    This interface is used by the OPropertyHelper, to access the property description.
49  */
50 class CPPUHELPER_DLLPUBLIC IPropertyArrayHelper
51 {
52 public:
53 	// these are here to force memory de/allocation to sal lib.
operator new(size_t nSize)54 	inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
55 		{ return ::rtl_allocateMemory( nSize ); }
operator delete(void * pMem)56 	inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
57 		{ ::rtl_freeMemory( pMem ); }
operator new(size_t,void * pMem)58 	inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW( () )
59 		{ return pMem; }
operator delete(void *,void *)60 	inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW( () )
61 		{}
62 
63 	/**
64 	   Following the rule, the first virtual method implies the virtual destructor.
65 	 */
66 	virtual ~IPropertyArrayHelper();
67 
68 	/**
69 	   Return the property members Name and Attribute from the handle nHandle.
70 	   @param nHandle	the handle of a property. If the values of the handles
71 	  					are sorted in the same way as the names and the highest handle value
72 	  					is getCount() -1, than it must be an indexed access to the property array.
73 	   @param pPropName is an out parameter filled with property name of the property with the
74 	  						handle nHandle. May be NULL.
75 	   @param rAttributes is an out parameter filled with attributes of the property with the
76 	  						handle nHandle. May be NULL.
77 	   @return True, if the handle exist, otherwise false.
78 	 */
79 	virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
80 		::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) = 0;
81 	/**
82 	   Return the sequence of properties. The sequence is sorted by name.
83 	 */
84     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void) = 0;
85 	/**
86 	   Return the property with the name rPropertyName.
87 	   @param rPropertyName	the name of the property.
88 	   @exception UnknownPropertyException	thrown if the property name is unknown.
89 	 */
90     virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
91 		const ::rtl::OUString& rPropertyName )
92 		throw (::com::sun::star::beans::UnknownPropertyException) = 0;
93 	/**
94 	   Return true if the property with the name rPropertyName exist, otherwise false.
95 	   @param rPropertyName	the name of the property.
96 	 */
97     virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) = 0;
98 	/**
99 	   Return the handle of the property with the name rPropertyName.
100 	   If the property does not exist -1 is returned.
101 	   @param rPropertyName	the name of the property.
102 	 */
103 	virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) = 0;
104 	/**
105 	   Fill the array with the handles of the properties.
106 	   @return the handles of the names from the pHandles array. -1
107 	   indicates an unknown property name.
108 	 */
109 	virtual sal_Int32 SAL_CALL fillHandles(
110 		/*out*/ sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ) = 0;
111 };
112 
113 /**
114    You can use this helper class to map a XPropertySet-Interface to a XFast-
115    or a XMultiPropertySet interface.
116  */
117 class CPPUHELPER_DLLPUBLIC OPropertyArrayHelper : public IPropertyArrayHelper
118 {
119 public:
120      /**
121 	   Create an object which supports the common property interfaces.
122 
123 	   @param pProps	array of properties
124 	  					The array pProps should be sorted.
125 	   @param nElements	is the number of properties in the pProps structure.
126 	   @param bSorted	indicates that the elements are sorted.
127 	  *********/
128 	OPropertyArrayHelper(
129 		::com::sun::star::beans::Property *pProps,
130 		sal_Int32 nElements ,
131 		sal_Bool bSorted = sal_True )
132 		SAL_THROW( () );
133 
134      /**
135 	   Create an object which supports the common property interfaces.
136 	   @param aProps     sequence of properties which are supported by this helper.
137 	  					 The sequence aProps should be sorted.
138 	   @param bSorted    indicates that the elements are sorted.
139 	 */
140 	OPropertyArrayHelper(
141 		const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > & aProps,
142 		sal_Bool bSorted = sal_True )
143 		SAL_THROW( () );
144 
145 	/**
146 	   Return the number of properties.
147 	 */
148 	sal_Int32 SAL_CALL getCount() const SAL_THROW( () );
149 	/**
150 	   Return the property members Name and Attribute from the handle nHandle.
151 	   @param nHandle	the handle of a property. If the values of the handles
152 	  					are sorted in the same way as the names and the highest handle value
153 	  					is getCount() -1, than it is only an indexed access to the property array.
154 	  					Otherwise it is a linear search through the array.
155 	   @param pPropName is an out parameter filled with property name of the property with the
156 	  						handle nHandle. May be NULL.
157 	   @param rAttributes is an out parameter filled with attributes of the property with the
158 	  						handle nHandle. May be NULL.
159 	   @return True, if the handle exist, otherwise false.
160 	 */
161 	virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
162 		::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle );
163 	/**
164 	   Return the sequence of properties. The sequence is sorted by name.
165 	 */
166     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void);
167 	/**
168 	   Return the property with the name rPropertyName.
169 	   @param rPropertyName	the name of the property.
170 	   @exception UnknownPropertyException	thrown if the property name is unknown.
171 	 */
172     virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
173 		const ::rtl::OUString& rPropertyName )
174 		throw (::com::sun::star::beans::UnknownPropertyException);
175 	/**
176 	   Return true if the property with the name rPropertyName exist, otherwise false.
177 	   @param rPropertyName	the name of the property.
178 	 */
179     virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName);
180 	/**
181 	   Return the handle of the property with the name rPropertyName.
182 	   If the property does not exist -1 is returned.
183 	   @param rPropertyName	the name of the property.
184 	 */
185 	virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName );
186 	/**
187 	   Fill the array with the handles of the properties.
188 	   @return the handles of the names from the pHandles array. -1
189 	   indicates an unknown property name.
190 	 */
191 	virtual sal_Int32 SAL_CALL fillHandles(
192 		/*out*/sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames );
193 
194 protected:
195     /** reserved for future use. do not use.
196      */
197     void * m_pReserved;
198 
199 private:
200 	void init( sal_Bool bSorted ) SAL_THROW( () );
201 
202 	/** The sequence generated from the pProperties array. */
203 	::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aInfos;
204 
205 	/**
206 	   True, If the values of the handles are sorted in the same way as the names
207 	   and the highest handle value	is getCount() -1, otherwise false.
208 	 */
209 	sal_Bool					bRightOrdered;
210 };
211 
212 
213 //-----------------------------------------------------------------------------
214 // helper defines needed for an interface container with a 32 bit key values
215 
216 struct equalInt32_Impl
217 {
operator ()cppu::equalInt32_Impl218 	bool operator()(const sal_Int32 & i1 , const sal_Int32 & i2) const SAL_THROW( () )
219 		{ return i1 == i2; }
220 };
221 
222 struct hashInt32_Impl
223 {
operator ()cppu::hashInt32_Impl224 	size_t operator()(const sal_Int32 & i) const SAL_THROW( () )
225 		{ return i; }
226 };
227 /** Specialized class for key type sal_Int32,
228     without explicit usage of STL symbols.
229 */
230 class CPPUHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelperInt32
231 {
232 public:
233 	// these are here to force memory de/allocation to sal lib.
operator new(size_t nSize)234 	inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
235 		{ return ::rtl_allocateMemory( nSize ); }
operator delete(void * pMem)236 	inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
237 		{ ::rtl_freeMemory( pMem ); }
operator new(size_t,void * pMem)238 	inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW( () )
239 		{ return pMem; }
operator delete(void *,void *)240 	inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW( () )
241 		{}
242 
243 	/**
244 	  Create a container of interface containers.
245 
246 	  @param rMutex	the mutex to protect multi thread access.
247 	 					The lifetime must be longer than the lifetime
248 	 					of this object.
249 	 */
250 	OMultiTypeInterfaceContainerHelperInt32( ::osl::Mutex & ) SAL_THROW( () );
251 	/**
252 	  Delete all containers.
253 	 */
254 	~OMultiTypeInterfaceContainerHelperInt32() SAL_THROW( () );
255 
256 	/**
257 	  Return all id's under which at least one interface is added.
258 	 */
259 	::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getContainedTypes() const SAL_THROW( () );
260 
261 	/**
262 	  Return the container created under this key.
263 	  @return the container created under this key. If the container
264 	 			was not created, null was returned.
265 	 */
266 	OInterfaceContainerHelper * SAL_CALL getContainer( const sal_Int32 & rKey ) const SAL_THROW( () );
267 
268 	/**
269 	  Insert an element in the container specified with the key. The position is not specified.
270 	  @param rKey		the id of the container.
271 	  @param rxIFace	the added interface. It is allowed to insert null or
272 	 					the same pointer more than once.
273 	  @return the new count of elements in the container.
274 	 */
275 	sal_Int32 SAL_CALL addInterface(
276 		const sal_Int32 & rKey,
277 		const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & r )
278 		SAL_THROW( () );
279 
280 	/**
281 	  Remove an element from the container specified with the key.
282 	  It uses the equal definition of uno objects to remove the interfaces.
283 	  @param rKey		the id of the container.
284 	  @param rxIFace	the removed interface.
285 	  @return the new count of elements in the container.
286 	 */
287 	sal_Int32 SAL_CALL removeInterface(
288 		const sal_Int32 & rKey,
289 		const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace )
290 		SAL_THROW( () );
291 
292 	/**
293 	  Call disposing on all object in the container that
294 	  support XEventListener. Than clear the container.
295 	 */
296 	void	SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt ) SAL_THROW( () );
297 	/**
298 	  Remove all elements of all containers. Does not delete the container.
299 	 */
300 	void SAL_CALL clear() SAL_THROW( () );
301 
302 	typedef sal_Int32 keyType;
303 private:
304 	void *m_pMap;
305 	::osl::Mutex &	rMutex;
306 
307 	inline OMultiTypeInterfaceContainerHelperInt32( const OMultiTypeInterfaceContainerHelperInt32 & ) SAL_THROW( () );
308 	inline OMultiTypeInterfaceContainerHelperInt32 & operator = ( const OMultiTypeInterfaceContainerHelperInt32 & ) SAL_THROW( () );
309 };
310 
311 
312 /** An interface to extend event notification actions.
313   */
314 class IEventNotificationHook
315 {
316 public:
317     /**
318         Method to be called by OPropertySetHelper::fire.
319 
320         @param bIgnoreRuntimeExceptionsWhileFiring
321                         indicates whether occurring RuntimeExceptions shall be
322                         ignored when firing notifications
323 
324         @see OPropertySetHelper::fire
325      */
326     virtual void fireEvents(
327         sal_Int32 * pnHandles,
328 		sal_Int32 nCount,
329 		sal_Bool bVetoable,
330         bool bIgnoreRuntimeExceptionsWhileFiring) = 0;
331 };
332 
333 
334 
335 /**
336    This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet
337    and XPropertySet to the methods getInfoHelper, convertFastPropertyValue,
338    setFastPropertyValue_NoBroadcast and getFastPropertyValue. You must derive from
339    this class and overload the methods.
340    It provides a standard implementation of the XPropertySetInfo.
341    The XPropertiesChangeListener are inserted in the rBHelper.aLC structure.
342    The XPropertyChangeListener and XVetoableChangeListener with no names are inserted
343    in the rBHelper.aLC structure. So it is possible to advise property listeners with
344    the connection point interfaces. But only listeners that listen to all property changes.
345 
346  */
347 class CPPUHELPER_DLLPUBLIC OPropertySetHelper : public ::com::sun::star::beans::XMultiPropertySet,
348 						   public ::com::sun::star::beans::XFastPropertySet,
349 						   public ::com::sun::star::beans::XPropertySet
350 {
351 public:
352 	/**
353 	   @param rBHelper	this structure contains the basic members of
354 	  					a broadcaster.
355 	  					The lifetime must be longer than the lifetime
356 	  					of this object. Stored in the variable rBHelper.
357 	 */
358 	OPropertySetHelper( OBroadcastHelper & rBHelper ) SAL_THROW( () );
359 
360 	/** Constructor.
361 
362         @param rBHelper
363                         this structure contains the basic members of
364                         a broadcaster.
365 	  					The lifetime must be longer than the lifetime
366 	  					of this object. Stored in the variable rBHelper.
367 
368         @param bIgnoreRuntimeExceptionsWhileFiring
369                         indicates whether occurring RuntimeExceptions will be
370                         ignored when firing notifications (vetoableChange((),
371                         propertyChange()) to listeners.
372                         PropertyVetoExceptions may still be thrown.
373                         This flag is useful in a inter-process scenarios when
374                         remote bridges may break down
375                         (firing DisposedExceptions).
376     */
377 	OPropertySetHelper(
378         OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring );
379 
380 	/** Constructor.
381 
382         @param rBHelper
383                         this structure contains the basic members of
384                         a broadcaster.
385                         The lifetime must be longer than the lifetime
386                         of this object. Stored in the variable rBHelper.
387 
388         @param i_pFireEvents
389                         additional event notifier
390 
391         @param bIgnoreRuntimeExceptionsWhileFiring
392                         indicates whether occurring RuntimeExceptions will be
393                         ignored when firing notifications (vetoableChange((),
394                         propertyChange()) to listeners.
395                         PropertyVetoExceptions may still be thrown.
396                         This flag is useful in a inter-process scenarios when
397                         remote bridges may break down
398                         (firing DisposedExceptions).
399     */
400 	OPropertySetHelper(
401         OBroadcastHelper & rBHelper,
402         IEventNotificationHook *i_pFireEvents,
403         bool bIgnoreRuntimeExceptionsWhileFiring = false);
404 
405 	/**
406 	   Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and
407 	   XEventListener.
408 	 */
409 	::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
410 		throw (::com::sun::star::uno::RuntimeException);
411 
412 	/** eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet
413 	 */
414     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > getTypes()
415         throw(::com::sun::star::uno::RuntimeException);
416 
417 	/**
418 	   Send a disposing notification to the listeners in the conatiners aBoundLC
419 	   and aVetoableLC.
420 
421 	   @see OComponentHelper
422 	 */
423 	void SAL_CALL disposing() SAL_THROW( () );
424 
425 	/**
426 	   Throw UnknownPropertyException or PropertyVetoException if the property with the name
427 	   rPropertyName does not exist or is readonly. Otherwise rPropertyName is changed to its handle
428 	   value and setFastPropertyValue is called.
429 	 */
430 	virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue )
431 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
432 	/**
433 	   Throw UnknownPropertyException if the property with the name
434 	   rPropertyName does not exist.
435 	 */
436 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName)
437 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
438 	/** Ignored if the property is not bound. */
439 	virtual void SAL_CALL addPropertyChangeListener(
440 		const ::rtl::OUString& aPropertyName,
441 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener)
442 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
443 
444 	/** Ignored if the property is not bound. */
445 	virtual void SAL_CALL removePropertyChangeListener(
446 		const ::rtl::OUString& aPropertyName,
447 		const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertyChangeListener >& aListener)
448 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
449 
450 	/** Ignored if the property is not constrained. */
451 	virtual void SAL_CALL addVetoableChangeListener(
452 		const ::rtl::OUString& aPropertyName,
453 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener)
454 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
455 
456 	/** Ignored if the property is not constrained. */
457 	virtual void SAL_CALL removeVetoableChangeListener(
458 		const ::rtl::OUString& aPropertyName,
459 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener )
460 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
461 
462 	/**
463 	   Throw UnknownPropertyException or PropertyVetoException if the property with the name
464 	   rPropertyName does not exist or is readonly. Otherwise the method convertFastPropertyValue
465 	   is called, then the vetoable listeners are notified. After this the value of the property
466 	   is changed with the setFastPropertyValue_NoBroadcast method and the bound listeners are
467 	   notified.
468 	  */
469 	virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
470 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
471 
472 	/**
473 	   @exception com::sun::star::beans::UnknownPropertyException
474          if the property with the handle nHandle does not exist.
475 	 */
476 	virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle )
477 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
478 
479 	// XMultiPropertySet
480 	virtual void SAL_CALL setPropertyValues(
481 		const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
482 		const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values )
483 		throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
484 
485 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues(
486 		const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames )
487 		throw(::com::sun::star::uno::RuntimeException);
488 
489 	virtual void SAL_CALL addPropertiesChangeListener(
490 		const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
491 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
492 		throw(::com::sun::star::uno::RuntimeException);
493 
494 	virtual void SAL_CALL removePropertiesChangeListener(
495 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
496 		throw(::com::sun::star::uno::RuntimeException);
497 
498 	virtual void SAL_CALL firePropertiesChangeEvent(
499 		const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
500 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > & Listener )
501 		throw(::com::sun::star::uno::RuntimeException);
502 	/**
503 	   The property sequence is created in the call. The interface isn't used after the call.
504 	 */
505 	static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
506 		createPropertySetInfo( IPropertyArrayHelper & rProperties ) SAL_THROW( () );
507 protected:
508 	/**
509 	   This method fire events to all registered property listeners.
510 	   @param pnHandles		the id's of the properties that changed.
511 	   @param pNewValues	the new values of the properties.
512 	   @param pOldValues	the old values of the properties.
513 	   @param nCount		the number of elements in the arrays pnHandles, pNewValues and pOldValues.
514 	   @param bVetoable true means fire to VetoableChangeListener, false means fire to
515 	  			XPropertyChangedListener and XMultiPropertyChangedListener.
516 	 */
517 	void SAL_CALL fire(
518 		sal_Int32 * pnHandles,
519 		const ::com::sun::star::uno::Any * pNewValues,
520 		const ::com::sun::star::uno::Any * pOldValues,
521 		sal_Int32 nCount,
522 		sal_Bool bVetoable );
523 
524 	/**
525 	   Set multiple properties with the handles.
526 	   @param nSeqLen	the length of the arrays pHandles and Values.
527 	   @param pHandles the handles of the properties. The number of elements
528 	  		in the Values sequence is the length of the handle array. A value of -1
529 	  		of a handle means invalid property. These are ignored.
530 	   @param pValues the values of the properties.
531 	   @param nHitCount the number of valid entries in the handle array.
532 	 */
533 	void SAL_CALL setFastPropertyValues(
534 		sal_Int32 nSeqLen,
535 		sal_Int32 * pHandles,
536 		const ::com::sun::star::uno::Any * pValues,
537 		sal_Int32 nHitCount )
538 		SAL_THROW( (::com::sun::star::uno::Exception) );
539 
540 	/**
541 	   This abstract method must return the name to index table. This table contains all property
542 	   names and types of this object. The method is not implemented in this class.
543 	 */
544 	virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
545 
546 	/**
547 	   Converted the value rValue and return the result in rConvertedValue and the
548 	   old value in rOldValue. A IllegalArgumentException is thrown.
549 	   The method is not implemented in this class. After this call the vetoable
550 	   listeners are notified.
551 
552 	   @param rConvertedValue the converted value. Only set if return is true.
553 	   @param rOldValue the old value. Only set if return is true.
554 	   @param nHandle the handle of the property.
555 	   @return true if the value converted.
556 	 */
557 	virtual sal_Bool SAL_CALL convertFastPropertyValue(
558 		::com::sun::star::uno::Any & rConvertedValue,
559 		::com::sun::star::uno::Any & rOldValue,
560 		sal_Int32 nHandle,
561 		const ::com::sun::star::uno::Any& rValue )
562 		throw (::com::sun::star::lang::IllegalArgumentException) = 0;
563 
564 	/** The same as setFastProperyValue; nHandle is always valid.
565         The changes must not be broadcasted in this method.
566         The method is implemented in a derived class.
567 
568         @attention
569         Although you are permitted to throw any UNO exception, only the following
570         are valid for usage:
571         -- ::com::sun::star::beans::UnknownPropertyException
572         -- ::com::sun::star::beans::PropertyVetoException
573         -- ::com::sun::star::lang::IllegalArgumentException
574         -- ::com::sun::star::lang::WrappedTargetException
575         -- ::com::sun::star::uno::RuntimeException
576 
577         @param nHandle
578                handle
579         @param rValue
580                value
581     */
582 	virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
583 		sal_Int32 nHandle,
584 		const ::com::sun::star::uno::Any& rValue )
585 		throw (::com::sun::star::uno::Exception) = 0;
586 	/**
587 	   The same as getFastProperyValue, but return the value through rValue and nHandle
588 	   is always valid.
589 	   The method is not implemented in this class.
590 	 */
591 	virtual void SAL_CALL getFastPropertyValue(
592 		::com::sun::star::uno::Any& rValue,
593 		sal_Int32 nHandle ) const = 0;
594 
595     /** sets an dependent property's value
596 
597         <p>Sometimes setting a given property needs to implicitly modify another property's value. Calling |setPropertyValue|
598         from within |setFastPropertyValue_NoBroadcast| is not an option here, as it would notify the property listeners
599         while our mutex is still locked. Setting the dependent property's value directly (e.g. by calling |setFastPropertyValue_NoBroadcast|
600         recursively) is not an option, too, since it would miss firing the property change event.</p>
601 
602         <p>So, in such cases, you use |setDependentFastPropertyValue| from within |setFastPropertyValue_NoBroadcast|.
603         It will convert and actually set the property value (invoking |convertFastPropertyValue| and |setFastPropertyValue_NoBroadcast|
604         for the given handle and value), and add the property change event to the list of events to be notified
605         when the bottom-most |setFastPropertyValue_NoBroadcast| on the stack returns.</p>
606 
607         <p><strong>Note</strong>: The method will <em>not</em> invoke veto listeners for the property.</p>
608 
609         <p><strong>Note</strong>: It's the caller's responsibility to ensure that our mutex is locked. This is
610         canonically given when the method is invoked from within |setFastPropertyValue_NoBroadcast|, in other
611         contexts, you might need to take own measures.</p>
612     */
613     void    setDependentFastPropertyValue(
614                 sal_Int32 i_handle,
615                 const ::com::sun::star::uno::Any& i_value
616             );
617 
618 	/** The common data of a broadcaster. Use the mutex, disposing state and the listener container. */
619 	OBroadcastHelper	&rBHelper;
620 	/**
621 	   Container for the XProperyChangedListener. The listeners are inserted by handle.
622 	 */
623 	OMultiTypeInterfaceContainerHelperInt32 aBoundLC;
624 	/**
625 	   Container for the XPropertyVetoableListener. The listeners are inserted by handle.
626 	 */
627 	OMultiTypeInterfaceContainerHelperInt32 aVetoableLC;
628 
629     class Impl;
630 
631     /** reserved for future use. finally, the future has arrived...
632      */
633     const std::auto_ptr<Impl> m_pReserved;
634 
635 private:
636 	OPropertySetHelper( const OPropertySetHelper & ) SAL_THROW( () );
637 	OPropertySetHelper &	operator = ( const OPropertySetHelper & ) SAL_THROW( () );
638 
639     /** notifies the given changes in property's values, <em>plus</em> all property changes collected during recent
640         |setDependentFastPropertyValue| calls.
641     */
642     void    impl_fireAll(
643 		        sal_Int32* i_handles,
644 		        const ::com::sun::star::uno::Any * i_newValues,
645 		        const ::com::sun::star::uno::Any * i_oldValues,
646 		        sal_Int32 i_count
647             );
648 
649 public:
650 // Suppress warning about virtual functions but non-virtual destructor:
651 #if defined __GNUC__
652 #pragma GCC system_header
653 #elif defined _MSC_VER
654 #pragma warning(push)
655 #pragma warning(disable: 4265)
656 #endif
657 	/**
658 	   You must call disposing before destruction.
659 	 */
660 	~OPropertySetHelper() SAL_THROW( () );
661 };
662 #if defined _MSC_VER
663 #pragma warning(pop)
664 #endif
665 
666 } // end namespace cppuhelper
667 #endif	//
668 
669