LibreOffice
LibreOffice 6.0 SDK C/C++ API Reference
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 
25 #include <exception>
26 
27 #include <com/sun/star/beans/PropertyVetoException.hpp>
28 #include <com/sun/star/beans/UnknownPropertyException.hpp>
29 #include <com/sun/star/beans/XFastPropertySet.hpp>
30 #include <com/sun/star/beans/XPropertyAccess.hpp>
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/lang/IllegalArgumentException.hpp>
33 #include <com/sun/star/lang/WrappedTargetException.hpp>
35 #include <com/sun/star/uno/RuntimeException.hpp>
37 #include <sal/types.h>
39 
40 namespace com { namespace sun { namespace star {
41  namespace beans {
42  class XPropertyChangeListener;
43  class XPropertySetInfo;
44  class XVetoableChangeListener;
45  struct PropertyValue;
46  }
47  namespace uno {
48  class Any;
49  class Type;
50  class XComponentContext;
51  }
52 } } }
53 namespace rtl { class OUString; }
54 
55 namespace cppu {
56 
57 template< typename T > class PropertySetMixin;
58 
59 // Suppress warnings about virtual functions but non-virtual destructor:
60 #if defined _MSC_VER
61 #pragma warning(push)
62 #pragma warning(disable: 4265)
63 #endif
64 
83 #if defined __GNUC__ && !defined __clang__
84 #pragma GCC diagnostic push
85 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
86 #endif
88  public css::beans::XPropertySet,
89  public css::beans::XFastPropertySet,
90  public css::beans::XPropertyAccess
91 {
92 protected:
98  enum Implements {
103  IMPLEMENTS_PROPERTY_SET = 1,
104 
110  IMPLEMENTS_FAST_PROPERTY_SET = 2,
111 
117  IMPLEMENTS_PROPERTY_ACCESS = 4
118  };
119 
133  public:
139  BoundListeners();
140 
146  ~BoundListeners();
147 
158  void notify() const;
159 
160  private:
162  void operator=( const BoundListeners&) SAL_DELETED_FUNCTION;
163 
164  class Impl;
165  Impl * m_impl;
166 
167  friend class PropertySetMixinImpl;
168  };
169 
229  void prepareSet(
230  rtl::OUString const & propertyName,
231  css::uno::Any const & oldValue,
232  css::uno::Any const & newValue,
233  BoundListeners * boundListeners);
234 
249  void dispose();
250 
264  virtual css::uno::Any SAL_CALL queryInterface(
265  css::uno::Type const & type) SAL_OVERRIDE;
266 
267  // @see css::beans::XPropertySet::getPropertySetInfo
268  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() SAL_OVERRIDE;
269 
270  // @see css::beans::XPropertySet::setPropertyValue
271  virtual void SAL_CALL setPropertyValue(
272  rtl::OUString const & propertyName,
273  css::uno::Any const & value) SAL_OVERRIDE;
274 
275  // @see css::beans::XPropertySet::getPropertyValue
276  virtual css::uno::Any SAL_CALL getPropertyValue(
277  rtl::OUString const & propertyName) SAL_OVERRIDE;
278 
288  virtual void SAL_CALL addPropertyChangeListener(
289  rtl::OUString const & propertyName,
290  css::uno::Reference<
291  css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
292 
293  // @see css::beans::XPropertySet::removePropertyChangeListener
294  virtual void SAL_CALL removePropertyChangeListener(
295  rtl::OUString const & propertyName,
296  css::uno::Reference<
297  css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
298 
308  virtual void SAL_CALL addVetoableChangeListener(
309  rtl::OUString const & propertyName,
310  css::uno::Reference<
311  css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
312 
313  // @see css::beans::XPropertySet::removeVetoableChangeListener
314  virtual void SAL_CALL removeVetoableChangeListener(
315  rtl::OUString const & propertyName,
316  css::uno::Reference<
317  css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
318 
319  // @see css::beans::XFastPropertySet::setFastPropertyValue
320  virtual void SAL_CALL setFastPropertyValue(
321  sal_Int32 handle, css::uno::Any const & value) SAL_OVERRIDE;
322 
323  // @see css::beans::XFastPropertySet::getFastPropertyValue
324  virtual css::uno::Any SAL_CALL getFastPropertyValue(
325  sal_Int32 handle) SAL_OVERRIDE;
326 
327  // @see css::beans::XPropertyAccess::getPropertyValues
328  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() SAL_OVERRIDE;
329 
330  // @see css::beans::XPropertyAccess::setPropertyValues
331  virtual void SAL_CALL setPropertyValues(
332  css::uno::Sequence< css::beans::PropertyValue > const & props) SAL_OVERRIDE;
333 
334 private:
336  void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
337 
339  css::uno::Reference< css::uno::XComponentContext > const & context,
340  Implements implements,
341  css::uno::Sequence< rtl::OUString > const & absentOptional,
342  css::uno::Type const & type);
343 
344  class Impl;
345  Impl * m_impl;
346 
347  friend class Impl;
348  template< typename T > friend class PropertySetMixin;
349 
351 
352  void checkUnknown(rtl::OUString const & propertyName);
353 };
354 
367 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
368 protected:
410  css::uno::Reference< css::uno::XComponentContext > const & context,
411  Implements implements,
412  css::uno::Sequence< rtl::OUString > const & absentOptional):
413  PropertySetMixinImpl(
414  context, implements, absentOptional, T::static_type())
415  {}
416 
423 
424 private:
425  PropertySetMixin( const PropertySetMixin&) SAL_DELETED_FUNCTION;
426  void operator=( const PropertySetMixin&) SAL_DELETED_FUNCTION;
427 };
428 #if defined __GNUC__ && !defined __clang__
429 #pragma GCC diagnostic pop
430 #endif
431 
432 #if defined _MSC_VER
433 #pragma warning(pop)
434 #endif
435 
436 }
437 
438 #endif
439 
440 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute s...
Definition: propertysetmixin.hxx:132
PropertySetMixin(css::uno::Reference< css::uno::XComponentContext > const &context, Implements implements, css::uno::Sequence< rtl::OUString > const &absentOptional)
The constructor.
Definition: propertysetmixin.hxx:409
Definition: Enterable.hxx:26
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:402
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:415
Definition: types.h:383
Definition: types.h:383
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:98
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:422
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
Definition: bootstrap.hxx:29
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:120
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:87
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:57