LibreOffice Module cppuhelper (master)  1
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 /*
21  * This file is part of LibreOffice published API.
22  */
23 
24 #ifndef INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
25 #define INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
26 
27 #include "sal/config.h"
28 
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/uno/Reference.h"
33 #include "com/sun/star/uno/Sequence.hxx"
34 #include "sal/types.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 Type;
46  class XComponentContext;
47  }
48 } } }
49 
50 namespace cppu {
51 
70 #if defined __GNUC__ && !defined __clang__
71 #pragma GCC diagnostic push
72 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
73 #endif
75  public css::beans::XPropertySet,
76  public css::beans::XFastPropertySet,
77  public css::beans::XPropertyAccess
78 {
79 protected:
85  enum Implements {
90  IMPLEMENTS_PROPERTY_SET = 1,
91 
97  IMPLEMENTS_FAST_PROPERTY_SET = 2,
98 
104  IMPLEMENTS_PROPERTY_ACCESS = 4
105  };
106 
120  public:
126  BoundListeners();
127 
133  ~BoundListeners();
134 
145  void notify() const;
146 
147  private:
148  BoundListeners( const BoundListeners&) SAL_DELETED_FUNCTION;
149  void operator=( const BoundListeners&) SAL_DELETED_FUNCTION;
150 
151  class Impl;
152  Impl * m_impl;
153 
154  friend class PropertySetMixinImpl;
155  };
156 
216  void prepareSet(
217  rtl::OUString const & propertyName,
218  css::uno::Any const & oldValue,
219  css::uno::Any const & newValue,
220  BoundListeners * boundListeners);
221 
236  void dispose();
237 
251  virtual css::uno::Any SAL_CALL queryInterface(
252  css::uno::Type const & type) SAL_OVERRIDE;
253 
254  // @see css::beans::XPropertySet::getPropertySetInfo
255  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() SAL_OVERRIDE;
256 
257  // @see css::beans::XPropertySet::setPropertyValue
258  virtual void SAL_CALL setPropertyValue(
259  rtl::OUString const & propertyName,
260  css::uno::Any const & value) SAL_OVERRIDE;
261 
262  // @see css::beans::XPropertySet::getPropertyValue
263  virtual css::uno::Any SAL_CALL getPropertyValue(
264  rtl::OUString const & propertyName) SAL_OVERRIDE;
265 
275  virtual void SAL_CALL addPropertyChangeListener(
276  rtl::OUString const & propertyName,
277  css::uno::Reference<
278  css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
279 
280  // @see css::beans::XPropertySet::removePropertyChangeListener
281  virtual void SAL_CALL removePropertyChangeListener(
282  rtl::OUString const & propertyName,
283  css::uno::Reference<
284  css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE;
285 
295  virtual void SAL_CALL addVetoableChangeListener(
296  rtl::OUString const & propertyName,
297  css::uno::Reference<
298  css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
299 
300  // @see css::beans::XPropertySet::removeVetoableChangeListener
301  virtual void SAL_CALL removeVetoableChangeListener(
302  rtl::OUString const & propertyName,
303  css::uno::Reference<
304  css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE;
305 
306  // @see css::beans::XFastPropertySet::setFastPropertyValue
307  virtual void SAL_CALL setFastPropertyValue(
308  sal_Int32 handle, css::uno::Any const & value) SAL_OVERRIDE;
309 
310  // @see css::beans::XFastPropertySet::getFastPropertyValue
311  virtual css::uno::Any SAL_CALL getFastPropertyValue(
312  sal_Int32 handle) SAL_OVERRIDE;
313 
314  // @see css::beans::XPropertyAccess::getPropertyValues
315  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() SAL_OVERRIDE;
316 
317  // @see css::beans::XPropertyAccess::setPropertyValues
318  virtual void SAL_CALL setPropertyValues(
319  css::uno::Sequence< css::beans::PropertyValue > const & props) SAL_OVERRIDE;
320 
321 private:
322  PropertySetMixinImpl( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
323  void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
324 
326  css::uno::Reference< css::uno::XComponentContext > const & context,
327  Implements implements,
328  css::uno::Sequence< rtl::OUString > const & absentOptional,
329  css::uno::Type const & type);
330 
331  class Impl;
332  Impl * m_impl;
333 
334  friend class Impl;
335  template< typename T > friend class PropertySetMixin;
336 
338 
339  void checkUnknown(rtl::OUString const & propertyName);
340 };
341 
354 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
355 protected:
397  css::uno::Reference< css::uno::XComponentContext > const & context,
398  Implements implements,
399  css::uno::Sequence< rtl::OUString > const & absentOptional):
400  PropertySetMixinImpl(
401  context, implements, absentOptional, T::static_type())
402  {}
403 
410 
411 private:
412  PropertySetMixin( const PropertySetMixin&) SAL_DELETED_FUNCTION;
413  void operator=( const PropertySetMixin&) SAL_DELETED_FUNCTION;
414 };
415 #if defined __GNUC__ && !defined __clang__
416 #pragma GCC diagnostic pop
417 #endif
418 
419 }
420 
421 #endif
422 
423 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Type
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
A helper base class for cppu::PropertySetMixin.
exports com.sun.star. beans
~PropertySetMixin()
The destructor.
Any value
void dispose()
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
#define CPPUHELPER_DLLPUBLIC
A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute s...
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
PropertySetMixin(css::uno::Reference< css::uno::XComponentContext > const &context, Implements implements, css::uno::Sequence< rtl::OUString > const &absentOptional)
The constructor.