LibreOffice: cppuhelper/propertysetmixin.hxx Source File

LibreOffice LibreOffice 4.4 SDK C/C++ API Reference

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

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 com::sun::star::beans::XPropertySet,
89 public com::sun::star::beans::XFastPropertySet,
90 public com::sun::star::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&); // not defined
162 void operator=( const BoundListeners&); // not defined
163
164 class Impl;
165 Impl * m_impl;
166
167 friend class PropertySetMixinImpl;
168 };
169
229 void prepareSet(
230 rtl::OUString const & propertyName,
231 com::sun::star::uno::Any const & oldValue,
232 com::sun::star::uno::Any const & newValue,
233 BoundListeners * boundListeners);
234
249 void dispose();
250
264 virtual com::sun::star::uno::Any SAL_CALL queryInterface(
265 com::sun::star::uno::Type const & type)
266 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
267
268 // @see com::sun::star::beans::XPropertySet::getPropertySetInfo
269 virtual
270 com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >
271 SAL_CALL getPropertySetInfo()
272 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
273
274 // @see com::sun::star::beans::XPropertySet::setPropertyValue
275 virtual void SAL_CALL setPropertyValue(
276 rtl::OUString const & propertyName,
277 com::sun::star::uno::Any const & value)
278 throw (
279 com::sun::star::beans::UnknownPropertyException,
280 com::sun::star::beans::PropertyVetoException,
281 com::sun::star::lang::IllegalArgumentException,
282 com::sun::star::lang::WrappedTargetException,
283 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
284
285 // @see com::sun::star::beans::XPropertySet::getPropertyValue
286 virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(
287 rtl::OUString const & propertyName)
288 throw (
289 com::sun::star::beans::UnknownPropertyException,
290 com::sun::star::lang::WrappedTargetException,
291 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
292
302 virtual void SAL_CALL addPropertyChangeListener(
303 rtl::OUString const & propertyName,
304 com::sun::star::uno::Reference<
305 com::sun::star::beans::XPropertyChangeListener > const & listener)
306 throw (
307 com::sun::star::beans::UnknownPropertyException,
308 com::sun::star::lang::WrappedTargetException,
309 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
310
311 // @see com::sun::star::beans::XPropertySet::removePropertyChangeListener
312 virtual void SAL_CALL removePropertyChangeListener(
313 rtl::OUString const & propertyName,
314 com::sun::star::uno::Reference<
315 com::sun::star::beans::XPropertyChangeListener > const & listener)
316 throw (
317 com::sun::star::beans::UnknownPropertyException,
318 com::sun::star::lang::WrappedTargetException,
319 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
320
330 virtual void SAL_CALL addVetoableChangeListener(
331 rtl::OUString const & propertyName,
332 com::sun::star::uno::Reference<
333 com::sun::star::beans::XVetoableChangeListener > const & listener)
334 throw (
335 com::sun::star::beans::UnknownPropertyException,
336 com::sun::star::lang::WrappedTargetException,
337 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
338
339 // @see com::sun::star::beans::XPropertySet::removeVetoableChangeListener
340 virtual void SAL_CALL removeVetoableChangeListener(
341 rtl::OUString const & propertyName,
342 com::sun::star::uno::Reference<
343 com::sun::star::beans::XVetoableChangeListener > const & listener)
344 throw (
345 com::sun::star::beans::UnknownPropertyException,
346 com::sun::star::lang::WrappedTargetException,
347 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
348
349 // @see com::sun::star::beans::XFastPropertySet::setFastPropertyValue
350 virtual void SAL_CALL setFastPropertyValue(
351 sal_Int32 handle, com::sun::star::uno::Any const & value)
352 throw (
353 com::sun::star::beans::UnknownPropertyException,
354 com::sun::star::beans::PropertyVetoException,
355 com::sun::star::lang::IllegalArgumentException,
356 com::sun::star::lang::WrappedTargetException,
357 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
358
359 // @see com::sun::star::beans::XFastPropertySet::getFastPropertyValue
360 virtual com::sun::star::uno::Any SAL_CALL getFastPropertyValue(
361 sal_Int32 handle)
362 throw (
363 com::sun::star::beans::UnknownPropertyException,
364 com::sun::star::lang::WrappedTargetException,
365 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
366
367 // @see com::sun::star::beans::XPropertyAccess::getPropertyValues
368 virtual
369 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
370 SAL_CALL getPropertyValues()
371 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
372
373 // @see com::sun::star::beans::XPropertyAccess::setPropertyValues
374 virtual void SAL_CALL setPropertyValues(
375 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
376 const & props)
377 throw (
378 com::sun::star::beans::UnknownPropertyException,
379 com::sun::star::beans::PropertyVetoException,
380 com::sun::star::lang::IllegalArgumentException,
381 com::sun::star::lang::WrappedTargetException,
382 com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
383
384 private:
385 PropertySetMixinImpl( const PropertySetMixinImpl&); // not defined
386 void operator=( const PropertySetMixinImpl&); // not defined
387
388 PropertySetMixinImpl(
389 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
390 const & context,
391 Implements implements,
392 com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional,
393 com::sun::star::uno::Type const & type);
394
395 class Impl;
396 Impl * m_impl;
397
398 friend class Impl;
399 template< typename T > friend class PropertySetMixin;
400
401 ~PropertySetMixinImpl();
402
403 void checkUnknown(rtl::OUString const & propertyName);
404 };
405
418 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
419 protected:
460 PropertySetMixin(
461 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
462 const & context,
463 Implements implements,
464 com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional):
465 PropertySetMixinImpl(
466 context, implements, absentOptional, T::static_type())
467 {}
468
474 ~PropertySetMixin() {}
475
476 private:
477 PropertySetMixin( const PropertySetMixin&); // not defined
478 void operator=( const PropertySetMixin&); // not defined
479 };
480 #if defined __GNUC__ && !defined __clang__
481 #pragma GCC diagnostic pop
482 #endif
483
484 #if defined _MSC_VER
485 #pragma warning(pop)
486 #endif
487
488 }
489
490 #endif
491
492 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
com
Definition: types.h:375
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
rtl
Definition: bootstrap.hxx:24
cppu::PropertySetMixin::PropertySetMixin
PropertySetMixin(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &context, Implements implements, com::sun::star::uno::Sequence< rtl::OUString > const &absentOptional)
The constructor.
Definition: propertysetmixin.hxx:460
cppu::PropertySetMixinImpl::Implements
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:98
cppu::PropertySetMixin::~PropertySetMixin
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:474
cppuhelperdllapi.h
com::sun::star::uno::Type
C++ class representing an IDL meta type.
Definition: Type.h:54
com::sun::star::uno::Sequence
Template C++ class representing an IDL sequence.
Definition: unotype.hxx:33
com::sun::star::uno::Any
C++ class representing an IDL any.
Definition: Any.h:49
CPPUHELPER_DLLPUBLIC
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
rtl::OUString
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:81
types.h
Reference.hxx
cppu::PropertySetMixinImpl
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:87
SAL_OVERRIDE
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:407
cppu::queryInterface
inline::com::sun::star::uno::Any queryInterface(const ::com::sun::star::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
config.h
com::sun::star::uno::Reference
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32
Sequence.hxx
cppu::PropertySetMixin
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:57