UDK 3.2.7 C/C++ API Reference
cppuhelper/propertysetmixin.hxx
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*************************************************************************
00003  *
00004  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00005  *
00006  * Copyright 2000, 2010 Oracle and/or its affiliates.
00007  *
00008  * OpenOffice.org - a multi-platform office productivity suite
00009  *
00010  * This file is part of OpenOffice.org.
00011  *
00012  * OpenOffice.org is free software: you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 3
00014  * only, as published by the Free Software Foundation.
00015  *
00016  * OpenOffice.org is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License version 3 for more details
00020  * (a copy is included in the LICENSE file that accompanied this code).
00021  *
00022  * You should have received a copy of the GNU Lesser General Public License
00023  * version 3 along with OpenOffice.org.  If not, see
00024  * <http://www.openoffice.org/license.html>
00025  * for a copy of the LGPLv3 License.
00026  *
00027  ************************************************************************/
00028 
00029 #ifndef INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
00030 #define INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX \
00031     INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
00032 
00033 #include "sal/config.h"
00034 #include "com/sun/star/beans/PropertyVetoException.hpp"
00035 #include "com/sun/star/beans/UnknownPropertyException.hpp"
00036 #include "com/sun/star/beans/XFastPropertySet.hpp"
00037 #include "com/sun/star/beans/XPropertyAccess.hpp"
00038 #include "com/sun/star/beans/XPropertySet.hpp"
00039 #include "com/sun/star/lang/IllegalArgumentException.hpp"
00040 #include "com/sun/star/lang/WrappedTargetException.hpp"
00041 #include "com/sun/star/uno/Reference.hxx"
00042 #include "com/sun/star/uno/RuntimeException.hpp"
00043 #include "com/sun/star/uno/Sequence.hxx"
00044 #include "sal/types.h"
00045 #include "cppuhelperdllapi.h"
00046 
00047 namespace com { namespace sun { namespace star {
00048     namespace beans {
00049         class XPropertyChangeListener;
00050         class XPropertySetInfo;
00051         class XVetoableChangeListener;
00052         struct PropertyValue;
00053     }
00054     namespace uno {
00055         class Any;
00056         class Type;
00057         class XComponentContext;
00058     }
00059 } } }
00060 namespace rtl { class OUString; }
00061 
00062 namespace cppu {
00063 
00064 template< typename T > class PropertySetMixin;
00065 
00066 // Suppress warnings about virtual functions but non-virtual destructor:
00067 #if defined _MSC_VER
00068 #pragma warning(push)
00069 #pragma warning(disable: 4265)
00070 #endif
00071 
00090 #if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
00091 #pragma GCC diagnostic push
00092 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
00093 #endif
00094 class CPPUHELPER_DLLPUBLIC PropertySetMixinImpl:
00095     public com::sun::star::beans::XPropertySet,
00096     public com::sun::star::beans::XFastPropertySet,
00097     public com::sun::star::beans::XPropertyAccess
00098 {
00099 protected:
00105     enum Implements {
00110         IMPLEMENTS_PROPERTY_SET = 1,
00111 
00117         IMPLEMENTS_FAST_PROPERTY_SET = 2,
00118 
00124         IMPLEMENTS_PROPERTY_ACCESS = 4
00125     };
00126 
00139     class CPPUHELPER_DLLPUBLIC BoundListeners {
00140     public:
00146         BoundListeners();
00147 
00153         ~BoundListeners();
00154 
00165         void notify() const;
00166 
00167     private:
00168         BoundListeners(BoundListeners &); // not defined
00169         void operator =(BoundListeners); // not defined
00170 
00171         class Impl;
00172         Impl * m_impl;
00173 
00174         friend class PropertySetMixinImpl;
00175     };
00176 
00236     void prepareSet(
00237         rtl::OUString const & propertyName,
00238         com::sun::star::uno::Any const & oldValue,
00239         com::sun::star::uno::Any const & newValue,
00240         BoundListeners * boundListeners);
00241 
00256     void dispose();
00257 
00271     virtual com::sun::star::uno::Any SAL_CALL queryInterface(
00272         com::sun::star::uno::Type const & type)
00273         throw (com::sun::star::uno::RuntimeException);
00274 
00275     // @see com::sun::star::beans::XPropertySet::getPropertySetInfo
00276     virtual
00277     com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >
00278     SAL_CALL getPropertySetInfo() throw (com::sun::star::uno::RuntimeException);
00279 
00280     // @see com::sun::star::beans::XPropertySet::setPropertyValue
00281     virtual void SAL_CALL setPropertyValue(
00282         rtl::OUString const & propertyName,
00283         com::sun::star::uno::Any const & value)
00284         throw (
00285             com::sun::star::beans::UnknownPropertyException,
00286             com::sun::star::beans::PropertyVetoException,
00287             com::sun::star::lang::IllegalArgumentException,
00288             com::sun::star::lang::WrappedTargetException,
00289             com::sun::star::uno::RuntimeException);
00290 
00291     // @see com::sun::star::beans::XPropertySet::getPropertyValue
00292     virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(
00293         rtl::OUString const & propertyName)
00294         throw (
00295             com::sun::star::beans::UnknownPropertyException,
00296             com::sun::star::lang::WrappedTargetException,
00297             com::sun::star::uno::RuntimeException);
00298 
00308     virtual void SAL_CALL addPropertyChangeListener(
00309         rtl::OUString const & propertyName,
00310         com::sun::star::uno::Reference<
00311         com::sun::star::beans::XPropertyChangeListener > const & listener)
00312         throw (
00313             com::sun::star::beans::UnknownPropertyException,
00314             com::sun::star::lang::WrappedTargetException,
00315             com::sun::star::uno::RuntimeException);
00316 
00317     // @see com::sun::star::beans::XPropertySet::removePropertyChangeListener
00318     virtual void SAL_CALL removePropertyChangeListener(
00319         rtl::OUString const & propertyName,
00320         com::sun::star::uno::Reference<
00321         com::sun::star::beans::XPropertyChangeListener > const & listener)
00322         throw (
00323             com::sun::star::beans::UnknownPropertyException,
00324             com::sun::star::lang::WrappedTargetException,
00325             com::sun::star::uno::RuntimeException);
00326 
00336     virtual void SAL_CALL addVetoableChangeListener(
00337         rtl::OUString const & propertyName,
00338         com::sun::star::uno::Reference<
00339         com::sun::star::beans::XVetoableChangeListener > const & listener)
00340         throw (
00341             com::sun::star::beans::UnknownPropertyException,
00342             com::sun::star::lang::WrappedTargetException,
00343             com::sun::star::uno::RuntimeException);
00344 
00345     // @see com::sun::star::beans::XPropertySet::removeVetoableChangeListener
00346     virtual void SAL_CALL removeVetoableChangeListener(
00347         rtl::OUString const & propertyName,
00348         com::sun::star::uno::Reference<
00349         com::sun::star::beans::XVetoableChangeListener > const & listener)
00350         throw (
00351             com::sun::star::beans::UnknownPropertyException,
00352             com::sun::star::lang::WrappedTargetException,
00353             com::sun::star::uno::RuntimeException);
00354 
00355     // @see com::sun::star::beans::XFastPropertySet::setFastPropertyValue
00356     virtual void SAL_CALL setFastPropertyValue(
00357         sal_Int32 handle, com::sun::star::uno::Any const & value)
00358         throw (
00359             com::sun::star::beans::UnknownPropertyException,
00360             com::sun::star::beans::PropertyVetoException,
00361             com::sun::star::lang::IllegalArgumentException,
00362             com::sun::star::lang::WrappedTargetException,
00363             com::sun::star::uno::RuntimeException);
00364 
00365     // @see com::sun::star::beans::XFastPropertySet::getFastPropertyValue
00366     virtual com::sun::star::uno::Any SAL_CALL getFastPropertyValue(
00367         sal_Int32 handle)
00368         throw (
00369             com::sun::star::beans::UnknownPropertyException,
00370             com::sun::star::lang::WrappedTargetException,
00371             com::sun::star::uno::RuntimeException);
00372 
00373     // @see com::sun::star::beans::XPropertyAccess::getPropertyValues
00374     virtual
00375     com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
00376     SAL_CALL getPropertyValues() throw (com::sun::star::uno::RuntimeException);
00377 
00378     // @see com::sun::star::beans::XPropertyAccess::setPropertyValues
00379     virtual void SAL_CALL setPropertyValues(
00380         com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
00381         const & props)
00382         throw (
00383             com::sun::star::beans::UnknownPropertyException,
00384             com::sun::star::beans::PropertyVetoException,
00385             com::sun::star::lang::IllegalArgumentException,
00386             com::sun::star::lang::WrappedTargetException,
00387             com::sun::star::uno::RuntimeException);
00388 
00389 private:
00390     PropertySetMixinImpl(PropertySetMixinImpl &); // not defined
00391     void operator =(PropertySetMixinImpl &); // not defined
00392 
00393     PropertySetMixinImpl(
00394         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
00395         const & context,
00396         Implements implements,
00397         com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional,
00398         com::sun::star::uno::Type const & type);
00399 
00400     class Impl;
00401     Impl * m_impl;
00402 
00403     friend class Impl;
00404     template< typename T > friend class PropertySetMixin;
00405 
00406     ~PropertySetMixinImpl();
00407 
00408     void checkUnknown(rtl::OUString const & propertyName);
00409 };
00410 #if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
00411 #pragma GCC diagnostic pop
00412 #endif
00413 
00426 template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
00427 protected:
00468     PropertySetMixin(
00469         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
00470         const & context,
00471         Implements implements,
00472         com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional):
00473         PropertySetMixinImpl(
00474             context, implements, absentOptional, T::static_type())
00475     {}
00476 
00482     ~PropertySetMixin() {}
00483 
00484 private:
00485     PropertySetMixin(PropertySetMixin &); // not defined
00486     void operator =(PropertySetMixin &); // not defined
00487 };
00488 
00489 #if defined _MSC_VER
00490 #pragma warning(pop)
00491 #endif
00492 
00493 }
00494 
00495 #endif
00496 
00497 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines