LibreOffice
LibreOffice 6.1 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 
77 #if defined __GNUC__ && !defined __clang__
78 #pragma GCC diagnostic push
79 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
80 #endif
82  public css::beans::XPropertySet,
83  public css::beans::XFastPropertySet,
84  public css::beans::XPropertyAccess
85 {
86 protected:
92  enum Implements {
97  IMPLEMENTS_PROPERTY_SET = 1,
98 
104  IMPLEMENTS_FAST_PROPERTY_SET = 2,
105 
111  IMPLEMENTS_PROPERTY_ACCESS = 4
112  };
113 
127  public:
133  BoundListeners();
134 
140  ~BoundListeners();
141 
152  void notify() const;
153 
154  private:
156  void operator=( const BoundListeners&) SAL_DELETED_FUNCTION;
157 
158  class Impl;
159  Impl * m_impl;
160 
161  friend class PropertySetMixinImpl;
162  };
163 
223  void prepareSet(
224  rtl::OUString const & propertyName,
225  css::uno::Any const & oldValue,
226  css::uno::Any const & newValue,
227  BoundListeners * boundListeners);
228 
243  void dispose();
244 
258  virtual css::uno::Any SAL_CALL queryInterface(
259  css::uno::Type const & type) SAL_OVERRIDE;
260 
261  // @see css::beans::XPropertySet::getPropertySetInfo
262  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() SAL_OVERRIDE;
263 
264  // @see css::beans::XPropertySet::setPropertyValue
265  virtual void SAL_CALL setPropertyValue(
266  rtl::OUString const & propertyName,
267  css::uno::Any const & value) SAL_OVERRIDE;
268 
269  // @see css::beans::XPropertySet::getPropertyValue
270  virtual css::uno::Any SAL_CALL getPropertyValue(
271  rtl::OUString const & propertyName) SAL_OVERRIDE;
272 
282  virtual void SAL_CALL addPropertyChangeListener(
283  rtl::OUString const & propertyName,
284  css::uno::Reference<
285  css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
286 
287  // @see css::beans::XPropertySet::removePropertyChangeListener
288  virtual void SAL_CALL removePropertyChangeListener(
289  rtl::OUString const & propertyName,
290  css::uno::Reference<
291  css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
292 
302  virtual void SAL_CALL addVetoableChangeListener(
303  rtl::OUString const & propertyName,
304  css::uno::Reference<
305  css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
306 
307  // @see css::beans::XPropertySet::removeVetoableChangeListener
308  virtual void SAL_CALL removeVetoableChangeListener(
309  rtl::OUString const & propertyName,
310  css::uno::Reference<
311  css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
312 
313  // @see css::beans::XFastPropertySet::setFastPropertyValue
314  virtual void SAL_CALL setFastPropertyValue(
315  sal_Int32 handle, css::uno::Any const & value) SAL_OVERRIDE;
316 
317  // @see css::beans::XFastPropertySet::getFastPropertyValue
318  virtual css::uno::Any SAL_CALL getFastPropertyValue(
319  sal_Int32 handle) SAL_OVERRIDE;
320 
321  // @see css::beans::XPropertyAccess::getPropertyValues
322  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() SAL_OVERRIDE;
323 
324  // @see css::beans::XPropertyAccess::setPropertyValues
325  virtual void SAL_CALL setPropertyValues(
326  css::uno::Sequence< css::beans::PropertyValue > const & props) SAL_OVERRIDE;
327 
328 private:
330  void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
331 
333  css::uno::Reference< css::uno::XComponentContext > const & context,
334  Implements implements,
335  css::uno::Sequence< rtl::OUString > const & absentOptional,
336  css::uno::Type const & type);
337 
338  class Impl;
339  Impl * m_impl;
340 
341  friend class Impl;
342  template< typename T > friend class PropertySetMixin;
343 
345 
346  void checkUnknown(rtl::OUString const & propertyName);
347 };
348 
361 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
362 protected:
404  css::uno::Reference< css::uno::XComponentContext > const & context,
405  Implements implements,
406  css::uno::Sequence< rtl::OUString > const & absentOptional):
408  context, implements, absentOptional, T::static_type())
409  {}
410 
417 
418 private:
420  void operator=( const PropertySetMixin&) SAL_DELETED_FUNCTION;
421 };
422 #if defined __GNUC__ && !defined __clang__
423 #pragma GCC diagnostic pop
424 #endif
425 
426 }
427 
428 #endif
429 
430 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:407
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:57
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:416
A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute s...
Definition: propertysetmixin.hxx:126
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:394
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:121
Definition: types.h:375
Definition: bootstrap.hxx:29
PropertySetMixin(css::uno::Reference< css::uno::XComponentContext > const &context, Implements implements, css::uno::Sequence< rtl::OUString > const &absentOptional)
The constructor.
Definition: propertysetmixin.hxx:403
Definition: Enterable.hxx:26
Definition: types.h:375
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:81
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:92