00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _CPPUHELPER_PROPSHLP_HXX
00021 #define _CPPUHELPER_PROPSHLP_HXX
00022
00023 #include <rtl/alloc.h>
00024
00025 #include <cppuhelper/interfacecontainer.hxx>
00026
00027 #include <com/sun/star/beans/XPropertySet.hpp>
00028 #include <com/sun/star/beans/XPropertySetOption.hpp>
00029 #include <com/sun/star/beans/XMultiPropertySet.hpp>
00030 #include <com/sun/star/beans/XFastPropertySet.hpp>
00031
00032 #include <memory>
00033 #include "cppuhelperdllapi.h"
00034
00035
00036 namespace cppu
00037 {
00038
00039
00040
00041
00042
00043
00047 class CPPUHELPER_DLLPUBLIC IPropertyArrayHelper
00048 {
00049 public:
00050
00051 inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
00052 { return ::rtl_allocateMemory( nSize ); }
00053 inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
00054 { ::rtl_freeMemory( pMem ); }
00055 inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
00056 { return pMem; }
00057 inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
00058 {}
00059
00063 virtual ~IPropertyArrayHelper();
00064
00076 virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
00077 ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) = 0;
00081 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void) = 0;
00087 virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
00088 const ::rtl::OUString& rPropertyName )
00089 throw (::com::sun::star::beans::UnknownPropertyException) = 0;
00094 virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) = 0;
00100 virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) = 0;
00106 virtual sal_Int32 SAL_CALL fillHandles(
00107 sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ) = 0;
00108 };
00109
00114 class CPPUHELPER_DLLPUBLIC OPropertyArrayHelper : public IPropertyArrayHelper
00115 {
00116 public:
00125 OPropertyArrayHelper(
00126 ::com::sun::star::beans::Property *pProps,
00127 sal_Int32 nElements ,
00128 sal_Bool bSorted = sal_True )
00129 SAL_THROW(());
00130
00137 OPropertyArrayHelper(
00138 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > & aProps,
00139 sal_Bool bSorted = sal_True )
00140 SAL_THROW(());
00141
00145 sal_Int32 SAL_CALL getCount() const SAL_THROW(());
00158 virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
00159 ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle );
00163 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void);
00169 virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
00170 const ::rtl::OUString& rPropertyName )
00171 throw (::com::sun::star::beans::UnknownPropertyException);
00176 virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName);
00182 virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName );
00188 virtual sal_Int32 SAL_CALL fillHandles(
00189 sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames );
00190
00191 protected:
00194 void * m_pReserved;
00195
00196 private:
00197 void init( sal_Bool bSorted ) SAL_THROW(());
00198
00200 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aInfos;
00201
00206 sal_Bool bRightOrdered;
00207 };
00208
00209
00210
00211
00212
00213 struct equalInt32_Impl
00214 {
00215 bool operator()(const sal_Int32 & i1 , const sal_Int32 & i2) const SAL_THROW(())
00216 { return i1 == i2; }
00217 };
00218
00219 struct hashInt32_Impl
00220 {
00221 size_t operator()(const sal_Int32 & i) const SAL_THROW(())
00222 { return i; }
00223 };
00227 class CPPUHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelperInt32
00228 {
00229 public:
00230
00231 inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
00232 { return ::rtl_allocateMemory( nSize ); }
00233 inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
00234 { ::rtl_freeMemory( pMem ); }
00235 inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
00236 { return pMem; }
00237 inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
00238 {}
00239
00247 OMultiTypeInterfaceContainerHelperInt32( ::osl::Mutex & rMutex ) SAL_THROW(());
00251 ~OMultiTypeInterfaceContainerHelperInt32() SAL_THROW(());
00252
00256 ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getContainedTypes() const SAL_THROW(());
00257
00263 OInterfaceContainerHelper * SAL_CALL getContainer( const sal_Int32 & rKey ) const SAL_THROW(());
00264
00272 sal_Int32 SAL_CALL addInterface(
00273 const sal_Int32 & rKey,
00274 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & r )
00275 SAL_THROW(());
00276
00284 sal_Int32 SAL_CALL removeInterface(
00285 const sal_Int32 & rKey,
00286 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace )
00287 SAL_THROW(());
00288
00293 void SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt ) SAL_THROW(());
00297 void SAL_CALL clear() SAL_THROW(());
00298
00299 typedef sal_Int32 keyType;
00300 private:
00301 void *m_pMap;
00302 ::osl::Mutex & rMutex;
00303
00304 inline OMultiTypeInterfaceContainerHelperInt32( const OMultiTypeInterfaceContainerHelperInt32 & ) SAL_THROW(());
00305 inline OMultiTypeInterfaceContainerHelperInt32 & operator = ( const OMultiTypeInterfaceContainerHelperInt32 & ) SAL_THROW(());
00306 };
00307
00308
00311 class IEventNotificationHook
00312 {
00313 public:
00323 virtual void fireEvents(
00324 sal_Int32 * pnHandles,
00325 sal_Int32 nCount,
00326 sal_Bool bVetoable,
00327 bool bIgnoreRuntimeExceptionsWhileFiring) = 0;
00328
00329 #if !defined _MSC_VER // public -> protected changes mangled names there
00330 protected:
00331 #endif
00332 ~IEventNotificationHook() {}
00333
00334 };
00335
00336
00337
00350 class CPPUHELPER_DLLPUBLIC OPropertySetHelper :
00351 public ::com::sun::star::beans::XMultiPropertySet,
00352 public ::com::sun::star::beans::XFastPropertySet,
00353 public ::com::sun::star::beans::XPropertySet
00354 {
00355 public:
00362 OPropertySetHelper( OBroadcastHelper & rBHelper ) SAL_THROW(());
00363
00382 OPropertySetHelper(
00383 OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring );
00384
00406 OPropertySetHelper(
00407 OBroadcastHelper & rBHelper,
00408 IEventNotificationHook *i_pFireEvents,
00409 bool bIgnoreRuntimeExceptionsWhileFiring = false);
00410
00415 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
00416 throw (::com::sun::star::uno::RuntimeException);
00417
00420 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > getTypes()
00421 throw(::com::sun::star::uno::RuntimeException);
00422
00429 void SAL_CALL disposing() SAL_THROW(());
00430
00436 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue )
00437 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);
00442 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName)
00443 throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
00445 virtual void SAL_CALL addPropertyChangeListener(
00446 const ::rtl::OUString& aPropertyName,
00447 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener)
00448 throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
00449
00451 virtual void SAL_CALL removePropertyChangeListener(
00452 const ::rtl::OUString& aPropertyName,
00453 const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertyChangeListener >& aListener)
00454 throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
00455
00457 virtual void SAL_CALL addVetoableChangeListener(
00458 const ::rtl::OUString& aPropertyName,
00459 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener)
00460 throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
00461
00463 virtual void SAL_CALL removeVetoableChangeListener(
00464 const ::rtl::OUString& aPropertyName,
00465 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener )
00466 throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
00467
00475 virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
00476 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);
00477
00482 virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle )
00483 throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
00484
00485
00486 virtual void SAL_CALL setPropertyValues(
00487 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
00488 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values )
00489 throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
00490
00491 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues(
00492 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames )
00493 throw(::com::sun::star::uno::RuntimeException);
00494
00495 virtual void SAL_CALL addPropertiesChangeListener(
00496 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
00497 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
00498 throw(::com::sun::star::uno::RuntimeException);
00499
00500 virtual void SAL_CALL removePropertiesChangeListener(
00501 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
00502 throw(::com::sun::star::uno::RuntimeException);
00503
00504 virtual void SAL_CALL firePropertiesChangeEvent(
00505 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
00506 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > & Listener )
00507 throw(::com::sun::star::uno::RuntimeException);
00508
00512 static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
00513 createPropertySetInfo( IPropertyArrayHelper & rProperties ) SAL_THROW(());
00514 protected:
00524 void SAL_CALL fire(
00525 sal_Int32 * pnHandles,
00526 const ::com::sun::star::uno::Any * pNewValues,
00527 const ::com::sun::star::uno::Any * pOldValues,
00528 sal_Int32 nCount,
00529 sal_Bool bVetoable );
00530
00540 void SAL_CALL setFastPropertyValues(
00541 sal_Int32 nSeqLen,
00542 sal_Int32 * pHandles,
00543 const ::com::sun::star::uno::Any * pValues,
00544 sal_Int32 nHitCount )
00545 SAL_THROW( (::com::sun::star::uno::Exception) );
00546
00551 virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
00552
00564 virtual sal_Bool SAL_CALL convertFastPropertyValue(
00565 ::com::sun::star::uno::Any & rConvertedValue,
00566 ::com::sun::star::uno::Any & rOldValue,
00567 sal_Int32 nHandle,
00568 const ::com::sun::star::uno::Any& rValue )
00569 throw (::com::sun::star::lang::IllegalArgumentException) = 0;
00570
00589 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
00590 sal_Int32 nHandle,
00591 const ::com::sun::star::uno::Any& rValue )
00592 throw (::com::sun::star::uno::Exception) = 0;
00598 virtual void SAL_CALL getFastPropertyValue(
00599 ::com::sun::star::uno::Any& rValue,
00600 sal_Int32 nHandle ) const = 0;
00601
00620 void setDependentFastPropertyValue(
00621 sal_Int32 i_handle,
00622 const ::com::sun::star::uno::Any& i_value
00623 );
00624
00626 OBroadcastHelper &rBHelper;
00630 OMultiTypeInterfaceContainerHelperInt32 aBoundLC;
00634 OMultiTypeInterfaceContainerHelperInt32 aVetoableLC;
00635
00636 class Impl;
00637
00640 const std::auto_ptr<Impl> m_pReserved;
00641
00642 private:
00643 OPropertySetHelper( const OPropertySetHelper & ) SAL_THROW(());
00644 OPropertySetHelper & operator = ( const OPropertySetHelper & ) SAL_THROW(());
00645
00649 void impl_fireAll(
00650 sal_Int32* i_handles,
00651 const ::com::sun::star::uno::Any * i_newValues,
00652 const ::com::sun::star::uno::Any * i_oldValues,
00653 sal_Int32 i_count
00654 );
00655
00656 #if defined _MSC_VER // public -> protected changes mangled names there
00657 public:
00658 #else
00659 protected:
00660 #endif
00661
00662 #if defined _MSC_VER
00663 #pragma warning(push)
00664 #pragma warning(disable: 4265)
00665 #endif
00666
00669 ~OPropertySetHelper() SAL_THROW(());
00670 };
00671 #if defined _MSC_VER
00672 #pragma warning(pop)
00673 #endif
00674
00678 class CPPUHELPER_DLLPUBLIC OPropertySetHelper2 : public OPropertySetHelper,
00679 public ::com::sun::star::beans::XPropertySetOption
00680 {
00681 public:
00686 explicit OPropertySetHelper2(
00687 OBroadcastHelper & rBHelper,
00688 IEventNotificationHook *i_pFireEvents = NULL,
00689 bool bIgnoreRuntimeExceptionsWhileFiring = false);
00690
00691
00692 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
00693 throw (::com::sun::star::uno::RuntimeException);
00694
00695
00696 virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
00697 throw(::com::sun::star::uno::RuntimeException);
00698
00699
00700
00701 private:
00702 OPropertySetHelper2( const OPropertySetHelper2 & ) SAL_THROW(());
00703 OPropertySetHelper2 & operator = ( const OPropertySetHelper2 & ) SAL_THROW(());
00704
00705 #if defined _MSC_VER // public -> protected changes mangled names there
00706 public:
00707 #else
00708 protected:
00709 #endif
00710
00714 virtual ~OPropertySetHelper2() SAL_THROW(());
00715 };
00716
00717 }
00718 #endif //
00719
00720
00721
00722