LibreOffice
LibreOffice 4.1 SDK 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  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
21 #define INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
22 
23 #include "sal/config.h"
24 #include "com/sun/star/beans/PropertyVetoException.hpp"
25 #include "com/sun/star/beans/UnknownPropertyException.hpp"
26 #include "com/sun/star/beans/XFastPropertySet.hpp"
27 #include "com/sun/star/beans/XPropertyAccess.hpp"
28 #include "com/sun/star/beans/XPropertySet.hpp"
29 #include "com/sun/star/lang/IllegalArgumentException.hpp"
30 #include "com/sun/star/lang/WrappedTargetException.hpp"
32 #include "com/sun/star/uno/RuntimeException.hpp"
34 #include "sal/types.h"
35 #include "cppuhelperdllapi.h"
36 
37 namespace com { namespace sun { namespace star {
38  namespace beans {
39  class XPropertyChangeListener;
40  class XPropertySetInfo;
41  class XVetoableChangeListener;
42  struct PropertyValue;
43  }
44  namespace uno {
45  class Any;
46  class Type;
47  class XComponentContext;
48  }
49 } } }
50 namespace rtl { class OUString; }
51 
52 namespace cppu {
53 
54 template< typename T > class PropertySetMixin;
55 
56 // Suppress warnings about virtual functions but non-virtual destructor:
57 #if defined _MSC_VER
58 #pragma warning(push)
59 #pragma warning(disable: 4265)
60 #endif
61 
80 #if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY && HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE \
81  && !defined __clang__
82 #pragma GCC diagnostic push
83 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
84 #endif
86  public com::sun::star::beans::XPropertySet,
87  public com::sun::star::beans::XFastPropertySet,
88  public com::sun::star::beans::XPropertyAccess
89 {
90 protected:
96  enum Implements {
101  IMPLEMENTS_PROPERTY_SET = 1,
102 
108  IMPLEMENTS_FAST_PROPERTY_SET = 2,
109 
115  IMPLEMENTS_PROPERTY_ACCESS = 4
116  };
117 
131  public:
137  BoundListeners();
138 
144  ~BoundListeners();
145 
156  void notify() const;
157 
158  private:
159  BoundListeners( const BoundListeners&); // not defined
160  void operator=( const BoundListeners&); // not defined
161 
162  class Impl;
163  Impl * m_impl;
164 
165  friend class PropertySetMixinImpl;
166  };
167 
227  void prepareSet(
228  rtl::OUString const & propertyName,
229  com::sun::star::uno::Any const & oldValue,
230  com::sun::star::uno::Any const & newValue,
231  BoundListeners * boundListeners);
232 
247  void dispose();
248 
262  virtual com::sun::star::uno::Any SAL_CALL queryInterface(
263  com::sun::star::uno::Type const & type)
264  throw (com::sun::star::uno::RuntimeException);
265 
266  // @see com::sun::star::beans::XPropertySet::getPropertySetInfo
267  virtual
269  SAL_CALL getPropertySetInfo() throw (com::sun::star::uno::RuntimeException);
270 
271  // @see com::sun::star::beans::XPropertySet::setPropertyValue
272  virtual void SAL_CALL setPropertyValue(
273  rtl::OUString const & propertyName,
274  com::sun::star::uno::Any const & value)
275  throw (
276  com::sun::star::beans::UnknownPropertyException,
277  com::sun::star::beans::PropertyVetoException,
278  com::sun::star::lang::IllegalArgumentException,
279  com::sun::star::lang::WrappedTargetException,
280  com::sun::star::uno::RuntimeException);
281 
282  // @see com::sun::star::beans::XPropertySet::getPropertyValue
283  virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(
284  rtl::OUString const & propertyName)
285  throw (
286  com::sun::star::beans::UnknownPropertyException,
287  com::sun::star::lang::WrappedTargetException,
288  com::sun::star::uno::RuntimeException);
289 
299  virtual void SAL_CALL addPropertyChangeListener(
300  rtl::OUString const & propertyName,
301  com::sun::star::uno::Reference<
302  com::sun::star::beans::XPropertyChangeListener > const & listener)
303  throw (
304  com::sun::star::beans::UnknownPropertyException,
305  com::sun::star::lang::WrappedTargetException,
306  com::sun::star::uno::RuntimeException);
307 
308  // @see com::sun::star::beans::XPropertySet::removePropertyChangeListener
309  virtual void SAL_CALL removePropertyChangeListener(
310  rtl::OUString const & propertyName,
311  com::sun::star::uno::Reference<
312  com::sun::star::beans::XPropertyChangeListener > const & listener)
313  throw (
314  com::sun::star::beans::UnknownPropertyException,
315  com::sun::star::lang::WrappedTargetException,
316  com::sun::star::uno::RuntimeException);
317 
327  virtual void SAL_CALL addVetoableChangeListener(
328  rtl::OUString const & propertyName,
329  com::sun::star::uno::Reference<
330  com::sun::star::beans::XVetoableChangeListener > const & listener)
331  throw (
332  com::sun::star::beans::UnknownPropertyException,
333  com::sun::star::lang::WrappedTargetException,
334  com::sun::star::uno::RuntimeException);
335 
336  // @see com::sun::star::beans::XPropertySet::removeVetoableChangeListener
337  virtual void SAL_CALL removeVetoableChangeListener(
338  rtl::OUString const & propertyName,
339  com::sun::star::uno::Reference<
340  com::sun::star::beans::XVetoableChangeListener > const & listener)
341  throw (
342  com::sun::star::beans::UnknownPropertyException,
343  com::sun::star::lang::WrappedTargetException,
344  com::sun::star::uno::RuntimeException);
345 
346  // @see com::sun::star::beans::XFastPropertySet::setFastPropertyValue
347  virtual void SAL_CALL setFastPropertyValue(
348  sal_Int32 handle, com::sun::star::uno::Any const & value)
349  throw (
350  com::sun::star::beans::UnknownPropertyException,
351  com::sun::star::beans::PropertyVetoException,
352  com::sun::star::lang::IllegalArgumentException,
353  com::sun::star::lang::WrappedTargetException,
354  com::sun::star::uno::RuntimeException);
355 
356  // @see com::sun::star::beans::XFastPropertySet::getFastPropertyValue
357  virtual com::sun::star::uno::Any SAL_CALL getFastPropertyValue(
358  sal_Int32 handle)
359  throw (
360  com::sun::star::beans::UnknownPropertyException,
361  com::sun::star::lang::WrappedTargetException,
362  com::sun::star::uno::RuntimeException);
363 
364  // @see com::sun::star::beans::XPropertyAccess::getPropertyValues
365  virtual
366  com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
367  SAL_CALL getPropertyValues() throw (com::sun::star::uno::RuntimeException);
368 
369  // @see com::sun::star::beans::XPropertyAccess::setPropertyValues
370  virtual void SAL_CALL setPropertyValues(
371  com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
372  const & props)
373  throw (
374  com::sun::star::beans::UnknownPropertyException,
375  com::sun::star::beans::PropertyVetoException,
376  com::sun::star::lang::IllegalArgumentException,
377  com::sun::star::lang::WrappedTargetException,
378  com::sun::star::uno::RuntimeException);
379 
380 private:
381  PropertySetMixinImpl( const PropertySetMixinImpl&); // not defined
382  void operator=( const PropertySetMixinImpl&); // not defined
383 
384  PropertySetMixinImpl(
385  com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
386  const & context,
387  Implements implements,
388  com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional,
389  com::sun::star::uno::Type const & type);
390 
391  class Impl;
392  Impl * m_impl;
393 
394  friend class Impl;
395  template< typename T > friend class PropertySetMixin;
396 
397  ~PropertySetMixinImpl();
398 
399  void checkUnknown(rtl::OUString const & propertyName);
400 };
401 #if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY && HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE \
402  && !defined __clang__
403 #pragma GCC diagnostic pop
404 #endif
405 
418 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
419 protected:
462  const & context,
463  Implements implements,
464  com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional):
465  PropertySetMixinImpl(
466  context, implements, absentOptional, T::static_type())
467  {}
468 
475 
476 private:
477  PropertySetMixin( const PropertySetMixin&); // not defined
478  void operator=( const PropertySetMixin&); // not defined
479 };
480 
481 #if defined _MSC_VER
482 #pragma warning(pop)
483 #endif
484 
485 }
486 
487 #endif
488 
489 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:96
A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute s...
Definition: propertysetmixin.hxx:130
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:54
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32
inline::com::sun::star::uno::Any queryInterface(const ::com::sun::star::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
PropertySetMixin(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &context, Implements implements, com::sun::star::uno::Sequence< rtl::OUString > const &absentOptional)
The constructor.
Definition: propertysetmixin.hxx:460
Template C++ class representing an IDL sequence.
Definition: unotype.hxx:33
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:87
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:85
C++ class representing an IDL any.
Definition: Any.h:46
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:474
C++ class representing an IDL meta type.
Definition: Type.h:55