xref: /AOO41X/main/comphelper/inc/comphelper/SettingsHelper.hxx (revision 9877b273795ec465a3ce9c15d738eb34c0455705)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _COMPHELPER_SETTINGSHELPER_HXX_
25 #define _COMPHELPER_SETTINGSHELPER_HXX_
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/beans/XMultiPropertySet.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <cppuhelper/implbase3.hxx>
30 namespace vos
31 {
32     class IMutex;
33 }
34 
35 namespace comphelper
36 {
37     class MasterPropertySet;
38     class MasterPropertySetInfo;
39     class ChainablePropertySet;
40     class ChainablePropertySetInfo;
41 
42     typedef  cppu::WeakImplHelper3
43     <
44         ::com::sun::star::beans::XPropertySet,
45         ::com::sun::star::beans::XMultiPropertySet,
46         ::com::sun::star::lang::XServiceInfo
47     >
48     HelperBaseNoState;
49     template < class ComphelperBase, class ComphelperBaseInfo > class SettingsHelperNoState :
50         public HelperBaseNoState,
51         public ComphelperBase
52     {
53     public:
SettingsHelperNoState(ComphelperBaseInfo * pInfo,::vos::IMutex * pMutex=NULL)54         SettingsHelperNoState ( ComphelperBaseInfo *pInfo, ::vos::IMutex *pMutex = NULL)
55         : ComphelperBase ( pInfo, pMutex )
56         {}
~SettingsHelperNoState()57         virtual ~SettingsHelperNoState () throw( ) {}
queryInterface(const com::sun::star::uno::Type & aType)58         com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type& aType ) throw (com::sun::star::uno::RuntimeException)
59         { return HelperBaseNoState::queryInterface( aType ); }
acquire()60         void SAL_CALL acquire(  ) throw ()
61         { HelperBaseNoState::acquire( ); }
release()62         void SAL_CALL release(  ) throw ()
63         { HelperBaseNoState::release( ); }
64 
65         // XPropertySet
getPropertySetInfo()66         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  )
67             throw(::com::sun::star::uno::RuntimeException)
68         { return ComphelperBase::getPropertySetInfo(); }
setPropertyValue(const::rtl::OUString & aPropertyName,const::com::sun::star::uno::Any & aValue)69         virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
70             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
71         { ComphelperBase::setPropertyValue ( aPropertyName, aValue ); }
getPropertyValue(const::rtl::OUString & PropertyName)72         virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
73             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
74         { return ComphelperBase::getPropertyValue ( PropertyName ); }
addPropertyChangeListener(const::rtl::OUString & aPropertyName,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertyChangeListener> & xListener)75         virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
76             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
77         { ComphelperBase::addPropertyChangeListener ( aPropertyName, xListener ); }
removePropertyChangeListener(const::rtl::OUString & aPropertyName,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertyChangeListener> & aListener)78         virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
79             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
80         { ComphelperBase::removePropertyChangeListener ( aPropertyName, aListener ); }
addVetoableChangeListener(const::rtl::OUString & PropertyName,const::com::sun::star::uno::Reference<::com::sun::star::beans::XVetoableChangeListener> & aListener)81         virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
82             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
83         { ComphelperBase::addVetoableChangeListener ( PropertyName, aListener ); }
removeVetoableChangeListener(const::rtl::OUString & PropertyName,const::com::sun::star::uno::Reference<::com::sun::star::beans::XVetoableChangeListener> & aListener)84         virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
85             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
86         { ComphelperBase::removeVetoableChangeListener ( PropertyName, aListener ); }
87 
88         // XMultiPropertySet
setPropertyValues(const::com::sun::star::uno::Sequence<::rtl::OUString> & aPropertyNames,const::com::sun::star::uno::Sequence<::com::sun::star::uno::Any> & aValues)89         virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
90             throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
91         { ComphelperBase::setPropertyValues ( aPropertyNames, aValues ); }
getPropertyValues(const::com::sun::star::uno::Sequence<::rtl::OUString> & aPropertyNames)92         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
93             throw(::com::sun::star::uno::RuntimeException)
94         { return ComphelperBase::getPropertyValues ( aPropertyNames ); }
addPropertiesChangeListener(const::com::sun::star::uno::Sequence<::rtl::OUString> & aPropertyNames,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertiesChangeListener> & xListener)95         virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
96             throw(::com::sun::star::uno::RuntimeException)
97         { ComphelperBase::addPropertiesChangeListener ( aPropertyNames, xListener ); }
removePropertiesChangeListener(const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertiesChangeListener> & xListener)98         virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
99             throw(::com::sun::star::uno::RuntimeException)
100         { ComphelperBase::removePropertiesChangeListener ( xListener ); }
firePropertiesChangeEvent(const::com::sun::star::uno::Sequence<::rtl::OUString> & aPropertyNames,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertiesChangeListener> & xListener)101         virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
102             throw(::com::sun::star::uno::RuntimeException)
103         { ComphelperBase::firePropertiesChangeEvent ( aPropertyNames, xListener ); }
104     };
105     typedef comphelper::SettingsHelperNoState
106     <
107         ::comphelper::MasterPropertySet,
108         ::comphelper::MasterPropertySetInfo
109     >
110     MasterHelperNoState;
111     typedef comphelper::SettingsHelperNoState
112     <
113         ::comphelper::ChainablePropertySet,
114         ::comphelper::ChainablePropertySetInfo
115     >
116     ChainableHelperNoState;
117 }
118 
119 #endif
120