xref: /aoo41x/main/toolkit/source/awt/forward.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef AWT_FORWARD_HXX
29 #define AWT_FORWARD_HXX
30 
31 #include <comphelper/uno3.hxx>
32 
33 #define IMPLEMENT_FORWARD_XTYPEPROVIDER1( classname, baseclass ) \
34     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL classname::getTypes(  ) throw (::com::sun::star::uno::RuntimeException) \
35     { return baseclass::getTypes(); } \
36     IMPLEMENT_GET_IMPLEMENTATION_ID( classname )
37 
38 #define IMPLEMENT_2_FORWARD_XINTERFACE1( classname, refcountbase1, refcountbase2 ) \
39     void SAL_CALL classname::acquire() throw() { refcountbase1::acquire(); refcountbase2::acquire(); } \
40     void SAL_CALL classname::release() throw() { refcountbase1::release(); refcountbase2::release(); } \
41     ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
42     { \
43         ::com::sun::star::uno::Any aReturn = refcountbase1::queryInterface( _rType ); \
44         if ( !aReturn.hasValue() ) \
45         { \
46             aReturn = refcountbase2::queryInterface( _rType ); \
47         } \
48         return aReturn; \
49     }
50 
51 #define IMPLEMENT_2_FORWARD_XINTERFACE2( classname, refcountbase1, refcountbase2, baseclass3 ) \
52     void SAL_CALL classname::acquire() throw() { refcountbase1::acquire(); refcountbase2::acquire(); } \
53     void SAL_CALL classname::release() throw() { refcountbase1::release(); refcountbase2::release(); } \
54     ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
55     { \
56         ::com::sun::star::uno::Any aReturn = refcountbase1::queryInterface( _rType ); \
57         if ( !aReturn.hasValue() ) \
58         { \
59             aReturn = refcountbase2::queryInterface( _rType ); \
60             if ( !aReturn.hasValue() ) \
61                 aReturn = baseclass3::queryInterface( _rType ); \
62         } \
63         return aReturn; \
64     }
65 
66 #if defined (_MSC_VER) && (_MSC_VER <= 1310)
67 // Windows .Net2003 build fix
68 #define W3K_EXPLICIT_CAST(x) static_cast <XWindow2*> (&x)
69 #else // !(defined (_MSC_VER) && (_MSC_VER <= 1310))
70 #define W3K_EXPLICIT_CAST(x) x
71 #endif // !(defined (_MSC_VER) && (_MSC_VER <= 1310))
72 
73 #endif /* AWT_FORWARD_HXX */
74