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 #ifndef _CPPUHELPER_COMPBASE_HXX_
24 #define _CPPUHELPER_COMPBASE_HXX_
25 
26 #include <cppuhelper/compbase_ex.hxx>
27 #include <cppuhelper/implbase.hxx>
28 
29 /* This header should not be used anymore.
30    @deprecated
31 */
32 
33 //==================================================================================================
34 /** @internal */
35 #define __DEF_COMPIMPLHELPER_A( N ) \
36 namespace cppu \
37 { \
38 template< __CLASS_IFC##N > \
39 class SAL_NO_VTABLE WeakComponentImplHelper##N \
40     : public ::cppu::WeakComponentImplHelperBase \
41 	, public ImplHelperBase##N< __IFC##N > \
42 { \
43 	static ClassData##N s_aCD; \
44 public: \
45 	WeakComponentImplHelper##N( ::osl::Mutex & rMutex ) SAL_THROW( () ) \
46 		: WeakComponentImplHelperBase( rMutex ) \
47 		{} \
48 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
49 	{ \
50 		::com::sun::star::uno::Any aRet( getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
51 		if (aRet.hasValue()) \
52 			return aRet; \
53         return WeakComponentImplHelperBase::queryInterface( rType ); \
54 	} \
55 	virtual void SAL_CALL acquire() throw () \
56 		{ WeakComponentImplHelperBase::acquire(); } \
57 	virtual void SAL_CALL release() throw () \
58 		{ WeakComponentImplHelperBase::release(); } \
59 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
60 		{ return getClassData( s_aCD ).getTypes(); } \
61 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
62 		{ return getClassData( s_aCD ).getImplementationId(); } \
63 }; \
64 template< __CLASS_IFC##N > \
65 class SAL_NO_VTABLE WeakAggComponentImplHelper##N \
66 	: public ::cppu::WeakAggComponentImplHelperBase \
67 	, public ImplHelperBase##N< __IFC##N > \
68 { \
69 	static ClassData##N s_aCD; \
70 public: \
71 	WeakAggComponentImplHelper##N( ::osl::Mutex & rMutex ) SAL_THROW( () ) \
72 		: WeakAggComponentImplHelperBase( rMutex ) \
73 		{} \
74 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
75 		{ return WeakAggComponentImplHelperBase::queryInterface( rType ); } \
76 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
77 	{ \
78 		::com::sun::star::uno::Any aRet( getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
79 		if (aRet.hasValue()) \
80 			return aRet; \
81         return WeakAggComponentImplHelperBase::queryAggregation( rType ); \
82 	} \
83 	virtual void SAL_CALL acquire() throw () \
84 		{ WeakAggComponentImplHelperBase::acquire(); } \
85 	virtual void SAL_CALL release() throw () \
86 		{ WeakAggComponentImplHelperBase::release(); } \
87 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
88 		{ return getClassData( s_aCD ).getTypes(); } \
89 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
90 		{ return getClassData( s_aCD ).getImplementationId(); } \
91 };
92 
93 //==================================================================================================
94 /** @internal */
95 #define __DEF_COMPIMPLHELPER_B( N ) \
96 template< __CLASS_IFC##N > \
97 ClassData##N WeakComponentImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 4 ); \
98 template< __CLASS_IFC##N > \
99 ClassData##N WeakAggComponentImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 3 );
100 //==================================================================================================
101 /** @internal */
102 #define __DEF_COMPIMPLHELPER_C( N ) \
103 }
104 //==================================================================================================
105 /** @internal */
106 #define __DEF_COMPIMPLHELPER( N ) \
107 __DEF_COMPIMPLHELPER_A( N ) \
108 __DEF_COMPIMPLHELPER_B( N ) \
109 __DEF_COMPIMPLHELPER_C( N )
110 
111 #endif
112