LibreOffice
LibreOffice 24.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 /*
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"
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 
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):
397  context, implements, absentOptional, T::static_type())
398  {}
399 
406 
407 private:
409  void operator=( const PropertySetMixin&) SAL_DELETED_FUNCTION;
410 };
411 
412 }
413 
414 #endif
415 
416 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:43
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:391
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:405
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:378
Definition: types.h:359
A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute s...
Definition: propertysetmixin.hxx:115
Definition: bootstrap.hxx:33
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:81
Definition: Enterable.hxx:30
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:170
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:32
PropertySetMixin(css::uno::Reference< css::uno::XComponentContext > const &context, Implements implements, css::uno::Sequence< rtl::OUString > const &absentOptional)
The constructor.
Definition: propertysetmixin.hxx:392
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:70
Definition: types.h:359
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:350