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