00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
00021 #define INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX \
00022 INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
00023
00024 #include "sal/config.h"
00025 #include "com/sun/star/beans/PropertyVetoException.hpp"
00026 #include "com/sun/star/beans/UnknownPropertyException.hpp"
00027 #include "com/sun/star/beans/XFastPropertySet.hpp"
00028 #include "com/sun/star/beans/XPropertyAccess.hpp"
00029 #include "com/sun/star/beans/XPropertySet.hpp"
00030 #include "com/sun/star/lang/IllegalArgumentException.hpp"
00031 #include "com/sun/star/lang/WrappedTargetException.hpp"
00032 #include "com/sun/star/uno/Reference.hxx"
00033 #include "com/sun/star/uno/RuntimeException.hpp"
00034 #include "com/sun/star/uno/Sequence.hxx"
00035 #include "sal/types.h"
00036 #include "cppuhelperdllapi.h"
00037
00038 namespace com { namespace sun { namespace star {
00039 namespace beans {
00040 class XPropertyChangeListener;
00041 class XPropertySetInfo;
00042 class XVetoableChangeListener;
00043 struct PropertyValue;
00044 }
00045 namespace uno {
00046 class Any;
00047 class Type;
00048 class XComponentContext;
00049 }
00050 } } }
00051 namespace rtl { class OUString; }
00052
00053 namespace cppu {
00054
00055 template< typename T > class PropertySetMixin;
00056
00057
00058 #if defined _MSC_VER
00059 #pragma warning(push)
00060 #pragma warning(disable: 4265)
00061 #endif
00062
00081 #if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
00082 #pragma GCC diagnostic push
00083 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
00084 #endif
00085 class CPPUHELPER_DLLPUBLIC PropertySetMixinImpl:
00086 public com::sun::star::beans::XPropertySet,
00087 public com::sun::star::beans::XFastPropertySet,
00088 public com::sun::star::beans::XPropertyAccess
00089 {
00090 protected:
00096 enum Implements {
00101 IMPLEMENTS_PROPERTY_SET = 1,
00102
00108 IMPLEMENTS_FAST_PROPERTY_SET = 2,
00109
00115 IMPLEMENTS_PROPERTY_ACCESS = 4
00116 };
00117
00130 class CPPUHELPER_DLLPUBLIC BoundListeners {
00131 public:
00137 BoundListeners();
00138
00144 ~BoundListeners();
00145
00156 void notify() const;
00157
00158 private:
00159 BoundListeners(BoundListeners &);
00160 void operator =(BoundListeners);
00161
00162 class Impl;
00163 Impl * m_impl;
00164
00165 friend class PropertySetMixinImpl;
00166 };
00167
00227 void prepareSet(
00228 rtl::OUString const & propertyName,
00229 com::sun::star::uno::Any const & oldValue,
00230 com::sun::star::uno::Any const & newValue,
00231 BoundListeners * boundListeners);
00232
00247 void dispose();
00248
00262 virtual com::sun::star::uno::Any SAL_CALL queryInterface(
00263 com::sun::star::uno::Type const & type)
00264 throw (com::sun::star::uno::RuntimeException);
00265
00266
00267 virtual
00268 com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >
00269 SAL_CALL getPropertySetInfo() throw (com::sun::star::uno::RuntimeException);
00270
00271
00272 virtual void SAL_CALL setPropertyValue(
00273 rtl::OUString const & propertyName,
00274 com::sun::star::uno::Any const & value)
00275 throw (
00276 com::sun::star::beans::UnknownPropertyException,
00277 com::sun::star::beans::PropertyVetoException,
00278 com::sun::star::lang::IllegalArgumentException,
00279 com::sun::star::lang::WrappedTargetException,
00280 com::sun::star::uno::RuntimeException);
00281
00282
00283 virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(
00284 rtl::OUString const & propertyName)
00285 throw (
00286 com::sun::star::beans::UnknownPropertyException,
00287 com::sun::star::lang::WrappedTargetException,
00288 com::sun::star::uno::RuntimeException);
00289
00299 virtual void SAL_CALL addPropertyChangeListener(
00300 rtl::OUString const & propertyName,
00301 com::sun::star::uno::Reference<
00302 com::sun::star::beans::XPropertyChangeListener > const & listener)
00303 throw (
00304 com::sun::star::beans::UnknownPropertyException,
00305 com::sun::star::lang::WrappedTargetException,
00306 com::sun::star::uno::RuntimeException);
00307
00308
00309 virtual void SAL_CALL removePropertyChangeListener(
00310 rtl::OUString const & propertyName,
00311 com::sun::star::uno::Reference<
00312 com::sun::star::beans::XPropertyChangeListener > const & listener)
00313 throw (
00314 com::sun::star::beans::UnknownPropertyException,
00315 com::sun::star::lang::WrappedTargetException,
00316 com::sun::star::uno::RuntimeException);
00317
00327 virtual void SAL_CALL addVetoableChangeListener(
00328 rtl::OUString const & propertyName,
00329 com::sun::star::uno::Reference<
00330 com::sun::star::beans::XVetoableChangeListener > const & listener)
00331 throw (
00332 com::sun::star::beans::UnknownPropertyException,
00333 com::sun::star::lang::WrappedTargetException,
00334 com::sun::star::uno::RuntimeException);
00335
00336
00337 virtual void SAL_CALL removeVetoableChangeListener(
00338 rtl::OUString const & propertyName,
00339 com::sun::star::uno::Reference<
00340 com::sun::star::beans::XVetoableChangeListener > const & listener)
00341 throw (
00342 com::sun::star::beans::UnknownPropertyException,
00343 com::sun::star::lang::WrappedTargetException,
00344 com::sun::star::uno::RuntimeException);
00345
00346
00347 virtual void SAL_CALL setFastPropertyValue(
00348 sal_Int32 handle, com::sun::star::uno::Any const & value)
00349 throw (
00350 com::sun::star::beans::UnknownPropertyException,
00351 com::sun::star::beans::PropertyVetoException,
00352 com::sun::star::lang::IllegalArgumentException,
00353 com::sun::star::lang::WrappedTargetException,
00354 com::sun::star::uno::RuntimeException);
00355
00356
00357 virtual com::sun::star::uno::Any SAL_CALL getFastPropertyValue(
00358 sal_Int32 handle)
00359 throw (
00360 com::sun::star::beans::UnknownPropertyException,
00361 com::sun::star::lang::WrappedTargetException,
00362 com::sun::star::uno::RuntimeException);
00363
00364
00365 virtual
00366 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
00367 SAL_CALL getPropertyValues() throw (com::sun::star::uno::RuntimeException);
00368
00369
00370 virtual void SAL_CALL setPropertyValues(
00371 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
00372 const & props)
00373 throw (
00374 com::sun::star::beans::UnknownPropertyException,
00375 com::sun::star::beans::PropertyVetoException,
00376 com::sun::star::lang::IllegalArgumentException,
00377 com::sun::star::lang::WrappedTargetException,
00378 com::sun::star::uno::RuntimeException);
00379
00380 private:
00381 PropertySetMixinImpl(PropertySetMixinImpl &);
00382 void operator =(PropertySetMixinImpl &);
00383
00384 PropertySetMixinImpl(
00385 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
00386 const & context,
00387 Implements implements,
00388 com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional,
00389 com::sun::star::uno::Type const & type);
00390
00391 class Impl;
00392 Impl * m_impl;
00393
00394 friend class Impl;
00395 template< typename T > friend class PropertySetMixin;
00396
00397 ~PropertySetMixinImpl();
00398
00399 void checkUnknown(rtl::OUString const & propertyName);
00400 };
00401 #if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
00402 #pragma GCC diagnostic pop
00403 #endif
00404
00417 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
00418 protected:
00459 PropertySetMixin(
00460 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
00461 const & context,
00462 Implements implements,
00463 com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional):
00464 PropertySetMixinImpl(
00465 context, implements, absentOptional, T::static_type())
00466 {}
00467
00473 ~PropertySetMixin() {}
00474
00475 private:
00476 PropertySetMixin(PropertySetMixin &);
00477 void operator =(PropertySetMixin &);
00478 };
00479
00480 #if defined _MSC_VER
00481 #pragma warning(pop)
00482 #endif
00483
00484 }
00485
00486 #endif
00487
00488