1*2a97ec55SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2a97ec55SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2a97ec55SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2a97ec55SAndrew Rist  * distributed with this work for additional information
6*2a97ec55SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2a97ec55SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2a97ec55SAndrew Rist  * "License"); you may not use this file except in compliance
9*2a97ec55SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2a97ec55SAndrew Rist  *
11*2a97ec55SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2a97ec55SAndrew Rist  *
13*2a97ec55SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2a97ec55SAndrew Rist  * software distributed under the License is distributed on an
15*2a97ec55SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2a97ec55SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2a97ec55SAndrew Rist  * specific language governing permissions and limitations
18*2a97ec55SAndrew Rist  * under the License.
19*2a97ec55SAndrew Rist  *
20*2a97ec55SAndrew Rist  *************************************************************/
21*2a97ec55SAndrew Rist 
22*2a97ec55SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_extensions.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <atlbase.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir CComModule _Module;
30cdf0e10cSrcweir #include<atlcom.h>
31cdf0e10cSrcweir #include <comdef.h>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include "axhost.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <stdio.h>
36cdf0e10cSrcweir #include "typelib/typedescription.hxx"
37cdf0e10cSrcweir #include <com/sun/star/bridge/oleautomation/Date.hpp>
38cdf0e10cSrcweir #include <com/sun/star/bridge/oleautomation/Currency.hpp>
39cdf0e10cSrcweir #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
40cdf0e10cSrcweir #include <com/sun/star/bridge/oleautomation/SCode.hpp>
41cdf0e10cSrcweir #include <com/sun/star/bridge/oleautomation/NamedArgument.hpp>
42cdf0e10cSrcweir #include <com/sun/star/bridge/oleautomation/PropertyPutArgument.hpp>
43cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44cdf0e10cSrcweir #include <com/sun/star/script/XInvocation.hpp>
45cdf0e10cSrcweir //#include <oletest/XCallback.hpp>
46cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
47cdf0e10cSrcweir #include <cppuhelper/servicefactory.hxx>
48cdf0e10cSrcweir #include <rtl/string.h>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
51cdf0e10cSrcweir BEGIN_OBJECT_MAP(ObjectMap)
52cdf0e10cSrcweir END_OBJECT_MAP()
53cdf0e10cSrcweir 
54cdf0e10cSrcweir using namespace com::sun::star::lang;
55cdf0e10cSrcweir using namespace com::sun::star::uno;
56cdf0e10cSrcweir using namespace com::sun::star::script;
57cdf0e10cSrcweir using namespace com::sun::star::bridge::oleautomation;
58cdf0e10cSrcweir using namespace cppu;
59cdf0e10cSrcweir using namespace rtl;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 
63cdf0e10cSrcweir Reference<XInvocation> convertComObject( IUnknown* pUnk);
64cdf0e10cSrcweir Reference<XInvocation> getComObject( OUString progId);
65cdf0e10cSrcweir bool checkOutArgs(const Sequence<Any> & outArgs,
66cdf0e10cSrcweir                   const Sequence<sal_Int16> & indices, const Sequence<Any> & values);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir bool doSimpleTest(const Reference<XInvocation> & inv);
69cdf0e10cSrcweir bool doSimpleSequenceTest(const Reference<XInvocation> & inv);
70cdf0e10cSrcweir bool doParameterTest(const Reference<XInvocation> & inv);
71cdf0e10cSrcweir bool doPropertyWithArgumentTest(const Reference<XInvocation> & inv);
72cdf0e10cSrcweir bool equalSequences(const Any& orig, const Any& returned);
73cdf0e10cSrcweir HRESULT doTest();
74cdf0e10cSrcweir HRESULT doTest2( Reference<XInvocation> &);
75cdf0e10cSrcweir Reference<XInvocation> getComObject(OUString& );
76cdf0e10cSrcweir 
77cdf0e10cSrcweir HRESULT InitializeParameter();
78cdf0e10cSrcweir void printResultVariantArray( VARIANT & var);
79cdf0e10cSrcweir void printVariant( VARIANT & var);
80cdf0e10cSrcweir void printSequence( Sequence<Any>& val);
81cdf0e10cSrcweir 
main(int,char **)82cdf0e10cSrcweir extern "C" int __cdecl main( int , char **)
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	HRESULT hr;
85cdf0e10cSrcweir 	if( FAILED( hr=CoInitialize(NULL)))
86cdf0e10cSrcweir 	{
87cdf0e10cSrcweir 		_tprintf(_T("CoInitialize failed \n"));
88cdf0e10cSrcweir 		return -1;
89cdf0e10cSrcweir 	}
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	_Module.Init( ObjectMap, GetModuleHandle( NULL));
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	if( FAILED(hr=doTest()))
95cdf0e10cSrcweir 	{
96cdf0e10cSrcweir 		_com_error err( hr);
97cdf0e10cSrcweir 		const TCHAR * errMsg= err.ErrorMessage();
98cdf0e10cSrcweir 		MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
99cdf0e10cSrcweir 	}
100cdf0e10cSrcweir 	else
101cdf0e10cSrcweir 	{
102cdf0e10cSrcweir 		MessageBox( NULL,NULL , "Test succeeded", MB_ICONINFORMATION);
103cdf0e10cSrcweir 	}
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	_Module.Term();
107cdf0e10cSrcweir 	CoUninitialize();
108cdf0e10cSrcweir 	return 0;
109cdf0e10cSrcweir }
110cdf0e10cSrcweir //Also supports named args
111cdf0e10cSrcweir 
doParameterTest(const Reference<XInvocation> & inv)112cdf0e10cSrcweir bool doParameterTest(const Reference<XInvocation> & inv)
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	Sequence< sal_Int16> seqIndices;
115cdf0e10cSrcweir 	Sequence<Any> seqOut;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     Any arArgs[2];
118cdf0e10cSrcweir     Any arValue[2];
119cdf0e10cSrcweir     Any arArgs1[4];
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     NamedArgument arg1(OUString(L"val1"), makeAny((sal_Int32) 123));
122cdf0e10cSrcweir     NamedArgument arg2(OUString(L"val2"), makeAny((sal_Int32) 456));
123cdf0e10cSrcweir     NamedArgument arg3(OUString(L"val3"), makeAny((sal_Int32) 0xff));
124cdf0e10cSrcweir     NamedArgument arg4(OUString(L"val4"), makeAny((sal_Int32) 0xffff));
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     NamedArgument argOut1(OUString(L"val1"), Any());
127cdf0e10cSrcweir     NamedArgument argOut2(OUString(L"val2"), Any());
128cdf0e10cSrcweir     Sequence<Any> seqNoArgs;
129cdf0e10cSrcweir     arArgs[0] <<= (sal_Int32) 0;
130cdf0e10cSrcweir     arArgs[1] <<= (sal_Int32) 0;
131cdf0e10cSrcweir     Sequence<Any> seqPositional0(arArgs, 2);
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     arArgs[0] <<= arg1;
135cdf0e10cSrcweir     arArgs[1] <<= arg2;
136cdf0e10cSrcweir     Sequence<Any> seqNamed(arArgs, 2);
137cdf0e10cSrcweir     arArgs[0] <<= arg2;
138cdf0e10cSrcweir     arArgs[1] <<= arg1;
139cdf0e10cSrcweir     Sequence<Any> seqNamed2(arArgs, 2);
140cdf0e10cSrcweir     arArgs[0] <<= argOut1;
141cdf0e10cSrcweir     arArgs[1] <<= argOut2;
142cdf0e10cSrcweir     Sequence<Any> seqNamed3(arArgs, 2);
143cdf0e10cSrcweir     arArgs[0] <<= argOut2;
144cdf0e10cSrcweir     arArgs[1] <<= argOut1;
145cdf0e10cSrcweir     Sequence<Any> seqNamed4(arArgs, 2);
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     arArgs[0] <<= arg1;
148cdf0e10cSrcweir     Sequence<Any> seqNamed5(arArgs, 1);
149cdf0e10cSrcweir     arArgs[0] <<= arg2;
150cdf0e10cSrcweir     Sequence<Any> seqNamed6(arArgs, 1);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     arArgs[0] <<= (sal_Int32) 123;
153cdf0e10cSrcweir     arArgs[1] <<= (sal_Int32) 456;
154cdf0e10cSrcweir     Sequence<Any> seqPositional(arArgs, 2);
155cdf0e10cSrcweir     arArgs[0] <<= (sal_Int32) 123;
156cdf0e10cSrcweir     Sequence<Any> seqPositional2(arArgs, 1);
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     arArgs[0] <<= Any();
159cdf0e10cSrcweir     arArgs[1] <<= Any();
160cdf0e10cSrcweir     Sequence<Any> seqPositional3(arArgs, 2);
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     arArgs[0] <<= (sal_Int32) 123;
163cdf0e10cSrcweir     arArgs[1] <<= SCode(DISP_E_PARAMNOTFOUND);
164cdf0e10cSrcweir     Sequence<Any> seqOutOpt1(arArgs, 2);
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     arArgs[0] <<= SCode(DISP_E_PARAMNOTFOUND);
167cdf0e10cSrcweir     arArgs[1] <<= SCode(DISP_E_PARAMNOTFOUND);
168cdf0e10cSrcweir     Sequence<Any> seqOutOpt2(arArgs, 2);
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     arArgs[0] <<= SCode(DISP_E_PARAMNOTFOUND);
171cdf0e10cSrcweir     arArgs[1] <<= (sal_Int32) 456;
172cdf0e10cSrcweir     Sequence<Any> seqOutOpt3(arArgs, 2);
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     arArgs1[0] <<= (sal_Int32) 0;
175cdf0e10cSrcweir     arArgs1[1] <<= (sal_Int32) 0;
176cdf0e10cSrcweir     arArgs1[2] <<= (sal_Int32) 0;
177cdf0e10cSrcweir     arArgs1[3] <<= (sal_Int32) 0;
178cdf0e10cSrcweir     Sequence<Any> seqMix0(arArgs1, 4);
179cdf0e10cSrcweir 
180cdf0e10cSrcweir     arArgs1[0] <<= (sal_Int32) 123;
181cdf0e10cSrcweir     arArgs1[1] <<= (sal_Int32) 456;
182cdf0e10cSrcweir     arArgs1[2] <<= arg3;
183cdf0e10cSrcweir     arArgs1[3] <<= arg4;
184cdf0e10cSrcweir     Sequence<Any> seqMix(arArgs1, 4);
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     arArgs1[0] <<= Any();
187cdf0e10cSrcweir     arArgs1[1] <<= (sal_Int32) 456;
188cdf0e10cSrcweir     arArgs1[2] <<= arg4;
189cdf0e10cSrcweir     Sequence<Any> seqMix2(arArgs1, 3);
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     arArgs1[0] <<= SCode(DISP_E_PARAMNOTFOUND);
192cdf0e10cSrcweir     arArgs1[1] <<= (sal_Int32) 456;
193cdf0e10cSrcweir     arArgs1[2] <<= SCode(DISP_E_PARAMNOTFOUND);
194cdf0e10cSrcweir     arArgs1[3] <<= arg4.Value;
195cdf0e10cSrcweir     Sequence<Any> seqMixOut(arArgs1, 4);
196cdf0e10cSrcweir 
197cdf0e10cSrcweir     arArgs1[0] <<= SCode(DISP_E_PARAMNOTFOUND);
198cdf0e10cSrcweir     arArgs1[1] <<= Any();
199cdf0e10cSrcweir     arArgs1[2] <<= arg4;
200cdf0e10cSrcweir     Sequence<Any> seqMix2Out(arArgs1, 3);
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 
204cdf0e10cSrcweir     //in args + out, optional, positional-----------------------------------------
205cdf0e10cSrcweir     //first general test
206cdf0e10cSrcweir     seqIndices.realloc(0);
207cdf0e10cSrcweir     seqOut.realloc(0);
208cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqPositional, seqIndices, seqOut);
209cdf0e10cSrcweir 	seqIndices.realloc(0);
210cdf0e10cSrcweir 	seqOut.realloc(0);
211cdf0e10cSrcweir     inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
212cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqPositional))
213cdf0e10cSrcweir         return false;
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     //2 optional args, 1 provided
216cdf0e10cSrcweir     seqIndices.realloc(0);
217cdf0e10cSrcweir     seqOut.realloc(0);
218cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
219cdf0e10cSrcweir     seqIndices.realloc(0);
220cdf0e10cSrcweir     seqOut.realloc(0);
221cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqPositional2, seqIndices, seqOut);
222cdf0e10cSrcweir 	seqIndices.realloc(0);
223cdf0e10cSrcweir 	seqOut.realloc(0);
224cdf0e10cSrcweir     inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
225cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt1))
226cdf0e10cSrcweir         return false;
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	//2 optional args, 0 provided
229cdf0e10cSrcweir     seqIndices.realloc(0);
230cdf0e10cSrcweir     seqOut.realloc(0);
231cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
232cdf0e10cSrcweir     seqIndices.realloc(0);
233cdf0e10cSrcweir     seqOut.realloc(0);
234cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqNoArgs, seqIndices, seqOut);
235cdf0e10cSrcweir 	seqIndices.realloc(0);
236cdf0e10cSrcweir 	seqOut.realloc(0);
237cdf0e10cSrcweir     inv->invoke(OUString(L"optional5"), seqPositional3, seqIndices, seqOut);
238cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt2))
239cdf0e10cSrcweir         return false;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir     //named args --------------------------------------------
242cdf0e10cSrcweir 
243cdf0e10cSrcweir     // 2 named args, correct position
244cdf0e10cSrcweir     seqIndices.realloc(0);
245cdf0e10cSrcweir     seqOut.realloc(0);
246cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
247cdf0e10cSrcweir     seqIndices.realloc(0);
248cdf0e10cSrcweir 	seqOut.realloc(0);
249cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqNamed, seqIndices, seqOut);
250cdf0e10cSrcweir 	seqIndices.realloc(0);
251cdf0e10cSrcweir 	seqOut.realloc(0);
252cdf0e10cSrcweir     inv->invoke(OUString(L"optional5"), seqPositional0, seqIndices, seqOut);
253cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqPositional))
254cdf0e10cSrcweir         return false;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     // 2named args, position differs
257cdf0e10cSrcweir     seqIndices.realloc(0);
258cdf0e10cSrcweir     seqOut.realloc(0);
259cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
260cdf0e10cSrcweir 	seqIndices.realloc(0);
261cdf0e10cSrcweir 	seqOut.realloc(0);
262cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqNamed2, seqIndices, seqOut);
263cdf0e10cSrcweir 	seqIndices.realloc(0);
264cdf0e10cSrcweir 	seqOut.realloc(0);
265cdf0e10cSrcweir     inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
266cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqPositional))
267cdf0e10cSrcweir         return false;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     //named out args, 2 named args with correct position
270cdf0e10cSrcweir     seqIndices.realloc(0);
271cdf0e10cSrcweir     seqOut.realloc(0);
272cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqNamed, seqIndices, seqOut);
273cdf0e10cSrcweir     seqIndices.realloc(0);
274cdf0e10cSrcweir     seqIndices.realloc(0);
275cdf0e10cSrcweir     inv->invoke(OUString(L"optional5"), seqNamed3, seqIndices, seqOut);
276cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqNamed ))
277cdf0e10cSrcweir         return false;
278cdf0e10cSrcweir 
279cdf0e10cSrcweir     //named out args, 2 named args with different position
280cdf0e10cSrcweir     seqIndices.realloc(0);
281cdf0e10cSrcweir     seqOut.realloc(0);
282cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqNamed, seqIndices, seqOut);
283cdf0e10cSrcweir     seqIndices.realloc(0);
284cdf0e10cSrcweir     seqIndices.realloc(0);
285cdf0e10cSrcweir     inv->invoke(OUString(L"optional5"), seqNamed4, seqIndices, seqOut);
286cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqNamed2 ))
287cdf0e10cSrcweir         return false;
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 
290cdf0e10cSrcweir     //2 args, 1 provided (correct order)
291cdf0e10cSrcweir     seqIndices.realloc(0);
292cdf0e10cSrcweir     seqOut.realloc(0);
293cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
294cdf0e10cSrcweir 	seqIndices.realloc(0);
295cdf0e10cSrcweir 	seqOut.realloc(0);
296cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqNamed5, seqIndices, seqOut);
297cdf0e10cSrcweir 	seqIndices.realloc(0);
298cdf0e10cSrcweir 	seqOut.realloc(0);
299cdf0e10cSrcweir     inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
300cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt1))
301cdf0e10cSrcweir         return false;
302cdf0e10cSrcweir     //2 args, 1 provided (incorrect order)
303cdf0e10cSrcweir     seqIndices.realloc(0);
304cdf0e10cSrcweir     seqOut.realloc(0);
305cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
306cdf0e10cSrcweir 	seqIndices.realloc(0);
307cdf0e10cSrcweir 	seqOut.realloc(0);
308cdf0e10cSrcweir     inv->invoke(OUString(L"optional3"), seqNamed6, seqIndices, seqOut);
309cdf0e10cSrcweir 	seqIndices.realloc(0);
310cdf0e10cSrcweir 	seqOut.realloc(0);
311cdf0e10cSrcweir     inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
312cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt3))
313cdf0e10cSrcweir         return false;
314cdf0e10cSrcweir 
315cdf0e10cSrcweir     //2position + 2 2named args, correct order
316cdf0e10cSrcweir     seqIndices.realloc(0);
317cdf0e10cSrcweir     seqOut.realloc(0);
318cdf0e10cSrcweir     inv->invoke(OUString(L"optional6"), seqMix0, seqIndices, seqOut);
319cdf0e10cSrcweir 	seqIndices.realloc(0);
320cdf0e10cSrcweir 	seqOut.realloc(0);
321cdf0e10cSrcweir     inv->invoke(OUString(L"optional6"), seqMix, seqIndices, seqOut);
322cdf0e10cSrcweir 	seqIndices.realloc(0);
323cdf0e10cSrcweir 	seqOut.realloc(0);
324cdf0e10cSrcweir     inv->invoke(OUString(L"optional7"), seqMix, seqIndices, seqOut);
325cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqMix))
326cdf0e10cSrcweir          return false;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir     // 4 in args, 1 positional, 1 named, 1 positional omitted
329cdf0e10cSrcweir     seqIndices.realloc(0);
330cdf0e10cSrcweir     seqOut.realloc(0);
331cdf0e10cSrcweir     inv->invoke(OUString(L"optional6"), seqMix0, seqIndices, seqOut);
332cdf0e10cSrcweir 	seqIndices.realloc(0);
333cdf0e10cSrcweir 	seqOut.realloc(0);
334cdf0e10cSrcweir     inv->invoke(OUString(L"optional6"), seqMix2, seqIndices, seqOut);
335cdf0e10cSrcweir 	seqIndices.realloc(0);
336cdf0e10cSrcweir 	seqOut.realloc(0);
337cdf0e10cSrcweir     inv->invoke(OUString(L"optional7"), seqMix0, seqIndices, seqOut);
338cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqMixOut))
339cdf0e10cSrcweir          return false;
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 	// 4 out args, 1 positional, 1 named, 1 positional omitted
342cdf0e10cSrcweir     seqIndices.realloc(0);
343cdf0e10cSrcweir     seqOut.realloc(0);
344cdf0e10cSrcweir     inv->invoke(OUString(L"optional6"), seqMix2, seqIndices, seqOut);
345cdf0e10cSrcweir 	seqIndices.realloc(0);
346cdf0e10cSrcweir 	seqOut.realloc(0);
347cdf0e10cSrcweir     inv->invoke(OUString(L"optional7"), seqMix2Out, seqIndices, seqOut);
348cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqMix2Out))
349cdf0e10cSrcweir          return false;
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 
352cdf0e10cSrcweir     return true;
353cdf0e10cSrcweir }
doPropertyTest(const Reference<XInvocation> & inv)354cdf0e10cSrcweir bool doPropertyTest(const Reference<XInvocation> & inv)
355cdf0e10cSrcweir {
356cdf0e10cSrcweir 	Sequence< sal_Int16> seqIndices;
357cdf0e10cSrcweir 	Sequence<Any> seqOut;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	Any inBool, outBool;
360cdf0e10cSrcweir 	Any inByte, outByte;
361cdf0e10cSrcweir 	Any inShort, outShort;
362cdf0e10cSrcweir 	Any inLong,  outLong;
363cdf0e10cSrcweir 	Any inString,  outString;
364cdf0e10cSrcweir 	Any inFloat, outFloat;
365cdf0e10cSrcweir 	Any inDouble, outDouble;
366cdf0e10cSrcweir 	Any inVariant, outVariant;
367cdf0e10cSrcweir 	Any inObject, outObject;
368cdf0e10cSrcweir     Any inUnknown, outUnknown;
369cdf0e10cSrcweir     Any inCY, outCY;
370cdf0e10cSrcweir     Any inDate, outDate;
371cdf0e10cSrcweir 	Any inDecimal, outDecimal;
372cdf0e10cSrcweir     Any inSCode, outSCode;
373cdf0e10cSrcweir     Any inrefLong, outrefLong;
374cdf0e10cSrcweir     Any inrefVariant, outrefVariant;
375cdf0e10cSrcweir     Any inrefDecimal, outrefDecimal;
376cdf0e10cSrcweir     Any inParamsLong, outParamsLong;
377cdf0e10cSrcweir     Reference<XInterface> xintUnknown(getComObject(L"AxTestComponents.Foo"));
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 	inBool <<= (sal_Bool) sal_True;
380cdf0e10cSrcweir 	inv->setValue(OUString(L"prpBool"), inBool);
381cdf0e10cSrcweir 	outBool = inv->getValue(OUString(L"prpBool"));
382cdf0e10cSrcweir 
383cdf0e10cSrcweir     inByte <<= (sal_Int8) 100;
384cdf0e10cSrcweir     inv->setValue(OUString(L"prpByte"), inByte);
385cdf0e10cSrcweir     outByte = inv->getValue(OUString(L"prpByte"));
386cdf0e10cSrcweir 
387cdf0e10cSrcweir     inShort <<= static_cast<sal_Int16>( -1);
388cdf0e10cSrcweir 	inv->setValue(OUString(L"prpShort"), inShort);
389cdf0e10cSrcweir 	outShort = inv->getValue(OUString(L"prpShort"));
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 	inLong <<= ( sal_Int32) 1234567;
392cdf0e10cSrcweir 	inv->setValue(OUString(L"prpLong"), inLong	// TODO: Add your implementation code here
393cdf0e10cSrcweir );
394cdf0e10cSrcweir 	outLong = inv->getValue(OUString(L"prpLong"));
395cdf0e10cSrcweir 
396cdf0e10cSrcweir 	inString <<= OUString(L" this is clientTest.exe");
397cdf0e10cSrcweir 	inv->setValue(OUString(L"prpString"), inString);
398cdf0e10cSrcweir 	outString = inv->getValue(OUString(L"prpString"));
399cdf0e10cSrcweir 
400cdf0e10cSrcweir 	inFloat <<=  3.14f;
401cdf0e10cSrcweir 	inv->setValue(OUString(L"prpFloat"), inFloat);
402cdf0e10cSrcweir 	outFloat = inv->getValue(OUString(L"prpFloat"));
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 	inDouble <<= ( double) 3.145;
405cdf0e10cSrcweir 	inv->setValue(OUString(L"prpDouble"), inDouble);
406cdf0e10cSrcweir 	outDouble = inv->getValue(OUString(L"prpDouble"));
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 	inVariant <<= OUString(L"A string in an any");
409cdf0e10cSrcweir 	inv->setValue(OUString(L"prpVariant"), inVariant);
410cdf0e10cSrcweir 	outVariant = inv->getValue(OUString(L"prpVariant"));
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 	inObject <<= inv;
413cdf0e10cSrcweir 	inv->setValue(OUString(L"prpObject"), inObject);
414cdf0e10cSrcweir 	outObject = inv->getValue(OUString(L"prpObject"));
415cdf0e10cSrcweir 
416cdf0e10cSrcweir     inUnknown <<= xintUnknown;
417cdf0e10cSrcweir 	inv->setValue(OUString(L"prpUnknown"), inUnknown);
418cdf0e10cSrcweir 	outUnknown = inv->getValue(OUString(L"prpUnknown"));
419cdf0e10cSrcweir 
420cdf0e10cSrcweir     Currency cur(99999);
421cdf0e10cSrcweir     inCY <<= cur;
422cdf0e10cSrcweir     inv->setValue(OUString(L"prpCurrency"), inCY);
423cdf0e10cSrcweir     outCY = inv->getValue(OUString(L"prpCurrency"));
424cdf0e10cSrcweir 
425cdf0e10cSrcweir     Date d(37889.0);
426cdf0e10cSrcweir     inDate <<= d;
427cdf0e10cSrcweir     inv->setValue(OUString(L"prpDate"), inDate);
428cdf0e10cSrcweir     outDate = inv->getValue(OUString(L"prpDate"));
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 	Decimal dec(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff);
431cdf0e10cSrcweir 	inDecimal <<= dec;
432cdf0e10cSrcweir 	inv->setValue(OUString(L"prpDecimal"), inDecimal);
433cdf0e10cSrcweir 	outDecimal = inv->getValue(OUString(L"prpDecimal"));
434cdf0e10cSrcweir 
435cdf0e10cSrcweir     SCode code(DISP_E_BADVARTYPE);
436cdf0e10cSrcweir     inSCode <<= code;
437cdf0e10cSrcweir     inv->setValue(OUString(L"prpSCode"), inSCode);
438cdf0e10cSrcweir     outSCode = inv->getValue(OUString(L"prpSCode"));
439cdf0e10cSrcweir 
440cdf0e10cSrcweir     inrefLong <<= (sal_Int32) 123456;
441cdf0e10cSrcweir     inv->setValue(OUString(L"prprefLong"), inrefLong);
442cdf0e10cSrcweir     outrefLong = inv->getValue(OUString(L"prprefLong"));
443cdf0e10cSrcweir 
444cdf0e10cSrcweir 	inrefVariant <<= OUString(L"A string in an any");
445cdf0e10cSrcweir 	inv->setValue(OUString(L"prprefVariant"), inrefVariant);
446cdf0e10cSrcweir 	outrefVariant = inv->getValue(OUString(L"prprefVariant"));
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 	Decimal decref(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff);
449cdf0e10cSrcweir 	inrefDecimal <<= decref;
450cdf0e10cSrcweir 	inv->setValue(OUString(L"prprefDecimal"), inrefDecimal);
451cdf0e10cSrcweir 	outrefDecimal = inv->getValue(OUString(L"prprefDecimal"));
452cdf0e10cSrcweir 
453cdf0e10cSrcweir     if (inBool != outBool || inByte != outByte || inShort != outShort || inLong != outLong
454cdf0e10cSrcweir  		|| inFloat != outFloat || inDouble != outDouble || inString != outString
455cdf0e10cSrcweir  		|| inVariant != outVariant || inObject != outObject
456cdf0e10cSrcweir         || inUnknown != outUnknown || inCY != outCY
457cdf0e10cSrcweir         || inDate != outDate || inDecimal != outDecimal || inSCode != outSCode
458cdf0e10cSrcweir         || inrefLong != outrefLong ||inrefVariant != outrefVariant
459cdf0e10cSrcweir         || inrefDecimal != outrefDecimal)
460cdf0e10cSrcweir         return false;
461cdf0e10cSrcweir     return true;
462cdf0e10cSrcweir }
463cdf0e10cSrcweir 
doPropertyWithArgumentTest(const Reference<XInvocation> & inv)464cdf0e10cSrcweir bool doPropertyWithArgumentTest(const Reference<XInvocation> & inv)
465cdf0e10cSrcweir {
466cdf0e10cSrcweir     Sequence< sal_Int16> seqIndices;
467cdf0e10cSrcweir 	Sequence<Any> seqOut;
468cdf0e10cSrcweir 
469cdf0e10cSrcweir     Any arMultiArgs[3];
470cdf0e10cSrcweir     arMultiArgs[0] <<= makeAny((sal_Int32) 0);
471cdf0e10cSrcweir     arMultiArgs[1] <<= makeAny((sal_Int32) 0);
472cdf0e10cSrcweir     arMultiArgs[2] <<= PropertyPutArgument(makeAny((sal_Int32) 0));
473cdf0e10cSrcweir     Sequence<Any> seqMultiArgPut0(arMultiArgs, 3);
474cdf0e10cSrcweir 
475cdf0e10cSrcweir     arMultiArgs[0] <<= makeAny((sal_Int32) 1);
476cdf0e10cSrcweir     arMultiArgs[1] <<= makeAny((sal_Int32) 2);
477cdf0e10cSrcweir     arMultiArgs[2] <<= PropertyPutArgument(makeAny((sal_Int32) 3));
478cdf0e10cSrcweir     Sequence<Any> seqMultiArgPut1(arMultiArgs, 3);
479cdf0e10cSrcweir 
480cdf0e10cSrcweir     arMultiArgs[0] <<= makeAny((sal_Int32) 1);
481cdf0e10cSrcweir     arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 3));
482cdf0e10cSrcweir     Sequence<Any> seqMultiArgPut2(arMultiArgs, 2);
483cdf0e10cSrcweir 
484cdf0e10cSrcweir     arMultiArgs[0] <<= NamedArgument(OUString(L"val2"), makeAny((sal_Int32) 1));
485cdf0e10cSrcweir     arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 3));
486cdf0e10cSrcweir     Sequence<Any> seqMultiArgPut3(arMultiArgs, 2);
487cdf0e10cSrcweir 
488cdf0e10cSrcweir     arMultiArgs[0] <<= NamedArgument(OUString(L"val2"), makeAny((sal_Int32) 1));
489cdf0e10cSrcweir     arMultiArgs[1] <<= NamedArgument(OUString(L"val3"), makeAny((sal_Int32) 3));
490cdf0e10cSrcweir     Sequence<Any> seqMultiArgPut4(arMultiArgs, 2);
491cdf0e10cSrcweir 
492cdf0e10cSrcweir     arMultiArgs[0] <<= makeAny((sal_Int32) 0);
493cdf0e10cSrcweir     arMultiArgs[1] <<= makeAny((sal_Int32) 0);
494cdf0e10cSrcweir     Sequence<Any> seqMultiArgGet0(arMultiArgs, 2);
495cdf0e10cSrcweir 
496cdf0e10cSrcweir     arMultiArgs[0] <<= makeAny((sal_Int32) 1);
497cdf0e10cSrcweir     arMultiArgs[1] <<= makeAny((sal_Int32) 2);
498cdf0e10cSrcweir     Sequence<Any> seqMultiArgGet1(arMultiArgs, 2);
499cdf0e10cSrcweir     Sequence<Any> seqMultiArgGet2(arMultiArgs, 1);
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 
502cdf0e10cSrcweir     arMultiArgs[0] <<= makeAny((sal_Int32) 0);
503cdf0e10cSrcweir     arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 0));
504cdf0e10cSrcweir     Sequence<Any> seqMultiArgPut5(arMultiArgs, 2);
505cdf0e10cSrcweir 
506cdf0e10cSrcweir     arMultiArgs[0] <<= makeAny((sal_Int32) 1);
507cdf0e10cSrcweir     arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 2));
508cdf0e10cSrcweir     Sequence<Any> seqMultiArgPut6(arMultiArgs, 2);
509cdf0e10cSrcweir 
510cdf0e10cSrcweir     arMultiArgs[0] <<= Any();
511cdf0e10cSrcweir     arMultiArgs[1] <<= Any();
512cdf0e10cSrcweir     Sequence<Any> seqMultiVoid(arMultiArgs, 2);
513cdf0e10cSrcweir 
514cdf0e10cSrcweir     arMultiArgs[0] = makeAny((sal_Int32) 0);
515cdf0e10cSrcweir     arMultiArgs[1] = makeAny((sal_Int32) 0);
516cdf0e10cSrcweir     Sequence<Any> seqMultiVoid2(arMultiArgs, 2);
517cdf0e10cSrcweir 
518cdf0e10cSrcweir     //[propput, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [in] VARIANT* newVal);
519cdf0e10cSrcweir     //[propget, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [out, optional, retval] VARIANT* pVal);
520cdf0e10cSrcweir     seqIndices.realloc( 0);
521cdf0e10cSrcweir  	seqOut.realloc(0);
522cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut0, seqIndices, seqOut);
523cdf0e10cSrcweir  	seqIndices.realloc( 0);
524cdf0e10cSrcweir  	seqOut.realloc(0);
525cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut1, seqIndices, seqOut);
526cdf0e10cSrcweir     //check in/out args
527cdf0e10cSrcweir    	seqIndices.realloc( 0);
528cdf0e10cSrcweir 	seqOut.realloc(0);
529cdf0e10cSrcweir  	Any anyRet = inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgGet0,
530cdf0e10cSrcweir                              seqIndices, seqOut);
531cdf0e10cSrcweir 
532cdf0e10cSrcweir     if (anyRet != ((PropertyPutArgument const *)seqMultiArgPut1[2].getValue())->Value
533cdf0e10cSrcweir         || ! checkOutArgs(seqOut, seqIndices, Sequence<Any>(seqMultiArgPut1.getArray(), 2)))
534cdf0e10cSrcweir     {
535cdf0e10cSrcweir        return false;
536cdf0e10cSrcweir     }
537cdf0e10cSrcweir     // test optional (one arg omitted
538cdf0e10cSrcweir     seqIndices.realloc( 0);
539cdf0e10cSrcweir  	seqOut.realloc(0);
540cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut0, seqIndices, seqOut);
541cdf0e10cSrcweir  	seqIndices.realloc( 0);
542cdf0e10cSrcweir  	seqOut.realloc(0);
543cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut2, seqIndices, seqOut);
544cdf0e10cSrcweir    	seqIndices.realloc( 0);
545cdf0e10cSrcweir 	seqOut.realloc(0);
546cdf0e10cSrcweir  	anyRet = inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgGet0,
547cdf0e10cSrcweir                              seqIndices, seqOut);
548cdf0e10cSrcweir 
549cdf0e10cSrcweir     arMultiArgs[0] = makeAny((sal_Int32) 1);
550cdf0e10cSrcweir     arMultiArgs[1] = makeAny((SCode(DISP_E_PARAMNOTFOUND)));
551cdf0e10cSrcweir 
552cdf0e10cSrcweir     if (anyRet != ((PropertyPutArgument const *) seqMultiArgPut2[1].getValue())->Value
553cdf0e10cSrcweir         || ! checkOutArgs(seqOut, seqIndices, Sequence<Any>(arMultiArgs, 2)))
554cdf0e10cSrcweir     {
555cdf0e10cSrcweir        return false;
556cdf0e10cSrcweir     }
557cdf0e10cSrcweir 
558cdf0e10cSrcweir     //test one named arg and one omitted
559cdf0e10cSrcweir     seqIndices.realloc( 0);
560cdf0e10cSrcweir  	seqOut.realloc(0);
561cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut0, seqIndices, seqOut);
562cdf0e10cSrcweir  	seqIndices.realloc( 0);
563cdf0e10cSrcweir  	seqOut.realloc(0);
564cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut3, seqIndices, seqOut);
565cdf0e10cSrcweir    	seqIndices.realloc( 0);
566cdf0e10cSrcweir 	seqOut.realloc(0);
567cdf0e10cSrcweir  	anyRet = inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgGet0,
568cdf0e10cSrcweir                              seqIndices, seqOut);
569cdf0e10cSrcweir 
570cdf0e10cSrcweir     arMultiArgs[0] = makeAny((SCode(DISP_E_PARAMNOTFOUND)));
571cdf0e10cSrcweir     arMultiArgs[1] = ((NamedArgument const*) seqMultiArgPut3[0].getValue())->Value;
572cdf0e10cSrcweir     if (anyRet !=  ((PropertyPutArgument const*) seqMultiArgPut3[1].getValue())->Value
573cdf0e10cSrcweir         || ! checkOutArgs(seqOut, seqIndices, Sequence<Any>(arMultiArgs, 2)))
574cdf0e10cSrcweir     {
575cdf0e10cSrcweir        return false;
576cdf0e10cSrcweir     }
577cdf0e10cSrcweir 
578cdf0e10cSrcweir //    [propget,...] HRESULT prpMultiArg2([in] VARIANT val1, [out, retval] VARIANT* pVal);
579cdf0e10cSrcweir //    [propput,...] HRESULT prpMultiArg2([in] VARIANT val1, [in] VARIANT newVal);
580cdf0e10cSrcweir     seqIndices.realloc( 0);
581cdf0e10cSrcweir  	seqOut.realloc(0);
582cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg2"), seqMultiArgPut5, seqIndices, seqOut);
583cdf0e10cSrcweir  	seqIndices.realloc( 0);
584cdf0e10cSrcweir  	seqOut.realloc(0);
585cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg2GetValues"), seqMultiVoid, seqIndices, seqOut);
586cdf0e10cSrcweir 
587cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqMultiVoid2))
588cdf0e10cSrcweir         return false;
589cdf0e10cSrcweir    	seqIndices.realloc( 0);
590cdf0e10cSrcweir 	seqOut.realloc(0);
591cdf0e10cSrcweir  	anyRet = inv->invoke(OUString(L"prpMultiArg2"), seqMultiArgPut6,
592cdf0e10cSrcweir                              seqIndices, seqOut);
593cdf0e10cSrcweir    	seqIndices.realloc( 0);
594cdf0e10cSrcweir 	seqOut.realloc(0);
595cdf0e10cSrcweir  	anyRet = inv->invoke(OUString(L"prpMultiArg2GetValues"), seqMultiVoid,
596cdf0e10cSrcweir                              seqIndices, seqOut);
597cdf0e10cSrcweir 
598cdf0e10cSrcweir // [propget,...] HRESULT prpMultiArg3([in,out] LONG* val1, [out, retval] LONG* pVal);
599cdf0e10cSrcweir // [propput,...] HRESULT prpMultiArg3([in,out] LONG* val1, [in] LONG newVal);
600cdf0e10cSrcweir 
601cdf0e10cSrcweir     if ( ! checkOutArgs(seqOut, seqIndices, seqMultiArgGet1 ))
602cdf0e10cSrcweir          return false;
603cdf0e10cSrcweir     seqIndices.realloc( 0);
604cdf0e10cSrcweir  	seqOut.realloc(0);
605cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg3"), seqMultiArgPut5, seqIndices, seqOut);
606cdf0e10cSrcweir  	seqIndices.realloc( 0);
607cdf0e10cSrcweir  	seqOut.realloc(0);
608cdf0e10cSrcweir     inv->invoke(OUString(L"prpMultiArg3"), seqMultiArgPut6, seqIndices, seqOut);
609cdf0e10cSrcweir  	seqIndices.realloc( 0);
610cdf0e10cSrcweir  	seqOut.realloc(0);
611cdf0e10cSrcweir     anyRet = inv->invoke(OUString(L"prpMultiArg3"), seqMultiArgGet2, seqIndices, seqOut);
612cdf0e10cSrcweir 
613cdf0e10cSrcweir     if ( anyRet !=  ((PropertyPutArgument const*) seqMultiArgPut6[1].getValue())->Value
614cdf0e10cSrcweir          || !checkOutArgs(seqOut, seqIndices, seqMultiArgGet2))
615cdf0e10cSrcweir         return false;
616cdf0e10cSrcweir 
617cdf0e10cSrcweir 
618cdf0e10cSrcweir     //hasProperty, hasMethod
619cdf0e10cSrcweir     if (inv->hasProperty(OUSTR("prpMultiArg1")))
620cdf0e10cSrcweir         return false;
621cdf0e10cSrcweir     if ( ! inv->hasMethod(OUSTR("prpMultiArg1")))
622cdf0e10cSrcweir         return false;
623cdf0e10cSrcweir     if ( ! inv->hasProperty(OUSTR("prprefLong")))
624cdf0e10cSrcweir         return false;
625cdf0e10cSrcweir     if (inv->hasMethod(OUSTR("prprefLong")))
626cdf0e10cSrcweir         return false;
627cdf0e10cSrcweir     if ( ! inv->hasMethod(OUSTR("inLong")))
628cdf0e10cSrcweir         return false;
629cdf0e10cSrcweir 
630cdf0e10cSrcweir 	return true;
631cdf0e10cSrcweir }
doSimpleTest(const Reference<XInvocation> & inv)632cdf0e10cSrcweir bool doSimpleTest(const Reference<XInvocation> & inv)
633cdf0e10cSrcweir {
634cdf0e10cSrcweir 	Sequence< sal_Int16> seqIndices;
635cdf0e10cSrcweir 	Sequence<Any> seqOut;
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 	Any inBool, outBool;
638cdf0e10cSrcweir 	Any inByte, outByte;
639cdf0e10cSrcweir 	Any inShort, outShort;
640cdf0e10cSrcweir 	Any inLong,  outLong;
641cdf0e10cSrcweir 	Any inString,  outString;
642cdf0e10cSrcweir 	Any inFloat, outFloat;
643cdf0e10cSrcweir 	Any inDouble, outDouble;
644cdf0e10cSrcweir 	Any inVariant, outVariant;
645cdf0e10cSrcweir 	Any inObject, outObject;
646cdf0e10cSrcweir 	Any inUnknown, outUnknown;
647cdf0e10cSrcweir     Any inCY, outCY;
648cdf0e10cSrcweir     Any inDate, outDate;
649cdf0e10cSrcweir     Any inDecimal, outDecimal;
650cdf0e10cSrcweir     Any inSCode, outSCode;
651cdf0e10cSrcweir     Any inrefLong, outrefLong;
652cdf0e10cSrcweir     Any inrefVariant, outrefVariant;
653cdf0e10cSrcweir     Any inrefDecimal, outrefDecimal;
654cdf0e10cSrcweir 
655cdf0e10cSrcweir 	Reference<XInterface> xIntFoo(getComObject(L"AxTestComponents.Foo"));
656cdf0e10cSrcweir 	//###################################################################################
657cdf0e10cSrcweir 	//	in and out parameter
658cdf0e10cSrcweir 	//###################################################################################
659cdf0e10cSrcweir 	sal_Bool aBool = sal_True;
660cdf0e10cSrcweir 	inBool.setValue(&aBool, getCppuBooleanType());
661cdf0e10cSrcweir 	inv->invoke(OUString(L"inBool"), Sequence< Any > ( &inBool, 1), seqIndices, seqOut);
662cdf0e10cSrcweir 	seqIndices.realloc(0);
663cdf0e10cSrcweir 	seqOut.realloc(0);
664cdf0e10cSrcweir 	inv->invoke(OUString(L"outBool"), Sequence< Any > ( & outBool, 1), seqIndices, seqOut);
665cdf0e10cSrcweir 	outBool <<= seqOut[0];
666cdf0e10cSrcweir 
667cdf0e10cSrcweir 	inByte <<= (sal_Int8) 127;
668cdf0e10cSrcweir 	inv->invoke(OUString(L"inByte"), Sequence< Any > ( & inByte, 1), seqIndices, seqOut);
669cdf0e10cSrcweir 	seqIndices.realloc( 0);
670cdf0e10cSrcweir 	seqOut.realloc(0);
671cdf0e10cSrcweir 	inv->invoke(OUString(L"outByte"), Sequence< Any > ( & outByte, 1), seqIndices, seqOut);
672cdf0e10cSrcweir 	outByte <<= seqOut[0];
673cdf0e10cSrcweir 
674cdf0e10cSrcweir 	inShort <<= static_cast<sal_Int16>(-1);
675cdf0e10cSrcweir 	inv->invoke(OUString(L"inShort"), Sequence< Any > ( & inShort, 1), seqIndices, seqOut);
676cdf0e10cSrcweir 	seqIndices.realloc( 0);
677cdf0e10cSrcweir 	seqOut.realloc(0);
678cdf0e10cSrcweir 	inv->invoke(OUString(L"outShort"), Sequence< Any > ( & outShort, 1), seqIndices, seqOut);
679cdf0e10cSrcweir 	outShort <<= seqOut[0];
680cdf0e10cSrcweir 
681cdf0e10cSrcweir 	inLong <<= ( sal_Int32) 1234567;
682cdf0e10cSrcweir 	inv->invoke(OUString(L"inLong"), Sequence< Any > ( & inLong, 1), seqIndices, seqOut);
683cdf0e10cSrcweir 	seqIndices.realloc( 0);
684cdf0e10cSrcweir 	seqOut.realloc(0);
685cdf0e10cSrcweir 	inv->invoke(OUString(L"outLong"), Sequence< Any > ( & outLong, 1 ), seqIndices, seqOut);
686cdf0e10cSrcweir 	outLong <<= seqOut[0];
687cdf0e10cSrcweir 
688cdf0e10cSrcweir 	inString <<= OUString(L" this is clientTest.exe");
689cdf0e10cSrcweir 	inv->invoke(OUString(L"inString"), Sequence< Any > ( & inString, 1), seqIndices, seqOut);
690cdf0e10cSrcweir 	seqIndices.realloc( 0);
691cdf0e10cSrcweir 	seqOut.realloc(0);
692cdf0e10cSrcweir 	inv->invoke(OUString(L"outString"), Sequence< Any > ( & outString, 1 ), seqIndices, seqOut);
693cdf0e10cSrcweir 	outString <<= seqOut[0];
694cdf0e10cSrcweir 
695cdf0e10cSrcweir 	inFloat <<=  3.14f;
696cdf0e10cSrcweir 	inv->invoke(OUString(L"inFloat"), Sequence< Any > ( & inFloat, 1), seqIndices, seqOut);
697cdf0e10cSrcweir 	seqIndices.realloc( 0);
698cdf0e10cSrcweir 	seqOut.realloc(0);
699cdf0e10cSrcweir 	inv->invoke(OUString(L"outFloat"), Sequence< Any > ( & outFloat, 1 ), seqIndices, seqOut);
700cdf0e10cSrcweir 	outFloat <<= seqOut[0];
701cdf0e10cSrcweir 
702cdf0e10cSrcweir 	inDouble <<= ( double) 3.145;
703cdf0e10cSrcweir 	inv->invoke(OUString(L"inDouble"), Sequence< Any > ( & inDouble, 1), seqIndices, seqOut);
704cdf0e10cSrcweir 	seqIndices.realloc( 0);
705cdf0e10cSrcweir 	seqOut.realloc(0);
706cdf0e10cSrcweir 	inv->invoke(OUString(L"outDouble"), Sequence< Any > ( & outDouble, 1 ), seqIndices, seqOut);
707cdf0e10cSrcweir 	outDouble <<= seqOut[0];
708cdf0e10cSrcweir 
709cdf0e10cSrcweir 	inVariant <<= OUString(L" A string in an any");
710cdf0e10cSrcweir 	inv->invoke(OUString(L"inVariant"), Sequence< Any > ( & inVariant, 1), seqIndices, seqOut);
711cdf0e10cSrcweir 	seqIndices.realloc( 0);
712cdf0e10cSrcweir 	seqOut.realloc(0);
713cdf0e10cSrcweir 	inv->invoke(OUString(L"outVariant"), Sequence< Any > (&outVariant, 1), seqIndices, seqOut);
714cdf0e10cSrcweir 	outVariant <<= seqOut[0];
715cdf0e10cSrcweir 
716cdf0e10cSrcweir 	inObject <<= inv;
717cdf0e10cSrcweir 	inv->invoke(OUString(L"inObject"), Sequence< Any > ( & inObject, 1), seqIndices, seqOut);
718cdf0e10cSrcweir 	seqIndices.realloc( 0);
719cdf0e10cSrcweir 	seqOut.realloc(0);
720cdf0e10cSrcweir 	inv->invoke(OUString(L"outObject"), Sequence< Any > (& outObject, 1), seqIndices, seqOut);
721cdf0e10cSrcweir 	outObject <<= seqOut[0];
722cdf0e10cSrcweir 
723cdf0e10cSrcweir 	inUnknown <<= xIntFoo;
724cdf0e10cSrcweir 	inv->invoke(OUString(L"inUnknown"), Sequence< Any > ( & inUnknown, 1), seqIndices, seqOut);
725cdf0e10cSrcweir 	seqIndices.realloc( 0);
726cdf0e10cSrcweir 	seqOut.realloc(0);
727cdf0e10cSrcweir 	inv->invoke(OUString(L"outUnknown"), Sequence< Any > (& outUnknown, 1), seqIndices, seqOut);
728cdf0e10cSrcweir 	outUnknown <<= seqOut[0];
729cdf0e10cSrcweir 
730cdf0e10cSrcweir     Currency cur(999999);
731cdf0e10cSrcweir     inCY <<= cur;
732cdf0e10cSrcweir     inv->invoke(OUString(L"inCurrency"), Sequence<Any>( & inCY, 1), seqIndices, seqOut);
733cdf0e10cSrcweir 	seqIndices.realloc( 0);
734cdf0e10cSrcweir 	seqOut.realloc(0);
735cdf0e10cSrcweir     inv->invoke(OUString(L"outCurrency"), Sequence< Any > (& outCY, 1), seqIndices, seqOut);
736cdf0e10cSrcweir     outCY <<= seqOut[0];
737cdf0e10cSrcweir 
738cdf0e10cSrcweir     Date dDate(37889.0);
739cdf0e10cSrcweir     inDate <<= dDate;
740cdf0e10cSrcweir     inv->invoke(OUString(L"inDate"), Sequence<Any>( & inDate, 1), seqIndices, seqOut);
741cdf0e10cSrcweir 	seqIndices.realloc( 0);
742cdf0e10cSrcweir 	seqOut.realloc(0);
743cdf0e10cSrcweir     inv->invoke(OUString(L"outDate"), Sequence< Any > (& outDate, 1), seqIndices, seqOut);
744cdf0e10cSrcweir     outDate <<= seqOut[0];
745cdf0e10cSrcweir 
746cdf0e10cSrcweir     Decimal dec(3, 0, 0xffffffff, 0xffffffff, 0xfffffff0);
747cdf0e10cSrcweir     inDecimal <<= dec;
748cdf0e10cSrcweir     inv->invoke(OUString(L"inDecimal"), Sequence<Any>( & inDecimal, 1), seqIndices, seqOut);
749cdf0e10cSrcweir 	seqIndices.realloc( 0);
750cdf0e10cSrcweir 	seqOut.realloc(0);
751cdf0e10cSrcweir     inv->invoke(OUString(L"outDecimal"), Sequence< Any > (& outDecimal, 1), seqIndices, seqOut);
752cdf0e10cSrcweir     outDecimal <<= seqOut[0];
753cdf0e10cSrcweir 
754cdf0e10cSrcweir     SCode code(DISP_E_BADVARTYPE);
755cdf0e10cSrcweir     inSCode <<= code;
756cdf0e10cSrcweir     inv->invoke(OUString(L"inSCode"), Sequence<Any>( & inSCode, 1), seqIndices, seqOut);
757cdf0e10cSrcweir 	seqIndices.realloc( 0);
758cdf0e10cSrcweir 	seqOut.realloc(0);
759cdf0e10cSrcweir     inv->invoke(OUString(L"outSCode"), Sequence< Any > (& outSCode, 1), seqIndices, seqOut);
760cdf0e10cSrcweir     outSCode <<= seqOut[0];
761cdf0e10cSrcweir 
762cdf0e10cSrcweir     if (inBool != outBool || inByte != outByte || inShort != outShort || inLong != outLong
763cdf0e10cSrcweir 		|| inFloat != outFloat || inDouble != outDouble || inString != outString
764cdf0e10cSrcweir 		|| inVariant != outVariant || inObject != outObject || inUnknown != outUnknown
765cdf0e10cSrcweir 		|| inCY != outCY
766cdf0e10cSrcweir         || inDate != outDate || inDecimal != outDecimal || inSCode != outSCode)
767cdf0e10cSrcweir 		return false;
768cdf0e10cSrcweir 	//###################################################################################
769cdf0e10cSrcweir 	//	in/out parameter
770cdf0e10cSrcweir 	//###################################################################################
771cdf0e10cSrcweir 	outBool = Any();
772cdf0e10cSrcweir 	seqIndices.realloc( 0);
773cdf0e10cSrcweir 	seqOut.realloc(0);
774cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutBool"), Sequence< Any > ( & inBool, 1), seqIndices, seqOut);
775cdf0e10cSrcweir 	outBool <<= seqOut[0];
776cdf0e10cSrcweir 
777cdf0e10cSrcweir 	outByte = Any();
778cdf0e10cSrcweir 	seqIndices.realloc( 0);
779cdf0e10cSrcweir 	seqOut.realloc(0);
780cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutByte"), Sequence< Any > ( & inByte, 1), seqIndices, seqOut);
781cdf0e10cSrcweir 	outByte <<= seqOut[0];
782cdf0e10cSrcweir 
783cdf0e10cSrcweir 	outShort = Any();
784cdf0e10cSrcweir 	seqIndices.realloc( 0);
785cdf0e10cSrcweir 	seqOut.realloc(0);
786cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutShort"), Sequence< Any > ( & inShort, 1), seqIndices, seqOut);
787cdf0e10cSrcweir 	outShort <<= seqOut[0];
788cdf0e10cSrcweir 
789cdf0e10cSrcweir 	outLong = Any();
790cdf0e10cSrcweir 	seqIndices.realloc( 0);
791cdf0e10cSrcweir 	seqOut.realloc(0);
792cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutLong"), Sequence< Any > ( & inLong, 1), seqIndices, seqOut);
793cdf0e10cSrcweir 	outLong <<= seqOut[0];
794cdf0e10cSrcweir 
795cdf0e10cSrcweir 	outString = Any();
796cdf0e10cSrcweir 	seqIndices.realloc( 0);
797cdf0e10cSrcweir 	seqOut.realloc(0);
798cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutString"), Sequence< Any > ( & inString, 1), seqIndices, seqOut);
799cdf0e10cSrcweir 	outString <<= seqOut[0];
800cdf0e10cSrcweir 
801cdf0e10cSrcweir 	outFloat = Any();
802cdf0e10cSrcweir 	seqIndices.realloc( 0);
803cdf0e10cSrcweir 	seqOut.realloc(0);
804cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutFloat"), Sequence< Any > ( & inFloat, 1), seqIndices, seqOut);
805cdf0e10cSrcweir 	outFloat <<= seqOut[0];
806cdf0e10cSrcweir 
807cdf0e10cSrcweir 	outDouble = Any();
808cdf0e10cSrcweir 	seqIndices.realloc( 0);
809cdf0e10cSrcweir 	seqOut.realloc(0);
810cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutDouble"), Sequence< Any > ( &inDouble, 1), seqIndices, seqOut);
811cdf0e10cSrcweir 	outDouble <<= seqOut[0];
812cdf0e10cSrcweir 
813cdf0e10cSrcweir 	outVariant = Any();
814cdf0e10cSrcweir 	seqIndices.realloc( 0);
815cdf0e10cSrcweir 	seqOut.realloc(0);
816cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutVariant"), Sequence< Any > ( & inVariant, 1), seqIndices, seqOut);
817cdf0e10cSrcweir 	outVariant <<= seqOut[0];
818cdf0e10cSrcweir 
819cdf0e10cSrcweir 	outObject = Any();
820cdf0e10cSrcweir 	seqIndices.realloc( 0);
821cdf0e10cSrcweir 	seqOut.realloc(0);
822cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutObject"), Sequence< Any > ( & inObject, 1), seqIndices, seqOut);
823cdf0e10cSrcweir 	outObject <<= seqOut[0];
824cdf0e10cSrcweir 
825cdf0e10cSrcweir 	outCY = Any();
826cdf0e10cSrcweir 	seqIndices.realloc( 0);
827cdf0e10cSrcweir 	seqOut.realloc(0);
828cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutCurrency"), Sequence< Any > ( & inCY, 1), seqIndices, seqOut);
829cdf0e10cSrcweir 	outCY <<= seqOut[0];
830cdf0e10cSrcweir 
831cdf0e10cSrcweir     outDate = Any();
832cdf0e10cSrcweir 	seqIndices.realloc( 0);
833cdf0e10cSrcweir 	seqOut.realloc(0);
834cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutDate"), Sequence< Any > ( & inDate, 1), seqIndices, seqOut);
835cdf0e10cSrcweir 	outDate <<= seqOut[0];
836cdf0e10cSrcweir 
837cdf0e10cSrcweir     outDecimal = Any();
838cdf0e10cSrcweir 	seqIndices.realloc( 0);
839cdf0e10cSrcweir 	seqOut.realloc(0);
840cdf0e10cSrcweir     inv->invoke(OUString(L"inoutDecimal"), Sequence< Any > (& inDecimal, 1), seqIndices, seqOut);
841cdf0e10cSrcweir     outDecimal <<= seqOut[0];
842cdf0e10cSrcweir 
843cdf0e10cSrcweir     outSCode = Any();
844cdf0e10cSrcweir     seqIndices.realloc(0);
845cdf0e10cSrcweir     seqOut.realloc(0);
846cdf0e10cSrcweir     inv->invoke(OUString(L"inoutSCode"), Sequence< Any > (& inSCode, 1), seqIndices, seqOut);
847cdf0e10cSrcweir     outSCode <<= seqOut[0];
848cdf0e10cSrcweir 
849cdf0e10cSrcweir 	if (inBool != outBool || inByte != outByte || inShort != outShort || inLong != outLong
850cdf0e10cSrcweir 		|| inFloat != outFloat || inDouble != outDouble || inString != outString
851cdf0e10cSrcweir 		|| inVariant != outVariant || inObject != outObject || inCY != outCY
852cdf0e10cSrcweir         || inDate != outDate || inDecimal != outDecimal || inSCode != outSCode)
853cdf0e10cSrcweir 		return false;
854cdf0e10cSrcweir 
855cdf0e10cSrcweir     //###################################################################################
856cdf0e10cSrcweir 	//	in byref parameters
857cdf0e10cSrcweir 	//###################################################################################
858cdf0e10cSrcweir 
859cdf0e10cSrcweir     inrefLong <<= (sal_Int32) 1234;
860cdf0e10cSrcweir     inv->invoke(OUString(L"inrefLong"), Sequence<Any>( & inrefLong, 1), seqIndices, seqOut);
861cdf0e10cSrcweir 	seqIndices.realloc( 0);
862cdf0e10cSrcweir 	seqOut.realloc(0);
863cdf0e10cSrcweir     inv->invoke(OUString(L"outLong"), Sequence< Any > (& outrefLong, 1), seqIndices, seqOut);
864cdf0e10cSrcweir     outrefLong <<= seqOut[0];
865cdf0e10cSrcweir 
866cdf0e10cSrcweir 	inrefVariant <<= OUString(L" A string in an any");
867cdf0e10cSrcweir 	inv->invoke(OUString(L"inrefVariant"), Sequence< Any > ( & inrefVariant, 1), seqIndices, seqOut);
868cdf0e10cSrcweir 	seqIndices.realloc( 0);
869cdf0e10cSrcweir 	seqOut.realloc(0);
870cdf0e10cSrcweir 	inv->invoke(OUString(L"outVariant"), Sequence< Any > (&outrefVariant, 1), seqIndices, seqOut);
871cdf0e10cSrcweir 	outrefVariant <<= seqOut[0];
872cdf0e10cSrcweir 
873cdf0e10cSrcweir     Decimal refdec(5, 1, 0xffff, 0xff, 0x1);
874cdf0e10cSrcweir     inrefDecimal <<= refdec;
875cdf0e10cSrcweir 	inv->invoke(OUString(L"inrefDecimal"), Sequence< Any > ( & inrefDecimal, 1), seqIndices, seqOut);
876cdf0e10cSrcweir 	seqIndices.realloc( 0);
877cdf0e10cSrcweir 	seqOut.realloc(0);
878cdf0e10cSrcweir 	inv->invoke(OUString(L"outDecimal"), Sequence< Any > (&outrefDecimal, 1), seqIndices, seqOut);
879cdf0e10cSrcweir 	outrefDecimal <<= seqOut[0];
880cdf0e10cSrcweir 
881cdf0e10cSrcweir     if (inrefLong != outrefLong || inrefVariant != outrefVariant
882cdf0e10cSrcweir         || inrefDecimal != outrefDecimal)
883cdf0e10cSrcweir         return false;
884cdf0e10cSrcweir 
885cdf0e10cSrcweir 
886cdf0e10cSrcweir     //###################################################################################
887cdf0e10cSrcweir 	//	mixed parameter
888cdf0e10cSrcweir 	//###################################################################################
889cdf0e10cSrcweir 	// mixed1
890cdf0e10cSrcweir 	seqIndices.realloc( 0);
891cdf0e10cSrcweir 	seqOut.realloc(0);
892cdf0e10cSrcweir 	Any param[3];
893cdf0e10cSrcweir 	param[0] = inByte;
894cdf0e10cSrcweir 	param[1] = inFloat;
895cdf0e10cSrcweir 	param[2] = inVariant;
896cdf0e10cSrcweir 	inv->invoke(OUString(L"mixed1"), Sequence< Any >(param, 3), seqIndices, seqOut);
897cdf0e10cSrcweir 
898cdf0e10cSrcweir 	if (seqOut.getLength() != 3 || inByte != seqOut[0] || inFloat != seqOut[1]
899cdf0e10cSrcweir 		|| inVariant != seqOut[2])
900cdf0e10cSrcweir 			return false;
901cdf0e10cSrcweir 	return true;
902cdf0e10cSrcweir }
903cdf0e10cSrcweir 
doSimpleSequenceTest(const Reference<XInvocation> & inv)904cdf0e10cSrcweir bool doSimpleSequenceTest(const Reference<XInvocation> & inv)
905cdf0e10cSrcweir {
906cdf0e10cSrcweir 	bool ret = true;
907cdf0e10cSrcweir 	Sequence<sal_Int16> seqIndices;
908cdf0e10cSrcweir 	Sequence<Any> seqOut;
909cdf0e10cSrcweir 	Any voidAny;
910cdf0e10cSrcweir 	Any inArAny;
911cdf0e10cSrcweir 	Any outArray;
912cdf0e10cSrcweir 	Any inArBool, outArBool;
913cdf0e10cSrcweir 	Any inArByte, outArByte;
914cdf0e10cSrcweir 	Any inArShort, outArShort;
915cdf0e10cSrcweir 	Any inArLong, outArLong;
916cdf0e10cSrcweir 	Any inArString, outArString;
917cdf0e10cSrcweir 	Any inArFloat, outArFloat;
918cdf0e10cSrcweir 	Any inArDouble, outArDouble;
919cdf0e10cSrcweir 	Any inArObject, outArObject;
920cdf0e10cSrcweir 	Any outVariant;
921cdf0e10cSrcweir 
922cdf0e10cSrcweir 	//Initialize arrays
923cdf0e10cSrcweir 	OUString arStr[]= {L"string0", L"string1", L"string2"};
924cdf0e10cSrcweir 	Sequence<OUString> seq( arStr, 3);
925cdf0e10cSrcweir 	inArString <<= seq;
926cdf0e10cSrcweir 
927cdf0e10cSrcweir 	Any arAnyStrTmp[3];
928cdf0e10cSrcweir 	arAnyStrTmp[0]<<= arStr[0];
929cdf0e10cSrcweir 	arAnyStrTmp[1]<<= arStr[1];
930cdf0e10cSrcweir 	arAnyStrTmp[2]<<= arStr[2];
931cdf0e10cSrcweir 	Sequence<Any> seq_1( arAnyStrTmp, 3);
932cdf0e10cSrcweir 	inArAny <<= seq_1;
933cdf0e10cSrcweir 	//###################################################################################
934cdf0e10cSrcweir 	//	in, out Sequences
935cdf0e10cSrcweir 	//###################################################################################
936cdf0e10cSrcweir 	//Test sequence containing Anys of Strings
937cdf0e10cSrcweir 	inv->invoke(OUString(L"inArray"), Sequence< Any > ( & inArAny, 1), seqIndices, seqOut);
938cdf0e10cSrcweir 	seqIndices.realloc(0);
939cdf0e10cSrcweir 	seqOut.realloc(0);
940cdf0e10cSrcweir 	inv->invoke(OUString(L"outArray"), Sequence<Any>( & voidAny, 1), seqIndices, seqOut);
941cdf0e10cSrcweir 	if (inArAny != seqOut[0])
942cdf0e10cSrcweir 		return false;
943cdf0e10cSrcweir 
944cdf0e10cSrcweir 	seqIndices.realloc(0);
945cdf0e10cSrcweir 	seqOut.realloc(0);
946cdf0e10cSrcweir 	inv->invoke(OUString(L"inArray"), Sequence< Any >( & inArString, 1), seqIndices, seqOut);
947cdf0e10cSrcweir 	inv->invoke(OUString(L"outArray"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
948cdf0e10cSrcweir 	outArray <<= seqOut[0];
949cdf0e10cSrcweir 
950cdf0e10cSrcweir 	sal_Int8 arByte[]={1,2,3};
951cdf0e10cSrcweir 	Sequence<sal_Int8> seqByte(arByte, 3);
952cdf0e10cSrcweir 	inArByte <<= seqByte;
953cdf0e10cSrcweir 	inv->invoke(OUString(L"inSequenceByte"),Sequence<Any>( & inArByte, 1), seqIndices, seqOut);
954cdf0e10cSrcweir 	seqIndices.realloc(0);
955cdf0e10cSrcweir 	seqOut.realloc(0);
956cdf0e10cSrcweir 	inv->invoke(OUString(L"outSequenceByte"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
957cdf0e10cSrcweir 	outArByte <<= seqOut[0];
958cdf0e10cSrcweir 
959cdf0e10cSrcweir 	sal_Int16 arShort[]={4,5,6};
960cdf0e10cSrcweir 	Sequence<sal_Int16> seqShort(arShort, 3);
961cdf0e10cSrcweir 	inArShort<<= seqShort;
962cdf0e10cSrcweir 	inv->invoke(OUString(L"inSequenceShort"),Sequence< Any >( & inArShort, 1), seqIndices, seqOut);
963cdf0e10cSrcweir 	seqIndices.realloc(0);
964cdf0e10cSrcweir 	seqOut.realloc(0);
965cdf0e10cSrcweir 	inv->invoke(OUString(L"outSequenceShort"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
966cdf0e10cSrcweir 	outArShort <<= seqOut[0];
967cdf0e10cSrcweir 
968cdf0e10cSrcweir 	sal_Int32 arLong[] = {7,8,9};
969cdf0e10cSrcweir 	Sequence<sal_Int32> seqLong(arLong, 3);
970cdf0e10cSrcweir 	inArLong <<= seqLong;
971cdf0e10cSrcweir 	inv->invoke(OUString(L"inSequenceLong"),Sequence< Any > ( & inArLong, 1), seqIndices, seqOut);
972cdf0e10cSrcweir 	seqIndices.realloc(0);
973cdf0e10cSrcweir 	seqOut.realloc(0);
974cdf0e10cSrcweir 	inv->invoke(OUString(L"outSequenceLong"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
975cdf0e10cSrcweir 	outArLong <<= seqOut[0];
976cdf0e10cSrcweir 
977cdf0e10cSrcweir 	inv->invoke(OUString(L"inSequenceLong"),Sequence< Any > ( & inArLong, 1), seqIndices, seqOut);
978cdf0e10cSrcweir 	seqIndices.realloc(0);
979cdf0e10cSrcweir 	seqOut.realloc(0);
980cdf0e10cSrcweir 	inv->invoke(OUString(L"outSequenceLong"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
981cdf0e10cSrcweir 	outArLong <<= seqOut[0];
982cdf0e10cSrcweir 
983cdf0e10cSrcweir 	inv->invoke( OUString(L"inSequenceString"),Sequence< Any > ( & inArString, 1), seqIndices, seqOut);
984cdf0e10cSrcweir 	seqIndices.realloc(0);
985cdf0e10cSrcweir 	seqOut.realloc(0);
986cdf0e10cSrcweir 	inv->invoke(OUString(L"outSequenceString"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
987cdf0e10cSrcweir 	outArString <<= seqOut[0];
988cdf0e10cSrcweir 
989cdf0e10cSrcweir 	float arFloat[]={3.14f, 31.4f, 314.f};
990cdf0e10cSrcweir 	Sequence<float> seqFloat( arFloat, 3);
991cdf0e10cSrcweir 	inArFloat <<= seqFloat;
992cdf0e10cSrcweir 	inv->invoke( OUString(L"inSequenceFloat"),Sequence< Any > ( & inArFloat, 1), seqIndices, seqOut);
993cdf0e10cSrcweir 	seqIndices.realloc(0);
994cdf0e10cSrcweir 	seqOut.realloc(0);
995cdf0e10cSrcweir 	inv->invoke(OUString(L"outSequenceFloat"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
996cdf0e10cSrcweir 	outArFloat <<= seqOut[0];
997cdf0e10cSrcweir 
998cdf0e10cSrcweir 	double arDouble[]={3.145, 31.45, 3145.};
999cdf0e10cSrcweir 	Sequence<double> seqDouble( arDouble, 3);
1000cdf0e10cSrcweir 	inArDouble <<= seqDouble;
1001cdf0e10cSrcweir 	inv->invoke(OUString(L"inSequenceDouble"),Sequence< Any >( & inArDouble, 1), seqIndices, seqOut);
1002cdf0e10cSrcweir 	seqIndices.realloc(0);
1003cdf0e10cSrcweir 	seqOut.realloc(0);
1004cdf0e10cSrcweir 	inv->invoke(OUString(L"outSequenceDouble"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
1005cdf0e10cSrcweir 	outArDouble <<= seqOut[0];
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir 	Sequence<Reference<XInvocation> > seqObj(2);
1008cdf0e10cSrcweir 	seqObj[0]= 	getComObject(L"AxTestComponents.Basic");
1009cdf0e10cSrcweir 	seqObj[1]= 	getComObject(L"AxTestComponents.Basic");
1010cdf0e10cSrcweir 	inArObject <<= seqObj;
1011cdf0e10cSrcweir 	inv->invoke(OUString(L"inSequenceObject"),Sequence< Any >( & inArObject, 1), seqIndices, seqOut);
1012cdf0e10cSrcweir 	seqIndices.realloc(0);
1013cdf0e10cSrcweir 	seqOut.realloc(0);
1014cdf0e10cSrcweir 	inv->invoke(OUString(L"outSequenceObject"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
1015cdf0e10cSrcweir 	outArObject <<= seqOut[0];
1016cdf0e10cSrcweir 
1017cdf0e10cSrcweir 	if ( ! equalSequences(inArByte, outArByte) || ! equalSequences(inArShort, outArShort)
1018cdf0e10cSrcweir 		|| ! equalSequences(inArLong, outArLong) || ! equalSequences(inArString, outArray)
1019cdf0e10cSrcweir 		|| ! equalSequences(inArFloat, outArFloat) || ! equalSequences(inArDouble, outArDouble)
1020cdf0e10cSrcweir 		|| ! equalSequences(inArString, outArString)  || ! equalSequences(inArObject, outArObject))
1021cdf0e10cSrcweir 		return false;
1022cdf0e10cSrcweir 
1023cdf0e10cSrcweir 	//###################################################################################
1024cdf0e10cSrcweir 	//	in/out Sequences
1025cdf0e10cSrcweir 	//###################################################################################
1026cdf0e10cSrcweir 	seqIndices.realloc(0);
1027cdf0e10cSrcweir 	seqOut.realloc(0);
1028cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutArray"), Sequence< Any >( & inArString, 1), seqIndices, seqOut);
1029cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutArray"), Sequence< Any >( & inArString, 1), seqIndices, seqOut);
1030cdf0e10cSrcweir 	outArray <<= seqOut[0];
1031cdf0e10cSrcweir 
1032cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceByte"), Sequence<Any>( & inArByte, 1), seqIndices, seqOut);
1033cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceByte"), Sequence<Any>( & inArByte, 1), seqIndices, seqOut);
1034cdf0e10cSrcweir 	outArByte <<= seqOut[0];
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceShort"), Sequence<Any>( & inArShort, 1), seqIndices, seqOut);
1037cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceShort"), Sequence<Any>( & inArShort, 1), seqIndices, seqOut);
1038cdf0e10cSrcweir 	outArShort <<= seqOut[0];
1039cdf0e10cSrcweir 
1040cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceLong"), Sequence<Any>( & inArLong, 1), seqIndices, seqOut);
1041cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceLong"), Sequence< Any >( & inArLong, 1), seqIndices, seqOut);
1042cdf0e10cSrcweir 	outArLong <<= seqOut[0];
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceString"), Sequence<Any>( & inArString, 1), seqIndices, seqOut);
1045cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceString"), Sequence<Any>( & inArString, 1), seqIndices, seqOut);
1046cdf0e10cSrcweir 	outArString <<= seqOut[0];
1047cdf0e10cSrcweir 
1048cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceFloat"), Sequence<Any>( & inArFloat, 1), seqIndices, seqOut);
1049cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceFloat"), Sequence<Any>( & inArFloat, 1), seqIndices, seqOut);
1050cdf0e10cSrcweir 	outArFloat <<= seqOut[0];
1051cdf0e10cSrcweir 
1052cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceDouble"), Sequence<Any>( & inArDouble, 1), seqIndices, seqOut);
1053cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceDouble"), Sequence<Any>( & inArDouble, 1), seqIndices, seqOut);
1054cdf0e10cSrcweir 	outArDouble <<= seqOut[0];
1055cdf0e10cSrcweir 
1056cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceObject"), Sequence<Any>( & inArObject, 1), seqIndices, seqOut);
1057cdf0e10cSrcweir 	inv->invoke(OUString(L"inoutSequenceObject"), Sequence<Any>( & inArObject, 1), seqIndices, seqOut);
1058cdf0e10cSrcweir 	outArObject <<= seqOut[0];
1059cdf0e10cSrcweir 
1060cdf0e10cSrcweir 	if ( ! equalSequences(inArByte, outArByte) || ! equalSequences(inArShort, outArShort)
1061cdf0e10cSrcweir 		|| ! equalSequences(inArLong, outArLong) || ! equalSequences(inArString, outArray)
1062cdf0e10cSrcweir 		|| ! equalSequences(inArFloat, outArFloat) || ! equalSequences(inArDouble, outArDouble)
1063cdf0e10cSrcweir 		|| ! equalSequences(inArString, outArString)  || ! equalSequences(inArObject, outArObject))
1064cdf0e10cSrcweir 		return false;
1065cdf0e10cSrcweir 
1066cdf0e10cSrcweir 	return ret;
1067cdf0e10cSrcweir }
1068cdf0e10cSrcweir 
doTest()1069cdf0e10cSrcweir HRESULT doTest()
1070cdf0e10cSrcweir {
1071cdf0e10cSrcweir 	HRESULT hr= S_OK;
1072cdf0e10cSrcweir 	USES_CONVERSION;
1073cdf0e10cSrcweir 	Reference<XInvocation> inv= getComObject( L"AxTestComponents.Basic");
1074cdf0e10cSrcweir 
1075cdf0e10cSrcweir 	HostWin* pWin= new HostWin( L"MFCCONTROL.MfcControlCtrl.1");
1076cdf0e10cSrcweir 	CComPtr<IUnknown> spUnk= pWin->GetHostedControl();
1077cdf0e10cSrcweir 	Reference<XInvocation> invMfc= convertComObject( spUnk.p);
1078cdf0e10cSrcweir 
1079cdf0e10cSrcweir 	Sequence< sal_Int16> seqIndices;
1080cdf0e10cSrcweir 	Sequence<Any> seqOut;
1081cdf0e10cSrcweir 
1082cdf0e10cSrcweir 	Any aAny;
1083cdf0e10cSrcweir 	Any anyOut;
1084cdf0e10cSrcweir 	char buff[1024];
1085cdf0e10cSrcweir 	Any seqAny;
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir 	if (! doSimpleTest(inv))
1088cdf0e10cSrcweir 	{
1089cdf0e10cSrcweir 		fprintf(stdout, "### Test failed!\n");
1090cdf0e10cSrcweir 		return E_FAIL;
1091cdf0e10cSrcweir 	}
1092cdf0e10cSrcweir 
1093cdf0e10cSrcweir     if (! doPropertyTest(inv))
1094cdf0e10cSrcweir     {
1095cdf0e10cSrcweir         fprintf(stdout, "### Test failed!\n");
1096cdf0e10cSrcweir 		return E_FAIL;
1097cdf0e10cSrcweir     }
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir 	if ( ! doSimpleSequenceTest(inv))
1100cdf0e10cSrcweir 	{
1101cdf0e10cSrcweir 		fprintf(stdout, "### Test failed! \n");
1102cdf0e10cSrcweir 		return E_FAIL;
1103cdf0e10cSrcweir 	}
1104cdf0e10cSrcweir 
1105cdf0e10cSrcweir     if ( ! doParameterTest(inv))
1106cdf0e10cSrcweir 	{
1107cdf0e10cSrcweir 		fprintf(stdout, "### Test failed! \n");
1108cdf0e10cSrcweir 		return E_FAIL;
1109cdf0e10cSrcweir 	}
1110cdf0e10cSrcweir 
1111cdf0e10cSrcweir     if ( ! doPropertyWithArgumentTest(inv))
1112cdf0e10cSrcweir     {
1113cdf0e10cSrcweir         fprintf(stdout, "### Test failed! \n");
1114cdf0e10cSrcweir 		return E_FAIL;
1115cdf0e10cSrcweir     }
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir 
1118cdf0e10cSrcweir 
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir 
1121cdf0e10cSrcweir //
1122cdf0e10cSrcweir //	//###################################################################################
1123cdf0e10cSrcweir //	//	in multi Sequences
1124cdf0e10cSrcweir //	//###################################################################################
1125cdf0e10cSrcweir //	// inMulDimArrayLong
1126cdf0e10cSrcweir 	sal_Int32 arLongi[]={1,2,3};
1127cdf0e10cSrcweir 	sal_Int32 arLongi2[]={4,5,6,7};
1128cdf0e10cSrcweir 	sal_Int32 arLongi3[]={8,9,10,11,12};
1129cdf0e10cSrcweir 
1130cdf0e10cSrcweir 	Sequence<sal_Int32> seqLongi1( arLongi, 3);
1131cdf0e10cSrcweir 	Sequence<sal_Int32> seqLongi2( arLongi2, 4);
1132cdf0e10cSrcweir 	Sequence<sal_Int32> seqLongi3( arLongi3, 5);
1133cdf0e10cSrcweir 
1134cdf0e10cSrcweir 	Sequence< Sequence< sal_Int32 > > seq2i(3);
1135cdf0e10cSrcweir 	seq2i[0]= seqLongi1;
1136cdf0e10cSrcweir 	seq2i[1]= seqLongi2;
1137cdf0e10cSrcweir 	seq2i[2]= seqLongi3;
1138cdf0e10cSrcweir 	seqAny<<= seq2i;
1139cdf0e10cSrcweir 	// dimension length 3,5
1140cdf0e10cSrcweir 	inv->invoke( OUString(L"inMulDimArrayLong"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut);
1141cdf0e10cSrcweir //
1142cdf0e10cSrcweir 	//inMulDimArrayVariant
1143cdf0e10cSrcweir 	inv->invoke( OUString(L"inMulDimArrayVariant"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut);
1144cdf0e10cSrcweir 
1145cdf0e10cSrcweir 	//inMulDimArrayLong2
1146cdf0e10cSrcweir 	sal_Int32 arLongii1[]={1,2,3};
1147cdf0e10cSrcweir 	sal_Int32 arLongii2[]={4,5,6,7};
1148cdf0e10cSrcweir 	sal_Int32 arLongii3[]={8,9,10,11,12};
1149cdf0e10cSrcweir 	sal_Int32 arLongii4[]={13,14,15,16};
1150cdf0e10cSrcweir 	sal_Int32 arLongii5[]={17,18,19};
1151cdf0e10cSrcweir 
1152cdf0e10cSrcweir 	Sequence<sal_Int32> seqLongii1( arLongii1, 3);
1153cdf0e10cSrcweir 	Sequence<sal_Int32> seqLongii2( arLongii2, 4);
1154cdf0e10cSrcweir 	Sequence<sal_Int32> seqLongii3( arLongii3, 5);
1155cdf0e10cSrcweir 	Sequence<sal_Int32> seqLongii4( arLongii4, 4);
1156cdf0e10cSrcweir 	Sequence<sal_Int32> seqLongii5( arLongii5, 3);
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir 	Sequence< Sequence< sal_Int32 > > seq2ii(3);
1159cdf0e10cSrcweir 	Sequence< Sequence< sal_Int32> > seq2ii2(2);
1160cdf0e10cSrcweir 	seq2ii[0]= seqLongii1;
1161cdf0e10cSrcweir 	seq2ii[1]= seqLongii2;
1162cdf0e10cSrcweir 	seq2ii[2]= seqLongii3;
1163cdf0e10cSrcweir 
1164cdf0e10cSrcweir 	seq2ii2[0]= seqLongii4;
1165cdf0e10cSrcweir 	seq2ii2[1]= seqLongii5;
1166cdf0e10cSrcweir 
1167cdf0e10cSrcweir 	Sequence< Sequence< Sequence< sal_Int32> > >  seq3ii(2);
1168cdf0e10cSrcweir 	seq3ii[0]=seq2ii;
1169cdf0e10cSrcweir 	seq3ii[1]=seq2ii2;
1170cdf0e10cSrcweir 	seqAny<<= seq3ii;
1171cdf0e10cSrcweir 	inv->invoke( OUString(L"inMulDimArrayLong2"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut);
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir 	// inMulDimArrayByte2
1174cdf0e10cSrcweir 	sal_Int8 arByteii1[]={1,2,3};
1175cdf0e10cSrcweir 	sal_Int8 arByteii2[]={4,5,6,7};
1176cdf0e10cSrcweir 	sal_Int8 arByteii3[]={8,9,10,11,12};
1177cdf0e10cSrcweir 	sal_Int8 arByteii4[]={13,14,15,16};
1178cdf0e10cSrcweir 	sal_Int8 arByteii5[]={17,18,19};
1179cdf0e10cSrcweir 
1180cdf0e10cSrcweir 	Sequence<sal_Int8> seqByteii1( arByteii1, 3);
1181cdf0e10cSrcweir 	Sequence<sal_Int8> seqByteii2( arByteii2, 4);
1182cdf0e10cSrcweir 	Sequence<sal_Int8> seqByteii3( arByteii3, 5);
1183cdf0e10cSrcweir 	Sequence<sal_Int8> seqByteii4( arByteii4, 4);
1184cdf0e10cSrcweir 	Sequence<sal_Int8> seqByteii5( arByteii5, 3);
1185cdf0e10cSrcweir 
1186cdf0e10cSrcweir 	Sequence< Sequence< sal_Int8 > > seq2Byteii(3);
1187cdf0e10cSrcweir 	Sequence< Sequence< sal_Int8> > seq2Byteii2(2);
1188cdf0e10cSrcweir 	seq2Byteii[0]= seqByteii1;
1189cdf0e10cSrcweir 	seq2Byteii[1]= seqByteii2;
1190cdf0e10cSrcweir 	seq2Byteii[2]= seqByteii3;
1191cdf0e10cSrcweir 
1192cdf0e10cSrcweir 	seq2Byteii2[0]= seqByteii4;
1193cdf0e10cSrcweir 	seq2Byteii2[1]= seqByteii5;
1194cdf0e10cSrcweir 
1195cdf0e10cSrcweir 	Sequence< Sequence< Sequence< sal_Int8> > >  seq3Byteii(2);
1196cdf0e10cSrcweir 	seq3Byteii[0]=seq2Byteii;
1197cdf0e10cSrcweir 	seq3Byteii[1]=seq2Byteii2;
1198cdf0e10cSrcweir 	seqAny<<= seq3Byteii;
1199cdf0e10cSrcweir 	inv->invoke( OUString(L"inMulDimArrayByte2"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut);
1200cdf0e10cSrcweir 
1201cdf0e10cSrcweir 
1202cdf0e10cSrcweir 
1203cdf0e10cSrcweir 	//###################################################################################
1204cdf0e10cSrcweir 	//###################################################################################
1205cdf0e10cSrcweir 	//###################################################################################
1206cdf0e10cSrcweir 	//	Tests with a MFC ActiveX control, ( pure dispinterface)
1207cdf0e10cSrcweir 	//###################################################################################
1208cdf0e10cSrcweir 
1209cdf0e10cSrcweir 	//###################################################################################
1210cdf0e10cSrcweir 	//	in parameter MFC ActiveX
1211cdf0e10cSrcweir 	//###################################################################################
1212cdf0e10cSrcweir 	// unsigned char is not supported by MFC
1213cdf0e10cSrcweir 	//	aAny <<= ( sal_Int8) 127;
1214cdf0e10cSrcweir 	//	invMfc->invoke( OUString(L"inByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1215cdf0e10cSrcweir 	if ( ! invMfc.is())
1216cdf0e10cSrcweir 		return hr;
1217cdf0e10cSrcweir 	aAny <<= static_cast<sal_Int16>(-1);
1218cdf0e10cSrcweir 	aAny= invMfc->invoke( OUString(L"inShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir //
1221cdf0e10cSrcweir 	aAny <<= ( sal_Int32) 1234567;
1222cdf0e10cSrcweir 	aAny=invMfc->invoke( OUString(L"inLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1223cdf0e10cSrcweir 	sal_Int32 retLong= *(sal_Int32*)aAny.getValue();
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir 	OUString str_1(L" this is clientTest.exe");
1226cdf0e10cSrcweir 	aAny <<= str_1;
1227cdf0e10cSrcweir 	aAny=invMfc->invoke( OUString(L"inString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1228cdf0e10cSrcweir 	aAny>>= str_1;
1229cdf0e10cSrcweir 
1230cdf0e10cSrcweir 	aAny <<= ( float) 3.14;
1231cdf0e10cSrcweir 	aAny=invMfc->invoke( OUString(L"inFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1232cdf0e10cSrcweir 
1233cdf0e10cSrcweir 	aAny <<= ( double) 3.145;
1234cdf0e10cSrcweir 	aAny=invMfc->invoke( OUString(L"inDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1235cdf0e10cSrcweir 
1236cdf0e10cSrcweir 	aAny <<= OUString( L" A string in an any");
1237cdf0e10cSrcweir 	aAny=invMfc->invoke( OUString(L"inVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1238cdf0e10cSrcweir 
1239cdf0e10cSrcweir 	// Tests with Sequences later.
1240cdf0e10cSrcweir 	//	OUString arStr4[]= {L"string0", L"string1", L"string2"};
1241cdf0e10cSrcweir 	//	Sequence<OUString> seqStr4( arStr4, 3);
1242cdf0e10cSrcweir 	//	aAny <<= seqStr4;
1243cdf0e10cSrcweir 	//	invMfc->invoke( OUString(L"inArray"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1244cdf0e10cSrcweir 
1245cdf0e10cSrcweir 
1246cdf0e10cSrcweir 	Reference < XInvocation > inv5= getComObject(L"AxTestComponents.Basic");
1247cdf0e10cSrcweir 	Any anyVal4;
1248cdf0e10cSrcweir 	anyVal4 <<= OUString(L"this is the value of prpString");
1249cdf0e10cSrcweir 	inv5->setValue( OUString(L"prpString"), anyVal4);
1250cdf0e10cSrcweir 	aAny <<= inv5;
1251cdf0e10cSrcweir 	aAny=invMfc->invoke( OUString(L"inObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1252cdf0e10cSrcweir //
1253cdf0e10cSrcweir //	//###################################################################################
1254cdf0e10cSrcweir //	//	out parameter MFC ActiveX
1255cdf0e10cSrcweir //	//###################################################################################
1256cdf0e10cSrcweir //
1257cdf0e10cSrcweir //	// outShort
1258cdf0e10cSrcweir 	aAny= invMfc->invoke( OUString(L"outShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1259cdf0e10cSrcweir 	anyOut<<= seqOut[0];
1260cdf0e10cSrcweir 	sprintf(buff, "MFC outShort %d",  *(sal_Int16*)anyOut.getValue());
1261cdf0e10cSrcweir 	MessageBox( NULL, buff, _T("clientTest"), MB_OK);
1262cdf0e10cSrcweir 
1263cdf0e10cSrcweir 	// outLong
1264cdf0e10cSrcweir 	aAny= invMfc->invoke( OUString(L"outLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1265cdf0e10cSrcweir 	anyOut<<= seqOut[0];
1266cdf0e10cSrcweir 	sprintf(buff, "MFC outLong %d",  *(sal_Int32*)anyOut.getValue());
1267cdf0e10cSrcweir 	MessageBox( NULL, buff, _T("clientTest"), MB_OK);
1268cdf0e10cSrcweir 
1269cdf0e10cSrcweir 	// outString
1270cdf0e10cSrcweir 	aAny= invMfc->invoke( OUString(L"outString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1271cdf0e10cSrcweir 	anyOut<<= seqOut[0];
1272cdf0e10cSrcweir 	sprintf(buff, "MFC outString %S",  ((OUString*)anyOut.getValue())->getStr());
1273cdf0e10cSrcweir 	MessageBox( NULL, buff, _T("clientTest"), MB_OK);
1274cdf0e10cSrcweir 
1275cdf0e10cSrcweir 	// outFloat
1276cdf0e10cSrcweir 	aAny= invMfc->invoke( OUString(L"outFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1277cdf0e10cSrcweir 	anyOut<<= seqOut[0];
1278cdf0e10cSrcweir 	sprintf(buff, "MFC outFloat %f",  *(float*)anyOut.getValue());
1279cdf0e10cSrcweir 	MessageBox( NULL, buff, _T("clientTest"), MB_OK);
1280cdf0e10cSrcweir 
1281cdf0e10cSrcweir 	// outDouble
1282cdf0e10cSrcweir 	aAny= invMfc->invoke( OUString(L"outDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1283cdf0e10cSrcweir 	anyOut<<= seqOut[0];
1284cdf0e10cSrcweir 	sprintf(buff, "MFC outFloat %f",  *(double*)anyOut.getValue());
1285cdf0e10cSrcweir 	MessageBox( NULL, buff, _T("clientTest"), MB_OK);
1286cdf0e10cSrcweir 
1287cdf0e10cSrcweir 	// outVariant
1288cdf0e10cSrcweir 	// we expect a string!! ( VT_BSTR)
1289cdf0e10cSrcweir 	aAny= invMfc->invoke( OUString(L"outVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1290cdf0e10cSrcweir 	anyOut<<= seqOut[0];
1291cdf0e10cSrcweir 	sprintf(buff, "MFC outVariant %S", ((OUString*)anyOut.getValue())->getStr());
1292cdf0e10cSrcweir 	MessageBox( NULL, buff, _T("clientTest"), MB_OK);
1293cdf0e10cSrcweir 
1294cdf0e10cSrcweir 	// outDouble
1295cdf0e10cSrcweir 	aAny= invMfc->invoke( OUString(L"outObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1296cdf0e10cSrcweir 	Reference<XInvocation> invOut5;
1297cdf0e10cSrcweir 	seqOut[0]>>= invOut5;
1298cdf0e10cSrcweir 	// we assume that an object of AxTestControls.Basic is being returned.
1299cdf0e10cSrcweir 	anyOut= invOut5->getValue( OUString(L"prpString"));
1300cdf0e10cSrcweir 	OUString tmpStr;
1301cdf0e10cSrcweir 	anyOut>>=tmpStr;
1302cdf0e10cSrcweir 	sprintf(buff, "MFC outObject, property:  %S",  tmpStr.getStr());
1303cdf0e10cSrcweir 	MessageBox( NULL, buff, _T("clientTest"), MB_OK);
1304cdf0e10cSrcweir 
1305cdf0e10cSrcweir 
1306cdf0e10cSrcweir 	//###################################################################################
1307cdf0e10cSrcweir 	//	Sequence parameter MFC ActiveX
1308cdf0e10cSrcweir 	//###################################################################################
1309cdf0e10cSrcweir 	// Sequences are not directly supported.
1310cdf0e10cSrcweir 
1311cdf0e10cSrcweir 
1312cdf0e10cSrcweir 	delete pWin;
1313cdf0e10cSrcweir 	return hr;
1314cdf0e10cSrcweir 
1315cdf0e10cSrcweir }
1316cdf0e10cSrcweir 
1317cdf0e10cSrcweir 
1318cdf0e10cSrcweir 
1319cdf0e10cSrcweir //VARIANT_TRUE VT_UI1
1320cdf0e10cSrcweir 
1321cdf0e10cSrcweir 
1322