LibreOffice LibreOffice 5.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 <exception>
26
27 #include <com/sun/star/beans/PropertyVetoException.hpp>
28 #include <com/sun/star/beans/UnknownPropertyException.hpp>
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/lang/IllegalArgumentException.hpp>
33 #include <com/sun/star/lang/WrappedTargetException.hpp>
34 #include <com/sun/star/uno/Reference.hxx>
35 #include <com/sun/star/uno/RuntimeException.hpp>
36 #include <com/sun/star/uno/Sequence.hxx>
37 #include <sal/types.h>
38 #include <cppuhelper/cppuhelperdllapi.h>
39
40 namespace com { namespace sun { namespace star {
41 namespace beans {
42 class XPropertyChangeListener;
43 class XPropertySetInfo;
44 class XVetoableChangeListener;
45 struct PropertyValue;
46 }
47 namespace uno {
48 class Any;
49 class Type;
50 class XComponentContext;
51 }
52 } } }
53 namespace rtl { class OUString; }
54
55 namespace cppu {
56
57 template< typename T > class PropertySetMixin;
58
59 // Suppress warnings about virtual functions but non-virtual destructor:
60 #if defined _MSC_VER
61 #pragma warning(push)
62 #pragma warning(disable: 4265)
63 #endif
64
83 #if defined __GNUC__ && !defined __clang__
84 #pragma GCC diagnostic push
85 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
86 #endif
87 class CPPUHELPER_DLLPUBLIC PropertySetMixinImpl:
88 public css::beans::XPropertySet,
89 public css::beans::XFastPropertySet,
90 public css::beans::XPropertyAccess
91 {
92 protected:
98 enum Implements {
103 IMPLEMENTS_PROPERTY_SET = 1,
104
110 IMPLEMENTS_FAST_PROPERTY_SET = 2,
111
117 IMPLEMENTS_PROPERTY_ACCESS = 4
118 };
119
132 class CPPUHELPER_DLLPUBLIC BoundListeners {
133 public:
139 BoundListeners();
140
146 ~BoundListeners();
147
158 void notify() const;
159
160 private:
161 BoundListeners( const BoundListeners&) SAL_DELETED_FUNCTION;
162 void operator=( const BoundListeners&) SAL_DELETED_FUNCTION;
163
164 class Impl;
165 Impl * m_impl;
166
167 friend class PropertySetMixinImpl;
168 };
169
229 void prepareSet(
230 rtl::OUString const & propertyName,
231 css::uno::Any const & oldValue,
232 css::uno::Any const & newValue,
233 BoundListeners * boundListeners);
234
249 void dispose();
250
264 virtual css::uno::Any SAL_CALL queryInterface(
265 css::uno::Type const & type)
266 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
267
268 // @see css::beans::XPropertySet::getPropertySetInfo
269 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
270 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
271
272 // @see css::beans::XPropertySet::setPropertyValue
273 virtual void SAL_CALL setPropertyValue(
274 rtl::OUString const & propertyName,
275 css::uno::Any const & value)
276 throw (
277 css::beans::UnknownPropertyException,
278 css::beans::PropertyVetoException,
279 css::lang::IllegalArgumentException,
280 css::lang::WrappedTargetException,
281 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
282
283 // @see css::beans::XPropertySet::getPropertyValue
284 virtual css::uno::Any SAL_CALL getPropertyValue(
285 rtl::OUString const & propertyName)
286 throw (
287 css::beans::UnknownPropertyException,
288 css::lang::WrappedTargetException,
289 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
290
300 virtual void SAL_CALL addPropertyChangeListener(
301 rtl::OUString const & propertyName,
302 css::uno::Reference<
303 css::beans::XPropertyChangeListener > const & listener)
304 throw (
305 css::beans::UnknownPropertyException,
306 css::lang::WrappedTargetException,
307 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
308
309 // @see css::beans::XPropertySet::removePropertyChangeListener
310 virtual void SAL_CALL removePropertyChangeListener(
311 rtl::OUString const & propertyName,
312 css::uno::Reference<
313 css::beans::XPropertyChangeListener > const & listener)
314 throw (
315 css::beans::UnknownPropertyException,
316 css::lang::WrappedTargetException,
317 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
318
328 virtual void SAL_CALL addVetoableChangeListener(
329 rtl::OUString const & propertyName,
330 css::uno::Reference<
331 css::beans::XVetoableChangeListener > const & listener)
332 throw (
333 css::beans::UnknownPropertyException,
334 css::lang::WrappedTargetException,
335 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
336
337 // @see css::beans::XPropertySet::removeVetoableChangeListener
338 virtual void SAL_CALL removeVetoableChangeListener(
339 rtl::OUString const & propertyName,
340 css::uno::Reference<
341 css::beans::XVetoableChangeListener > const & listener)
342 throw (
343 css::beans::UnknownPropertyException,
344 css::lang::WrappedTargetException,
345 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
346
347 // @see css::beans::XFastPropertySet::setFastPropertyValue
348 virtual void SAL_CALL setFastPropertyValue(
349 sal_Int32 handle, css::uno::Any const & value)
350 throw (
351 css::beans::UnknownPropertyException,
352 css::beans::PropertyVetoException,
353 css::lang::IllegalArgumentException,
354 css::lang::WrappedTargetException,
355 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
356
357 // @see css::beans::XFastPropertySet::getFastPropertyValue
358 virtual css::uno::Any SAL_CALL getFastPropertyValue(
359 sal_Int32 handle)
360 throw (
361 css::beans::UnknownPropertyException,
362 css::lang::WrappedTargetException,
363 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
364
365 // @see css::beans::XPropertyAccess::getPropertyValues
366 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues()
367 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
368
369 // @see css::beans::XPropertyAccess::setPropertyValues
370 virtual void SAL_CALL setPropertyValues(
371 css::uno::Sequence< css::beans::PropertyValue > const & props)
372 throw (
373 css::beans::UnknownPropertyException,
374 css::beans::PropertyVetoException,
375 css::lang::IllegalArgumentException,
376 css::lang::WrappedTargetException,
377 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
378
379 private:
380 PropertySetMixinImpl( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
381 void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION;
382
383 PropertySetMixinImpl(
384 css::uno::Reference< css::uno::XComponentContext > const & context,
385 Implements implements,
386 css::uno::Sequence< rtl::OUString > const & absentOptional,
387 css::uno::Type const & type);
388
389 class Impl;
390 Impl * m_impl;
391
392 friend class Impl;
393 template< typename T > friend class PropertySetMixin;
394
395 ~PropertySetMixinImpl();
396
397 void checkUnknown(rtl::OUString const & propertyName);
398 };
399
412 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
413 protected:
454 PropertySetMixin(
455 css::uno::Reference< css::uno::XComponentContext > const & context,
456 Implements implements,
457 css::uno::Sequence< rtl::OUString > const & absentOptional):
458 PropertySetMixinImpl(
459 context, implements, absentOptional, T::static_type())
460 {}
461
467 ~PropertySetMixin() {}
468
469 private:
470 PropertySetMixin( const PropertySetMixin&) SAL_DELETED_FUNCTION;
471 void operator=( const PropertySetMixin&) SAL_DELETED_FUNCTION;
472 };
473 #if defined __GNUC__ && !defined __clang__
474 #pragma GCC diagnostic pop
475 #endif
476
477 #if defined _MSC_VER
478 #pragma warning(pop)
479 #endif
480
481 }
482
483 #endif
484
485 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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
SAL_OVERRIDE
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:423
CPPUHELPER_DLLPUBLIC
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
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:454
cppu::PropertySetMixinImpl::Implements
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:98
com
Definition: types.h:391
SAL_DELETED_FUNCTION
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:410
cppu::PropertySetMixin
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:57
Reference.hxx
Sequence.hxx
cppu
Definition: Enterable.hxx:26
cppu::PropertySetMixinImpl::BoundListeners
A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute s...
Definition: propertysetmixin.hxx:132
types.h
cppu::PropertySetMixin::~PropertySetMixin
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:467
com::sun::star
Definition: types.h:391
config.h
cppu::PropertySetMixinImpl
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:87
rtl::OUString
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:106
cppuhelperdllapi.h
rtl
Definition: bootstrap.hxx:29