1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: clientTest.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_extensions.hxx"
43 #include "typelib/typedescription.hxx"
44 #include <com/sun/star/bridge/oleautomation/Date.hpp>
45 #include <com/sun/star/bridge/oleautomation/Currency.hpp>
46 #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
47 #include <com/sun/star/bridge/oleautomation/SCode.hpp>
48 #include <com/sun/star/bridge/oleautomation/NamedArgument.hpp>
49 #include <com/sun/star/bridge/oleautomation/PropertyPutArgument.hpp>
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
51 #include <com/sun/star/script/XInvocation.hpp>
52 //#include <oletest/XCallback.hpp>
53 #include <com/sun/star/uno/Reference.h>
54 #include <cppuhelper/servicefactory.hxx>
55 #include <rtl/string.h>
57 #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
58 BEGIN_OBJECT_MAP(ObjectMap
)
61 using namespace com::sun::star::lang
;
62 using namespace com::sun::star::uno
;
63 using namespace com::sun::star::script
;
64 using namespace com::sun::star::bridge::oleautomation
;
70 Reference
<XInvocation
> convertComObject( IUnknown
* pUnk
);
71 Reference
<XInvocation
> getComObject( OUString progId
);
72 bool checkOutArgs(const Sequence
<Any
> & outArgs
,
73 const Sequence
<sal_Int16
> & indices
, const Sequence
<Any
> & values
);
75 bool doSimpleTest(const Reference
<XInvocation
> & inv
);
76 bool doSimpleSequenceTest(const Reference
<XInvocation
> & inv
);
77 bool doParameterTest(const Reference
<XInvocation
> & inv
);
78 bool doPropertyWithArgumentTest(const Reference
<XInvocation
> & inv
);
79 bool equalSequences(const Any
& orig
, const Any
& returned
);
81 HRESULT
doTest2( Reference
<XInvocation
> &);
82 Reference
<XInvocation
> getComObject(OUString
& );
84 HRESULT
InitializeParameter();
85 void printResultVariantArray( VARIANT
& var
);
86 void printVariant( VARIANT
& var
);
87 void printSequence( Sequence
<Any
>& val
);
89 extern "C" int __cdecl
main( int , char **)
92 if( FAILED( hr
=CoInitialize(NULL
)))
94 _tprintf(_T("CoInitialize failed \n"));
99 _Module
.Init( ObjectMap
, GetModuleHandle( NULL
));
101 if( FAILED(hr
=doTest()))
104 const TCHAR
* errMsg
= err
.ErrorMessage();
105 MessageBox( NULL
, errMsg
, "Test failed", MB_ICONERROR
);
109 MessageBox( NULL
,NULL
, "Test succeeded", MB_ICONINFORMATION
);
117 //Also supports named args
119 bool doParameterTest(const Reference
<XInvocation
> & inv
)
121 Sequence
< sal_Int16
> seqIndices
;
122 Sequence
<Any
> seqOut
;
128 NamedArgument
arg1(OUString(L
"val1"), makeAny((sal_Int32
) 123));
129 NamedArgument
arg2(OUString(L
"val2"), makeAny((sal_Int32
) 456));
130 NamedArgument
arg3(OUString(L
"val3"), makeAny((sal_Int32
) 0xff));
131 NamedArgument
arg4(OUString(L
"val4"), makeAny((sal_Int32
) 0xffff));
133 NamedArgument
argOut1(OUString(L
"val1"), Any());
134 NamedArgument
argOut2(OUString(L
"val2"), Any());
135 Sequence
<Any
> seqNoArgs
;
136 arArgs
[0] <<= (sal_Int32
) 0;
137 arArgs
[1] <<= (sal_Int32
) 0;
138 Sequence
<Any
> seqPositional0(arArgs
, 2);
143 Sequence
<Any
> seqNamed(arArgs
, 2);
146 Sequence
<Any
> seqNamed2(arArgs
, 2);
147 arArgs
[0] <<= argOut1
;
148 arArgs
[1] <<= argOut2
;
149 Sequence
<Any
> seqNamed3(arArgs
, 2);
150 arArgs
[0] <<= argOut2
;
151 arArgs
[1] <<= argOut1
;
152 Sequence
<Any
> seqNamed4(arArgs
, 2);
155 Sequence
<Any
> seqNamed5(arArgs
, 1);
157 Sequence
<Any
> seqNamed6(arArgs
, 1);
159 arArgs
[0] <<= (sal_Int32
) 123;
160 arArgs
[1] <<= (sal_Int32
) 456;
161 Sequence
<Any
> seqPositional(arArgs
, 2);
162 arArgs
[0] <<= (sal_Int32
) 123;
163 Sequence
<Any
> seqPositional2(arArgs
, 1);
167 Sequence
<Any
> seqPositional3(arArgs
, 2);
169 arArgs
[0] <<= (sal_Int32
) 123;
170 arArgs
[1] <<= SCode(DISP_E_PARAMNOTFOUND
);
171 Sequence
<Any
> seqOutOpt1(arArgs
, 2);
173 arArgs
[0] <<= SCode(DISP_E_PARAMNOTFOUND
);
174 arArgs
[1] <<= SCode(DISP_E_PARAMNOTFOUND
);
175 Sequence
<Any
> seqOutOpt2(arArgs
, 2);
177 arArgs
[0] <<= SCode(DISP_E_PARAMNOTFOUND
);
178 arArgs
[1] <<= (sal_Int32
) 456;
179 Sequence
<Any
> seqOutOpt3(arArgs
, 2);
181 arArgs1
[0] <<= (sal_Int32
) 0;
182 arArgs1
[1] <<= (sal_Int32
) 0;
183 arArgs1
[2] <<= (sal_Int32
) 0;
184 arArgs1
[3] <<= (sal_Int32
) 0;
185 Sequence
<Any
> seqMix0(arArgs1
, 4);
187 arArgs1
[0] <<= (sal_Int32
) 123;
188 arArgs1
[1] <<= (sal_Int32
) 456;
191 Sequence
<Any
> seqMix(arArgs1
, 4);
193 arArgs1
[0] <<= Any();
194 arArgs1
[1] <<= (sal_Int32
) 456;
196 Sequence
<Any
> seqMix2(arArgs1
, 3);
198 arArgs1
[0] <<= SCode(DISP_E_PARAMNOTFOUND
);
199 arArgs1
[1] <<= (sal_Int32
) 456;
200 arArgs1
[2] <<= SCode(DISP_E_PARAMNOTFOUND
);
201 arArgs1
[3] <<= arg4
.Value
;
202 Sequence
<Any
> seqMixOut(arArgs1
, 4);
204 arArgs1
[0] <<= SCode(DISP_E_PARAMNOTFOUND
);
205 arArgs1
[1] <<= Any();
207 Sequence
<Any
> seqMix2Out(arArgs1
, 3);
211 //in args + out, optional, positional-----------------------------------------
213 seqIndices
.realloc(0);
215 inv
->invoke(OUString(L
"optional3"), seqPositional
, seqIndices
, seqOut
);
216 seqIndices
.realloc(0);
218 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
219 if ( ! checkOutArgs(seqOut
, seqIndices
, seqPositional
))
222 //2 optional args, 1 provided
223 seqIndices
.realloc(0);
225 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
226 seqIndices
.realloc(0);
228 inv
->invoke(OUString(L
"optional3"), seqPositional2
, seqIndices
, seqOut
);
229 seqIndices
.realloc(0);
231 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
232 if ( ! checkOutArgs(seqOut
, seqIndices
, seqOutOpt1
))
235 //2 optional args, 0 provided
236 seqIndices
.realloc(0);
238 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
239 seqIndices
.realloc(0);
241 inv
->invoke(OUString(L
"optional3"), seqNoArgs
, seqIndices
, seqOut
);
242 seqIndices
.realloc(0);
244 inv
->invoke(OUString(L
"optional5"), seqPositional3
, seqIndices
, seqOut
);
245 if ( ! checkOutArgs(seqOut
, seqIndices
, seqOutOpt2
))
248 //named args --------------------------------------------
250 // 2 named args, correct position
251 seqIndices
.realloc(0);
253 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
254 seqIndices
.realloc(0);
256 inv
->invoke(OUString(L
"optional3"), seqNamed
, seqIndices
, seqOut
);
257 seqIndices
.realloc(0);
259 inv
->invoke(OUString(L
"optional5"), seqPositional0
, seqIndices
, seqOut
);
260 if ( ! checkOutArgs(seqOut
, seqIndices
, seqPositional
))
263 // 2named args, position differs
264 seqIndices
.realloc(0);
266 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
267 seqIndices
.realloc(0);
269 inv
->invoke(OUString(L
"optional3"), seqNamed2
, seqIndices
, seqOut
);
270 seqIndices
.realloc(0);
272 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
273 if ( ! checkOutArgs(seqOut
, seqIndices
, seqPositional
))
276 //named out args, 2 named args with correct position
277 seqIndices
.realloc(0);
279 inv
->invoke(OUString(L
"optional3"), seqNamed
, seqIndices
, seqOut
);
280 seqIndices
.realloc(0);
281 seqIndices
.realloc(0);
282 inv
->invoke(OUString(L
"optional5"), seqNamed3
, seqIndices
, seqOut
);
283 if ( ! checkOutArgs(seqOut
, seqIndices
, seqNamed
))
286 //named out args, 2 named args with different position
287 seqIndices
.realloc(0);
289 inv
->invoke(OUString(L
"optional3"), seqNamed
, seqIndices
, seqOut
);
290 seqIndices
.realloc(0);
291 seqIndices
.realloc(0);
292 inv
->invoke(OUString(L
"optional5"), seqNamed4
, seqIndices
, seqOut
);
293 if ( ! checkOutArgs(seqOut
, seqIndices
, seqNamed2
))
297 //2 args, 1 provided (correct order)
298 seqIndices
.realloc(0);
300 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
301 seqIndices
.realloc(0);
303 inv
->invoke(OUString(L
"optional3"), seqNamed5
, seqIndices
, seqOut
);
304 seqIndices
.realloc(0);
306 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
307 if ( ! checkOutArgs(seqOut
, seqIndices
, seqOutOpt1
))
309 //2 args, 1 provided (incorrect order)
310 seqIndices
.realloc(0);
312 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
313 seqIndices
.realloc(0);
315 inv
->invoke(OUString(L
"optional3"), seqNamed6
, seqIndices
, seqOut
);
316 seqIndices
.realloc(0);
318 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
319 if ( ! checkOutArgs(seqOut
, seqIndices
, seqOutOpt3
))
322 //2position + 2 2named args, correct order
323 seqIndices
.realloc(0);
325 inv
->invoke(OUString(L
"optional6"), seqMix0
, seqIndices
, seqOut
);
326 seqIndices
.realloc(0);
328 inv
->invoke(OUString(L
"optional6"), seqMix
, seqIndices
, seqOut
);
329 seqIndices
.realloc(0);
331 inv
->invoke(OUString(L
"optional7"), seqMix
, seqIndices
, seqOut
);
332 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMix
))
335 // 4 in args, 1 positional, 1 named, 1 positional omitted
336 seqIndices
.realloc(0);
338 inv
->invoke(OUString(L
"optional6"), seqMix0
, seqIndices
, seqOut
);
339 seqIndices
.realloc(0);
341 inv
->invoke(OUString(L
"optional6"), seqMix2
, seqIndices
, seqOut
);
342 seqIndices
.realloc(0);
344 inv
->invoke(OUString(L
"optional7"), seqMix0
, seqIndices
, seqOut
);
345 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMixOut
))
348 // 4 out args, 1 positional, 1 named, 1 positional omitted
349 seqIndices
.realloc(0);
351 inv
->invoke(OUString(L
"optional6"), seqMix2
, seqIndices
, seqOut
);
352 seqIndices
.realloc(0);
354 inv
->invoke(OUString(L
"optional7"), seqMix2Out
, seqIndices
, seqOut
);
355 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMix2Out
))
361 bool doPropertyTest(const Reference
<XInvocation
> & inv
)
363 Sequence
< sal_Int16
> seqIndices
;
364 Sequence
<Any
> seqOut
;
368 Any inShort
, outShort
;
370 Any inString
, outString
;
371 Any inFloat
, outFloat
;
372 Any inDouble
, outDouble
;
373 Any inVariant
, outVariant
;
374 Any inObject
, outObject
;
375 Any inUnknown
, outUnknown
;
378 Any inDecimal
, outDecimal
;
379 Any inSCode
, outSCode
;
380 Any inrefLong
, outrefLong
;
381 Any inrefVariant
, outrefVariant
;
382 Any inrefDecimal
, outrefDecimal
;
383 Any inParamsLong
, outParamsLong
;
384 Reference
<XInterface
> xintUnknown(getComObject(L
"AxTestComponents.Foo"));
386 inBool
<<= (sal_Bool
) sal_True
;
387 inv
->setValue(OUString(L
"prpBool"), inBool
);
388 outBool
= inv
->getValue(OUString(L
"prpBool"));
390 inByte
<<= (sal_Int8
) 100;
391 inv
->setValue(OUString(L
"prpByte"), inByte
);
392 outByte
= inv
->getValue(OUString(L
"prpByte"));
394 inShort
<<= static_cast<sal_Int16
>( -1);
395 inv
->setValue(OUString(L
"prpShort"), inShort
);
396 outShort
= inv
->getValue(OUString(L
"prpShort"));
398 inLong
<<= ( sal_Int32
) 1234567;
399 inv
->setValue(OUString(L
"prpLong"), inLong
// TODO: Add your implementation code here
401 outLong
= inv
->getValue(OUString(L
"prpLong"));
403 inString
<<= OUString(L
" this is clientTest.exe");
404 inv
->setValue(OUString(L
"prpString"), inString
);
405 outString
= inv
->getValue(OUString(L
"prpString"));
408 inv
->setValue(OUString(L
"prpFloat"), inFloat
);
409 outFloat
= inv
->getValue(OUString(L
"prpFloat"));
411 inDouble
<<= ( double) 3.145;
412 inv
->setValue(OUString(L
"prpDouble"), inDouble
);
413 outDouble
= inv
->getValue(OUString(L
"prpDouble"));
415 inVariant
<<= OUString(L
"A string in an any");
416 inv
->setValue(OUString(L
"prpVariant"), inVariant
);
417 outVariant
= inv
->getValue(OUString(L
"prpVariant"));
420 inv
->setValue(OUString(L
"prpObject"), inObject
);
421 outObject
= inv
->getValue(OUString(L
"prpObject"));
423 inUnknown
<<= xintUnknown
;
424 inv
->setValue(OUString(L
"prpUnknown"), inUnknown
);
425 outUnknown
= inv
->getValue(OUString(L
"prpUnknown"));
429 inv
->setValue(OUString(L
"prpCurrency"), inCY
);
430 outCY
= inv
->getValue(OUString(L
"prpCurrency"));
434 inv
->setValue(OUString(L
"prpDate"), inDate
);
435 outDate
= inv
->getValue(OUString(L
"prpDate"));
437 Decimal
dec(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff);
439 inv
->setValue(OUString(L
"prpDecimal"), inDecimal
);
440 outDecimal
= inv
->getValue(OUString(L
"prpDecimal"));
442 SCode
code(DISP_E_BADVARTYPE
);
444 inv
->setValue(OUString(L
"prpSCode"), inSCode
);
445 outSCode
= inv
->getValue(OUString(L
"prpSCode"));
447 inrefLong
<<= (sal_Int32
) 123456;
448 inv
->setValue(OUString(L
"prprefLong"), inrefLong
);
449 outrefLong
= inv
->getValue(OUString(L
"prprefLong"));
451 inrefVariant
<<= OUString(L
"A string in an any");
452 inv
->setValue(OUString(L
"prprefVariant"), inrefVariant
);
453 outrefVariant
= inv
->getValue(OUString(L
"prprefVariant"));
455 Decimal
decref(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff);
456 inrefDecimal
<<= decref
;
457 inv
->setValue(OUString(L
"prprefDecimal"), inrefDecimal
);
458 outrefDecimal
= inv
->getValue(OUString(L
"prprefDecimal"));
460 if (inBool
!= outBool
|| inByte
!= outByte
|| inShort
!= outShort
|| inLong
!= outLong
461 || inFloat
!= outFloat
|| inDouble
!= outDouble
|| inString
!= outString
462 || inVariant
!= outVariant
|| inObject
!= outObject
463 || inUnknown
!= outUnknown
|| inCY
!= outCY
464 || inDate
!= outDate
|| inDecimal
!= outDecimal
|| inSCode
!= outSCode
465 || inrefLong
!= outrefLong
||inrefVariant
!= outrefVariant
466 || inrefDecimal
!= outrefDecimal
)
471 bool doPropertyWithArgumentTest(const Reference
<XInvocation
> & inv
)
473 Sequence
< sal_Int16
> seqIndices
;
474 Sequence
<Any
> seqOut
;
477 arMultiArgs
[0] <<= makeAny((sal_Int32
) 0);
478 arMultiArgs
[1] <<= makeAny((sal_Int32
) 0);
479 arMultiArgs
[2] <<= PropertyPutArgument(makeAny((sal_Int32
) 0));
480 Sequence
<Any
> seqMultiArgPut0(arMultiArgs
, 3);
482 arMultiArgs
[0] <<= makeAny((sal_Int32
) 1);
483 arMultiArgs
[1] <<= makeAny((sal_Int32
) 2);
484 arMultiArgs
[2] <<= PropertyPutArgument(makeAny((sal_Int32
) 3));
485 Sequence
<Any
> seqMultiArgPut1(arMultiArgs
, 3);
487 arMultiArgs
[0] <<= makeAny((sal_Int32
) 1);
488 arMultiArgs
[1] <<= PropertyPutArgument(makeAny((sal_Int32
) 3));
489 Sequence
<Any
> seqMultiArgPut2(arMultiArgs
, 2);
491 arMultiArgs
[0] <<= NamedArgument(OUString(L
"val2"), makeAny((sal_Int32
) 1));
492 arMultiArgs
[1] <<= PropertyPutArgument(makeAny((sal_Int32
) 3));
493 Sequence
<Any
> seqMultiArgPut3(arMultiArgs
, 2);
495 arMultiArgs
[0] <<= NamedArgument(OUString(L
"val2"), makeAny((sal_Int32
) 1));
496 arMultiArgs
[1] <<= NamedArgument(OUString(L
"val3"), makeAny((sal_Int32
) 3));
497 Sequence
<Any
> seqMultiArgPut4(arMultiArgs
, 2);
499 arMultiArgs
[0] <<= makeAny((sal_Int32
) 0);
500 arMultiArgs
[1] <<= makeAny((sal_Int32
) 0);
501 Sequence
<Any
> seqMultiArgGet0(arMultiArgs
, 2);
503 arMultiArgs
[0] <<= makeAny((sal_Int32
) 1);
504 arMultiArgs
[1] <<= makeAny((sal_Int32
) 2);
505 Sequence
<Any
> seqMultiArgGet1(arMultiArgs
, 2);
506 Sequence
<Any
> seqMultiArgGet2(arMultiArgs
, 1);
509 arMultiArgs
[0] <<= makeAny((sal_Int32
) 0);
510 arMultiArgs
[1] <<= PropertyPutArgument(makeAny((sal_Int32
) 0));
511 Sequence
<Any
> seqMultiArgPut5(arMultiArgs
, 2);
513 arMultiArgs
[0] <<= makeAny((sal_Int32
) 1);
514 arMultiArgs
[1] <<= PropertyPutArgument(makeAny((sal_Int32
) 2));
515 Sequence
<Any
> seqMultiArgPut6(arMultiArgs
, 2);
517 arMultiArgs
[0] <<= Any();
518 arMultiArgs
[1] <<= Any();
519 Sequence
<Any
> seqMultiVoid(arMultiArgs
, 2);
521 arMultiArgs
[0] = makeAny((sal_Int32
) 0);
522 arMultiArgs
[1] = makeAny((sal_Int32
) 0);
523 Sequence
<Any
> seqMultiVoid2(arMultiArgs
, 2);
525 //[propput, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [in] VARIANT* newVal);
526 //[propget, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [out, optional, retval] VARIANT* pVal);
527 seqIndices
.realloc( 0);
529 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut0
, seqIndices
, seqOut
);
530 seqIndices
.realloc( 0);
532 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut1
, seqIndices
, seqOut
);
534 seqIndices
.realloc( 0);
536 Any anyRet
= inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgGet0
,
539 if (anyRet
!= ((PropertyPutArgument
const *)seqMultiArgPut1
[2].getValue())->Value
540 || ! checkOutArgs(seqOut
, seqIndices
, Sequence
<Any
>(seqMultiArgPut1
.getArray(), 2)))
544 // test optional (one arg omitted
545 seqIndices
.realloc( 0);
547 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut0
, seqIndices
, seqOut
);
548 seqIndices
.realloc( 0);
550 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut2
, seqIndices
, seqOut
);
551 seqIndices
.realloc( 0);
553 anyRet
= inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgGet0
,
556 arMultiArgs
[0] = makeAny((sal_Int32
) 1);
557 arMultiArgs
[1] = makeAny((SCode(DISP_E_PARAMNOTFOUND
)));
559 if (anyRet
!= ((PropertyPutArgument
const *) seqMultiArgPut2
[1].getValue())->Value
560 || ! checkOutArgs(seqOut
, seqIndices
, Sequence
<Any
>(arMultiArgs
, 2)))
565 //test one named arg and one omitted
566 seqIndices
.realloc( 0);
568 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut0
, seqIndices
, seqOut
);
569 seqIndices
.realloc( 0);
571 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut3
, seqIndices
, seqOut
);
572 seqIndices
.realloc( 0);
574 anyRet
= inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgGet0
,
577 arMultiArgs
[0] = makeAny((SCode(DISP_E_PARAMNOTFOUND
)));
578 arMultiArgs
[1] = ((NamedArgument
const*) seqMultiArgPut3
[0].getValue())->Value
;
579 if (anyRet
!= ((PropertyPutArgument
const*) seqMultiArgPut3
[1].getValue())->Value
580 || ! checkOutArgs(seqOut
, seqIndices
, Sequence
<Any
>(arMultiArgs
, 2)))
585 // [propget,...] HRESULT prpMultiArg2([in] VARIANT val1, [out, retval] VARIANT* pVal);
586 // [propput,...] HRESULT prpMultiArg2([in] VARIANT val1, [in] VARIANT newVal);
587 seqIndices
.realloc( 0);
589 inv
->invoke(OUString(L
"prpMultiArg2"), seqMultiArgPut5
, seqIndices
, seqOut
);
590 seqIndices
.realloc( 0);
592 inv
->invoke(OUString(L
"prpMultiArg2GetValues"), seqMultiVoid
, seqIndices
, seqOut
);
594 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMultiVoid2
))
596 seqIndices
.realloc( 0);
598 anyRet
= inv
->invoke(OUString(L
"prpMultiArg2"), seqMultiArgPut6
,
600 seqIndices
.realloc( 0);
602 anyRet
= inv
->invoke(OUString(L
"prpMultiArg2GetValues"), seqMultiVoid
,
605 // [propget,...] HRESULT prpMultiArg3([in,out] LONG* val1, [out, retval] LONG* pVal);
606 // [propput,...] HRESULT prpMultiArg3([in,out] LONG* val1, [in] LONG newVal);
608 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMultiArgGet1
))
610 seqIndices
.realloc( 0);
612 inv
->invoke(OUString(L
"prpMultiArg3"), seqMultiArgPut5
, seqIndices
, seqOut
);
613 seqIndices
.realloc( 0);
615 inv
->invoke(OUString(L
"prpMultiArg3"), seqMultiArgPut6
, seqIndices
, seqOut
);
616 seqIndices
.realloc( 0);
618 anyRet
= inv
->invoke(OUString(L
"prpMultiArg3"), seqMultiArgGet2
, seqIndices
, seqOut
);
620 if ( anyRet
!= ((PropertyPutArgument
const*) seqMultiArgPut6
[1].getValue())->Value
621 || !checkOutArgs(seqOut
, seqIndices
, seqMultiArgGet2
))
625 //hasProperty, hasMethod
626 if (inv
->hasProperty(OUSTR("prpMultiArg1")))
628 if ( ! inv
->hasMethod(OUSTR("prpMultiArg1")))
630 if ( ! inv
->hasProperty(OUSTR("prprefLong")))
632 if (inv
->hasMethod(OUSTR("prprefLong")))
634 if ( ! inv
->hasMethod(OUSTR("inLong")))
639 bool doSimpleTest(const Reference
<XInvocation
> & inv
)
641 Sequence
< sal_Int16
> seqIndices
;
642 Sequence
<Any
> seqOut
;
646 Any inShort
, outShort
;
648 Any inString
, outString
;
649 Any inFloat
, outFloat
;
650 Any inDouble
, outDouble
;
651 Any inVariant
, outVariant
;
652 Any inObject
, outObject
;
653 Any inUnknown
, outUnknown
;
656 Any inDecimal
, outDecimal
;
657 Any inSCode
, outSCode
;
658 Any inrefLong
, outrefLong
;
659 Any inrefVariant
, outrefVariant
;
660 Any inrefDecimal
, outrefDecimal
;
662 Reference
<XInterface
> xIntFoo(getComObject(L
"AxTestComponents.Foo"));
663 //###################################################################################
664 // in and out parameter
665 //###################################################################################
666 sal_Bool aBool
= sal_True
;
667 inBool
.setValue(&aBool
, getCppuBooleanType());
668 inv
->invoke(OUString(L
"inBool"), Sequence
< Any
> ( &inBool
, 1), seqIndices
, seqOut
);
669 seqIndices
.realloc(0);
671 inv
->invoke(OUString(L
"outBool"), Sequence
< Any
> ( & outBool
, 1), seqIndices
, seqOut
);
672 outBool
<<= seqOut
[0];
674 inByte
<<= (sal_Int8
) 127;
675 inv
->invoke(OUString(L
"inByte"), Sequence
< Any
> ( & inByte
, 1), seqIndices
, seqOut
);
676 seqIndices
.realloc( 0);
678 inv
->invoke(OUString(L
"outByte"), Sequence
< Any
> ( & outByte
, 1), seqIndices
, seqOut
);
679 outByte
<<= seqOut
[0];
681 inShort
<<= static_cast<sal_Int16
>(-1);
682 inv
->invoke(OUString(L
"inShort"), Sequence
< Any
> ( & inShort
, 1), seqIndices
, seqOut
);
683 seqIndices
.realloc( 0);
685 inv
->invoke(OUString(L
"outShort"), Sequence
< Any
> ( & outShort
, 1), seqIndices
, seqOut
);
686 outShort
<<= seqOut
[0];
688 inLong
<<= ( sal_Int32
) 1234567;
689 inv
->invoke(OUString(L
"inLong"), Sequence
< Any
> ( & inLong
, 1), seqIndices
, seqOut
);
690 seqIndices
.realloc( 0);
692 inv
->invoke(OUString(L
"outLong"), Sequence
< Any
> ( & outLong
, 1 ), seqIndices
, seqOut
);
693 outLong
<<= seqOut
[0];
695 inString
<<= OUString(L
" this is clientTest.exe");
696 inv
->invoke(OUString(L
"inString"), Sequence
< Any
> ( & inString
, 1), seqIndices
, seqOut
);
697 seqIndices
.realloc( 0);
699 inv
->invoke(OUString(L
"outString"), Sequence
< Any
> ( & outString
, 1 ), seqIndices
, seqOut
);
700 outString
<<= seqOut
[0];
703 inv
->invoke(OUString(L
"inFloat"), Sequence
< Any
> ( & inFloat
, 1), seqIndices
, seqOut
);
704 seqIndices
.realloc( 0);
706 inv
->invoke(OUString(L
"outFloat"), Sequence
< Any
> ( & outFloat
, 1 ), seqIndices
, seqOut
);
707 outFloat
<<= seqOut
[0];
709 inDouble
<<= ( double) 3.145;
710 inv
->invoke(OUString(L
"inDouble"), Sequence
< Any
> ( & inDouble
, 1), seqIndices
, seqOut
);
711 seqIndices
.realloc( 0);
713 inv
->invoke(OUString(L
"outDouble"), Sequence
< Any
> ( & outDouble
, 1 ), seqIndices
, seqOut
);
714 outDouble
<<= seqOut
[0];
716 inVariant
<<= OUString(L
" A string in an any");
717 inv
->invoke(OUString(L
"inVariant"), Sequence
< Any
> ( & inVariant
, 1), seqIndices
, seqOut
);
718 seqIndices
.realloc( 0);
720 inv
->invoke(OUString(L
"outVariant"), Sequence
< Any
> (&outVariant
, 1), seqIndices
, seqOut
);
721 outVariant
<<= seqOut
[0];
724 inv
->invoke(OUString(L
"inObject"), Sequence
< Any
> ( & inObject
, 1), seqIndices
, seqOut
);
725 seqIndices
.realloc( 0);
727 inv
->invoke(OUString(L
"outObject"), Sequence
< Any
> (& outObject
, 1), seqIndices
, seqOut
);
728 outObject
<<= seqOut
[0];
730 inUnknown
<<= xIntFoo
;
731 inv
->invoke(OUString(L
"inUnknown"), Sequence
< Any
> ( & inUnknown
, 1), seqIndices
, seqOut
);
732 seqIndices
.realloc( 0);
734 inv
->invoke(OUString(L
"outUnknown"), Sequence
< Any
> (& outUnknown
, 1), seqIndices
, seqOut
);
735 outUnknown
<<= seqOut
[0];
737 Currency
cur(999999);
739 inv
->invoke(OUString(L
"inCurrency"), Sequence
<Any
>( & inCY
, 1), seqIndices
, seqOut
);
740 seqIndices
.realloc( 0);
742 inv
->invoke(OUString(L
"outCurrency"), Sequence
< Any
> (& outCY
, 1), seqIndices
, seqOut
);
747 inv
->invoke(OUString(L
"inDate"), Sequence
<Any
>( & inDate
, 1), seqIndices
, seqOut
);
748 seqIndices
.realloc( 0);
750 inv
->invoke(OUString(L
"outDate"), Sequence
< Any
> (& outDate
, 1), seqIndices
, seqOut
);
751 outDate
<<= seqOut
[0];
753 Decimal
dec(3, 0, 0xffffffff, 0xffffffff, 0xfffffff0);
755 inv
->invoke(OUString(L
"inDecimal"), Sequence
<Any
>( & inDecimal
, 1), seqIndices
, seqOut
);
756 seqIndices
.realloc( 0);
758 inv
->invoke(OUString(L
"outDecimal"), Sequence
< Any
> (& outDecimal
, 1), seqIndices
, seqOut
);
759 outDecimal
<<= seqOut
[0];
761 SCode
code(DISP_E_BADVARTYPE
);
763 inv
->invoke(OUString(L
"inSCode"), Sequence
<Any
>( & inSCode
, 1), seqIndices
, seqOut
);
764 seqIndices
.realloc( 0);
766 inv
->invoke(OUString(L
"outSCode"), Sequence
< Any
> (& outSCode
, 1), seqIndices
, seqOut
);
767 outSCode
<<= seqOut
[0];
769 if (inBool
!= outBool
|| inByte
!= outByte
|| inShort
!= outShort
|| inLong
!= outLong
770 || inFloat
!= outFloat
|| inDouble
!= outDouble
|| inString
!= outString
771 || inVariant
!= outVariant
|| inObject
!= outObject
|| inUnknown
!= outUnknown
773 || inDate
!= outDate
|| inDecimal
!= outDecimal
|| inSCode
!= outSCode
)
775 //###################################################################################
777 //###################################################################################
779 seqIndices
.realloc( 0);
781 inv
->invoke(OUString(L
"inoutBool"), Sequence
< Any
> ( & inBool
, 1), seqIndices
, seqOut
);
782 outBool
<<= seqOut
[0];
785 seqIndices
.realloc( 0);
787 inv
->invoke(OUString(L
"inoutByte"), Sequence
< Any
> ( & inByte
, 1), seqIndices
, seqOut
);
788 outByte
<<= seqOut
[0];
791 seqIndices
.realloc( 0);
793 inv
->invoke(OUString(L
"inoutShort"), Sequence
< Any
> ( & inShort
, 1), seqIndices
, seqOut
);
794 outShort
<<= seqOut
[0];
797 seqIndices
.realloc( 0);
799 inv
->invoke(OUString(L
"inoutLong"), Sequence
< Any
> ( & inLong
, 1), seqIndices
, seqOut
);
800 outLong
<<= seqOut
[0];
803 seqIndices
.realloc( 0);
805 inv
->invoke(OUString(L
"inoutString"), Sequence
< Any
> ( & inString
, 1), seqIndices
, seqOut
);
806 outString
<<= seqOut
[0];
809 seqIndices
.realloc( 0);
811 inv
->invoke(OUString(L
"inoutFloat"), Sequence
< Any
> ( & inFloat
, 1), seqIndices
, seqOut
);
812 outFloat
<<= seqOut
[0];
815 seqIndices
.realloc( 0);
817 inv
->invoke(OUString(L
"inoutDouble"), Sequence
< Any
> ( &inDouble
, 1), seqIndices
, seqOut
);
818 outDouble
<<= seqOut
[0];
821 seqIndices
.realloc( 0);
823 inv
->invoke(OUString(L
"inoutVariant"), Sequence
< Any
> ( & inVariant
, 1), seqIndices
, seqOut
);
824 outVariant
<<= seqOut
[0];
827 seqIndices
.realloc( 0);
829 inv
->invoke(OUString(L
"inoutObject"), Sequence
< Any
> ( & inObject
, 1), seqIndices
, seqOut
);
830 outObject
<<= seqOut
[0];
833 seqIndices
.realloc( 0);
835 inv
->invoke(OUString(L
"inoutCurrency"), Sequence
< Any
> ( & inCY
, 1), seqIndices
, seqOut
);
839 seqIndices
.realloc( 0);
841 inv
->invoke(OUString(L
"inoutDate"), Sequence
< Any
> ( & inDate
, 1), seqIndices
, seqOut
);
842 outDate
<<= seqOut
[0];
845 seqIndices
.realloc( 0);
847 inv
->invoke(OUString(L
"inoutDecimal"), Sequence
< Any
> (& inDecimal
, 1), seqIndices
, seqOut
);
848 outDecimal
<<= seqOut
[0];
851 seqIndices
.realloc(0);
853 inv
->invoke(OUString(L
"inoutSCode"), Sequence
< Any
> (& inSCode
, 1), seqIndices
, seqOut
);
854 outSCode
<<= seqOut
[0];
856 if (inBool
!= outBool
|| inByte
!= outByte
|| inShort
!= outShort
|| inLong
!= outLong
857 || inFloat
!= outFloat
|| inDouble
!= outDouble
|| inString
!= outString
858 || inVariant
!= outVariant
|| inObject
!= outObject
|| inCY
!= outCY
859 || inDate
!= outDate
|| inDecimal
!= outDecimal
|| inSCode
!= outSCode
)
862 //###################################################################################
863 // in byref parameters
864 //###################################################################################
866 inrefLong
<<= (sal_Int32
) 1234;
867 inv
->invoke(OUString(L
"inrefLong"), Sequence
<Any
>( & inrefLong
, 1), seqIndices
, seqOut
);
868 seqIndices
.realloc( 0);
870 inv
->invoke(OUString(L
"outLong"), Sequence
< Any
> (& outrefLong
, 1), seqIndices
, seqOut
);
871 outrefLong
<<= seqOut
[0];
873 inrefVariant
<<= OUString(L
" A string in an any");
874 inv
->invoke(OUString(L
"inrefVariant"), Sequence
< Any
> ( & inrefVariant
, 1), seqIndices
, seqOut
);
875 seqIndices
.realloc( 0);
877 inv
->invoke(OUString(L
"outVariant"), Sequence
< Any
> (&outrefVariant
, 1), seqIndices
, seqOut
);
878 outrefVariant
<<= seqOut
[0];
880 Decimal
refdec(5, 1, 0xffff, 0xff, 0x1);
881 inrefDecimal
<<= refdec
;
882 inv
->invoke(OUString(L
"inrefDecimal"), Sequence
< Any
> ( & inrefDecimal
, 1), seqIndices
, seqOut
);
883 seqIndices
.realloc( 0);
885 inv
->invoke(OUString(L
"outDecimal"), Sequence
< Any
> (&outrefDecimal
, 1), seqIndices
, seqOut
);
886 outrefDecimal
<<= seqOut
[0];
888 if (inrefLong
!= outrefLong
|| inrefVariant
!= outrefVariant
889 || inrefDecimal
!= outrefDecimal
)
893 //###################################################################################
895 //###################################################################################
897 seqIndices
.realloc( 0);
902 param
[2] = inVariant
;
903 inv
->invoke(OUString(L
"mixed1"), Sequence
< Any
>(param
, 3), seqIndices
, seqOut
);
905 if (seqOut
.getLength() != 3 || inByte
!= seqOut
[0] || inFloat
!= seqOut
[1]
906 || inVariant
!= seqOut
[2])
911 bool doSimpleSequenceTest(const Reference
<XInvocation
> & inv
)
914 Sequence
<sal_Int16
> seqIndices
;
915 Sequence
<Any
> seqOut
;
919 Any inArBool
, outArBool
;
920 Any inArByte
, outArByte
;
921 Any inArShort
, outArShort
;
922 Any inArLong
, outArLong
;
923 Any inArString
, outArString
;
924 Any inArFloat
, outArFloat
;
925 Any inArDouble
, outArDouble
;
926 Any inArObject
, outArObject
;
930 OUString arStr
[]= {L
"string0", L
"string1", L
"string2"};
931 Sequence
<OUString
> seq( arStr
, 3);
935 arAnyStrTmp
[0]<<= arStr
[0];
936 arAnyStrTmp
[1]<<= arStr
[1];
937 arAnyStrTmp
[2]<<= arStr
[2];
938 Sequence
<Any
> seq_1( arAnyStrTmp
, 3);
940 //###################################################################################
942 //###################################################################################
943 //Test sequence containing Anys of Strings
944 inv
->invoke(OUString(L
"inArray"), Sequence
< Any
> ( & inArAny
, 1), seqIndices
, seqOut
);
945 seqIndices
.realloc(0);
947 inv
->invoke(OUString(L
"outArray"), Sequence
<Any
>( & voidAny
, 1), seqIndices
, seqOut
);
948 if (inArAny
!= seqOut
[0])
951 seqIndices
.realloc(0);
953 inv
->invoke(OUString(L
"inArray"), Sequence
< Any
>( & inArString
, 1), seqIndices
, seqOut
);
954 inv
->invoke(OUString(L
"outArray"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
955 outArray
<<= seqOut
[0];
957 sal_Int8 arByte
[]={1,2,3};
958 Sequence
<sal_Int8
> seqByte(arByte
, 3);
959 inArByte
<<= seqByte
;
960 inv
->invoke(OUString(L
"inSequenceByte"),Sequence
<Any
>( & inArByte
, 1), seqIndices
, seqOut
);
961 seqIndices
.realloc(0);
963 inv
->invoke(OUString(L
"outSequenceByte"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
964 outArByte
<<= seqOut
[0];
966 sal_Int16 arShort
[]={4,5,6};
967 Sequence
<sal_Int16
> seqShort(arShort
, 3);
968 inArShort
<<= seqShort
;
969 inv
->invoke(OUString(L
"inSequenceShort"),Sequence
< Any
>( & inArShort
, 1), seqIndices
, seqOut
);
970 seqIndices
.realloc(0);
972 inv
->invoke(OUString(L
"outSequenceShort"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
973 outArShort
<<= seqOut
[0];
975 sal_Int32 arLong
[] = {7,8,9};
976 Sequence
<sal_Int32
> seqLong(arLong
, 3);
977 inArLong
<<= seqLong
;
978 inv
->invoke(OUString(L
"inSequenceLong"),Sequence
< Any
> ( & inArLong
, 1), seqIndices
, seqOut
);
979 seqIndices
.realloc(0);
981 inv
->invoke(OUString(L
"outSequenceLong"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
982 outArLong
<<= seqOut
[0];
984 inv
->invoke(OUString(L
"inSequenceLong"),Sequence
< Any
> ( & inArLong
, 1), seqIndices
, seqOut
);
985 seqIndices
.realloc(0);
987 inv
->invoke(OUString(L
"outSequenceLong"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
988 outArLong
<<= seqOut
[0];
990 inv
->invoke( OUString(L
"inSequenceString"),Sequence
< Any
> ( & inArString
, 1), seqIndices
, seqOut
);
991 seqIndices
.realloc(0);
993 inv
->invoke(OUString(L
"outSequenceString"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
994 outArString
<<= seqOut
[0];
996 float arFloat
[]={3.14f
, 31.4f
, 314.f
};
997 Sequence
<float> seqFloat( arFloat
, 3);
998 inArFloat
<<= seqFloat
;
999 inv
->invoke( OUString(L
"inSequenceFloat"),Sequence
< Any
> ( & inArFloat
, 1), seqIndices
, seqOut
);
1000 seqIndices
.realloc(0);
1002 inv
->invoke(OUString(L
"outSequenceFloat"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
1003 outArFloat
<<= seqOut
[0];
1005 double arDouble
[]={3.145, 31.45, 3145.};
1006 Sequence
<double> seqDouble( arDouble
, 3);
1007 inArDouble
<<= seqDouble
;
1008 inv
->invoke(OUString(L
"inSequenceDouble"),Sequence
< Any
>( & inArDouble
, 1), seqIndices
, seqOut
);
1009 seqIndices
.realloc(0);
1011 inv
->invoke(OUString(L
"outSequenceDouble"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
1012 outArDouble
<<= seqOut
[0];
1014 Sequence
<Reference
<XInvocation
> > seqObj(2);
1015 seqObj
[0]= getComObject(L
"AxTestComponents.Basic");
1016 seqObj
[1]= getComObject(L
"AxTestComponents.Basic");
1017 inArObject
<<= seqObj
;
1018 inv
->invoke(OUString(L
"inSequenceObject"),Sequence
< Any
>( & inArObject
, 1), seqIndices
, seqOut
);
1019 seqIndices
.realloc(0);
1021 inv
->invoke(OUString(L
"outSequenceObject"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
1022 outArObject
<<= seqOut
[0];
1024 if ( ! equalSequences(inArByte
, outArByte
) || ! equalSequences(inArShort
, outArShort
)
1025 || ! equalSequences(inArLong
, outArLong
) || ! equalSequences(inArString
, outArray
)
1026 || ! equalSequences(inArFloat
, outArFloat
) || ! equalSequences(inArDouble
, outArDouble
)
1027 || ! equalSequences(inArString
, outArString
) || ! equalSequences(inArObject
, outArObject
))
1030 //###################################################################################
1032 //###################################################################################
1033 seqIndices
.realloc(0);
1035 inv
->invoke(OUString(L
"inoutArray"), Sequence
< Any
>( & inArString
, 1), seqIndices
, seqOut
);
1036 inv
->invoke(OUString(L
"inoutArray"), Sequence
< Any
>( & inArString
, 1), seqIndices
, seqOut
);
1037 outArray
<<= seqOut
[0];
1039 inv
->invoke(OUString(L
"inoutSequenceByte"), Sequence
<Any
>( & inArByte
, 1), seqIndices
, seqOut
);
1040 inv
->invoke(OUString(L
"inoutSequenceByte"), Sequence
<Any
>( & inArByte
, 1), seqIndices
, seqOut
);
1041 outArByte
<<= seqOut
[0];
1043 inv
->invoke(OUString(L
"inoutSequenceShort"), Sequence
<Any
>( & inArShort
, 1), seqIndices
, seqOut
);
1044 inv
->invoke(OUString(L
"inoutSequenceShort"), Sequence
<Any
>( & inArShort
, 1), seqIndices
, seqOut
);
1045 outArShort
<<= seqOut
[0];
1047 inv
->invoke(OUString(L
"inoutSequenceLong"), Sequence
<Any
>( & inArLong
, 1), seqIndices
, seqOut
);
1048 inv
->invoke(OUString(L
"inoutSequenceLong"), Sequence
< Any
>( & inArLong
, 1), seqIndices
, seqOut
);
1049 outArLong
<<= seqOut
[0];
1051 inv
->invoke(OUString(L
"inoutSequenceString"), Sequence
<Any
>( & inArString
, 1), seqIndices
, seqOut
);
1052 inv
->invoke(OUString(L
"inoutSequenceString"), Sequence
<Any
>( & inArString
, 1), seqIndices
, seqOut
);
1053 outArString
<<= seqOut
[0];
1055 inv
->invoke(OUString(L
"inoutSequenceFloat"), Sequence
<Any
>( & inArFloat
, 1), seqIndices
, seqOut
);
1056 inv
->invoke(OUString(L
"inoutSequenceFloat"), Sequence
<Any
>( & inArFloat
, 1), seqIndices
, seqOut
);
1057 outArFloat
<<= seqOut
[0];
1059 inv
->invoke(OUString(L
"inoutSequenceDouble"), Sequence
<Any
>( & inArDouble
, 1), seqIndices
, seqOut
);
1060 inv
->invoke(OUString(L
"inoutSequenceDouble"), Sequence
<Any
>( & inArDouble
, 1), seqIndices
, seqOut
);
1061 outArDouble
<<= seqOut
[0];
1063 inv
->invoke(OUString(L
"inoutSequenceObject"), Sequence
<Any
>( & inArObject
, 1), seqIndices
, seqOut
);
1064 inv
->invoke(OUString(L
"inoutSequenceObject"), Sequence
<Any
>( & inArObject
, 1), seqIndices
, seqOut
);
1065 outArObject
<<= seqOut
[0];
1067 if ( ! equalSequences(inArByte
, outArByte
) || ! equalSequences(inArShort
, outArShort
)
1068 || ! equalSequences(inArLong
, outArLong
) || ! equalSequences(inArString
, outArray
)
1069 || ! equalSequences(inArFloat
, outArFloat
) || ! equalSequences(inArDouble
, outArDouble
)
1070 || ! equalSequences(inArString
, outArString
) || ! equalSequences(inArObject
, outArObject
))
1080 Reference
<XInvocation
> inv
= getComObject( L
"AxTestComponents.Basic");
1082 HostWin
* pWin
= new HostWin( L
"MFCCONTROL.MfcControlCtrl.1");
1083 CComPtr
<IUnknown
> spUnk
= pWin
->GetHostedControl();
1084 Reference
<XInvocation
> invMfc
= convertComObject( spUnk
.p
);
1086 Sequence
< sal_Int16
> seqIndices
;
1087 Sequence
<Any
> seqOut
;
1094 if (! doSimpleTest(inv
))
1096 fprintf(stdout
, "### Test failed!\n");
1100 if (! doPropertyTest(inv
))
1102 fprintf(stdout
, "### Test failed!\n");
1106 if ( ! doSimpleSequenceTest(inv
))
1108 fprintf(stdout
, "### Test failed! \n");
1112 if ( ! doParameterTest(inv
))
1114 fprintf(stdout
, "### Test failed! \n");
1118 if ( ! doPropertyWithArgumentTest(inv
))
1120 fprintf(stdout
, "### Test failed! \n");
1129 // //###################################################################################
1130 // // in multi Sequences
1131 // //###################################################################################
1132 // // inMulDimArrayLong
1133 sal_Int32 arLongi
[]={1,2,3};
1134 sal_Int32 arLongi2
[]={4,5,6,7};
1135 sal_Int32 arLongi3
[]={8,9,10,11,12};
1137 Sequence
<sal_Int32
> seqLongi1( arLongi
, 3);
1138 Sequence
<sal_Int32
> seqLongi2( arLongi2
, 4);
1139 Sequence
<sal_Int32
> seqLongi3( arLongi3
, 5);
1141 Sequence
< Sequence
< sal_Int32
> > seq2i(3);
1142 seq2i
[0]= seqLongi1
;
1143 seq2i
[1]= seqLongi2
;
1144 seq2i
[2]= seqLongi3
;
1146 // dimension length 3,5
1147 inv
->invoke( OUString(L
"inMulDimArrayLong"),Sequence
< Any
> ( &seqAny
, 1), seqIndices
, seqOut
);
1149 //inMulDimArrayVariant
1150 inv
->invoke( OUString(L
"inMulDimArrayVariant"),Sequence
< Any
> ( &seqAny
, 1), seqIndices
, seqOut
);
1152 //inMulDimArrayLong2
1153 sal_Int32 arLongii1
[]={1,2,3};
1154 sal_Int32 arLongii2
[]={4,5,6,7};
1155 sal_Int32 arLongii3
[]={8,9,10,11,12};
1156 sal_Int32 arLongii4
[]={13,14,15,16};
1157 sal_Int32 arLongii5
[]={17,18,19};
1159 Sequence
<sal_Int32
> seqLongii1( arLongii1
, 3);
1160 Sequence
<sal_Int32
> seqLongii2( arLongii2
, 4);
1161 Sequence
<sal_Int32
> seqLongii3( arLongii3
, 5);
1162 Sequence
<sal_Int32
> seqLongii4( arLongii4
, 4);
1163 Sequence
<sal_Int32
> seqLongii5( arLongii5
, 3);
1165 Sequence
< Sequence
< sal_Int32
> > seq2ii(3);
1166 Sequence
< Sequence
< sal_Int32
> > seq2ii2(2);
1167 seq2ii
[0]= seqLongii1
;
1168 seq2ii
[1]= seqLongii2
;
1169 seq2ii
[2]= seqLongii3
;
1171 seq2ii2
[0]= seqLongii4
;
1172 seq2ii2
[1]= seqLongii5
;
1174 Sequence
< Sequence
< Sequence
< sal_Int32
> > > seq3ii(2);
1178 inv
->invoke( OUString(L
"inMulDimArrayLong2"),Sequence
< Any
> ( &seqAny
, 1), seqIndices
, seqOut
);
1180 // inMulDimArrayByte2
1181 sal_Int8 arByteii1
[]={1,2,3};
1182 sal_Int8 arByteii2
[]={4,5,6,7};
1183 sal_Int8 arByteii3
[]={8,9,10,11,12};
1184 sal_Int8 arByteii4
[]={13,14,15,16};
1185 sal_Int8 arByteii5
[]={17,18,19};
1187 Sequence
<sal_Int8
> seqByteii1( arByteii1
, 3);
1188 Sequence
<sal_Int8
> seqByteii2( arByteii2
, 4);
1189 Sequence
<sal_Int8
> seqByteii3( arByteii3
, 5);
1190 Sequence
<sal_Int8
> seqByteii4( arByteii4
, 4);
1191 Sequence
<sal_Int8
> seqByteii5( arByteii5
, 3);
1193 Sequence
< Sequence
< sal_Int8
> > seq2Byteii(3);
1194 Sequence
< Sequence
< sal_Int8
> > seq2Byteii2(2);
1195 seq2Byteii
[0]= seqByteii1
;
1196 seq2Byteii
[1]= seqByteii2
;
1197 seq2Byteii
[2]= seqByteii3
;
1199 seq2Byteii2
[0]= seqByteii4
;
1200 seq2Byteii2
[1]= seqByteii5
;
1202 Sequence
< Sequence
< Sequence
< sal_Int8
> > > seq3Byteii(2);
1203 seq3Byteii
[0]=seq2Byteii
;
1204 seq3Byteii
[1]=seq2Byteii2
;
1205 seqAny
<<= seq3Byteii
;
1206 inv
->invoke( OUString(L
"inMulDimArrayByte2"),Sequence
< Any
> ( &seqAny
, 1), seqIndices
, seqOut
);
1210 //###################################################################################
1211 //###################################################################################
1212 //###################################################################################
1213 // Tests with a MFC ActiveX control, ( pure dispinterface)
1214 //###################################################################################
1216 //###################################################################################
1217 // in parameter MFC ActiveX
1218 //###################################################################################
1219 // unsigned char is not supported by MFC
1220 // aAny <<= ( sal_Int8) 127;
1221 // invMfc->invoke( OUString(L"inByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1224 aAny
<<= static_cast<sal_Int16
>(-1);
1225 aAny
= invMfc
->invoke( OUString(L
"inShort"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1228 aAny
<<= ( sal_Int32
) 1234567;
1229 aAny
=invMfc
->invoke( OUString(L
"inLong"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1230 sal_Int32 retLong
= *(sal_Int32
*)aAny
.getValue();
1232 OUString
str_1(L
" this is clientTest.exe");
1234 aAny
=invMfc
->invoke( OUString(L
"inString"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1237 aAny
<<= ( float) 3.14;
1238 aAny
=invMfc
->invoke( OUString(L
"inFloat"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1240 aAny
<<= ( double) 3.145;
1241 aAny
=invMfc
->invoke( OUString(L
"inDouble"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1243 aAny
<<= OUString( L
" A string in an any");
1244 aAny
=invMfc
->invoke( OUString(L
"inVariant"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1246 // Tests with Sequences later.
1247 // OUString arStr4[]= {L"string0", L"string1", L"string2"};
1248 // Sequence<OUString> seqStr4( arStr4, 3);
1249 // aAny <<= seqStr4;
1250 // invMfc->invoke( OUString(L"inArray"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1253 Reference
< XInvocation
> inv5
= getComObject(L
"AxTestComponents.Basic");
1255 anyVal4
<<= OUString(L
"this is the value of prpString");
1256 inv5
->setValue( OUString(L
"prpString"), anyVal4
);
1258 aAny
=invMfc
->invoke( OUString(L
"inObject"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1260 // //###################################################################################
1261 // // out parameter MFC ActiveX
1262 // //###################################################################################
1265 aAny
= invMfc
->invoke( OUString(L
"outShort"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1266 anyOut
<<= seqOut
[0];
1267 sprintf(buff
, "MFC outShort %d", *(sal_Int16
*)anyOut
.getValue());
1268 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1271 aAny
= invMfc
->invoke( OUString(L
"outLong"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1272 anyOut
<<= seqOut
[0];
1273 sprintf(buff
, "MFC outLong %d", *(sal_Int32
*)anyOut
.getValue());
1274 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1277 aAny
= invMfc
->invoke( OUString(L
"outString"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1278 anyOut
<<= seqOut
[0];
1279 sprintf(buff
, "MFC outString %S", ((OUString
*)anyOut
.getValue())->getStr());
1280 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1283 aAny
= invMfc
->invoke( OUString(L
"outFloat"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1284 anyOut
<<= seqOut
[0];
1285 sprintf(buff
, "MFC outFloat %f", *(float*)anyOut
.getValue());
1286 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1289 aAny
= invMfc
->invoke( OUString(L
"outDouble"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1290 anyOut
<<= seqOut
[0];
1291 sprintf(buff
, "MFC outFloat %f", *(double*)anyOut
.getValue());
1292 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1295 // we expect a string!! ( VT_BSTR)
1296 aAny
= invMfc
->invoke( OUString(L
"outVariant"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1297 anyOut
<<= seqOut
[0];
1298 sprintf(buff
, "MFC outVariant %S", ((OUString
*)anyOut
.getValue())->getStr());
1299 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1302 aAny
= invMfc
->invoke( OUString(L
"outObject"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1303 Reference
<XInvocation
> invOut5
;
1304 seqOut
[0]>>= invOut5
;
1305 // we assume that an object of AxTestControls.Basic is being returned.
1306 anyOut
= invOut5
->getValue( OUString(L
"prpString"));
1309 sprintf(buff
, "MFC outObject, property: %S", tmpStr
.getStr());
1310 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1313 //###################################################################################
1314 // Sequence parameter MFC ActiveX
1315 //###################################################################################
1316 // Sequences are not directly supported.
1326 //VARIANT_TRUE VT_UI1