LibreOffice
LibreOffice 6.2 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 "com/sun/star/beans/XFastPropertySet.hpp"
26 #include "com/sun/star/beans/XPropertyAccess.hpp"
27 #include "com/sun/star/beans/XPropertySet.hpp"
30 #include "sal/types.h"
32 
33 namespace com { namespace sun { namespace star {
34  namespace beans {
35  class XPropertyChangeListener;
36  class XPropertySetInfo;
37  class XVetoableChangeListener;
38  struct PropertyValue;
39  }
40  namespace uno {
41  class Type;
42  class XComponentContext;
43  }
44 } } }
45 
46 namespace cppu {
47 
66 #if defined __GNUC__ && !defined __clang__
67 #pragma GCC diagnostic push
68 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
69 #endif
71  public css::beans::XPropertySet,
72  public css::beans::XFastPropertySet,
73  public css::beans::XPropertyAccess
74 {
75 protected:
81  enum Implements {
86  IMPLEMENTS_PROPERTY_SET = 1,
87 
93  IMPLEMENTS_FAST_PROPERTY_SET = 2,
94 
100  IMPLEMENTS_PROPERTY_ACCESS = 4
101  };
102 
116  public:
122  BoundListeners();
123 
129  ~BoundListeners();
130 
141  void notify() const;
142 
143  private:
145  void operator=( const BoundListeners&) SAL_DELETED_FUNCTION;
146 
147  class Impl;
148  Impl * m_impl;
149 
150  friend class PropertySetMixinImpl;
151  };
152 
212  void prepareSet(
213  rtl::OUString const & propertyName,
214  css::uno::Any const & oldValue,
215  css::uno::Any const & newValue,
216  BoundListeners * boundListeners);
217 
232  void dispose();
233 
247  virtual css::uno::Any SAL_CALL queryInterface(
248  css::uno::Type const & type) SAL_OVERRIDE;
249 
250  // @see css::beans::XPropertySet::getPropertySetInfo
251  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() SAL_OVERRIDE;
252 
253  // @see css::beans::XPropertySet::setPropertyValue
254  virtual void SAL_CALL setPropertyValue(
255  rtl::OUString const & propertyName,
256  css::uno::Any const & value) SAL_OVERRIDE;
257 
258  // @see css::beans::XPropertySet::getPropertyValue
259  virtual css::uno::Any SAL_CALL getPropertyValue(
260  rtl::OUString const & propertyName) SAL_OVERRIDE;
261 
271  virtual void SAL_CALL addPropertyChangeListener(
272  rtl::OUString const & propertyName,
273  css::uno::Reference<
274  css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
275 
276  // @see css::beans::XPropertySet::removePropertyChangeListener
277  virtual void SAL_CALL removePropertyChangeListener(
278  rtl::OUString const & propertyName,
279  css::uno::Reference<
280  css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
281 
291  virtual void SAL_CALL addVetoableChangeListener(
292  rtl::OUString const & propertyName,
293  css::uno::Reference<
294  css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
295 
296  // @see css::beans::XPropertySet::removeVetoableChangeListener
297  virtual void SAL_CALL removeVetoableChangeListener(
298  rtl::OUString const & propertyName,
299  css::uno::Reference<
300  css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
301 
302  // @see css::beans::XFastPropertySet::setFastPropertyValue
303  virtual void SAL_CALL setFastPropertyValue(
304  sal_Int32 handle, css::uno::Any const & value) SAL_OVERRIDE;
305 
306  // @see css::beans::XFastPropertySet::getFastPropertyValue
307  virtual css::uno::Any SAL_CALL getFastPropertyValue(
308  sal_Int32 handle) SAL_OVERRIDE;
309 
310  // @see css::beans::XPropertyAccess::getPropertyValues
311  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() SAL_OVERRIDE;
312 
313  // @see css::beans::XPropertyAccess::setPropertyValues
314  virtual void SAL_CALL setPropertyValues(
315  css::uno::Sequence< css::beans::PropertyValue > const & props) SAL_OVERRIDE;
316 
317 private:
319  void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
320 
322  css::uno::Reference< css::uno::XComponentContext > const & context,
323  Implements implements,
324  css::uno::Sequence< rtl::OUString > const & absentOptional,
325  css::uno::Type const & type);
326 
327  class Impl;
328  Impl * m_impl;
329 
330  friend class Impl;
331  template< typename T > friend class PropertySetMixin;
332 
334 
335  void checkUnknown(rtl::OUString const & propertyName);
336 };
337 
350 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
351 protected:
393  css::uno::Reference< css::uno::XComponentContext > const & context,
394  Implements implements,
395  css::uno::Sequence< rtl::OUString > const & absentOptional):
396  PropertySetMixinImpl(
397  context, implements, absentOptional, T::static_type())
398  {}
399 
406 
407 private:
408  PropertySetMixin( const PropertySetMixin&) SAL_DELETED_FUNCTION;
409  void operator=( const PropertySetMixin&) SAL_DELETED_FUNCTION;
410 };
411 #if defined __GNUC__ && !defined __clang__
412 #pragma GCC diagnostic pop
413 #endif
414 
415 }
416 
417 #endif
418 
419 /* 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:115
PropertySetMixin(css::uno::Reference< css::uno::XComponentContext > const &context, Implements implements, css::uno::Sequence< rtl::OUString > const &absentOptional)
The constructor.
Definition: propertysetmixin.hxx:392
Definition: Enterable.hxx:26
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:396
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:409
Definition: types.h:377
Definition: types.h:377
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:81
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:405
#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:123
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:70
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:350