LibreOffice: cppuhelper/propertysetmixin.hxx Source File

LibreOffice LibreOffice 7.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/*
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"
35#include "cppuhelper/cppuhelperdllapi.h"
36
37namespace 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
50namespace cppu {
51
70#if defined __GNUC__ && !defined __clang__
71#pragma GCC diagnostic push
72#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
73#endif
74 class CPPUHELPER_DLLPUBLIC PropertySetMixinImpl:
75 public css::beans::XPropertySet,
76 public css::beans::XFastPropertySet,
77 public css::beans::XPropertyAccess
78{
79protected:
85 enum Implements {
90 IMPLEMENTS_PROPERTY_SET = 1,
91
97 IMPLEMENTS_FAST_PROPERTY_SET = 2,
98
104 IMPLEMENTS_PROPERTY_ACCESS = 4
105 };
106
119 class CPPUHELPER_DLLPUBLIC BoundListeners {
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
321private:
322 PropertySetMixinImpl( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
323 void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
324
325 PropertySetMixinImpl(
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
337 ~PropertySetMixinImpl();
338
339 void checkUnknown(rtl::OUString const & propertyName);
340};
341
354template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
355protected:
396 PropertySetMixin(
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
409 ~PropertySetMixin() {}
410
411private:
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: */
config.h
types.h
SAL_DELETED_FUNCTION
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:378
SAL_OVERRIDE
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:391
cppuhelperdllapi.h
CPPUHELPER_DLLPUBLIC
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:32
Reference.h
Sequence.hxx
com
Definition: types.h:359
com::sun::star
Definition: types.h:359
rtl
Definition: bootstrap.hxx:34
cppu
Definition: Enterable.hxx:31
rtl::OUString
This String class provides base functionality for C++ like Unicode character array handling.
Definition: ustring.hxx:204
cppu::PropertySetMixinImpl
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:78
cppu::PropertySetMixinImpl::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &type) SAL_OVERRIDE
A function used by subclasses of cppu::PropertySetMixin when implementing css::uno::XInterface::query...
cppu::PropertySetMixinImpl::getPropertySetInfo
virtual css::uno::Reference< css::beans::XPropertySetInfo > getPropertySetInfo() SAL_OVERRIDE
cppu::PropertySetMixinImpl::dispose
void dispose()
Mark this instance as being disposed.
cppu::PropertySetMixinImpl::Implements
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:85
cppu::PropertySetMixinImpl::prepareSet
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
A function used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribut...
cppu::PropertySetMixinImpl::BoundListeners
A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute s...
Definition: propertysetmixin.hxx:119
cppu::PropertySetMixinImpl::BoundListeners::~BoundListeners
~BoundListeners()
The destructor.
cppu::PropertySetMixinImpl::BoundListeners::notify
void notify() const
Notifies any css::beans::XPropertyChangeListeners.
cppu::PropertySetMixinImpl::BoundListeners::BoundListeners
BoundListeners()
The constructor.
cppu::PropertySetMixin
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:354
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:396
cppu::PropertySetMixin::~PropertySetMixin
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:409