xref: /AOO41X/main/cppuhelper/inc/cppuhelper/queryinterface.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
29*cdf0e10cSrcweir #define _CPPUHELPER_QUERYINTERFACE_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "sal/config.h"
32*cdf0e10cSrcweir #include "com/sun/star/uno/Any.hxx"
33*cdf0e10cSrcweir #include "com/sun/star/uno/Type.hxx"
34*cdf0e10cSrcweir #include "sal/types.h"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir namespace cppu
37*cdf0e10cSrcweir {
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir     @tplparam Interface1 interface type
42*cdf0e10cSrcweir     @param rType demanded type
43*cdf0e10cSrcweir     @param p1 interface pointer
44*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
45*cdf0e10cSrcweir */
46*cdf0e10cSrcweir template< class Interface1 >
47*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
48*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
49*cdf0e10cSrcweir 	Interface1 * p1 )
50*cdf0e10cSrcweir 	SAL_THROW( () )
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
53*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
54*cdf0e10cSrcweir 	else
55*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
56*cdf0e10cSrcweir }
57*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir     @tplparam Interface1 interface type
60*cdf0e10cSrcweir     @tplparam Interface2 interface type
61*cdf0e10cSrcweir     @param rType demanded type
62*cdf0e10cSrcweir     @param p1 interface pointer
63*cdf0e10cSrcweir     @param p2 interface pointer
64*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
65*cdf0e10cSrcweir */
66*cdf0e10cSrcweir template< class Interface1, class Interface2 >
67*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
68*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
69*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2 )
70*cdf0e10cSrcweir 	SAL_THROW( () )
71*cdf0e10cSrcweir {
72*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
73*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
74*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
75*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
76*cdf0e10cSrcweir 	else
77*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
78*cdf0e10cSrcweir }
79*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir     @tplparam Interface1 interface type
82*cdf0e10cSrcweir     @tplparam Interface2 interface type
83*cdf0e10cSrcweir     @tplparam Interface3 interface type
84*cdf0e10cSrcweir     @param rType demanded type
85*cdf0e10cSrcweir     @param p1 interface pointer
86*cdf0e10cSrcweir     @param p2 interface pointer
87*cdf0e10cSrcweir     @param p3 interface pointer
88*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
89*cdf0e10cSrcweir */
90*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3 >
91*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
92*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
93*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3 )
94*cdf0e10cSrcweir 	SAL_THROW( () )
95*cdf0e10cSrcweir {
96*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
97*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
98*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
99*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
100*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
101*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
102*cdf0e10cSrcweir 	else
103*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
104*cdf0e10cSrcweir }
105*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     @tplparam Interface1 interface type
108*cdf0e10cSrcweir     @tplparam Interface2 interface type
109*cdf0e10cSrcweir     @tplparam Interface3 interface type
110*cdf0e10cSrcweir     @tplparam Interface4 interface type
111*cdf0e10cSrcweir     @param rType demanded type
112*cdf0e10cSrcweir     @param p1 interface pointer
113*cdf0e10cSrcweir     @param p2 interface pointer
114*cdf0e10cSrcweir     @param p3 interface pointer
115*cdf0e10cSrcweir     @param p4 interface pointer
116*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
117*cdf0e10cSrcweir */
118*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3, class Interface4 >
119*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
120*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
121*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 )
122*cdf0e10cSrcweir 	SAL_THROW( () )
123*cdf0e10cSrcweir {
124*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
125*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
126*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
127*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
128*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
129*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
130*cdf0e10cSrcweir 	else if (rType == Interface4::static_type())
131*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p4, rType );
132*cdf0e10cSrcweir 	else
133*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
134*cdf0e10cSrcweir }
135*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir     @tplparam Interface1 interface type
138*cdf0e10cSrcweir     @tplparam Interface2 interface type
139*cdf0e10cSrcweir     @tplparam Interface3 interface type
140*cdf0e10cSrcweir     @tplparam Interface4 interface type
141*cdf0e10cSrcweir     @tplparam Interface5 interface type
142*cdf0e10cSrcweir     @param rType demanded type
143*cdf0e10cSrcweir     @param p1 interface pointer
144*cdf0e10cSrcweir     @param p2 interface pointer
145*cdf0e10cSrcweir     @param p3 interface pointer
146*cdf0e10cSrcweir     @param p4 interface pointer
147*cdf0e10cSrcweir     @param p5 interface pointer
148*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
149*cdf0e10cSrcweir */
150*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 >
151*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
152*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
153*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 )
154*cdf0e10cSrcweir 	SAL_THROW( () )
155*cdf0e10cSrcweir {
156*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
157*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
158*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
159*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
160*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
161*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
162*cdf0e10cSrcweir 	else if (rType == Interface4::static_type())
163*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p4, rType );
164*cdf0e10cSrcweir 	else if (rType == Interface5::static_type())
165*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p5, rType );
166*cdf0e10cSrcweir 	else
167*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
168*cdf0e10cSrcweir }
169*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir     @tplparam Interface1 interface type
172*cdf0e10cSrcweir     @tplparam Interface2 interface type
173*cdf0e10cSrcweir     @tplparam Interface3 interface type
174*cdf0e10cSrcweir     @tplparam Interface4 interface type
175*cdf0e10cSrcweir     @tplparam Interface5 interface type
176*cdf0e10cSrcweir     @tplparam Interface6 interface type
177*cdf0e10cSrcweir     @param rType demanded type
178*cdf0e10cSrcweir     @param p1 interface pointer
179*cdf0e10cSrcweir     @param p2 interface pointer
180*cdf0e10cSrcweir     @param p3 interface pointer
181*cdf0e10cSrcweir     @param p4 interface pointer
182*cdf0e10cSrcweir     @param p5 interface pointer
183*cdf0e10cSrcweir     @param p6 interface pointer
184*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
185*cdf0e10cSrcweir */
186*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
187*cdf0e10cSrcweir 		  class Interface6 >
188*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
189*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
190*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
191*cdf0e10cSrcweir 	Interface6 * p6 )
192*cdf0e10cSrcweir 	SAL_THROW( () )
193*cdf0e10cSrcweir {
194*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
195*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
196*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
197*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
198*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
199*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
200*cdf0e10cSrcweir 	else if (rType == Interface4::static_type())
201*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p4, rType );
202*cdf0e10cSrcweir 	else if (rType == Interface5::static_type())
203*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p5, rType );
204*cdf0e10cSrcweir 	else if (rType == Interface6::static_type())
205*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p6, rType );
206*cdf0e10cSrcweir 	else
207*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
208*cdf0e10cSrcweir }
209*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     @tplparam Interface1 interface type
212*cdf0e10cSrcweir     @tplparam Interface2 interface type
213*cdf0e10cSrcweir     @tplparam Interface3 interface type
214*cdf0e10cSrcweir     @tplparam Interface4 interface type
215*cdf0e10cSrcweir     @tplparam Interface5 interface type
216*cdf0e10cSrcweir     @tplparam Interface6 interface type
217*cdf0e10cSrcweir     @tplparam Interface7 interface type
218*cdf0e10cSrcweir     @param rType demanded type
219*cdf0e10cSrcweir     @param p1 interface pointer
220*cdf0e10cSrcweir     @param p2 interface pointer
221*cdf0e10cSrcweir     @param p3 interface pointer
222*cdf0e10cSrcweir     @param p4 interface pointer
223*cdf0e10cSrcweir     @param p5 interface pointer
224*cdf0e10cSrcweir     @param p6 interface pointer
225*cdf0e10cSrcweir     @param p7 interface pointer
226*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
227*cdf0e10cSrcweir */
228*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
229*cdf0e10cSrcweir 		  class Interface6, class Interface7 >
230*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
231*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
232*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
233*cdf0e10cSrcweir 	Interface6 * p6, Interface7 * p7 )
234*cdf0e10cSrcweir 	SAL_THROW( () )
235*cdf0e10cSrcweir {
236*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
237*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
238*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
239*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
240*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
241*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
242*cdf0e10cSrcweir 	else if (rType == Interface4::static_type())
243*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p4, rType );
244*cdf0e10cSrcweir 	else if (rType == Interface5::static_type())
245*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p5, rType );
246*cdf0e10cSrcweir 	else if (rType == Interface6::static_type())
247*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p6, rType );
248*cdf0e10cSrcweir 	else if (rType == Interface7::static_type())
249*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p7, rType );
250*cdf0e10cSrcweir 	else
251*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
252*cdf0e10cSrcweir }
253*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir     @tplparam Interface1 interface type
256*cdf0e10cSrcweir     @tplparam Interface2 interface type
257*cdf0e10cSrcweir     @tplparam Interface3 interface type
258*cdf0e10cSrcweir     @tplparam Interface4 interface type
259*cdf0e10cSrcweir     @tplparam Interface5 interface type
260*cdf0e10cSrcweir     @tplparam Interface6 interface type
261*cdf0e10cSrcweir     @tplparam Interface7 interface type
262*cdf0e10cSrcweir     @tplparam Interface8 interface type
263*cdf0e10cSrcweir     @param rType demanded type
264*cdf0e10cSrcweir     @param p1 interface pointer
265*cdf0e10cSrcweir     @param p2 interface pointer
266*cdf0e10cSrcweir     @param p3 interface pointer
267*cdf0e10cSrcweir     @param p4 interface pointer
268*cdf0e10cSrcweir     @param p5 interface pointer
269*cdf0e10cSrcweir     @param p6 interface pointer
270*cdf0e10cSrcweir     @param p7 interface pointer
271*cdf0e10cSrcweir     @param p8 interface pointer
272*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
273*cdf0e10cSrcweir */
274*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
275*cdf0e10cSrcweir 		  class Interface6, class Interface7, class Interface8 >
276*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
277*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
278*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
279*cdf0e10cSrcweir 	Interface6 * p6, Interface7 * p7, Interface8 * p8 )
280*cdf0e10cSrcweir 	SAL_THROW( () )
281*cdf0e10cSrcweir {
282*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
283*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
284*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
285*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
286*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
287*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
288*cdf0e10cSrcweir 	else if (rType == Interface4::static_type())
289*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p4, rType );
290*cdf0e10cSrcweir 	else if (rType == Interface5::static_type())
291*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p5, rType );
292*cdf0e10cSrcweir 	else if (rType == Interface6::static_type())
293*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p6, rType );
294*cdf0e10cSrcweir 	else if (rType == Interface7::static_type())
295*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p7, rType );
296*cdf0e10cSrcweir 	else if (rType == Interface8::static_type())
297*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p8, rType );
298*cdf0e10cSrcweir 	else
299*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
300*cdf0e10cSrcweir }
301*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir     @tplparam Interface1 interface type
304*cdf0e10cSrcweir     @tplparam Interface2 interface type
305*cdf0e10cSrcweir     @tplparam Interface3 interface type
306*cdf0e10cSrcweir     @tplparam Interface4 interface type
307*cdf0e10cSrcweir     @tplparam Interface5 interface type
308*cdf0e10cSrcweir     @tplparam Interface6 interface type
309*cdf0e10cSrcweir     @tplparam Interface7 interface type
310*cdf0e10cSrcweir     @tplparam Interface8 interface type
311*cdf0e10cSrcweir     @tplparam Interface9 interface type
312*cdf0e10cSrcweir     @param rType demanded type
313*cdf0e10cSrcweir     @param p1 interface pointer
314*cdf0e10cSrcweir     @param p2 interface pointer
315*cdf0e10cSrcweir     @param p3 interface pointer
316*cdf0e10cSrcweir     @param p4 interface pointer
317*cdf0e10cSrcweir     @param p5 interface pointer
318*cdf0e10cSrcweir     @param p6 interface pointer
319*cdf0e10cSrcweir     @param p7 interface pointer
320*cdf0e10cSrcweir     @param p8 interface pointer
321*cdf0e10cSrcweir     @param p9 interface pointer
322*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
323*cdf0e10cSrcweir */
324*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
325*cdf0e10cSrcweir 		  class Interface6, class Interface7, class Interface8, class Interface9 >
326*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
327*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
328*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
329*cdf0e10cSrcweir 	Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 )
330*cdf0e10cSrcweir 	SAL_THROW( () )
331*cdf0e10cSrcweir {
332*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
333*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
334*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
335*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
336*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
337*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
338*cdf0e10cSrcweir 	else if (rType == Interface4::static_type())
339*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p4, rType );
340*cdf0e10cSrcweir 	else if (rType == Interface5::static_type())
341*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p5, rType );
342*cdf0e10cSrcweir 	else if (rType == Interface6::static_type())
343*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p6, rType );
344*cdf0e10cSrcweir 	else if (rType == Interface7::static_type())
345*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p7, rType );
346*cdf0e10cSrcweir 	else if (rType == Interface8::static_type())
347*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p8, rType );
348*cdf0e10cSrcweir 	else if (rType == Interface9::static_type())
349*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p9, rType );
350*cdf0e10cSrcweir 	else
351*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
352*cdf0e10cSrcweir }
353*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir     @tplparam Interface1 interface type
356*cdf0e10cSrcweir     @tplparam Interface2 interface type
357*cdf0e10cSrcweir     @tplparam Interface3 interface type
358*cdf0e10cSrcweir     @tplparam Interface4 interface type
359*cdf0e10cSrcweir     @tplparam Interface5 interface type
360*cdf0e10cSrcweir     @tplparam Interface6 interface type
361*cdf0e10cSrcweir     @tplparam Interface7 interface type
362*cdf0e10cSrcweir     @tplparam Interface8 interface type
363*cdf0e10cSrcweir     @tplparam Interface9 interface type
364*cdf0e10cSrcweir     @tplparam Interface10 interface type
365*cdf0e10cSrcweir     @param rType demanded type
366*cdf0e10cSrcweir     @param p1 interface pointer
367*cdf0e10cSrcweir     @param p2 interface pointer
368*cdf0e10cSrcweir     @param p3 interface pointer
369*cdf0e10cSrcweir     @param p4 interface pointer
370*cdf0e10cSrcweir     @param p5 interface pointer
371*cdf0e10cSrcweir     @param p6 interface pointer
372*cdf0e10cSrcweir     @param p7 interface pointer
373*cdf0e10cSrcweir     @param p8 interface pointer
374*cdf0e10cSrcweir     @param p9 interface pointer
375*cdf0e10cSrcweir     @param p10 interface pointer
376*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
377*cdf0e10cSrcweir */
378*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
379*cdf0e10cSrcweir 		  class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 >
380*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
381*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
382*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
383*cdf0e10cSrcweir 	Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 )
384*cdf0e10cSrcweir 	SAL_THROW( () )
385*cdf0e10cSrcweir {
386*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
387*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
388*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
389*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
390*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
391*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
392*cdf0e10cSrcweir 	else if (rType == Interface4::static_type())
393*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p4, rType );
394*cdf0e10cSrcweir 	else if (rType == Interface5::static_type())
395*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p5, rType );
396*cdf0e10cSrcweir 	else if (rType == Interface6::static_type())
397*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p6, rType );
398*cdf0e10cSrcweir 	else if (rType == Interface7::static_type())
399*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p7, rType );
400*cdf0e10cSrcweir 	else if (rType == Interface8::static_type())
401*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p8, rType );
402*cdf0e10cSrcweir 	else if (rType == Interface9::static_type())
403*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p9, rType );
404*cdf0e10cSrcweir 	else if (rType == Interface10::static_type())
405*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p10, rType );
406*cdf0e10cSrcweir 	else
407*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
408*cdf0e10cSrcweir }
409*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir     @tplparam Interface1 interface type
412*cdf0e10cSrcweir     @tplparam Interface2 interface type
413*cdf0e10cSrcweir     @tplparam Interface3 interface type
414*cdf0e10cSrcweir     @tplparam Interface4 interface type
415*cdf0e10cSrcweir     @tplparam Interface5 interface type
416*cdf0e10cSrcweir     @tplparam Interface6 interface type
417*cdf0e10cSrcweir     @tplparam Interface7 interface type
418*cdf0e10cSrcweir     @tplparam Interface8 interface type
419*cdf0e10cSrcweir     @tplparam Interface9 interface type
420*cdf0e10cSrcweir     @tplparam Interface10 interface type
421*cdf0e10cSrcweir     @tplparam Interface11 interface type
422*cdf0e10cSrcweir     @param rType demanded type
423*cdf0e10cSrcweir     @param p1 interface pointer
424*cdf0e10cSrcweir     @param p2 interface pointer
425*cdf0e10cSrcweir     @param p3 interface pointer
426*cdf0e10cSrcweir     @param p4 interface pointer
427*cdf0e10cSrcweir     @param p5 interface pointer
428*cdf0e10cSrcweir     @param p6 interface pointer
429*cdf0e10cSrcweir     @param p7 interface pointer
430*cdf0e10cSrcweir     @param p8 interface pointer
431*cdf0e10cSrcweir     @param p9 interface pointer
432*cdf0e10cSrcweir     @param p10 interface pointer
433*cdf0e10cSrcweir     @param p11 interface pointer
434*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
435*cdf0e10cSrcweir */
436*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
437*cdf0e10cSrcweir 		  class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
438*cdf0e10cSrcweir 		  class Interface11 >
439*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
440*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
441*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
442*cdf0e10cSrcweir 	Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
443*cdf0e10cSrcweir 	Interface11 * p11 )
444*cdf0e10cSrcweir 	SAL_THROW( () )
445*cdf0e10cSrcweir {
446*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
447*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
448*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
449*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
450*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
451*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
452*cdf0e10cSrcweir 	else if (rType == Interface4::static_type())
453*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p4, rType );
454*cdf0e10cSrcweir 	else if (rType == Interface5::static_type())
455*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p5, rType );
456*cdf0e10cSrcweir 	else if (rType == Interface6::static_type())
457*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p6, rType );
458*cdf0e10cSrcweir 	else if (rType == Interface7::static_type())
459*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p7, rType );
460*cdf0e10cSrcweir 	else if (rType == Interface8::static_type())
461*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p8, rType );
462*cdf0e10cSrcweir 	else if (rType == Interface9::static_type())
463*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p9, rType );
464*cdf0e10cSrcweir 	else if (rType == Interface10::static_type())
465*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p10, rType );
466*cdf0e10cSrcweir 	else if (rType == Interface11::static_type())
467*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p11, rType );
468*cdf0e10cSrcweir 	else
469*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
470*cdf0e10cSrcweir }
471*cdf0e10cSrcweir /** Compares demanded type to given template argument types.
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir     @tplparam Interface1 interface type
474*cdf0e10cSrcweir     @tplparam Interface2 interface type
475*cdf0e10cSrcweir     @tplparam Interface3 interface type
476*cdf0e10cSrcweir     @tplparam Interface4 interface type
477*cdf0e10cSrcweir     @tplparam Interface5 interface type
478*cdf0e10cSrcweir     @tplparam Interface6 interface type
479*cdf0e10cSrcweir     @tplparam Interface7 interface type
480*cdf0e10cSrcweir     @tplparam Interface8 interface type
481*cdf0e10cSrcweir     @tplparam Interface9 interface type
482*cdf0e10cSrcweir     @tplparam Interface10 interface type
483*cdf0e10cSrcweir     @tplparam Interface11 interface type
484*cdf0e10cSrcweir     @tplparam Interface12 interface type
485*cdf0e10cSrcweir     @param rType demanded type
486*cdf0e10cSrcweir     @param p1 interface pointer
487*cdf0e10cSrcweir     @param p2 interface pointer
488*cdf0e10cSrcweir     @param p3 interface pointer
489*cdf0e10cSrcweir     @param p4 interface pointer
490*cdf0e10cSrcweir     @param p5 interface pointer
491*cdf0e10cSrcweir     @param p6 interface pointer
492*cdf0e10cSrcweir     @param p7 interface pointer
493*cdf0e10cSrcweir     @param p8 interface pointer
494*cdf0e10cSrcweir     @param p9 interface pointer
495*cdf0e10cSrcweir     @param p10 interface pointer
496*cdf0e10cSrcweir     @param p11 interface pointer
497*cdf0e10cSrcweir     @param p12 interface pointer
498*cdf0e10cSrcweir     @return acquired interface of demanded type or empty Any
499*cdf0e10cSrcweir */
500*cdf0e10cSrcweir template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
501*cdf0e10cSrcweir 		  class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
502*cdf0e10cSrcweir 		  class Interface11, class Interface12 >
503*cdf0e10cSrcweir inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
504*cdf0e10cSrcweir 	const ::com::sun::star::uno::Type & rType,
505*cdf0e10cSrcweir 	Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
506*cdf0e10cSrcweir 	Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
507*cdf0e10cSrcweir 	Interface11 * p11, Interface12 * p12 )
508*cdf0e10cSrcweir 	SAL_THROW( () )
509*cdf0e10cSrcweir {
510*cdf0e10cSrcweir 	if (rType == Interface1::static_type())
511*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p1, rType );
512*cdf0e10cSrcweir 	else if (rType == Interface2::static_type())
513*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p2, rType );
514*cdf0e10cSrcweir 	else if (rType == Interface3::static_type())
515*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p3, rType );
516*cdf0e10cSrcweir 	else if (rType == Interface4::static_type())
517*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p4, rType );
518*cdf0e10cSrcweir 	else if (rType == Interface5::static_type())
519*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p5, rType );
520*cdf0e10cSrcweir 	else if (rType == Interface6::static_type())
521*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p6, rType );
522*cdf0e10cSrcweir 	else if (rType == Interface7::static_type())
523*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p7, rType );
524*cdf0e10cSrcweir 	else if (rType == Interface8::static_type())
525*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p8, rType );
526*cdf0e10cSrcweir 	else if (rType == Interface9::static_type())
527*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p9, rType );
528*cdf0e10cSrcweir 	else if (rType == Interface10::static_type())
529*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p10, rType );
530*cdf0e10cSrcweir 	else if (rType == Interface11::static_type())
531*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p11, rType );
532*cdf0e10cSrcweir 	else if (rType == Interface12::static_type())
533*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any( &p12, rType );
534*cdf0e10cSrcweir 	else
535*cdf0e10cSrcweir 		return ::com::sun::star::uno::Any();
536*cdf0e10cSrcweir }
537*cdf0e10cSrcweir 
538*cdf0e10cSrcweir }
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir #endif
541*cdf0e10cSrcweir 
542