xref: /AOO41X/main/cppuhelper/inc/cppuhelper/compbase.hxx (revision 6da5f31158a7dd09f46f041b4f15bb7ae3eb92a4)
1*6da5f311SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*6da5f311SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*6da5f311SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*6da5f311SAndrew Rist  * distributed with this work for additional information
6*6da5f311SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*6da5f311SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*6da5f311SAndrew Rist  * "License"); you may not use this file except in compliance
9*6da5f311SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*6da5f311SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*6da5f311SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*6da5f311SAndrew Rist  * software distributed under the License is distributed on an
15*6da5f311SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6da5f311SAndrew Rist  * KIND, either express or implied.  See the License for the
17*6da5f311SAndrew Rist  * specific language governing permissions and limitations
18*6da5f311SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*6da5f311SAndrew Rist  *************************************************************/
21*6da5f311SAndrew Rist 
22*6da5f311SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CPPUHELPER_COMPBASE_HXX_
24cdf0e10cSrcweir #define _CPPUHELPER_COMPBASE_HXX_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <cppuhelper/compbase_ex.hxx>
27cdf0e10cSrcweir #include <cppuhelper/implbase.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir /* This header should not be used anymore.
30cdf0e10cSrcweir    @deprecated
31cdf0e10cSrcweir */
32cdf0e10cSrcweir 
33cdf0e10cSrcweir //==================================================================================================
34cdf0e10cSrcweir /** @internal */
35cdf0e10cSrcweir #define __DEF_COMPIMPLHELPER_A( N ) \
36cdf0e10cSrcweir namespace cppu \
37cdf0e10cSrcweir { \
38cdf0e10cSrcweir template< __CLASS_IFC##N > \
39cdf0e10cSrcweir class SAL_NO_VTABLE WeakComponentImplHelper##N \
40cdf0e10cSrcweir     : public ::cppu::WeakComponentImplHelperBase \
41cdf0e10cSrcweir 	, public ImplHelperBase##N< __IFC##N > \
42cdf0e10cSrcweir { \
43cdf0e10cSrcweir 	static ClassData##N s_aCD; \
44cdf0e10cSrcweir public: \
45cdf0e10cSrcweir 	WeakComponentImplHelper##N( ::osl::Mutex & rMutex ) SAL_THROW( () ) \
46cdf0e10cSrcweir 		: WeakComponentImplHelperBase( rMutex ) \
47cdf0e10cSrcweir 		{} \
48cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
49cdf0e10cSrcweir 	{ \
50cdf0e10cSrcweir 		::com::sun::star::uno::Any aRet( getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
51cdf0e10cSrcweir 		if (aRet.hasValue()) \
52cdf0e10cSrcweir 			return aRet; \
53cdf0e10cSrcweir         return WeakComponentImplHelperBase::queryInterface( rType ); \
54cdf0e10cSrcweir 	} \
55cdf0e10cSrcweir 	virtual void SAL_CALL acquire() throw () \
56cdf0e10cSrcweir 		{ WeakComponentImplHelperBase::acquire(); } \
57cdf0e10cSrcweir 	virtual void SAL_CALL release() throw () \
58cdf0e10cSrcweir 		{ WeakComponentImplHelperBase::release(); } \
59cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
60cdf0e10cSrcweir 		{ return getClassData( s_aCD ).getTypes(); } \
61cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
62cdf0e10cSrcweir 		{ return getClassData( s_aCD ).getImplementationId(); } \
63cdf0e10cSrcweir }; \
64cdf0e10cSrcweir template< __CLASS_IFC##N > \
65cdf0e10cSrcweir class SAL_NO_VTABLE WeakAggComponentImplHelper##N \
66cdf0e10cSrcweir 	: public ::cppu::WeakAggComponentImplHelperBase \
67cdf0e10cSrcweir 	, public ImplHelperBase##N< __IFC##N > \
68cdf0e10cSrcweir { \
69cdf0e10cSrcweir 	static ClassData##N s_aCD; \
70cdf0e10cSrcweir public: \
71cdf0e10cSrcweir 	WeakAggComponentImplHelper##N( ::osl::Mutex & rMutex ) SAL_THROW( () ) \
72cdf0e10cSrcweir 		: WeakAggComponentImplHelperBase( rMutex ) \
73cdf0e10cSrcweir 		{} \
74cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
75cdf0e10cSrcweir 		{ return WeakAggComponentImplHelperBase::queryInterface( rType ); } \
76cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
77cdf0e10cSrcweir 	{ \
78cdf0e10cSrcweir 		::com::sun::star::uno::Any aRet( getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
79cdf0e10cSrcweir 		if (aRet.hasValue()) \
80cdf0e10cSrcweir 			return aRet; \
81cdf0e10cSrcweir         return WeakAggComponentImplHelperBase::queryAggregation( rType ); \
82cdf0e10cSrcweir 	} \
83cdf0e10cSrcweir 	virtual void SAL_CALL acquire() throw () \
84cdf0e10cSrcweir 		{ WeakAggComponentImplHelperBase::acquire(); } \
85cdf0e10cSrcweir 	virtual void SAL_CALL release() throw () \
86cdf0e10cSrcweir 		{ WeakAggComponentImplHelperBase::release(); } \
87cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
88cdf0e10cSrcweir 		{ return getClassData( s_aCD ).getTypes(); } \
89cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
90cdf0e10cSrcweir 		{ return getClassData( s_aCD ).getImplementationId(); } \
91cdf0e10cSrcweir };
92cdf0e10cSrcweir 
93cdf0e10cSrcweir //==================================================================================================
94cdf0e10cSrcweir /** @internal */
95cdf0e10cSrcweir #define __DEF_COMPIMPLHELPER_B( N ) \
96cdf0e10cSrcweir template< __CLASS_IFC##N > \
97cdf0e10cSrcweir ClassData##N WeakComponentImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 4 ); \
98cdf0e10cSrcweir template< __CLASS_IFC##N > \
99cdf0e10cSrcweir ClassData##N WeakAggComponentImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 3 );
100cdf0e10cSrcweir //==================================================================================================
101cdf0e10cSrcweir /** @internal */
102cdf0e10cSrcweir #define __DEF_COMPIMPLHELPER_C( N ) \
103cdf0e10cSrcweir }
104cdf0e10cSrcweir //==================================================================================================
105cdf0e10cSrcweir /** @internal */
106cdf0e10cSrcweir #define __DEF_COMPIMPLHELPER( N ) \
107cdf0e10cSrcweir __DEF_COMPIMPLHELPER_A( N ) \
108cdf0e10cSrcweir __DEF_COMPIMPLHELPER_B( N ) \
109cdf0e10cSrcweir __DEF_COMPIMPLHELPER_C( N )
110cdf0e10cSrcweir 
111cdf0e10cSrcweir #endif
112