LibreOffice: cppuhelper/propertysetmixin.hxx Source File

LibreOffice LibreOffice 6.3 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"
28 #include "com/sun/star/uno/Reference.h"
29 #include "com/sun/star/uno/Sequence.hxx"
30 #include "sal/types.h"
31 #include "cppuhelper/cppuhelperdllapi.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
70 class CPPUHELPER_DLLPUBLIC PropertySetMixinImpl:
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
115 class CPPUHELPER_DLLPUBLIC BoundListeners {
116 public:
122 BoundListeners();
123
129 ~BoundListeners();
130
141 void notify() const;
142
143 private:
144 BoundListeners( const BoundListeners&) SAL_DELETED_FUNCTION;
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:
318 PropertySetMixinImpl( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
319 void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
320
321 PropertySetMixinImpl(
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
333 ~PropertySetMixinImpl();
334
335 void checkUnknown(rtl::OUString const & propertyName);
336 };
337
350 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
351 protected:
392 PropertySetMixin(
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
405 ~PropertySetMixin() {}
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: */
SAL_OVERRIDE
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:409
CPPUHELPER_DLLPUBLIC
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
Reference.h
rtl
Definition: bootstrap.hxx:29
SAL_DELETED_FUNCTION
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:396
cppu::queryInterface
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
cppu::PropertySetMixin::~PropertySetMixin
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:405
Sequence.hxx
cppu::PropertySetMixinImpl::Implements
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:81
com
Definition: types.h:377
cppu::PropertySetMixinImpl
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:70
types.h
cppu::PropertySetMixin
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:350
config.h
cppu
Definition: Enterable.hxx:26
cppuhelperdllapi.h
com::sun::star
Definition: types.h:377
cppu::PropertySetMixinImpl::BoundListeners
A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute s...
Definition: propertysetmixin.hxx:115
cppu::PropertySetMixin::PropertySetMixin
PropertySetMixin(css::uno::Reference< css::uno::XComponentContext > const &context, Implements implements, css::uno::Sequence< rtl::OUString > const &absentOptional)
The constructor.
Definition: propertysetmixin.hxx:392
rtl::OUString
This String class provides base functionality for C++ like Unicode character array handling.
Definition: ustring.hxx:126