LibreOffice
LibreOffice 4.2 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>
35 #include <com/sun/star/uno/RuntimeException.hpp>
37 #include <sal/types.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 HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY && HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE \
84  && !defined __clang__
85 #pragma GCC diagnostic push
86 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
87 #endif
89  public com::sun::star::beans::XPropertySet,
90  public com::sun::star::beans::XFastPropertySet,
91  public com::sun::star::beans::XPropertyAccess
92 {
93 protected:
99  enum Implements {
104  IMPLEMENTS_PROPERTY_SET = 1,
105 
111  IMPLEMENTS_FAST_PROPERTY_SET = 2,
112 
118  IMPLEMENTS_PROPERTY_ACCESS = 4
119  };
120 
134  public:
140  BoundListeners();
141 
147  ~BoundListeners();
148 
159  void notify() const;
160 
161  private:
162  BoundListeners( const BoundListeners&); // not defined
163  void operator=( const BoundListeners&); // not defined
164 
165  class Impl;
166  Impl * m_impl;
167 
168  friend class PropertySetMixinImpl;
169  };
170 
230  void prepareSet(
231  rtl::OUString const & propertyName,
232  com::sun::star::uno::Any const & oldValue,
233  com::sun::star::uno::Any const & newValue,
234  BoundListeners * boundListeners);
235 
250  void dispose();
251 
265  virtual com::sun::star::uno::Any SAL_CALL queryInterface(
266  com::sun::star::uno::Type const & type)
267  throw (com::sun::star::uno::RuntimeException);
268 
269  // @see com::sun::star::beans::XPropertySet::getPropertySetInfo
270  virtual
272  SAL_CALL getPropertySetInfo()
273  throw (com::sun::star::uno::RuntimeException, std::exception);
274 
275  // @see com::sun::star::beans::XPropertySet::setPropertyValue
276  virtual void SAL_CALL setPropertyValue(
277  rtl::OUString const & propertyName,
278  com::sun::star::uno::Any const & value)
279  throw (
280  com::sun::star::beans::UnknownPropertyException,
281  com::sun::star::beans::PropertyVetoException,
282  com::sun::star::lang::IllegalArgumentException,
283  com::sun::star::lang::WrappedTargetException,
284  com::sun::star::uno::RuntimeException, std::exception);
285 
286  // @see com::sun::star::beans::XPropertySet::getPropertyValue
287  virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(
288  rtl::OUString const & propertyName)
289  throw (
290  com::sun::star::beans::UnknownPropertyException,
291  com::sun::star::lang::WrappedTargetException,
292  com::sun::star::uno::RuntimeException, std::exception);
293 
303  virtual void SAL_CALL addPropertyChangeListener(
304  rtl::OUString const & propertyName,
305  com::sun::star::uno::Reference<
306  com::sun::star::beans::XPropertyChangeListener > const & listener)
307  throw (
308  com::sun::star::beans::UnknownPropertyException,
309  com::sun::star::lang::WrappedTargetException,
310  com::sun::star::uno::RuntimeException, std::exception);
311 
312  // @see com::sun::star::beans::XPropertySet::removePropertyChangeListener
313  virtual void SAL_CALL removePropertyChangeListener(
314  rtl::OUString const & propertyName,
315  com::sun::star::uno::Reference<
316  com::sun::star::beans::XPropertyChangeListener > const & listener)
317  throw (
318  com::sun::star::beans::UnknownPropertyException,
319  com::sun::star::lang::WrappedTargetException,
320  com::sun::star::uno::RuntimeException, std::exception);
321 
331  virtual void SAL_CALL addVetoableChangeListener(
332  rtl::OUString const & propertyName,
333  com::sun::star::uno::Reference<
334  com::sun::star::beans::XVetoableChangeListener > const & listener)
335  throw (
336  com::sun::star::beans::UnknownPropertyException,
337  com::sun::star::lang::WrappedTargetException,
338  com::sun::star::uno::RuntimeException, std::exception);
339 
340  // @see com::sun::star::beans::XPropertySet::removeVetoableChangeListener
341  virtual void SAL_CALL removeVetoableChangeListener(
342  rtl::OUString const & propertyName,
343  com::sun::star::uno::Reference<
344  com::sun::star::beans::XVetoableChangeListener > const & listener)
345  throw (
346  com::sun::star::beans::UnknownPropertyException,
347  com::sun::star::lang::WrappedTargetException,
348  com::sun::star::uno::RuntimeException, std::exception);
349 
350  // @see com::sun::star::beans::XFastPropertySet::setFastPropertyValue
351  virtual void SAL_CALL setFastPropertyValue(
352  sal_Int32 handle, com::sun::star::uno::Any const & value)
353  throw (
354  com::sun::star::beans::UnknownPropertyException,
355  com::sun::star::beans::PropertyVetoException,
356  com::sun::star::lang::IllegalArgumentException,
357  com::sun::star::lang::WrappedTargetException,
358  com::sun::star::uno::RuntimeException, std::exception);
359 
360  // @see com::sun::star::beans::XFastPropertySet::getFastPropertyValue
361  virtual com::sun::star::uno::Any SAL_CALL getFastPropertyValue(
362  sal_Int32 handle)
363  throw (
364  com::sun::star::beans::UnknownPropertyException,
365  com::sun::star::lang::WrappedTargetException,
366  com::sun::star::uno::RuntimeException, std::exception);
367 
368  // @see com::sun::star::beans::XPropertyAccess::getPropertyValues
369  virtual
370  com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
371  SAL_CALL getPropertyValues()
372  throw (com::sun::star::uno::RuntimeException, std::exception);
373 
374  // @see com::sun::star::beans::XPropertyAccess::setPropertyValues
375  virtual void SAL_CALL setPropertyValues(
376  com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
377  const & props)
378  throw (
379  com::sun::star::beans::UnknownPropertyException,
380  com::sun::star::beans::PropertyVetoException,
381  com::sun::star::lang::IllegalArgumentException,
382  com::sun::star::lang::WrappedTargetException,
383  com::sun::star::uno::RuntimeException, std::exception);
384 
385 private:
386  PropertySetMixinImpl( const PropertySetMixinImpl&); // not defined
387  void operator=( const PropertySetMixinImpl&); // not defined
388 
389  PropertySetMixinImpl(
390  com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
391  const & context,
392  Implements implements,
393  com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional,
394  com::sun::star::uno::Type const & type);
395 
396  class Impl;
397  Impl * m_impl;
398 
399  friend class Impl;
400  template< typename T > friend class PropertySetMixin;
401 
402  ~PropertySetMixinImpl();
403 
404  void checkUnknown(rtl::OUString const & propertyName);
405 };
406 #if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY && HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE \
407  && !defined __clang__
408 #pragma GCC diagnostic pop
409 #endif
410 
423 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
424 protected:
467  const & context,
468  Implements implements,
469  com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional):
470  PropertySetMixinImpl(
471  context, implements, absentOptional, T::static_type())
472  {}
473 
480 
481 private:
482  PropertySetMixin( const PropertySetMixin&); // not defined
483  void operator=( const PropertySetMixin&); // not defined
484 };
485 
486 #if defined _MSC_VER
487 #pragma warning(pop)
488 #endif
489 
490 }
491 
492 #endif
493 
494 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
C++ class representing an IDL meta type.
Definition: Type.h:55
A helper base class for cppu::PropertySetMixin.
Definition: propertysetmixin.hxx:88
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
Implements
Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be suppo...
Definition: propertysetmixin.hxx:99
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
A helper mixin to implement certain UNO interfaces related to property set handling on top of the att...
Definition: propertysetmixin.hxx:57
~PropertySetMixin()
The destructor.
Definition: propertysetmixin.hxx:479
A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute s...
Definition: propertysetmixin.hxx:133
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32
C++ class representing an IDL any.
Definition: Any.h:46
Template C++ class representing an IDL sequence.
Definition: unotype.hxx:33
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:465