My Project
UDK 3.2.7 C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
propertysetmixin.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 #ifndef INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
30 #define INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX \
31  INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
32 
33 #include "sal/config.h"
34 #include "com/sun/star/beans/PropertyVetoException.hpp"
35 #include "com/sun/star/beans/UnknownPropertyException.hpp"
36 #include "com/sun/star/beans/XFastPropertySet.hpp"
37 #include "com/sun/star/beans/XPropertyAccess.hpp"
38 #include "com/sun/star/beans/XPropertySet.hpp"
39 #include "com/sun/star/lang/IllegalArgumentException.hpp"
40 #include "com/sun/star/lang/WrappedTargetException.hpp"
42 #include "com/sun/star/uno/RuntimeException.hpp"
44 #include "sal/types.h"
45 #include "cppuhelperdllapi.h"
46 
47 namespace com { namespace sun { namespace star {
48  namespace beans {
49  class XPropertyChangeListener;
50  class XPropertySetInfo;
51  class XVetoableChangeListener;
52  struct PropertyValue;
53  }
54  namespace uno {
55  class Any;
56  class Type;
57  class XComponentContext;
58  }
59 } } }
60 namespace rtl { class OUString; }
61 
62 namespace cppu {
63 
64 template< typename T > class PropertySetMixin;
65 
66 // Suppress warnings about virtual functions but non-virtual destructor:
67 #if defined _MSC_VER
68 #pragma warning(push)
69 #pragma warning(disable: 4265)
70 #endif
71 
90 #if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
91 #pragma GCC diagnostic push
92 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
93 #endif
95  public com::sun::star::beans::XPropertySet,
96  public com::sun::star::beans::XFastPropertySet,
97  public com::sun::star::beans::XPropertyAccess
98 {
99 protected:
105  enum Implements {
110  IMPLEMENTS_PROPERTY_SET = 1,
111 
117  IMPLEMENTS_FAST_PROPERTY_SET = 2,
118 
124  IMPLEMENTS_PROPERTY_ACCESS = 4
125  };
126 
140  public:
146  BoundListeners();
147 
153  ~BoundListeners();
154 
165  void notify() const;
166 
167  private:
168  BoundListeners(BoundListeners &); // not defined
169  void operator =(BoundListeners); // not defined
170 
171  class Impl;
172  Impl * m_impl;
173 
174  friend class PropertySetMixinImpl;
175  };
176 
236  void prepareSet(
237  rtl::OUString const & propertyName,
238  com::sun::star::uno::Any const & oldValue,
239  com::sun::star::uno::Any const & newValue,
240  BoundListeners * boundListeners);
241 
256  void dispose();
257 
271  virtual com::sun::star::uno::Any SAL_CALL queryInterface(
272  com::sun::star::uno::Type const & type)
273  throw (com::sun::star::uno::RuntimeException);
274 
275  // @see com::sun::star::beans::XPropertySet::getPropertySetInfo
276  virtual
278  SAL_CALL getPropertySetInfo() throw (com::sun::star::uno::RuntimeException);
279 
280  // @see com::sun::star::beans::XPropertySet::setPropertyValue
281  virtual void SAL_CALL setPropertyValue(
282  rtl::OUString const & propertyName,
283  com::sun::star::uno::Any const & value)
284  throw (
285  com::sun::star::beans::UnknownPropertyException,
286  com::sun::star::beans::PropertyVetoException,
287  com::sun::star::lang::IllegalArgumentException,
288  com::sun::star::lang::WrappedTargetException,
289  com::sun::star::uno::RuntimeException);
290 
291  // @see com::sun::star::beans::XPropertySet::getPropertyValue
292  virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(
293  rtl::OUString const & propertyName)
294  throw (
295  com::sun::star::beans::UnknownPropertyException,
296  com::sun::star::lang::WrappedTargetException,
297  com::sun::star::uno::RuntimeException);
298 
308  virtual void SAL_CALL addPropertyChangeListener(
309  rtl::OUString const & propertyName,
310  com::sun::star::uno::Reference<
311  com::sun::star::beans::XPropertyChangeListener > const & listener)
312  throw (
313  com::sun::star::beans::UnknownPropertyException,
314  com::sun::star::lang::WrappedTargetException,
315  com::sun::star::uno::RuntimeException);
316 
317  // @see com::sun::star::beans::XPropertySet::removePropertyChangeListener
318  virtual void SAL_CALL removePropertyChangeListener(
319  rtl::OUString const & propertyName,
320  com::sun::star::uno::Reference<
321  com::sun::star::beans::XPropertyChangeListener > const & listener)
322  throw (
323  com::sun::star::beans::UnknownPropertyException,
324  com::sun::star::lang::WrappedTargetException,
325  com::sun::star::uno::RuntimeException);
326 
336  virtual void SAL_CALL addVetoableChangeListener(
337  rtl::OUString const & propertyName,
338  com::sun::star::uno::Reference<
339  com::sun::star::beans::XVetoableChangeListener > const & listener)
340  throw (
341  com::sun::star::beans::UnknownPropertyException,
342  com::sun::star::lang::WrappedTargetException,
343  com::sun::star::uno::RuntimeException);
344 
345  // @see com::sun::star::beans::XPropertySet::removeVetoableChangeListener
346  virtual void SAL_CALL removeVetoableChangeListener(
347  rtl::OUString const & propertyName,
348  com::sun::star::uno::Reference<
349  com::sun::star::beans::XVetoableChangeListener > const & listener)
350  throw (
351  com::sun::star::beans::UnknownPropertyException,
352  com::sun::star::lang::WrappedTargetException,
353  com::sun::star::uno::RuntimeException);
354 
355  // @see com::sun::star::beans::XFastPropertySet::setFastPropertyValue
356  virtual void SAL_CALL setFastPropertyValue(
357  sal_Int32 handle, com::sun::star::uno::Any const & value)
358  throw (
359  com::sun::star::beans::UnknownPropertyException,
360  com::sun::star::beans::PropertyVetoException,
361  com::sun::star::lang::IllegalArgumentException,
362  com::sun::star::lang::WrappedTargetException,
363  com::sun::star::uno::RuntimeException);
364 
365  // @see com::sun::star::beans::XFastPropertySet::getFastPropertyValue
366  virtual com::sun::star::uno::Any SAL_CALL getFastPropertyValue(
367  sal_Int32 handle)
368  throw (
369  com::sun::star::beans::UnknownPropertyException,
370  com::sun::star::lang::WrappedTargetException,
371  com::sun::star::uno::RuntimeException);
372 
373  // @see com::sun::star::beans::XPropertyAccess::getPropertyValues
374  virtual
375  com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
376  SAL_CALL getPropertyValues() throw (com::sun::star::uno::RuntimeException);
377 
378  // @see com::sun::star::beans::XPropertyAccess::setPropertyValues
379  virtual void SAL_CALL setPropertyValues(
380  com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
381  const & props)
382  throw (
383  com::sun::star::beans::UnknownPropertyException,
384  com::sun::star::beans::PropertyVetoException,
385  com::sun::star::lang::IllegalArgumentException,
386  com::sun::star::lang::WrappedTargetException,
387  com::sun::star::uno::RuntimeException);
388 
389 private:
390  PropertySetMixinImpl(PropertySetMixinImpl &); // not defined
391  void operator =(PropertySetMixinImpl &); // not defined
392 
393  PropertySetMixinImpl(
394  com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
395  const & context,
396  Implements implements,
397  com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional,
398  com::sun::star::uno::Type const & type);
399 
400  class Impl;
401  Impl * m_impl;
402 
403  friend class Impl;
404  template< typename T > friend class PropertySetMixin;
405 
406  ~PropertySetMixinImpl();
407 
408  void checkUnknown(rtl::OUString const & propertyName);
409 };
410 #if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
411 #pragma GCC diagnostic pop
412 #endif
413 
426 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
427 protected:
468  PropertySetMixin(
470  const & context,
471  Implements implements,
472  com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional):
473  PropertySetMixinImpl(
474  context, implements, absentOptional, T::static_type())
475  {}
476 
483 
484 private:
485  PropertySetMixin(PropertySetMixin &); // not defined
486  void operator =(PropertySetMixin &); // not defined
487 };
488 
489 #if defined _MSC_VER
490 #pragma warning(pop)
491 #endif
492 
493 }
494 
495 #endif
496 
497 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */