1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_extensions.hxx"
40 #include "typelib/typedescription.hxx"
41 #include <com/sun/star/bridge/oleautomation/Date.hpp>
42 #include <com/sun/star/bridge/oleautomation/Currency.hpp>
43 #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
44 #include <com/sun/star/bridge/oleautomation/SCode.hpp>
45 #include <com/sun/star/bridge/oleautomation/NamedArgument.hpp>
46 #include <com/sun/star/bridge/oleautomation/PropertyPutArgument.hpp>
47 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48 #include <com/sun/star/script/XInvocation.hpp>
49 //#include <oletest/XCallback.hpp>
50 #include <com/sun/star/uno/Reference.h>
51 #include <cppuhelper/servicefactory.hxx>
52 #include <rtl/string.h>
54 #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
55 BEGIN_OBJECT_MAP(ObjectMap
)
58 using namespace com::sun::star::lang
;
59 using namespace com::sun::star::uno
;
60 using namespace com::sun::star::script
;
61 using namespace com::sun::star::bridge::oleautomation
;
67 Reference
<XInvocation
> convertComObject( IUnknown
* pUnk
);
68 Reference
<XInvocation
> getComObject( OUString progId
);
69 bool checkOutArgs(const Sequence
<Any
> & outArgs
,
70 const Sequence
<sal_Int16
> & indices
, const Sequence
<Any
> & values
);
72 bool doSimpleTest(const Reference
<XInvocation
> & inv
);
73 bool doSimpleSequenceTest(const Reference
<XInvocation
> & inv
);
74 bool doParameterTest(const Reference
<XInvocation
> & inv
);
75 bool doPropertyWithArgumentTest(const Reference
<XInvocation
> & inv
);
76 bool equalSequences(const Any
& orig
, const Any
& returned
);
78 HRESULT
doTest2( Reference
<XInvocation
> &);
79 Reference
<XInvocation
> getComObject(OUString
& );
81 HRESULT
InitializeParameter();
82 void printResultVariantArray( VARIANT
& var
);
83 void printVariant( VARIANT
& var
);
84 void printSequence( Sequence
<Any
>& val
);
86 extern "C" int __cdecl
main( int , char **)
89 if( FAILED( hr
=CoInitialize(NULL
)))
91 _tprintf(_T("CoInitialize failed \n"));
96 _Module
.Init( ObjectMap
, GetModuleHandle( NULL
));
98 if( FAILED(hr
=doTest()))
101 const TCHAR
* errMsg
= err
.ErrorMessage();
102 MessageBox( NULL
, errMsg
, "Test failed", MB_ICONERROR
);
106 MessageBox( NULL
,NULL
, "Test succeeded", MB_ICONINFORMATION
);
114 //Also supports named args
116 bool doParameterTest(const Reference
<XInvocation
> & inv
)
118 Sequence
< sal_Int16
> seqIndices
;
119 Sequence
<Any
> seqOut
;
125 NamedArgument
arg1(OUString(L
"val1"), makeAny((sal_Int32
) 123));
126 NamedArgument
arg2(OUString(L
"val2"), makeAny((sal_Int32
) 456));
127 NamedArgument
arg3(OUString(L
"val3"), makeAny((sal_Int32
) 0xff));
128 NamedArgument
arg4(OUString(L
"val4"), makeAny((sal_Int32
) 0xffff));
130 NamedArgument
argOut1(OUString(L
"val1"), Any());
131 NamedArgument
argOut2(OUString(L
"val2"), Any());
132 Sequence
<Any
> seqNoArgs
;
133 arArgs
[0] <<= (sal_Int32
) 0;
134 arArgs
[1] <<= (sal_Int32
) 0;
135 Sequence
<Any
> seqPositional0(arArgs
, 2);
140 Sequence
<Any
> seqNamed(arArgs
, 2);
143 Sequence
<Any
> seqNamed2(arArgs
, 2);
144 arArgs
[0] <<= argOut1
;
145 arArgs
[1] <<= argOut2
;
146 Sequence
<Any
> seqNamed3(arArgs
, 2);
147 arArgs
[0] <<= argOut2
;
148 arArgs
[1] <<= argOut1
;
149 Sequence
<Any
> seqNamed4(arArgs
, 2);
152 Sequence
<Any
> seqNamed5(arArgs
, 1);
154 Sequence
<Any
> seqNamed6(arArgs
, 1);
156 arArgs
[0] <<= (sal_Int32
) 123;
157 arArgs
[1] <<= (sal_Int32
) 456;
158 Sequence
<Any
> seqPositional(arArgs
, 2);
159 arArgs
[0] <<= (sal_Int32
) 123;
160 Sequence
<Any
> seqPositional2(arArgs
, 1);
164 Sequence
<Any
> seqPositional3(arArgs
, 2);
166 arArgs
[0] <<= (sal_Int32
) 123;
167 arArgs
[1] <<= SCode(DISP_E_PARAMNOTFOUND
);
168 Sequence
<Any
> seqOutOpt1(arArgs
, 2);
170 arArgs
[0] <<= SCode(DISP_E_PARAMNOTFOUND
);
171 arArgs
[1] <<= SCode(DISP_E_PARAMNOTFOUND
);
172 Sequence
<Any
> seqOutOpt2(arArgs
, 2);
174 arArgs
[0] <<= SCode(DISP_E_PARAMNOTFOUND
);
175 arArgs
[1] <<= (sal_Int32
) 456;
176 Sequence
<Any
> seqOutOpt3(arArgs
, 2);
178 arArgs1
[0] <<= (sal_Int32
) 0;
179 arArgs1
[1] <<= (sal_Int32
) 0;
180 arArgs1
[2] <<= (sal_Int32
) 0;
181 arArgs1
[3] <<= (sal_Int32
) 0;
182 Sequence
<Any
> seqMix0(arArgs1
, 4);
184 arArgs1
[0] <<= (sal_Int32
) 123;
185 arArgs1
[1] <<= (sal_Int32
) 456;
188 Sequence
<Any
> seqMix(arArgs1
, 4);
190 arArgs1
[0] <<= Any();
191 arArgs1
[1] <<= (sal_Int32
) 456;
193 Sequence
<Any
> seqMix2(arArgs1
, 3);
195 arArgs1
[0] <<= SCode(DISP_E_PARAMNOTFOUND
);
196 arArgs1
[1] <<= (sal_Int32
) 456;
197 arArgs1
[2] <<= SCode(DISP_E_PARAMNOTFOUND
);
198 arArgs1
[3] <<= arg4
.Value
;
199 Sequence
<Any
> seqMixOut(arArgs1
, 4);
201 arArgs1
[0] <<= SCode(DISP_E_PARAMNOTFOUND
);
202 arArgs1
[1] <<= Any();
204 Sequence
<Any
> seqMix2Out(arArgs1
, 3);
208 //in args + out, optional, positional-----------------------------------------
210 seqIndices
.realloc(0);
212 inv
->invoke(OUString(L
"optional3"), seqPositional
, seqIndices
, seqOut
);
213 seqIndices
.realloc(0);
215 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
216 if ( ! checkOutArgs(seqOut
, seqIndices
, seqPositional
))
219 //2 optional args, 1 provided
220 seqIndices
.realloc(0);
222 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
223 seqIndices
.realloc(0);
225 inv
->invoke(OUString(L
"optional3"), seqPositional2
, seqIndices
, seqOut
);
226 seqIndices
.realloc(0);
228 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
229 if ( ! checkOutArgs(seqOut
, seqIndices
, seqOutOpt1
))
232 //2 optional args, 0 provided
233 seqIndices
.realloc(0);
235 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
236 seqIndices
.realloc(0);
238 inv
->invoke(OUString(L
"optional3"), seqNoArgs
, seqIndices
, seqOut
);
239 seqIndices
.realloc(0);
241 inv
->invoke(OUString(L
"optional5"), seqPositional3
, seqIndices
, seqOut
);
242 if ( ! checkOutArgs(seqOut
, seqIndices
, seqOutOpt2
))
245 //named args --------------------------------------------
247 // 2 named args, correct position
248 seqIndices
.realloc(0);
250 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
251 seqIndices
.realloc(0);
253 inv
->invoke(OUString(L
"optional3"), seqNamed
, seqIndices
, seqOut
);
254 seqIndices
.realloc(0);
256 inv
->invoke(OUString(L
"optional5"), seqPositional0
, seqIndices
, seqOut
);
257 if ( ! checkOutArgs(seqOut
, seqIndices
, seqPositional
))
260 // 2named args, position differs
261 seqIndices
.realloc(0);
263 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
264 seqIndices
.realloc(0);
266 inv
->invoke(OUString(L
"optional3"), seqNamed2
, seqIndices
, seqOut
);
267 seqIndices
.realloc(0);
269 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
270 if ( ! checkOutArgs(seqOut
, seqIndices
, seqPositional
))
273 //named out args, 2 named args with correct position
274 seqIndices
.realloc(0);
276 inv
->invoke(OUString(L
"optional3"), seqNamed
, seqIndices
, seqOut
);
277 seqIndices
.realloc(0);
278 seqIndices
.realloc(0);
279 inv
->invoke(OUString(L
"optional5"), seqNamed3
, seqIndices
, seqOut
);
280 if ( ! checkOutArgs(seqOut
, seqIndices
, seqNamed
))
283 //named out args, 2 named args with different position
284 seqIndices
.realloc(0);
286 inv
->invoke(OUString(L
"optional3"), seqNamed
, seqIndices
, seqOut
);
287 seqIndices
.realloc(0);
288 seqIndices
.realloc(0);
289 inv
->invoke(OUString(L
"optional5"), seqNamed4
, seqIndices
, seqOut
);
290 if ( ! checkOutArgs(seqOut
, seqIndices
, seqNamed2
))
294 //2 args, 1 provided (correct order)
295 seqIndices
.realloc(0);
297 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
298 seqIndices
.realloc(0);
300 inv
->invoke(OUString(L
"optional3"), seqNamed5
, seqIndices
, seqOut
);
301 seqIndices
.realloc(0);
303 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
304 if ( ! checkOutArgs(seqOut
, seqIndices
, seqOutOpt1
))
306 //2 args, 1 provided (incorrect order)
307 seqIndices
.realloc(0);
309 inv
->invoke(OUString(L
"optional3"), seqPositional0
, seqIndices
, seqOut
);
310 seqIndices
.realloc(0);
312 inv
->invoke(OUString(L
"optional3"), seqNamed6
, seqIndices
, seqOut
);
313 seqIndices
.realloc(0);
315 inv
->invoke(OUString(L
"optional5"), seqPositional
, seqIndices
, seqOut
);
316 if ( ! checkOutArgs(seqOut
, seqIndices
, seqOutOpt3
))
319 //2position + 2 2named args, correct order
320 seqIndices
.realloc(0);
322 inv
->invoke(OUString(L
"optional6"), seqMix0
, seqIndices
, seqOut
);
323 seqIndices
.realloc(0);
325 inv
->invoke(OUString(L
"optional6"), seqMix
, seqIndices
, seqOut
);
326 seqIndices
.realloc(0);
328 inv
->invoke(OUString(L
"optional7"), seqMix
, seqIndices
, seqOut
);
329 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMix
))
332 // 4 in args, 1 positional, 1 named, 1 positional omitted
333 seqIndices
.realloc(0);
335 inv
->invoke(OUString(L
"optional6"), seqMix0
, seqIndices
, seqOut
);
336 seqIndices
.realloc(0);
338 inv
->invoke(OUString(L
"optional6"), seqMix2
, seqIndices
, seqOut
);
339 seqIndices
.realloc(0);
341 inv
->invoke(OUString(L
"optional7"), seqMix0
, seqIndices
, seqOut
);
342 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMixOut
))
345 // 4 out args, 1 positional, 1 named, 1 positional omitted
346 seqIndices
.realloc(0);
348 inv
->invoke(OUString(L
"optional6"), seqMix2
, seqIndices
, seqOut
);
349 seqIndices
.realloc(0);
351 inv
->invoke(OUString(L
"optional7"), seqMix2Out
, seqIndices
, seqOut
);
352 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMix2Out
))
358 bool doPropertyTest(const Reference
<XInvocation
> & inv
)
360 Sequence
< sal_Int16
> seqIndices
;
361 Sequence
<Any
> seqOut
;
365 Any inShort
, outShort
;
367 Any inString
, outString
;
368 Any inFloat
, outFloat
;
369 Any inDouble
, outDouble
;
370 Any inVariant
, outVariant
;
371 Any inObject
, outObject
;
372 Any inUnknown
, outUnknown
;
375 Any inDecimal
, outDecimal
;
376 Any inSCode
, outSCode
;
377 Any inrefLong
, outrefLong
;
378 Any inrefVariant
, outrefVariant
;
379 Any inrefDecimal
, outrefDecimal
;
380 Any inParamsLong
, outParamsLong
;
381 Reference
<XInterface
> xintUnknown(getComObject(L
"AxTestComponents.Foo"));
383 inBool
<<= (sal_Bool
) sal_True
;
384 inv
->setValue(OUString(L
"prpBool"), inBool
);
385 outBool
= inv
->getValue(OUString(L
"prpBool"));
387 inByte
<<= (sal_Int8
) 100;
388 inv
->setValue(OUString(L
"prpByte"), inByte
);
389 outByte
= inv
->getValue(OUString(L
"prpByte"));
391 inShort
<<= static_cast<sal_Int16
>( -1);
392 inv
->setValue(OUString(L
"prpShort"), inShort
);
393 outShort
= inv
->getValue(OUString(L
"prpShort"));
395 inLong
<<= ( sal_Int32
) 1234567;
396 inv
->setValue(OUString(L
"prpLong"), inLong
// TODO: Add your implementation code here
398 outLong
= inv
->getValue(OUString(L
"prpLong"));
400 inString
<<= OUString(L
" this is clientTest.exe");
401 inv
->setValue(OUString(L
"prpString"), inString
);
402 outString
= inv
->getValue(OUString(L
"prpString"));
405 inv
->setValue(OUString(L
"prpFloat"), inFloat
);
406 outFloat
= inv
->getValue(OUString(L
"prpFloat"));
408 inDouble
<<= ( double) 3.145;
409 inv
->setValue(OUString(L
"prpDouble"), inDouble
);
410 outDouble
= inv
->getValue(OUString(L
"prpDouble"));
412 inVariant
<<= OUString(L
"A string in an any");
413 inv
->setValue(OUString(L
"prpVariant"), inVariant
);
414 outVariant
= inv
->getValue(OUString(L
"prpVariant"));
417 inv
->setValue(OUString(L
"prpObject"), inObject
);
418 outObject
= inv
->getValue(OUString(L
"prpObject"));
420 inUnknown
<<= xintUnknown
;
421 inv
->setValue(OUString(L
"prpUnknown"), inUnknown
);
422 outUnknown
= inv
->getValue(OUString(L
"prpUnknown"));
426 inv
->setValue(OUString(L
"prpCurrency"), inCY
);
427 outCY
= inv
->getValue(OUString(L
"prpCurrency"));
431 inv
->setValue(OUString(L
"prpDate"), inDate
);
432 outDate
= inv
->getValue(OUString(L
"prpDate"));
434 Decimal
dec(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff);
436 inv
->setValue(OUString(L
"prpDecimal"), inDecimal
);
437 outDecimal
= inv
->getValue(OUString(L
"prpDecimal"));
439 SCode
code(DISP_E_BADVARTYPE
);
441 inv
->setValue(OUString(L
"prpSCode"), inSCode
);
442 outSCode
= inv
->getValue(OUString(L
"prpSCode"));
444 inrefLong
<<= (sal_Int32
) 123456;
445 inv
->setValue(OUString(L
"prprefLong"), inrefLong
);
446 outrefLong
= inv
->getValue(OUString(L
"prprefLong"));
448 inrefVariant
<<= OUString(L
"A string in an any");
449 inv
->setValue(OUString(L
"prprefVariant"), inrefVariant
);
450 outrefVariant
= inv
->getValue(OUString(L
"prprefVariant"));
452 Decimal
decref(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff);
453 inrefDecimal
<<= decref
;
454 inv
->setValue(OUString(L
"prprefDecimal"), inrefDecimal
);
455 outrefDecimal
= inv
->getValue(OUString(L
"prprefDecimal"));
457 if (inBool
!= outBool
|| inByte
!= outByte
|| inShort
!= outShort
|| inLong
!= outLong
458 || inFloat
!= outFloat
|| inDouble
!= outDouble
|| inString
!= outString
459 || inVariant
!= outVariant
|| inObject
!= outObject
460 || inUnknown
!= outUnknown
|| inCY
!= outCY
461 || inDate
!= outDate
|| inDecimal
!= outDecimal
|| inSCode
!= outSCode
462 || inrefLong
!= outrefLong
||inrefVariant
!= outrefVariant
463 || inrefDecimal
!= outrefDecimal
)
468 bool doPropertyWithArgumentTest(const Reference
<XInvocation
> & inv
)
470 Sequence
< sal_Int16
> seqIndices
;
471 Sequence
<Any
> seqOut
;
474 arMultiArgs
[0] <<= makeAny((sal_Int32
) 0);
475 arMultiArgs
[1] <<= makeAny((sal_Int32
) 0);
476 arMultiArgs
[2] <<= PropertyPutArgument(makeAny((sal_Int32
) 0));
477 Sequence
<Any
> seqMultiArgPut0(arMultiArgs
, 3);
479 arMultiArgs
[0] <<= makeAny((sal_Int32
) 1);
480 arMultiArgs
[1] <<= makeAny((sal_Int32
) 2);
481 arMultiArgs
[2] <<= PropertyPutArgument(makeAny((sal_Int32
) 3));
482 Sequence
<Any
> seqMultiArgPut1(arMultiArgs
, 3);
484 arMultiArgs
[0] <<= makeAny((sal_Int32
) 1);
485 arMultiArgs
[1] <<= PropertyPutArgument(makeAny((sal_Int32
) 3));
486 Sequence
<Any
> seqMultiArgPut2(arMultiArgs
, 2);
488 arMultiArgs
[0] <<= NamedArgument(OUString(L
"val2"), makeAny((sal_Int32
) 1));
489 arMultiArgs
[1] <<= PropertyPutArgument(makeAny((sal_Int32
) 3));
490 Sequence
<Any
> seqMultiArgPut3(arMultiArgs
, 2);
492 arMultiArgs
[0] <<= NamedArgument(OUString(L
"val2"), makeAny((sal_Int32
) 1));
493 arMultiArgs
[1] <<= NamedArgument(OUString(L
"val3"), makeAny((sal_Int32
) 3));
494 Sequence
<Any
> seqMultiArgPut4(arMultiArgs
, 2);
496 arMultiArgs
[0] <<= makeAny((sal_Int32
) 0);
497 arMultiArgs
[1] <<= makeAny((sal_Int32
) 0);
498 Sequence
<Any
> seqMultiArgGet0(arMultiArgs
, 2);
500 arMultiArgs
[0] <<= makeAny((sal_Int32
) 1);
501 arMultiArgs
[1] <<= makeAny((sal_Int32
) 2);
502 Sequence
<Any
> seqMultiArgGet1(arMultiArgs
, 2);
503 Sequence
<Any
> seqMultiArgGet2(arMultiArgs
, 1);
506 arMultiArgs
[0] <<= makeAny((sal_Int32
) 0);
507 arMultiArgs
[1] <<= PropertyPutArgument(makeAny((sal_Int32
) 0));
508 Sequence
<Any
> seqMultiArgPut5(arMultiArgs
, 2);
510 arMultiArgs
[0] <<= makeAny((sal_Int32
) 1);
511 arMultiArgs
[1] <<= PropertyPutArgument(makeAny((sal_Int32
) 2));
512 Sequence
<Any
> seqMultiArgPut6(arMultiArgs
, 2);
514 arMultiArgs
[0] <<= Any();
515 arMultiArgs
[1] <<= Any();
516 Sequence
<Any
> seqMultiVoid(arMultiArgs
, 2);
518 arMultiArgs
[0] = makeAny((sal_Int32
) 0);
519 arMultiArgs
[1] = makeAny((sal_Int32
) 0);
520 Sequence
<Any
> seqMultiVoid2(arMultiArgs
, 2);
522 //[propput, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [in] VARIANT* newVal);
523 //[propget, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [out, optional, retval] VARIANT* pVal);
524 seqIndices
.realloc( 0);
526 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut0
, seqIndices
, seqOut
);
527 seqIndices
.realloc( 0);
529 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut1
, seqIndices
, seqOut
);
531 seqIndices
.realloc( 0);
533 Any anyRet
= inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgGet0
,
536 if (anyRet
!= ((PropertyPutArgument
const *)seqMultiArgPut1
[2].getValue())->Value
537 || ! checkOutArgs(seqOut
, seqIndices
, Sequence
<Any
>(seqMultiArgPut1
.getArray(), 2)))
541 // test optional (one arg omitted
542 seqIndices
.realloc( 0);
544 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut0
, seqIndices
, seqOut
);
545 seqIndices
.realloc( 0);
547 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut2
, seqIndices
, seqOut
);
548 seqIndices
.realloc( 0);
550 anyRet
= inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgGet0
,
553 arMultiArgs
[0] = makeAny((sal_Int32
) 1);
554 arMultiArgs
[1] = makeAny((SCode(DISP_E_PARAMNOTFOUND
)));
556 if (anyRet
!= ((PropertyPutArgument
const *) seqMultiArgPut2
[1].getValue())->Value
557 || ! checkOutArgs(seqOut
, seqIndices
, Sequence
<Any
>(arMultiArgs
, 2)))
562 //test one named arg and one omitted
563 seqIndices
.realloc( 0);
565 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut0
, seqIndices
, seqOut
);
566 seqIndices
.realloc( 0);
568 inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgPut3
, seqIndices
, seqOut
);
569 seqIndices
.realloc( 0);
571 anyRet
= inv
->invoke(OUString(L
"prpMultiArg1"), seqMultiArgGet0
,
574 arMultiArgs
[0] = makeAny((SCode(DISP_E_PARAMNOTFOUND
)));
575 arMultiArgs
[1] = ((NamedArgument
const*) seqMultiArgPut3
[0].getValue())->Value
;
576 if (anyRet
!= ((PropertyPutArgument
const*) seqMultiArgPut3
[1].getValue())->Value
577 || ! checkOutArgs(seqOut
, seqIndices
, Sequence
<Any
>(arMultiArgs
, 2)))
582 // [propget,...] HRESULT prpMultiArg2([in] VARIANT val1, [out, retval] VARIANT* pVal);
583 // [propput,...] HRESULT prpMultiArg2([in] VARIANT val1, [in] VARIANT newVal);
584 seqIndices
.realloc( 0);
586 inv
->invoke(OUString(L
"prpMultiArg2"), seqMultiArgPut5
, seqIndices
, seqOut
);
587 seqIndices
.realloc( 0);
589 inv
->invoke(OUString(L
"prpMultiArg2GetValues"), seqMultiVoid
, seqIndices
, seqOut
);
591 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMultiVoid2
))
593 seqIndices
.realloc( 0);
595 anyRet
= inv
->invoke(OUString(L
"prpMultiArg2"), seqMultiArgPut6
,
597 seqIndices
.realloc( 0);
599 anyRet
= inv
->invoke(OUString(L
"prpMultiArg2GetValues"), seqMultiVoid
,
602 // [propget,...] HRESULT prpMultiArg3([in,out] LONG* val1, [out, retval] LONG* pVal);
603 // [propput,...] HRESULT prpMultiArg3([in,out] LONG* val1, [in] LONG newVal);
605 if ( ! checkOutArgs(seqOut
, seqIndices
, seqMultiArgGet1
))
607 seqIndices
.realloc( 0);
609 inv
->invoke(OUString(L
"prpMultiArg3"), seqMultiArgPut5
, seqIndices
, seqOut
);
610 seqIndices
.realloc( 0);
612 inv
->invoke(OUString(L
"prpMultiArg3"), seqMultiArgPut6
, seqIndices
, seqOut
);
613 seqIndices
.realloc( 0);
615 anyRet
= inv
->invoke(OUString(L
"prpMultiArg3"), seqMultiArgGet2
, seqIndices
, seqOut
);
617 if ( anyRet
!= ((PropertyPutArgument
const*) seqMultiArgPut6
[1].getValue())->Value
618 || !checkOutArgs(seqOut
, seqIndices
, seqMultiArgGet2
))
622 //hasProperty, hasMethod
623 if (inv
->hasProperty(OUSTR("prpMultiArg1")))
625 if ( ! inv
->hasMethod(OUSTR("prpMultiArg1")))
627 if ( ! inv
->hasProperty(OUSTR("prprefLong")))
629 if (inv
->hasMethod(OUSTR("prprefLong")))
631 if ( ! inv
->hasMethod(OUSTR("inLong")))
636 bool doSimpleTest(const Reference
<XInvocation
> & inv
)
638 Sequence
< sal_Int16
> seqIndices
;
639 Sequence
<Any
> seqOut
;
643 Any inShort
, outShort
;
645 Any inString
, outString
;
646 Any inFloat
, outFloat
;
647 Any inDouble
, outDouble
;
648 Any inVariant
, outVariant
;
649 Any inObject
, outObject
;
650 Any inUnknown
, outUnknown
;
653 Any inDecimal
, outDecimal
;
654 Any inSCode
, outSCode
;
655 Any inrefLong
, outrefLong
;
656 Any inrefVariant
, outrefVariant
;
657 Any inrefDecimal
, outrefDecimal
;
659 Reference
<XInterface
> xIntFoo(getComObject(L
"AxTestComponents.Foo"));
660 //###################################################################################
661 // in and out parameter
662 //###################################################################################
663 sal_Bool aBool
= sal_True
;
664 inBool
.setValue(&aBool
, getCppuBooleanType());
665 inv
->invoke(OUString(L
"inBool"), Sequence
< Any
> ( &inBool
, 1), seqIndices
, seqOut
);
666 seqIndices
.realloc(0);
668 inv
->invoke(OUString(L
"outBool"), Sequence
< Any
> ( & outBool
, 1), seqIndices
, seqOut
);
669 outBool
<<= seqOut
[0];
671 inByte
<<= (sal_Int8
) 127;
672 inv
->invoke(OUString(L
"inByte"), Sequence
< Any
> ( & inByte
, 1), seqIndices
, seqOut
);
673 seqIndices
.realloc( 0);
675 inv
->invoke(OUString(L
"outByte"), Sequence
< Any
> ( & outByte
, 1), seqIndices
, seqOut
);
676 outByte
<<= seqOut
[0];
678 inShort
<<= static_cast<sal_Int16
>(-1);
679 inv
->invoke(OUString(L
"inShort"), Sequence
< Any
> ( & inShort
, 1), seqIndices
, seqOut
);
680 seqIndices
.realloc( 0);
682 inv
->invoke(OUString(L
"outShort"), Sequence
< Any
> ( & outShort
, 1), seqIndices
, seqOut
);
683 outShort
<<= seqOut
[0];
685 inLong
<<= ( sal_Int32
) 1234567;
686 inv
->invoke(OUString(L
"inLong"), Sequence
< Any
> ( & inLong
, 1), seqIndices
, seqOut
);
687 seqIndices
.realloc( 0);
689 inv
->invoke(OUString(L
"outLong"), Sequence
< Any
> ( & outLong
, 1 ), seqIndices
, seqOut
);
690 outLong
<<= seqOut
[0];
692 inString
<<= OUString(L
" this is clientTest.exe");
693 inv
->invoke(OUString(L
"inString"), Sequence
< Any
> ( & inString
, 1), seqIndices
, seqOut
);
694 seqIndices
.realloc( 0);
696 inv
->invoke(OUString(L
"outString"), Sequence
< Any
> ( & outString
, 1 ), seqIndices
, seqOut
);
697 outString
<<= seqOut
[0];
700 inv
->invoke(OUString(L
"inFloat"), Sequence
< Any
> ( & inFloat
, 1), seqIndices
, seqOut
);
701 seqIndices
.realloc( 0);
703 inv
->invoke(OUString(L
"outFloat"), Sequence
< Any
> ( & outFloat
, 1 ), seqIndices
, seqOut
);
704 outFloat
<<= seqOut
[0];
706 inDouble
<<= ( double) 3.145;
707 inv
->invoke(OUString(L
"inDouble"), Sequence
< Any
> ( & inDouble
, 1), seqIndices
, seqOut
);
708 seqIndices
.realloc( 0);
710 inv
->invoke(OUString(L
"outDouble"), Sequence
< Any
> ( & outDouble
, 1 ), seqIndices
, seqOut
);
711 outDouble
<<= seqOut
[0];
713 inVariant
<<= OUString(L
" A string in an any");
714 inv
->invoke(OUString(L
"inVariant"), Sequence
< Any
> ( & inVariant
, 1), seqIndices
, seqOut
);
715 seqIndices
.realloc( 0);
717 inv
->invoke(OUString(L
"outVariant"), Sequence
< Any
> (&outVariant
, 1), seqIndices
, seqOut
);
718 outVariant
<<= seqOut
[0];
721 inv
->invoke(OUString(L
"inObject"), Sequence
< Any
> ( & inObject
, 1), seqIndices
, seqOut
);
722 seqIndices
.realloc( 0);
724 inv
->invoke(OUString(L
"outObject"), Sequence
< Any
> (& outObject
, 1), seqIndices
, seqOut
);
725 outObject
<<= seqOut
[0];
727 inUnknown
<<= xIntFoo
;
728 inv
->invoke(OUString(L
"inUnknown"), Sequence
< Any
> ( & inUnknown
, 1), seqIndices
, seqOut
);
729 seqIndices
.realloc( 0);
731 inv
->invoke(OUString(L
"outUnknown"), Sequence
< Any
> (& outUnknown
, 1), seqIndices
, seqOut
);
732 outUnknown
<<= seqOut
[0];
734 Currency
cur(999999);
736 inv
->invoke(OUString(L
"inCurrency"), Sequence
<Any
>( & inCY
, 1), seqIndices
, seqOut
);
737 seqIndices
.realloc( 0);
739 inv
->invoke(OUString(L
"outCurrency"), Sequence
< Any
> (& outCY
, 1), seqIndices
, seqOut
);
744 inv
->invoke(OUString(L
"inDate"), Sequence
<Any
>( & inDate
, 1), seqIndices
, seqOut
);
745 seqIndices
.realloc( 0);
747 inv
->invoke(OUString(L
"outDate"), Sequence
< Any
> (& outDate
, 1), seqIndices
, seqOut
);
748 outDate
<<= seqOut
[0];
750 Decimal
dec(3, 0, 0xffffffff, 0xffffffff, 0xfffffff0);
752 inv
->invoke(OUString(L
"inDecimal"), Sequence
<Any
>( & inDecimal
, 1), seqIndices
, seqOut
);
753 seqIndices
.realloc( 0);
755 inv
->invoke(OUString(L
"outDecimal"), Sequence
< Any
> (& outDecimal
, 1), seqIndices
, seqOut
);
756 outDecimal
<<= seqOut
[0];
758 SCode
code(DISP_E_BADVARTYPE
);
760 inv
->invoke(OUString(L
"inSCode"), Sequence
<Any
>( & inSCode
, 1), seqIndices
, seqOut
);
761 seqIndices
.realloc( 0);
763 inv
->invoke(OUString(L
"outSCode"), Sequence
< Any
> (& outSCode
, 1), seqIndices
, seqOut
);
764 outSCode
<<= seqOut
[0];
766 if (inBool
!= outBool
|| inByte
!= outByte
|| inShort
!= outShort
|| inLong
!= outLong
767 || inFloat
!= outFloat
|| inDouble
!= outDouble
|| inString
!= outString
768 || inVariant
!= outVariant
|| inObject
!= outObject
|| inUnknown
!= outUnknown
770 || inDate
!= outDate
|| inDecimal
!= outDecimal
|| inSCode
!= outSCode
)
772 //###################################################################################
774 //###################################################################################
776 seqIndices
.realloc( 0);
778 inv
->invoke(OUString(L
"inoutBool"), Sequence
< Any
> ( & inBool
, 1), seqIndices
, seqOut
);
779 outBool
<<= seqOut
[0];
782 seqIndices
.realloc( 0);
784 inv
->invoke(OUString(L
"inoutByte"), Sequence
< Any
> ( & inByte
, 1), seqIndices
, seqOut
);
785 outByte
<<= seqOut
[0];
788 seqIndices
.realloc( 0);
790 inv
->invoke(OUString(L
"inoutShort"), Sequence
< Any
> ( & inShort
, 1), seqIndices
, seqOut
);
791 outShort
<<= seqOut
[0];
794 seqIndices
.realloc( 0);
796 inv
->invoke(OUString(L
"inoutLong"), Sequence
< Any
> ( & inLong
, 1), seqIndices
, seqOut
);
797 outLong
<<= seqOut
[0];
800 seqIndices
.realloc( 0);
802 inv
->invoke(OUString(L
"inoutString"), Sequence
< Any
> ( & inString
, 1), seqIndices
, seqOut
);
803 outString
<<= seqOut
[0];
806 seqIndices
.realloc( 0);
808 inv
->invoke(OUString(L
"inoutFloat"), Sequence
< Any
> ( & inFloat
, 1), seqIndices
, seqOut
);
809 outFloat
<<= seqOut
[0];
812 seqIndices
.realloc( 0);
814 inv
->invoke(OUString(L
"inoutDouble"), Sequence
< Any
> ( &inDouble
, 1), seqIndices
, seqOut
);
815 outDouble
<<= seqOut
[0];
818 seqIndices
.realloc( 0);
820 inv
->invoke(OUString(L
"inoutVariant"), Sequence
< Any
> ( & inVariant
, 1), seqIndices
, seqOut
);
821 outVariant
<<= seqOut
[0];
824 seqIndices
.realloc( 0);
826 inv
->invoke(OUString(L
"inoutObject"), Sequence
< Any
> ( & inObject
, 1), seqIndices
, seqOut
);
827 outObject
<<= seqOut
[0];
830 seqIndices
.realloc( 0);
832 inv
->invoke(OUString(L
"inoutCurrency"), Sequence
< Any
> ( & inCY
, 1), seqIndices
, seqOut
);
836 seqIndices
.realloc( 0);
838 inv
->invoke(OUString(L
"inoutDate"), Sequence
< Any
> ( & inDate
, 1), seqIndices
, seqOut
);
839 outDate
<<= seqOut
[0];
842 seqIndices
.realloc( 0);
844 inv
->invoke(OUString(L
"inoutDecimal"), Sequence
< Any
> (& inDecimal
, 1), seqIndices
, seqOut
);
845 outDecimal
<<= seqOut
[0];
848 seqIndices
.realloc(0);
850 inv
->invoke(OUString(L
"inoutSCode"), Sequence
< Any
> (& inSCode
, 1), seqIndices
, seqOut
);
851 outSCode
<<= seqOut
[0];
853 if (inBool
!= outBool
|| inByte
!= outByte
|| inShort
!= outShort
|| inLong
!= outLong
854 || inFloat
!= outFloat
|| inDouble
!= outDouble
|| inString
!= outString
855 || inVariant
!= outVariant
|| inObject
!= outObject
|| inCY
!= outCY
856 || inDate
!= outDate
|| inDecimal
!= outDecimal
|| inSCode
!= outSCode
)
859 //###################################################################################
860 // in byref parameters
861 //###################################################################################
863 inrefLong
<<= (sal_Int32
) 1234;
864 inv
->invoke(OUString(L
"inrefLong"), Sequence
<Any
>( & inrefLong
, 1), seqIndices
, seqOut
);
865 seqIndices
.realloc( 0);
867 inv
->invoke(OUString(L
"outLong"), Sequence
< Any
> (& outrefLong
, 1), seqIndices
, seqOut
);
868 outrefLong
<<= seqOut
[0];
870 inrefVariant
<<= OUString(L
" A string in an any");
871 inv
->invoke(OUString(L
"inrefVariant"), Sequence
< Any
> ( & inrefVariant
, 1), seqIndices
, seqOut
);
872 seqIndices
.realloc( 0);
874 inv
->invoke(OUString(L
"outVariant"), Sequence
< Any
> (&outrefVariant
, 1), seqIndices
, seqOut
);
875 outrefVariant
<<= seqOut
[0];
877 Decimal
refdec(5, 1, 0xffff, 0xff, 0x1);
878 inrefDecimal
<<= refdec
;
879 inv
->invoke(OUString(L
"inrefDecimal"), Sequence
< Any
> ( & inrefDecimal
, 1), seqIndices
, seqOut
);
880 seqIndices
.realloc( 0);
882 inv
->invoke(OUString(L
"outDecimal"), Sequence
< Any
> (&outrefDecimal
, 1), seqIndices
, seqOut
);
883 outrefDecimal
<<= seqOut
[0];
885 if (inrefLong
!= outrefLong
|| inrefVariant
!= outrefVariant
886 || inrefDecimal
!= outrefDecimal
)
890 //###################################################################################
892 //###################################################################################
894 seqIndices
.realloc( 0);
899 param
[2] = inVariant
;
900 inv
->invoke(OUString(L
"mixed1"), Sequence
< Any
>(param
, 3), seqIndices
, seqOut
);
902 if (seqOut
.getLength() != 3 || inByte
!= seqOut
[0] || inFloat
!= seqOut
[1]
903 || inVariant
!= seqOut
[2])
908 bool doSimpleSequenceTest(const Reference
<XInvocation
> & inv
)
911 Sequence
<sal_Int16
> seqIndices
;
912 Sequence
<Any
> seqOut
;
916 Any inArBool
, outArBool
;
917 Any inArByte
, outArByte
;
918 Any inArShort
, outArShort
;
919 Any inArLong
, outArLong
;
920 Any inArString
, outArString
;
921 Any inArFloat
, outArFloat
;
922 Any inArDouble
, outArDouble
;
923 Any inArObject
, outArObject
;
927 OUString arStr
[]= {L
"string0", L
"string1", L
"string2"};
928 Sequence
<OUString
> seq( arStr
, 3);
932 arAnyStrTmp
[0]<<= arStr
[0];
933 arAnyStrTmp
[1]<<= arStr
[1];
934 arAnyStrTmp
[2]<<= arStr
[2];
935 Sequence
<Any
> seq_1( arAnyStrTmp
, 3);
937 //###################################################################################
939 //###################################################################################
940 //Test sequence containing Anys of Strings
941 inv
->invoke(OUString(L
"inArray"), Sequence
< Any
> ( & inArAny
, 1), seqIndices
, seqOut
);
942 seqIndices
.realloc(0);
944 inv
->invoke(OUString(L
"outArray"), Sequence
<Any
>( & voidAny
, 1), seqIndices
, seqOut
);
945 if (inArAny
!= seqOut
[0])
948 seqIndices
.realloc(0);
950 inv
->invoke(OUString(L
"inArray"), Sequence
< Any
>( & inArString
, 1), seqIndices
, seqOut
);
951 inv
->invoke(OUString(L
"outArray"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
952 outArray
<<= seqOut
[0];
954 sal_Int8 arByte
[]={1,2,3};
955 Sequence
<sal_Int8
> seqByte(arByte
, 3);
956 inArByte
<<= seqByte
;
957 inv
->invoke(OUString(L
"inSequenceByte"),Sequence
<Any
>( & inArByte
, 1), seqIndices
, seqOut
);
958 seqIndices
.realloc(0);
960 inv
->invoke(OUString(L
"outSequenceByte"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
961 outArByte
<<= seqOut
[0];
963 sal_Int16 arShort
[]={4,5,6};
964 Sequence
<sal_Int16
> seqShort(arShort
, 3);
965 inArShort
<<= seqShort
;
966 inv
->invoke(OUString(L
"inSequenceShort"),Sequence
< Any
>( & inArShort
, 1), seqIndices
, seqOut
);
967 seqIndices
.realloc(0);
969 inv
->invoke(OUString(L
"outSequenceShort"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
970 outArShort
<<= seqOut
[0];
972 sal_Int32 arLong
[] = {7,8,9};
973 Sequence
<sal_Int32
> seqLong(arLong
, 3);
974 inArLong
<<= seqLong
;
975 inv
->invoke(OUString(L
"inSequenceLong"),Sequence
< Any
> ( & inArLong
, 1), seqIndices
, seqOut
);
976 seqIndices
.realloc(0);
978 inv
->invoke(OUString(L
"outSequenceLong"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
979 outArLong
<<= seqOut
[0];
981 inv
->invoke(OUString(L
"inSequenceLong"),Sequence
< Any
> ( & inArLong
, 1), seqIndices
, seqOut
);
982 seqIndices
.realloc(0);
984 inv
->invoke(OUString(L
"outSequenceLong"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
985 outArLong
<<= seqOut
[0];
987 inv
->invoke( OUString(L
"inSequenceString"),Sequence
< Any
> ( & inArString
, 1), seqIndices
, seqOut
);
988 seqIndices
.realloc(0);
990 inv
->invoke(OUString(L
"outSequenceString"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
991 outArString
<<= seqOut
[0];
993 float arFloat
[]={3.14f
, 31.4f
, 314.f
};
994 Sequence
<float> seqFloat( arFloat
, 3);
995 inArFloat
<<= seqFloat
;
996 inv
->invoke( OUString(L
"inSequenceFloat"),Sequence
< Any
> ( & inArFloat
, 1), seqIndices
, seqOut
);
997 seqIndices
.realloc(0);
999 inv
->invoke(OUString(L
"outSequenceFloat"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
1000 outArFloat
<<= seqOut
[0];
1002 double arDouble
[]={3.145, 31.45, 3145.};
1003 Sequence
<double> seqDouble( arDouble
, 3);
1004 inArDouble
<<= seqDouble
;
1005 inv
->invoke(OUString(L
"inSequenceDouble"),Sequence
< Any
>( & inArDouble
, 1), seqIndices
, seqOut
);
1006 seqIndices
.realloc(0);
1008 inv
->invoke(OUString(L
"outSequenceDouble"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
1009 outArDouble
<<= seqOut
[0];
1011 Sequence
<Reference
<XInvocation
> > seqObj(2);
1012 seqObj
[0]= getComObject(L
"AxTestComponents.Basic");
1013 seqObj
[1]= getComObject(L
"AxTestComponents.Basic");
1014 inArObject
<<= seqObj
;
1015 inv
->invoke(OUString(L
"inSequenceObject"),Sequence
< Any
>( & inArObject
, 1), seqIndices
, seqOut
);
1016 seqIndices
.realloc(0);
1018 inv
->invoke(OUString(L
"outSequenceObject"), Sequence
< Any
>( & voidAny
, 1), seqIndices
, seqOut
);
1019 outArObject
<<= seqOut
[0];
1021 if ( ! equalSequences(inArByte
, outArByte
) || ! equalSequences(inArShort
, outArShort
)
1022 || ! equalSequences(inArLong
, outArLong
) || ! equalSequences(inArString
, outArray
)
1023 || ! equalSequences(inArFloat
, outArFloat
) || ! equalSequences(inArDouble
, outArDouble
)
1024 || ! equalSequences(inArString
, outArString
) || ! equalSequences(inArObject
, outArObject
))
1027 //###################################################################################
1029 //###################################################################################
1030 seqIndices
.realloc(0);
1032 inv
->invoke(OUString(L
"inoutArray"), Sequence
< Any
>( & inArString
, 1), seqIndices
, seqOut
);
1033 inv
->invoke(OUString(L
"inoutArray"), Sequence
< Any
>( & inArString
, 1), seqIndices
, seqOut
);
1034 outArray
<<= seqOut
[0];
1036 inv
->invoke(OUString(L
"inoutSequenceByte"), Sequence
<Any
>( & inArByte
, 1), seqIndices
, seqOut
);
1037 inv
->invoke(OUString(L
"inoutSequenceByte"), Sequence
<Any
>( & inArByte
, 1), seqIndices
, seqOut
);
1038 outArByte
<<= seqOut
[0];
1040 inv
->invoke(OUString(L
"inoutSequenceShort"), Sequence
<Any
>( & inArShort
, 1), seqIndices
, seqOut
);
1041 inv
->invoke(OUString(L
"inoutSequenceShort"), Sequence
<Any
>( & inArShort
, 1), seqIndices
, seqOut
);
1042 outArShort
<<= seqOut
[0];
1044 inv
->invoke(OUString(L
"inoutSequenceLong"), Sequence
<Any
>( & inArLong
, 1), seqIndices
, seqOut
);
1045 inv
->invoke(OUString(L
"inoutSequenceLong"), Sequence
< Any
>( & inArLong
, 1), seqIndices
, seqOut
);
1046 outArLong
<<= seqOut
[0];
1048 inv
->invoke(OUString(L
"inoutSequenceString"), Sequence
<Any
>( & inArString
, 1), seqIndices
, seqOut
);
1049 inv
->invoke(OUString(L
"inoutSequenceString"), Sequence
<Any
>( & inArString
, 1), seqIndices
, seqOut
);
1050 outArString
<<= seqOut
[0];
1052 inv
->invoke(OUString(L
"inoutSequenceFloat"), Sequence
<Any
>( & inArFloat
, 1), seqIndices
, seqOut
);
1053 inv
->invoke(OUString(L
"inoutSequenceFloat"), Sequence
<Any
>( & inArFloat
, 1), seqIndices
, seqOut
);
1054 outArFloat
<<= seqOut
[0];
1056 inv
->invoke(OUString(L
"inoutSequenceDouble"), Sequence
<Any
>( & inArDouble
, 1), seqIndices
, seqOut
);
1057 inv
->invoke(OUString(L
"inoutSequenceDouble"), Sequence
<Any
>( & inArDouble
, 1), seqIndices
, seqOut
);
1058 outArDouble
<<= seqOut
[0];
1060 inv
->invoke(OUString(L
"inoutSequenceObject"), Sequence
<Any
>( & inArObject
, 1), seqIndices
, seqOut
);
1061 inv
->invoke(OUString(L
"inoutSequenceObject"), Sequence
<Any
>( & inArObject
, 1), seqIndices
, seqOut
);
1062 outArObject
<<= seqOut
[0];
1064 if ( ! equalSequences(inArByte
, outArByte
) || ! equalSequences(inArShort
, outArShort
)
1065 || ! equalSequences(inArLong
, outArLong
) || ! equalSequences(inArString
, outArray
)
1066 || ! equalSequences(inArFloat
, outArFloat
) || ! equalSequences(inArDouble
, outArDouble
)
1067 || ! equalSequences(inArString
, outArString
) || ! equalSequences(inArObject
, outArObject
))
1077 Reference
<XInvocation
> inv
= getComObject( L
"AxTestComponents.Basic");
1079 HostWin
* pWin
= new HostWin( L
"MFCCONTROL.MfcControlCtrl.1");
1080 CComPtr
<IUnknown
> spUnk
= pWin
->GetHostedControl();
1081 Reference
<XInvocation
> invMfc
= convertComObject( spUnk
.p
);
1083 Sequence
< sal_Int16
> seqIndices
;
1084 Sequence
<Any
> seqOut
;
1091 if (! doSimpleTest(inv
))
1093 fprintf(stdout
, "### Test failed!\n");
1097 if (! doPropertyTest(inv
))
1099 fprintf(stdout
, "### Test failed!\n");
1103 if ( ! doSimpleSequenceTest(inv
))
1105 fprintf(stdout
, "### Test failed! \n");
1109 if ( ! doParameterTest(inv
))
1111 fprintf(stdout
, "### Test failed! \n");
1115 if ( ! doPropertyWithArgumentTest(inv
))
1117 fprintf(stdout
, "### Test failed! \n");
1126 // //###################################################################################
1127 // // in multi Sequences
1128 // //###################################################################################
1129 // // inMulDimArrayLong
1130 sal_Int32 arLongi
[]={1,2,3};
1131 sal_Int32 arLongi2
[]={4,5,6,7};
1132 sal_Int32 arLongi3
[]={8,9,10,11,12};
1134 Sequence
<sal_Int32
> seqLongi1( arLongi
, 3);
1135 Sequence
<sal_Int32
> seqLongi2( arLongi2
, 4);
1136 Sequence
<sal_Int32
> seqLongi3( arLongi3
, 5);
1138 Sequence
< Sequence
< sal_Int32
> > seq2i(3);
1139 seq2i
[0]= seqLongi1
;
1140 seq2i
[1]= seqLongi2
;
1141 seq2i
[2]= seqLongi3
;
1143 // dimension length 3,5
1144 inv
->invoke( OUString(L
"inMulDimArrayLong"),Sequence
< Any
> ( &seqAny
, 1), seqIndices
, seqOut
);
1146 //inMulDimArrayVariant
1147 inv
->invoke( OUString(L
"inMulDimArrayVariant"),Sequence
< Any
> ( &seqAny
, 1), seqIndices
, seqOut
);
1149 //inMulDimArrayLong2
1150 sal_Int32 arLongii1
[]={1,2,3};
1151 sal_Int32 arLongii2
[]={4,5,6,7};
1152 sal_Int32 arLongii3
[]={8,9,10,11,12};
1153 sal_Int32 arLongii4
[]={13,14,15,16};
1154 sal_Int32 arLongii5
[]={17,18,19};
1156 Sequence
<sal_Int32
> seqLongii1( arLongii1
, 3);
1157 Sequence
<sal_Int32
> seqLongii2( arLongii2
, 4);
1158 Sequence
<sal_Int32
> seqLongii3( arLongii3
, 5);
1159 Sequence
<sal_Int32
> seqLongii4( arLongii4
, 4);
1160 Sequence
<sal_Int32
> seqLongii5( arLongii5
, 3);
1162 Sequence
< Sequence
< sal_Int32
> > seq2ii(3);
1163 Sequence
< Sequence
< sal_Int32
> > seq2ii2(2);
1164 seq2ii
[0]= seqLongii1
;
1165 seq2ii
[1]= seqLongii2
;
1166 seq2ii
[2]= seqLongii3
;
1168 seq2ii2
[0]= seqLongii4
;
1169 seq2ii2
[1]= seqLongii5
;
1171 Sequence
< Sequence
< Sequence
< sal_Int32
> > > seq3ii(2);
1175 inv
->invoke( OUString(L
"inMulDimArrayLong2"),Sequence
< Any
> ( &seqAny
, 1), seqIndices
, seqOut
);
1177 // inMulDimArrayByte2
1178 sal_Int8 arByteii1
[]={1,2,3};
1179 sal_Int8 arByteii2
[]={4,5,6,7};
1180 sal_Int8 arByteii3
[]={8,9,10,11,12};
1181 sal_Int8 arByteii4
[]={13,14,15,16};
1182 sal_Int8 arByteii5
[]={17,18,19};
1184 Sequence
<sal_Int8
> seqByteii1( arByteii1
, 3);
1185 Sequence
<sal_Int8
> seqByteii2( arByteii2
, 4);
1186 Sequence
<sal_Int8
> seqByteii3( arByteii3
, 5);
1187 Sequence
<sal_Int8
> seqByteii4( arByteii4
, 4);
1188 Sequence
<sal_Int8
> seqByteii5( arByteii5
, 3);
1190 Sequence
< Sequence
< sal_Int8
> > seq2Byteii(3);
1191 Sequence
< Sequence
< sal_Int8
> > seq2Byteii2(2);
1192 seq2Byteii
[0]= seqByteii1
;
1193 seq2Byteii
[1]= seqByteii2
;
1194 seq2Byteii
[2]= seqByteii3
;
1196 seq2Byteii2
[0]= seqByteii4
;
1197 seq2Byteii2
[1]= seqByteii5
;
1199 Sequence
< Sequence
< Sequence
< sal_Int8
> > > seq3Byteii(2);
1200 seq3Byteii
[0]=seq2Byteii
;
1201 seq3Byteii
[1]=seq2Byteii2
;
1202 seqAny
<<= seq3Byteii
;
1203 inv
->invoke( OUString(L
"inMulDimArrayByte2"),Sequence
< Any
> ( &seqAny
, 1), seqIndices
, seqOut
);
1207 //###################################################################################
1208 //###################################################################################
1209 //###################################################################################
1210 // Tests with a MFC ActiveX control, ( pure dispinterface)
1211 //###################################################################################
1213 //###################################################################################
1214 // in parameter MFC ActiveX
1215 //###################################################################################
1216 // unsigned char is not supported by MFC
1217 // aAny <<= ( sal_Int8) 127;
1218 // invMfc->invoke( OUString(L"inByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1221 aAny
<<= static_cast<sal_Int16
>(-1);
1222 aAny
= invMfc
->invoke( OUString(L
"inShort"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1225 aAny
<<= ( sal_Int32
) 1234567;
1226 aAny
=invMfc
->invoke( OUString(L
"inLong"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1227 sal_Int32 retLong
= *(sal_Int32
*)aAny
.getValue();
1229 OUString
str_1(L
" this is clientTest.exe");
1231 aAny
=invMfc
->invoke( OUString(L
"inString"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1234 aAny
<<= ( float) 3.14;
1235 aAny
=invMfc
->invoke( OUString(L
"inFloat"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1237 aAny
<<= ( double) 3.145;
1238 aAny
=invMfc
->invoke( OUString(L
"inDouble"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1240 aAny
<<= OUString( L
" A string in an any");
1241 aAny
=invMfc
->invoke( OUString(L
"inVariant"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1243 // Tests with Sequences later.
1244 // OUString arStr4[]= {L"string0", L"string1", L"string2"};
1245 // Sequence<OUString> seqStr4( arStr4, 3);
1246 // aAny <<= seqStr4;
1247 // invMfc->invoke( OUString(L"inArray"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
1250 Reference
< XInvocation
> inv5
= getComObject(L
"AxTestComponents.Basic");
1252 anyVal4
<<= OUString(L
"this is the value of prpString");
1253 inv5
->setValue( OUString(L
"prpString"), anyVal4
);
1255 aAny
=invMfc
->invoke( OUString(L
"inObject"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1257 // //###################################################################################
1258 // // out parameter MFC ActiveX
1259 // //###################################################################################
1262 aAny
= invMfc
->invoke( OUString(L
"outShort"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1263 anyOut
<<= seqOut
[0];
1264 sprintf(buff
, "MFC outShort %d", *(sal_Int16
*)anyOut
.getValue());
1265 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1268 aAny
= invMfc
->invoke( OUString(L
"outLong"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1269 anyOut
<<= seqOut
[0];
1270 sprintf(buff
, "MFC outLong %d", *(sal_Int32
*)anyOut
.getValue());
1271 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1274 aAny
= invMfc
->invoke( OUString(L
"outString"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1275 anyOut
<<= seqOut
[0];
1276 sprintf(buff
, "MFC outString %S", ((OUString
*)anyOut
.getValue())->getStr());
1277 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1280 aAny
= invMfc
->invoke( OUString(L
"outFloat"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1281 anyOut
<<= seqOut
[0];
1282 sprintf(buff
, "MFC outFloat %f", *(float*)anyOut
.getValue());
1283 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1286 aAny
= invMfc
->invoke( OUString(L
"outDouble"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1287 anyOut
<<= seqOut
[0];
1288 sprintf(buff
, "MFC outFloat %f", *(double*)anyOut
.getValue());
1289 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1292 // we expect a string!! ( VT_BSTR)
1293 aAny
= invMfc
->invoke( OUString(L
"outVariant"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1294 anyOut
<<= seqOut
[0];
1295 sprintf(buff
, "MFC outVariant %S", ((OUString
*)anyOut
.getValue())->getStr());
1296 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1299 aAny
= invMfc
->invoke( OUString(L
"outObject"), Sequence
< Any
> ( &aAny
, 1), seqIndices
, seqOut
);
1300 Reference
<XInvocation
> invOut5
;
1301 seqOut
[0]>>= invOut5
;
1302 // we assume that an object of AxTestControls.Basic is being returned.
1303 anyOut
= invOut5
->getValue( OUString(L
"prpString"));
1306 sprintf(buff
, "MFC outObject, property: %S", tmpStr
.getStr());
1307 MessageBox( NULL
, buff
, _T("clientTest"), MB_OK
);
1310 //###################################################################################
1311 // Sequence parameter MFC ActiveX
1312 //###################################################################################
1313 // Sequences are not directly supported.
1323 //VARIANT_TRUE VT_UI1