xref: /aoo42x/main/toolkit/source/awt/forward.hxx (revision 33b461d6)
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 AWT_FORWARD_HXX
25 #define AWT_FORWARD_HXX
26 
27 #include <comphelper/uno3.hxx>
28 
29 #define IMPLEMENT_FORWARD_XTYPEPROVIDER1( classname, baseclass ) \
30     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL classname::getTypes(  ) throw (::com::sun::star::uno::RuntimeException) \
31     { return baseclass::getTypes(); } \
32     IMPLEMENT_GET_IMPLEMENTATION_ID( classname )
33 
34 #define IMPLEMENT_2_FORWARD_XINTERFACE1( classname, refcountbase1, refcountbase2 ) \
35     void SAL_CALL classname::acquire() throw() { refcountbase1::acquire(); refcountbase2::acquire(); } \
36     void SAL_CALL classname::release() throw() { refcountbase1::release(); refcountbase2::release(); } \
37     ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
38     { \
39         ::com::sun::star::uno::Any aReturn = refcountbase1::queryInterface( _rType ); \
40         if ( !aReturn.hasValue() ) \
41         { \
42             aReturn = refcountbase2::queryInterface( _rType ); \
43         } \
44         return aReturn; \
45     }
46 
47 #define IMPLEMENT_2_FORWARD_XINTERFACE2( classname, refcountbase1, refcountbase2, baseclass3 ) \
48     void SAL_CALL classname::acquire() throw() { refcountbase1::acquire(); refcountbase2::acquire(); } \
49     void SAL_CALL classname::release() throw() { refcountbase1::release(); refcountbase2::release(); } \
50     ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
51     { \
52         ::com::sun::star::uno::Any aReturn = refcountbase1::queryInterface( _rType ); \
53         if ( !aReturn.hasValue() ) \
54         { \
55             aReturn = refcountbase2::queryInterface( _rType ); \
56             if ( !aReturn.hasValue() ) \
57                 aReturn = baseclass3::queryInterface( _rType ); \
58         } \
59         return aReturn; \
60     }
61 
62 // fix to remove a type ambiguity e.g.
63 //    class layoutimpl::VCLXDialog -> class VCLXWindow -> VCLXWindow_Base -> class VCLXDevice -> ::cppu::OWeakObject
64 //    class layoutimpl::VCLXDialog -> class layoutimpl::Bin -> class layoutimpl::Container -> Container_Base -> class cppu::OWeakObject
65 //    class layoutimpl::VCLXDialog -> class layoutimpl::Bin -> class layoutimpl::Container -> class layoutimpl::PropHelper -> cppu::OWeakObjec
66 #define W3K_EXPLICIT_CAST(x) static_cast <XWindow2*> (&x)
67 
68 #endif /* AWT_FORWARD_HXX */
69