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