summaryrefslogtreecommitdiffstats
path: root/extensions/test/ole/OleClient
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /extensions/test/ole/OleClient
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'extensions/test/ole/OleClient')
-rw-r--r--extensions/test/ole/OleClient/OleClient.ini5
-rw-r--r--extensions/test/ole/OleClient/axhost.cxx44
-rw-r--r--extensions/test/ole/OleClient/axhost.hxx53
-rw-r--r--extensions/test/ole/OleClient/clientTest.cxx1291
-rw-r--r--extensions/test/ole/OleClient/funcs.cxx345
-rw-r--r--extensions/test/ole/OleClient/readme.txt10
6 files changed, 1748 insertions, 0 deletions
diff --git a/extensions/test/ole/OleClient/OleClient.ini b/extensions/test/ole/OleClient/OleClient.ini
new file mode 100644
index 000000000..fa1ac118f
--- /dev/null
+++ b/extensions/test/ole/OleClient/OleClient.ini
@@ -0,0 +1,5 @@
+[Bootstrap]
+UNO_TYPES=types.rdb
+UNO_SERVICES=services.rdb
+
+
diff --git a/extensions/test/ole/OleClient/axhost.cxx b/extensions/test/ole/OleClient/axhost.cxx
new file mode 100644
index 000000000..a163a6a7d
--- /dev/null
+++ b/extensions/test/ole/OleClient/axhost.cxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "axhost.hxx"
+
+HostWin::HostWin(LPWSTR progid)
+{
+ controlName= progid;
+ RECT rcPos={0,0,200,200};
+ Create(0, rcPos, _T("HostWin"));
+}
+HostWin::~HostWin()
+{
+ DestroyWindow();
+}
+
+
+LRESULT HostWin::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
+{
+ CAxWindow wnd(m_hWnd);
+
+ HRESULT hr= wnd.CreateControlEx( controlName, NULL, NULL,&spControl.p);
+
+ return 0;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/test/ole/OleClient/axhost.hxx b/extensions/test/ole/OleClient/axhost.hxx
new file mode 100644
index 000000000..759b6eff4
--- /dev/null
+++ b/extensions/test/ole/OleClient/axhost.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EXTENSIONS_TEST_OLE_OLECLIENT_AXHOST_HXX
+#define INCLUDED_EXTENSIONS_TEST_OLE_OLECLIENT_AXHOST_HXX
+
+#include <atlbase.h>
+extern CComModule _Module;
+#include <atlcom.h>
+#include <atlhost.h>
+
+
+class HostWin: public CWindowImpl<HostWin, CWindow,
+ CWinTraits< WS_CAPTION|WS_POPUPWINDOW|WS_VISIBLE, 0> >
+{
+ CComBSTR controlName;
+ CComPtr<IUnknown> spControl;
+public:
+ explicit HostWin(LPWSTR progid);
+
+ ~HostWin();
+
+
+ BEGIN_MSG_MAP(HostWin)
+ MESSAGE_HANDLER( WM_CREATE, OnCreate)
+ END_MSG_MAP()
+
+ IUnknown* GetHostedControl(){
+ return spControl;
+ }
+
+ LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+};
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/test/ole/OleClient/clientTest.cxx b/extensions/test/ole/OleClient/clientTest.cxx
new file mode 100644
index 000000000..00a78034d
--- /dev/null
+++ b/extensions/test/ole/OleClient/clientTest.cxx
@@ -0,0 +1,1291 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#include <atlbase.h>
+
+CComModule _Module;
+#include <atlcom.h>
+#include <comdef.h>
+
+#include "axhost.hxx"
+
+#include <stdio.h>
+#include "typelib/typedescription.hxx"
+#include <com/sun/star/bridge/oleautomation/Date.hpp>
+#include <com/sun/star/bridge/oleautomation/Currency.hpp>
+#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
+#include <com/sun/star/bridge/oleautomation/SCode.hpp>
+#include <com/sun/star/bridge/oleautomation/NamedArgument.hpp>
+#include <com/sun/star/bridge/oleautomation/PropertyPutArgument.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/servicefactory.hxx>
+#include <rtl/string.h>
+
+BEGIN_OBJECT_MAP(ObjectMap)
+END_OBJECT_MAP()
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::script;
+using namespace com::sun::star::bridge::oleautomation;
+using namespace cppu;
+
+
+Reference<XInvocation> convertComObject( IUnknown* pUnk);
+Reference<XInvocation> getComObject( OUString progId);
+bool checkOutArgs(const Sequence<Any> & outArgs,
+ const Sequence<sal_Int16> & indices, const Sequence<Any> & values);
+
+bool doSimpleTest(const Reference<XInvocation> & inv);
+bool doSimpleSequenceTest(const Reference<XInvocation> & inv);
+bool doParameterTest(const Reference<XInvocation> & inv);
+bool doPropertyWithArgumentTest(const Reference<XInvocation> & inv);
+bool equalSequences(const Any& orig, const Any& returned);
+HRESULT doTest();
+HRESULT doTest2( Reference<XInvocation> &);
+Reference<XInvocation> getComObject(OUString& );
+
+HRESULT InitializeParameter();
+void printResultVariantArray( VARIANT & var);
+void printVariant( VARIANT & var);
+void printSequence( Sequence<Any>& val);
+
+extern "C" int SAL_CALL main( int , char **)
+{
+ HRESULT hr;
+ if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
+ {
+ _tprintf(_T("CoInitializeEx failed \n"));
+ return -1;
+ }
+
+
+ _Module.Init( ObjectMap, GetModuleHandle( NULL));
+
+ if( FAILED(hr=doTest()))
+ {
+ _com_error err( hr);
+ const TCHAR * errMsg= err.ErrorMessage();
+ MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
+ }
+ else
+ {
+ MessageBox( NULL,NULL , "Test succeeded", MB_ICONINFORMATION);
+ }
+
+
+ _Module.Term();
+ CoUninitialize();
+ return 0;
+}
+//Also supports named args
+
+bool doParameterTest(const Reference<XInvocation> & inv)
+{
+ Sequence< sal_Int16> seqIndices;
+ Sequence<Any> seqOut;
+
+ Any arArgs[2];
+ Any arArgs1[4];
+
+ NamedArgument arg1(OUString(L"val1"), makeAny((sal_Int32) 123));
+ NamedArgument arg2(OUString(L"val2"), makeAny((sal_Int32) 456));
+ NamedArgument arg3(OUString(L"val3"), makeAny((sal_Int32) 0xff));
+ NamedArgument arg4(OUString(L"val4"), makeAny((sal_Int32) 0xffff));
+
+ NamedArgument argOut1(OUString(L"val1"), Any());
+ NamedArgument argOut2(OUString(L"val2"), Any());
+ Sequence<Any> seqNoArgs;
+ arArgs[0] <<= (sal_Int32) 0;
+ arArgs[1] <<= (sal_Int32) 0;
+ Sequence<Any> seqPositional0(arArgs, 2);
+
+
+ arArgs[0] <<= arg1;
+ arArgs[1] <<= arg2;
+ Sequence<Any> seqNamed(arArgs, 2);
+ arArgs[0] <<= arg2;
+ arArgs[1] <<= arg1;
+ Sequence<Any> seqNamed2(arArgs, 2);
+ arArgs[0] <<= argOut1;
+ arArgs[1] <<= argOut2;
+ Sequence<Any> seqNamed3(arArgs, 2);
+ arArgs[0] <<= argOut2;
+ arArgs[1] <<= argOut1;
+ Sequence<Any> seqNamed4(arArgs, 2);
+
+ arArgs[0] <<= arg1;
+ Sequence<Any> seqNamed5(arArgs, 1);
+ arArgs[0] <<= arg2;
+ Sequence<Any> seqNamed6(arArgs, 1);
+
+ arArgs[0] <<= (sal_Int32) 123;
+ arArgs[1] <<= (sal_Int32) 456;
+ Sequence<Any> seqPositional(arArgs, 2);
+ arArgs[0] <<= (sal_Int32) 123;
+ Sequence<Any> seqPositional2(arArgs, 1);
+
+ arArgs[0].clear();
+ arArgs[1].clear();
+ Sequence<Any> seqPositional3(arArgs, 2);
+
+ arArgs[0] <<= (sal_Int32) 123;
+ arArgs[1] <<= SCode(DISP_E_PARAMNOTFOUND);
+ Sequence<Any> seqOutOpt1(arArgs, 2);
+
+ arArgs[0] <<= SCode(DISP_E_PARAMNOTFOUND);
+ arArgs[1] <<= SCode(DISP_E_PARAMNOTFOUND);
+ Sequence<Any> seqOutOpt2(arArgs, 2);
+
+ arArgs[0] <<= SCode(DISP_E_PARAMNOTFOUND);
+ arArgs[1] <<= (sal_Int32) 456;
+ Sequence<Any> seqOutOpt3(arArgs, 2);
+
+ arArgs1[0] <<= (sal_Int32) 0;
+ arArgs1[1] <<= (sal_Int32) 0;
+ arArgs1[2] <<= (sal_Int32) 0;
+ arArgs1[3] <<= (sal_Int32) 0;
+ Sequence<Any> seqMix0(arArgs1, 4);
+
+ arArgs1[0] <<= (sal_Int32) 123;
+ arArgs1[1] <<= (sal_Int32) 456;
+ arArgs1[2] <<= arg3;
+ arArgs1[3] <<= arg4;
+ Sequence<Any> seqMix(arArgs1, 4);
+
+ arArgs1[0].clear();
+ arArgs1[1] <<= (sal_Int32) 456;
+ arArgs1[2] <<= arg4;
+ Sequence<Any> seqMix2(arArgs1, 3);
+
+ arArgs1[0] <<= SCode(DISP_E_PARAMNOTFOUND);
+ arArgs1[1] <<= (sal_Int32) 456;
+ arArgs1[2] <<= SCode(DISP_E_PARAMNOTFOUND);
+ arArgs1[3] <<= arg4.Value;
+ Sequence<Any> seqMixOut(arArgs1, 4);
+
+ arArgs1[0] <<= SCode(DISP_E_PARAMNOTFOUND);
+ arArgs1[1].clear();
+ arArgs1[2] <<= arg4;
+ Sequence<Any> seqMix2Out(arArgs1, 3);
+
+
+ //in args + out, optional, positional-----------------------------------------
+ //first general test
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqPositional, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqPositional))
+ return false;
+
+ //2 optional args, 1 provided
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqPositional2, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt1))
+ return false;
+
+ //2 optional args, 0 provided
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqNoArgs, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional5"), seqPositional3, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt2))
+ return false;
+
+ //named args --------------------------------------------
+
+ // 2 named args, correct position
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqNamed, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional5"), seqPositional0, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqPositional))
+ return false;
+
+ // 2named args, position differs
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqNamed2, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqPositional))
+ return false;
+
+ //named out args, 2 named args with correct position
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqNamed, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqIndices.realloc(0);
+ inv->invoke(OUString(L"optional5"), seqNamed3, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqNamed ))
+ return false;
+
+ //named out args, 2 named args with different position
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqNamed, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqIndices.realloc(0);
+ inv->invoke(OUString(L"optional5"), seqNamed4, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqNamed2 ))
+ return false;
+
+
+ //2 args, 1 provided (correct order)
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqNamed5, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt1))
+ return false;
+ //2 args, 1 provided (incorrect order)
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional3"), seqNamed6, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt3))
+ return false;
+
+ //2position + 2 2named args, correct order
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional6"), seqMix0, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional6"), seqMix, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional7"), seqMix, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqMix))
+ return false;
+
+ // 4 in args, 1 positional, 1 named, 1 positional omitted
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional6"), seqMix0, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional6"), seqMix2, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional7"), seqMix0, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqMixOut))
+ return false;
+
+ // 4 out args, 1 positional, 1 named, 1 positional omitted
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional6"), seqMix2, seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"optional7"), seqMix2Out, seqIndices, seqOut);
+ if ( ! checkOutArgs(seqOut, seqIndices, seqMix2Out))
+ return false;
+
+
+ return true;
+}
+bool doPropertyTest(const Reference<XInvocation> & inv)
+{
+ Sequence< sal_Int16> seqIndices;
+ Sequence<Any> seqOut;
+
+ Any inBool, outBool;
+ Any inByte, outByte;
+ Any inShort, outShort;
+ Any inLong, outLong;
+ Any inString, outString;
+ Any inFloat, outFloat;
+ Any inDouble, outDouble;
+ Any inVariant, outVariant;
+ Any inObject, outObject;
+ Any inUnknown, outUnknown;
+ Any inCY, outCY;
+ Any inDate, outDate;
+ Any inDecimal, outDecimal;
+ Any inSCode, outSCode;
+ Any inrefLong, outrefLong;
+ Any inrefVariant, outrefVariant;
+ Any inrefDecimal, outrefDecimal;
+ Any inParamsLong, outParamsLong;
+ Reference<XInterface> xintUnknown(getComObject(L"AxTestComponents.Foo"));
+
+ inBool <<= (sal_Bool) sal_True;
+ inv->setValue(OUString(L"prpBool"), inBool);
+ outBool = inv->getValue(OUString(L"prpBool"));
+
+ inByte <<= (sal_Int8) 100;
+ inv->setValue(OUString(L"prpByte"), inByte);
+ outByte = inv->getValue(OUString(L"prpByte"));
+
+ inShort <<= static_cast<sal_Int16>( -1);
+ inv->setValue(OUString(L"prpShort"), inShort);
+ outShort = inv->getValue(OUString(L"prpShort"));
+
+ inLong <<= ( sal_Int32) 1234567;
+ inv->setValue(OUString(L"prpLong"), inLong // TODO: Add your implementation code here
+);
+ outLong = inv->getValue(OUString(L"prpLong"));
+
+ inString <<= OUString(L" this is clientTest.exe");
+ inv->setValue(OUString(L"prpString"), inString);
+ outString = inv->getValue(OUString(L"prpString"));
+
+ inFloat <<= 3.14f;
+ inv->setValue(OUString(L"prpFloat"), inFloat);
+ outFloat = inv->getValue(OUString(L"prpFloat"));
+
+ inDouble <<= ( double) 3.145;
+ inv->setValue(OUString(L"prpDouble"), inDouble);
+ outDouble = inv->getValue(OUString(L"prpDouble"));
+
+ inVariant <<= OUString(L"A string in an any");
+ inv->setValue(OUString(L"prpVariant"), inVariant);
+ outVariant = inv->getValue(OUString(L"prpVariant"));
+
+ inObject <<= inv;
+ inv->setValue(OUString(L"prpObject"), inObject);
+ outObject = inv->getValue(OUString(L"prpObject"));
+
+ inUnknown <<= xintUnknown;
+ inv->setValue(OUString(L"prpUnknown"), inUnknown);
+ outUnknown = inv->getValue(OUString(L"prpUnknown"));
+
+ Currency cur(99999);
+ inCY <<= cur;
+ inv->setValue(OUString(L"prpCurrency"), inCY);
+ outCY = inv->getValue(OUString(L"prpCurrency"));
+
+ Date d(37889.0);
+ inDate <<= d;
+ inv->setValue(OUString(L"prpDate"), inDate);
+ outDate = inv->getValue(OUString(L"prpDate"));
+
+ Decimal dec(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff);
+ inDecimal <<= dec;
+ inv->setValue(OUString(L"prpDecimal"), inDecimal);
+ outDecimal = inv->getValue(OUString(L"prpDecimal"));
+
+ SCode code(DISP_E_BADVARTYPE);
+ inSCode <<= code;
+ inv->setValue(OUString(L"prpSCode"), inSCode);
+ outSCode = inv->getValue(OUString(L"prpSCode"));
+
+ inrefLong <<= (sal_Int32) 123456;
+ inv->setValue(OUString(L"prprefLong"), inrefLong);
+ outrefLong = inv->getValue(OUString(L"prprefLong"));
+
+ inrefVariant <<= OUString(L"A string in an any");
+ inv->setValue(OUString(L"prprefVariant"), inrefVariant);
+ outrefVariant = inv->getValue(OUString(L"prprefVariant"));
+
+ Decimal decref(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff);
+ inrefDecimal <<= decref;
+ inv->setValue(OUString(L"prprefDecimal"), inrefDecimal);
+ outrefDecimal = inv->getValue(OUString(L"prprefDecimal"));
+
+ if (inBool != outBool || inByte != outByte || inShort != outShort || inLong != outLong
+ || inFloat != outFloat || inDouble != outDouble || inString != outString
+ || inVariant != outVariant || inObject != outObject
+ || inUnknown != outUnknown || inCY != outCY
+ || inDate != outDate || inDecimal != outDecimal || inSCode != outSCode
+ || inrefLong != outrefLong ||inrefVariant != outrefVariant
+ || inrefDecimal != outrefDecimal)
+ return false;
+ return true;
+}
+
+bool doPropertyWithArgumentTest(const Reference<XInvocation> & inv)
+{
+ Sequence< sal_Int16> seqIndices;
+ Sequence<Any> seqOut;
+
+ Any arMultiArgs[3];
+ arMultiArgs[0] = makeAny((sal_Int32) 0);
+ arMultiArgs[1] = makeAny((sal_Int32) 0);
+ arMultiArgs[2] <<= PropertyPutArgument(makeAny((sal_Int32) 0));
+ Sequence<Any> seqMultiArgPut0(arMultiArgs, 3);
+
+ arMultiArgs[0] = makeAny((sal_Int32) 1);
+ arMultiArgs[1] = makeAny((sal_Int32) 2);
+ arMultiArgs[2] <<= PropertyPutArgument(makeAny((sal_Int32) 3));
+ Sequence<Any> seqMultiArgPut1(arMultiArgs, 3);
+
+ arMultiArgs[0] = makeAny((sal_Int32) 1);
+ arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 3));
+ Sequence<Any> seqMultiArgPut2(arMultiArgs, 2);
+
+ arMultiArgs[0] <<= NamedArgument(OUString(L"val2"), makeAny((sal_Int32) 1));
+ arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 3));
+ Sequence<Any> seqMultiArgPut3(arMultiArgs, 2);
+
+ arMultiArgs[0] <<= NamedArgument(OUString(L"val2"), makeAny((sal_Int32) 1));
+ arMultiArgs[1] <<= NamedArgument(OUString(L"val3"), makeAny((sal_Int32) 3));
+ Sequence<Any> seqMultiArgPut4(arMultiArgs, 2);
+
+ arMultiArgs[0] = makeAny((sal_Int32) 0);
+ arMultiArgs[1] = makeAny((sal_Int32) 0);
+ Sequence<Any> seqMultiArgGet0(arMultiArgs, 2);
+
+ arMultiArgs[0] = makeAny((sal_Int32) 1);
+ arMultiArgs[1] = makeAny((sal_Int32) 2);
+ Sequence<Any> seqMultiArgGet1(arMultiArgs, 2);
+ Sequence<Any> seqMultiArgGet2(arMultiArgs, 1);
+
+
+ arMultiArgs[0] = makeAny((sal_Int32) 0);
+ arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 0));
+ Sequence<Any> seqMultiArgPut5(arMultiArgs, 2);
+
+ arMultiArgs[0] = makeAny((sal_Int32) 1);
+ arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 2));
+ Sequence<Any> seqMultiArgPut6(arMultiArgs, 2);
+
+ arMultiArgs[0].clear();
+ arMultiArgs[1].clear();
+ Sequence<Any> seqMultiVoid(arMultiArgs, 2);
+
+ arMultiArgs[0] = makeAny((sal_Int32) 0);
+ arMultiArgs[1] = makeAny((sal_Int32) 0);
+ Sequence<Any> seqMultiVoid2(arMultiArgs, 2);
+
+ //[propput, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [in] VARIANT* newVal);
+ //[propget, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [out, optional, retval] VARIANT* pVal);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut0, seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut1, seqIndices, seqOut);
+ //check in/out args
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ Any anyRet = inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgGet0,
+ seqIndices, seqOut);
+
+ if (anyRet != ((PropertyPutArgument const *)seqMultiArgPut1[2].getValue())->Value
+ || ! checkOutArgs(seqOut, seqIndices, Sequence<Any>(seqMultiArgPut1.getArray(), 2)))
+ {
+ return false;
+ }
+ // test optional (one arg omitted
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut0, seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut2, seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ anyRet = inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgGet0,
+ seqIndices, seqOut);
+
+ arMultiArgs[0] = makeAny((sal_Int32) 1);
+ arMultiArgs[1] = makeAny((SCode(DISP_E_PARAMNOTFOUND)));
+
+ if (anyRet != ((PropertyPutArgument const *) seqMultiArgPut2[1].getValue())->Value
+ || ! checkOutArgs(seqOut, seqIndices, Sequence<Any>(arMultiArgs, 2)))
+ {
+ return false;
+ }
+
+ //test one named arg and one omitted
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut0, seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut3, seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ anyRet = inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgGet0,
+ seqIndices, seqOut);
+
+ arMultiArgs[0] = makeAny((SCode(DISP_E_PARAMNOTFOUND)));
+ arMultiArgs[1] = ((NamedArgument const*) seqMultiArgPut3[0].getValue())->Value;
+ if (anyRet != ((PropertyPutArgument const*) seqMultiArgPut3[1].getValue())->Value
+ || ! checkOutArgs(seqOut, seqIndices, Sequence<Any>(arMultiArgs, 2)))
+ {
+ return false;
+ }
+
+// [propget,...] HRESULT prpMultiArg2([in] VARIANT val1, [out, retval] VARIANT* pVal);
+// [propput,...] HRESULT prpMultiArg2([in] VARIANT val1, [in] VARIANT newVal);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg2"), seqMultiArgPut5, seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg2GetValues"), seqMultiVoid, seqIndices, seqOut);
+
+ if ( ! checkOutArgs(seqOut, seqIndices, seqMultiVoid2))
+ return false;
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ anyRet = inv->invoke(OUString(L"prpMultiArg2"), seqMultiArgPut6,
+ seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ anyRet = inv->invoke(OUString(L"prpMultiArg2GetValues"), seqMultiVoid,
+ seqIndices, seqOut);
+
+// [propget,...] HRESULT prpMultiArg3([in,out] LONG* val1, [out, retval] LONG* pVal);
+// [propput,...] HRESULT prpMultiArg3([in,out] LONG* val1, [in] LONG newVal);
+
+ if ( ! checkOutArgs(seqOut, seqIndices, seqMultiArgGet1 ))
+ return false;
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg3"), seqMultiArgPut5, seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"prpMultiArg3"), seqMultiArgPut6, seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ anyRet = inv->invoke(OUString(L"prpMultiArg3"), seqMultiArgGet2, seqIndices, seqOut);
+
+ if ( anyRet != ((PropertyPutArgument const*) seqMultiArgPut6[1].getValue())->Value
+ || !checkOutArgs(seqOut, seqIndices, seqMultiArgGet2))
+ return false;
+
+
+ //hasProperty, hasMethod
+ if (inv->hasProperty("prpMultiArg1"))
+ return false;
+ if ( ! inv->hasMethod("prpMultiArg1"))
+ return false;
+ if ( ! inv->hasProperty("prprefLong"))
+ return false;
+ if (inv->hasMethod("prprefLong"))
+ return false;
+ if ( ! inv->hasMethod("inLong"))
+ return false;
+
+ return true;
+}
+bool doSimpleTest(const Reference<XInvocation> & inv)
+{
+ Sequence< sal_Int16> seqIndices;
+ Sequence<Any> seqOut;
+
+ Any inBool, outBool;
+ Any inByte, outByte;
+ Any inShort, outShort;
+ Any inLong, outLong;
+ Any inString, outString;
+ Any inFloat, outFloat;
+ Any inDouble, outDouble;
+ Any inVariant, outVariant;
+ Any inObject, outObject;
+ Any inUnknown, outUnknown;
+ Any inCY, outCY;
+ Any inDate, outDate;
+ Any inDecimal, outDecimal;
+ Any inSCode, outSCode;
+ Any inrefLong, outrefLong;
+ Any inrefVariant, outrefVariant;
+ Any inrefDecimal, outrefDecimal;
+
+ Reference<XInterface> xIntFoo(getComObject(L"AxTestComponents.Foo"));
+
+ // in and out parameter
+
+ sal_Bool aBool = sal_True;
+ inBool.setValue(&aBool, cppu::UnoType<bool>::get());
+ inv->invoke(OUString(L"inBool"), Sequence< Any > ( &inBool, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outBool"), Sequence< Any > ( & outBool, 1), seqIndices, seqOut);
+ outBool <<= seqOut[0];
+
+ inByte <<= (sal_Int8) 127;
+ inv->invoke(OUString(L"inByte"), Sequence< Any > ( & inByte, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outByte"), Sequence< Any > ( & outByte, 1), seqIndices, seqOut);
+ outByte <<= seqOut[0];
+
+ inShort <<= static_cast<sal_Int16>(-1);
+ inv->invoke(OUString(L"inShort"), Sequence< Any > ( & inShort, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outShort"), Sequence< Any > ( & outShort, 1), seqIndices, seqOut);
+ outShort <<= seqOut[0];
+
+ inLong <<= ( sal_Int32) 1234567;
+ inv->invoke(OUString(L"inLong"), Sequence< Any > ( & inLong, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outLong"), Sequence< Any > ( & outLong, 1 ), seqIndices, seqOut);
+ outLong <<= seqOut[0];
+
+ inString <<= OUString(L" this is clientTest.exe");
+ inv->invoke(OUString(L"inString"), Sequence< Any > ( & inString, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outString"), Sequence< Any > ( & outString, 1 ), seqIndices, seqOut);
+ outString <<= seqOut[0];
+
+ inFloat <<= 3.14f;
+ inv->invoke(OUString(L"inFloat"), Sequence< Any > ( & inFloat, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outFloat"), Sequence< Any > ( & outFloat, 1 ), seqIndices, seqOut);
+ outFloat <<= seqOut[0];
+
+ inDouble <<= ( double) 3.145;
+ inv->invoke(OUString(L"inDouble"), Sequence< Any > ( & inDouble, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outDouble"), Sequence< Any > ( & outDouble, 1 ), seqIndices, seqOut);
+ outDouble <<= seqOut[0];
+
+ inVariant <<= OUString(L" A string in an any");
+ inv->invoke(OUString(L"inVariant"), Sequence< Any > ( & inVariant, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outVariant"), Sequence< Any > (&outVariant, 1), seqIndices, seqOut);
+ outVariant <<= seqOut[0];
+
+ inObject <<= inv;
+ inv->invoke(OUString(L"inObject"), Sequence< Any > ( & inObject, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outObject"), Sequence< Any > (& outObject, 1), seqIndices, seqOut);
+ outObject <<= seqOut[0];
+
+ inUnknown <<= xIntFoo;
+ inv->invoke(OUString(L"inUnknown"), Sequence< Any > ( & inUnknown, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outUnknown"), Sequence< Any > (& outUnknown, 1), seqIndices, seqOut);
+ outUnknown <<= seqOut[0];
+
+ Currency cur(999999);
+ inCY <<= cur;
+ inv->invoke(OUString(L"inCurrency"), Sequence<Any>( & inCY, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outCurrency"), Sequence< Any > (& outCY, 1), seqIndices, seqOut);
+ outCY <<= seqOut[0];
+
+ Date dDate(37889.0);
+ inDate <<= dDate;
+ inv->invoke(OUString(L"inDate"), Sequence<Any>( & inDate, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outDate"), Sequence< Any > (& outDate, 1), seqIndices, seqOut);
+ outDate <<= seqOut[0];
+
+ Decimal dec(3, 0, 0xffffffff, 0xffffffff, 0xfffffff0);
+ inDecimal <<= dec;
+ inv->invoke(OUString(L"inDecimal"), Sequence<Any>( & inDecimal, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outDecimal"), Sequence< Any > (& outDecimal, 1), seqIndices, seqOut);
+ outDecimal <<= seqOut[0];
+
+ SCode code(DISP_E_BADVARTYPE);
+ inSCode <<= code;
+ inv->invoke(OUString(L"inSCode"), Sequence<Any>( & inSCode, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outSCode"), Sequence< Any > (& outSCode, 1), seqIndices, seqOut);
+ outSCode <<= seqOut[0];
+
+ if (inBool != outBool || inByte != outByte || inShort != outShort || inLong != outLong
+ || inFloat != outFloat || inDouble != outDouble || inString != outString
+ || inVariant != outVariant || inObject != outObject || inUnknown != outUnknown
+ || inCY != outCY
+ || inDate != outDate || inDecimal != outDecimal || inSCode != outSCode)
+ return false;
+
+ // in/out parameter
+
+ outBool = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutBool"), Sequence< Any > ( & inBool, 1), seqIndices, seqOut);
+ outBool <<= seqOut[0];
+
+ outByte = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutByte"), Sequence< Any > ( & inByte, 1), seqIndices, seqOut);
+ outByte <<= seqOut[0];
+
+ outShort = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutShort"), Sequence< Any > ( & inShort, 1), seqIndices, seqOut);
+ outShort <<= seqOut[0];
+
+ outLong = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutLong"), Sequence< Any > ( & inLong, 1), seqIndices, seqOut);
+ outLong <<= seqOut[0];
+
+ outString = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutString"), Sequence< Any > ( & inString, 1), seqIndices, seqOut);
+ outString <<= seqOut[0];
+
+ outFloat = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutFloat"), Sequence< Any > ( & inFloat, 1), seqIndices, seqOut);
+ outFloat <<= seqOut[0];
+
+ outDouble = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutDouble"), Sequence< Any > ( &inDouble, 1), seqIndices, seqOut);
+ outDouble <<= seqOut[0];
+
+ outVariant = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutVariant"), Sequence< Any > ( & inVariant, 1), seqIndices, seqOut);
+ outVariant <<= seqOut[0];
+
+ outObject = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutObject"), Sequence< Any > ( & inObject, 1), seqIndices, seqOut);
+ outObject <<= seqOut[0];
+
+ outCY = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutCurrency"), Sequence< Any > ( & inCY, 1), seqIndices, seqOut);
+ outCY <<= seqOut[0];
+
+ outDate = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutDate"), Sequence< Any > ( & inDate, 1), seqIndices, seqOut);
+ outDate <<= seqOut[0];
+
+ outDecimal = Any();
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutDecimal"), Sequence< Any > (& inDecimal, 1), seqIndices, seqOut);
+ outDecimal <<= seqOut[0];
+
+ outSCode = Any();
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutSCode"), Sequence< Any > (& inSCode, 1), seqIndices, seqOut);
+ outSCode <<= seqOut[0];
+
+ if (inBool != outBool || inByte != outByte || inShort != outShort || inLong != outLong
+ || inFloat != outFloat || inDouble != outDouble || inString != outString
+ || inVariant != outVariant || inObject != outObject || inCY != outCY
+ || inDate != outDate || inDecimal != outDecimal || inSCode != outSCode)
+ return false;
+
+
+ // in byref parameters
+
+
+ inrefLong <<= (sal_Int32) 1234;
+ inv->invoke(OUString(L"inrefLong"), Sequence<Any>( & inrefLong, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outLong"), Sequence< Any > (& outrefLong, 1), seqIndices, seqOut);
+ outrefLong <<= seqOut[0];
+
+ inrefVariant <<= OUString(L" A string in an any");
+ inv->invoke(OUString(L"inrefVariant"), Sequence< Any > ( & inrefVariant, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outVariant"), Sequence< Any > (&outrefVariant, 1), seqIndices, seqOut);
+ outrefVariant <<= seqOut[0];
+
+ Decimal refdec(5, 1, 0xffff, 0xff, 0x1);
+ inrefDecimal <<= refdec;
+ inv->invoke(OUString(L"inrefDecimal"), Sequence< Any > ( & inrefDecimal, 1), seqIndices, seqOut);
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outDecimal"), Sequence< Any > (&outrefDecimal, 1), seqIndices, seqOut);
+ outrefDecimal <<= seqOut[0];
+
+ if (inrefLong != outrefLong || inrefVariant != outrefVariant
+ || inrefDecimal != outrefDecimal)
+ return false;
+
+
+ // mixed parameter
+
+ // mixed1
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ Any param[3];
+ param[0] = inByte;
+ param[1] = inFloat;
+ param[2] = inVariant;
+ inv->invoke(OUString(L"mixed1"), Sequence< Any >(param, 3), seqIndices, seqOut);
+
+ if (seqOut.getLength() != 3 || inByte != seqOut[0] || inFloat != seqOut[1]
+ || inVariant != seqOut[2])
+ return false;
+ return true;
+}
+
+bool doSimpleSequenceTest(const Reference<XInvocation> & inv)
+{
+ bool ret = true;
+ Sequence<sal_Int16> seqIndices;
+ Sequence<Any> seqOut;
+ Any voidAny;
+ Any inArAny;
+ Any outArray;
+ Any inArBool, outArBool;
+ Any inArByte, outArByte;
+ Any inArShort, outArShort;
+ Any inArLong, outArLong;
+ Any inArString, outArString;
+ Any inArFloat, outArFloat;
+ Any inArDouble, outArDouble;
+ Any inArObject, outArObject;
+ Any outVariant;
+
+ //Initialize arrays
+ OUString arStr[]= {L"string0", L"string1", L"string2"};
+ Sequence<OUString> seq( arStr, 3);
+ inArString <<= seq;
+
+ Any arAnyStrTmp[3];
+ arAnyStrTmp[0]<<= arStr[0];
+ arAnyStrTmp[1]<<= arStr[1];
+ arAnyStrTmp[2]<<= arStr[2];
+ Sequence<Any> seq_1( arAnyStrTmp, 3);
+ inArAny <<= seq_1;
+
+ // in, out Sequences
+
+ //Test sequence containing Anys of Strings
+ inv->invoke(OUString(L"inArray"), Sequence< Any > ( & inArAny, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outArray"), Sequence<Any>( & voidAny, 1), seqIndices, seqOut);
+ if (inArAny != seqOut[0])
+ return false;
+
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inArray"), Sequence< Any >( & inArString, 1), seqIndices, seqOut);
+ inv->invoke(OUString(L"outArray"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
+ outArray <<= seqOut[0];
+
+ sal_Int8 arByte[]={1,2,3};
+ Sequence<sal_Int8> seqByte(arByte, 3);
+ inArByte <<= seqByte;
+ inv->invoke(OUString(L"inSequenceByte"),Sequence<Any>( & inArByte, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outSequenceByte"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
+ outArByte <<= seqOut[0];
+
+ sal_Int16 arShort[]={4,5,6};
+ Sequence<sal_Int16> seqShort(arShort, 3);
+ inArShort<<= seqShort;
+ inv->invoke(OUString(L"inSequenceShort"),Sequence< Any >( & inArShort, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outSequenceShort"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
+ outArShort <<= seqOut[0];
+
+ sal_Int32 arLong[] = {7,8,9};
+ Sequence<sal_Int32> seqLong(arLong, 3);
+ inArLong <<= seqLong;
+ inv->invoke(OUString(L"inSequenceLong"),Sequence< Any > ( & inArLong, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outSequenceLong"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
+ outArLong <<= seqOut[0];
+
+ inv->invoke(OUString(L"inSequenceLong"),Sequence< Any > ( & inArLong, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outSequenceLong"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
+ outArLong <<= seqOut[0];
+
+ inv->invoke( OUString(L"inSequenceString"),Sequence< Any > ( & inArString, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outSequenceString"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
+ outArString <<= seqOut[0];
+
+ float arFloat[]={3.14f, 31.4f, 314.f};
+ Sequence<float> seqFloat( arFloat, 3);
+ inArFloat <<= seqFloat;
+ inv->invoke( OUString(L"inSequenceFloat"),Sequence< Any > ( & inArFloat, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outSequenceFloat"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
+ outArFloat <<= seqOut[0];
+
+ double arDouble[]={3.145, 31.45, 3145.};
+ Sequence<double> seqDouble( arDouble, 3);
+ inArDouble <<= seqDouble;
+ inv->invoke(OUString(L"inSequenceDouble"),Sequence< Any >( & inArDouble, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outSequenceDouble"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
+ outArDouble <<= seqOut[0];
+
+ Sequence<Reference<XInvocation> > seqObj(2);
+ seqObj[0]= getComObject(L"AxTestComponents.Basic");
+ seqObj[1]= getComObject(L"AxTestComponents.Basic");
+ inArObject <<= seqObj;
+ inv->invoke(OUString(L"inSequenceObject"),Sequence< Any >( & inArObject, 1), seqIndices, seqOut);
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"outSequenceObject"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut);
+ outArObject <<= seqOut[0];
+
+ if ( ! equalSequences(inArByte, outArByte) || ! equalSequences(inArShort, outArShort)
+ || ! equalSequences(inArLong, outArLong) || ! equalSequences(inArString, outArray)
+ || ! equalSequences(inArFloat, outArFloat) || ! equalSequences(inArDouble, outArDouble)
+ || ! equalSequences(inArString, outArString) || ! equalSequences(inArObject, outArObject))
+ return false;
+
+
+ // in/out Sequences
+
+ seqIndices.realloc(0);
+ seqOut.realloc(0);
+ inv->invoke(OUString(L"inoutArray"), Sequence< Any >( & inArString, 1), seqIndices, seqOut);
+ inv->invoke(OUString(L"inoutArray"), Sequence< Any >( & inArString, 1), seqIndices, seqOut);
+ outArray <<= seqOut[0];
+
+ inv->invoke(OUString(L"inoutSequenceByte"), Sequence<Any>( & inArByte, 1), seqIndices, seqOut);
+ inv->invoke(OUString(L"inoutSequenceByte"), Sequence<Any>( & inArByte, 1), seqIndices, seqOut);
+ outArByte <<= seqOut[0];
+
+ inv->invoke(OUString(L"inoutSequenceShort"), Sequence<Any>( & inArShort, 1), seqIndices, seqOut);
+ inv->invoke(OUString(L"inoutSequenceShort"), Sequence<Any>( & inArShort, 1), seqIndices, seqOut);
+ outArShort <<= seqOut[0];
+
+ inv->invoke(OUString(L"inoutSequenceLong"), Sequence<Any>( & inArLong, 1), seqIndices, seqOut);
+ inv->invoke(OUString(L"inoutSequenceLong"), Sequence< Any >( & inArLong, 1), seqIndices, seqOut);
+ outArLong <<= seqOut[0];
+
+ inv->invoke(OUString(L"inoutSequenceString"), Sequence<Any>( & inArString, 1), seqIndices, seqOut);
+ inv->invoke(OUString(L"inoutSequenceString"), Sequence<Any>( & inArString, 1), seqIndices, seqOut);
+ outArString <<= seqOut[0];
+
+ inv->invoke(OUString(L"inoutSequenceFloat"), Sequence<Any>( & inArFloat, 1), seqIndices, seqOut);
+ inv->invoke(OUString(L"inoutSequenceFloat"), Sequence<Any>( & inArFloat, 1), seqIndices, seqOut);
+ outArFloat <<= seqOut[0];
+
+ inv->invoke(OUString(L"inoutSequenceDouble"), Sequence<Any>( & inArDouble, 1), seqIndices, seqOut);
+ inv->invoke(OUString(L"inoutSequenceDouble"), Sequence<Any>( & inArDouble, 1), seqIndices, seqOut);
+ outArDouble <<= seqOut[0];
+
+ inv->invoke(OUString(L"inoutSequenceObject"), Sequence<Any>( & inArObject, 1), seqIndices, seqOut);
+ inv->invoke(OUString(L"inoutSequenceObject"), Sequence<Any>( & inArObject, 1), seqIndices, seqOut);
+ outArObject <<= seqOut[0];
+
+ if ( ! equalSequences(inArByte, outArByte) || ! equalSequences(inArShort, outArShort)
+ || ! equalSequences(inArLong, outArLong) || ! equalSequences(inArString, outArray)
+ || ! equalSequences(inArFloat, outArFloat) || ! equalSequences(inArDouble, outArDouble)
+ || ! equalSequences(inArString, outArString) || ! equalSequences(inArObject, outArObject))
+ return false;
+
+ return ret;
+}
+
+HRESULT doTest()
+{
+ HRESULT hr= S_OK;
+ USES_CONVERSION;
+ Reference<XInvocation> inv= getComObject( L"AxTestComponents.Basic");
+
+ HostWin* pWin= new HostWin( L"MFCCONTROL.MfcControlCtrl.1");
+ CComPtr<IUnknown> spUnk= pWin->GetHostedControl();
+ Reference<XInvocation> invMfc= convertComObject( spUnk.p);
+
+ Sequence< sal_Int16> seqIndices;
+ Sequence<Any> seqOut;
+
+ Any aAny;
+ Any anyOut;
+ char buff[1024];
+ Any seqAny;
+
+ if (! doSimpleTest(inv))
+ {
+ fprintf(stdout, "### Test failed!\n");
+ return E_FAIL;
+ }
+
+ if (! doPropertyTest(inv))
+ {
+ fprintf(stdout, "### Test failed!\n");
+ return E_FAIL;
+ }
+
+ if ( ! doSimpleSequenceTest(inv))
+ {
+ fprintf(stdout, "### Test failed! \n");
+ return E_FAIL;
+ }
+
+ if ( ! doParameterTest(inv))
+ {
+ fprintf(stdout, "### Test failed! \n");
+ return E_FAIL;
+ }
+
+ if ( ! doPropertyWithArgumentTest(inv))
+ {
+ fprintf(stdout, "### Test failed! \n");
+ return E_FAIL;
+ }
+
+
+// // in multi Sequences
+
+// // inMulDimArrayLong
+ sal_Int32 arLongi[]={1,2,3};
+ sal_Int32 arLongi2[]={4,5,6,7};
+ sal_Int32 arLongi3[]={8,9,10,11,12};
+
+ Sequence<sal_Int32> seqLongi1( arLongi, 3);
+ Sequence<sal_Int32> seqLongi2( arLongi2, 4);
+ Sequence<sal_Int32> seqLongi3( arLongi3, 5);
+
+ Sequence< Sequence< sal_Int32 > > seq2i(3);
+ seq2i[0]= seqLongi1;
+ seq2i[1]= seqLongi2;
+ seq2i[2]= seqLongi3;
+ seqAny<<= seq2i;
+ // dimension length 3,5
+ inv->invoke( OUString(L"inMulDimArrayLong"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut);
+
+ //inMulDimArrayVariant
+ inv->invoke( OUString(L"inMulDimArrayVariant"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut);
+
+ //inMulDimArrayLong2
+ sal_Int32 arLongii1[]={1,2,3};
+ sal_Int32 arLongii2[]={4,5,6,7};
+ sal_Int32 arLongii3[]={8,9,10,11,12};
+ sal_Int32 arLongii4[]={13,14,15,16};
+ sal_Int32 arLongii5[]={17,18,19};
+
+ Sequence<sal_Int32> seqLongii1( arLongii1, 3);
+ Sequence<sal_Int32> seqLongii2( arLongii2, 4);
+ Sequence<sal_Int32> seqLongii3( arLongii3, 5);
+ Sequence<sal_Int32> seqLongii4( arLongii4, 4);
+ Sequence<sal_Int32> seqLongii5( arLongii5, 3);
+
+ Sequence< Sequence< sal_Int32 > > seq2ii(3);
+ Sequence< Sequence< sal_Int32> > seq2ii2(2);
+ seq2ii[0]= seqLongii1;
+ seq2ii[1]= seqLongii2;
+ seq2ii[2]= seqLongii3;
+
+ seq2ii2[0]= seqLongii4;
+ seq2ii2[1]= seqLongii5;
+
+ Sequence< Sequence< Sequence< sal_Int32> > > seq3ii(2);
+ seq3ii[0]=seq2ii;
+ seq3ii[1]=seq2ii2;
+ seqAny<<= seq3ii;
+ inv->invoke( OUString(L"inMulDimArrayLong2"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut);
+
+ // inMulDimArrayByte2
+ sal_Int8 arByteii1[]={1,2,3};
+ sal_Int8 arByteii2[]={4,5,6,7};
+ sal_Int8 arByteii3[]={8,9,10,11,12};
+ sal_Int8 arByteii4[]={13,14,15,16};
+ sal_Int8 arByteii5[]={17,18,19};
+
+ Sequence<sal_Int8> seqByteii1( arByteii1, 3);
+ Sequence<sal_Int8> seqByteii2( arByteii2, 4);
+ Sequence<sal_Int8> seqByteii3( arByteii3, 5);
+ Sequence<sal_Int8> seqByteii4( arByteii4, 4);
+ Sequence<sal_Int8> seqByteii5( arByteii5, 3);
+
+ Sequence< Sequence< sal_Int8 > > seq2Byteii(3);
+ Sequence< Sequence< sal_Int8> > seq2Byteii2(2);
+ seq2Byteii[0]= seqByteii1;
+ seq2Byteii[1]= seqByteii2;
+ seq2Byteii[2]= seqByteii3;
+
+ seq2Byteii2[0]= seqByteii4;
+ seq2Byteii2[1]= seqByteii5;
+
+ Sequence< Sequence< Sequence< sal_Int8> > > seq3Byteii(2);
+ seq3Byteii[0]=seq2Byteii;
+ seq3Byteii[1]=seq2Byteii2;
+ seqAny<<= seq3Byteii;
+ inv->invoke( OUString(L"inMulDimArrayByte2"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut);
+
+
+ // Tests with a MFC ActiveX control, ( pure dispinterface)
+
+
+ // in parameter MFC ActiveX
+
+ // unsigned char is not supported by MFC
+ // aAny <<= ( sal_Int8) 127;
+ // invMfc->invoke( OUString(L"inByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ if ( ! invMfc.is())
+ return hr;
+ aAny <<= static_cast<sal_Int16>(-1);
+ aAny= invMfc->invoke( OUString(L"inShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+
+
+ aAny <<= ( sal_Int32) 1234567;
+ aAny=invMfc->invoke( OUString(L"inLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ sal_Int32 retLong= *(sal_Int32*)aAny.getValue();
+
+ OUString str_1(L" this is clientTest.exe");
+ aAny <<= str_1;
+ aAny=invMfc->invoke( OUString(L"inString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ aAny>>= str_1;
+
+ aAny <<= ( float) 3.14;
+ aAny=invMfc->invoke( OUString(L"inFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+
+ aAny <<= ( double) 3.145;
+ aAny=invMfc->invoke( OUString(L"inDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+
+ aAny <<= OUString( L" A string in an any");
+ aAny=invMfc->invoke( OUString(L"inVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+
+
+ Reference < XInvocation > inv5= getComObject(L"AxTestComponents.Basic");
+ Any anyVal4;
+ anyVal4 <<= OUString(L"this is the value of prpString");
+ inv5->setValue( OUString(L"prpString"), anyVal4);
+ aAny <<= inv5;
+ aAny=invMfc->invoke( OUString(L"inObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+
+
+// // out parameter MFC ActiveX
+
+
+// // outShort
+ aAny= invMfc->invoke( OUString(L"outShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ anyOut<<= seqOut[0];
+ sprintf(buff, "MFC outShort %d", *(sal_Int16*)anyOut.getValue());
+ MessageBox( NULL, buff, _T("clientTest"), MB_OK);
+
+ // outLong
+ aAny= invMfc->invoke( OUString(L"outLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ anyOut<<= seqOut[0];
+ sprintf(buff, "MFC outLong %d", *(sal_Int32*)anyOut.getValue());
+ MessageBox( NULL, buff, _T("clientTest"), MB_OK);
+
+ // outString
+ aAny= invMfc->invoke( OUString(L"outString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ anyOut<<= seqOut[0];
+ sprintf(buff, "MFC outString %S", ((OUString*)anyOut.getValue())->getStr());
+ MessageBox( NULL, buff, _T("clientTest"), MB_OK);
+
+ // outFloat
+ aAny= invMfc->invoke( OUString(L"outFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ anyOut<<= seqOut[0];
+ sprintf(buff, "MFC outFloat %f", *(float*)anyOut.getValue());
+ MessageBox( NULL, buff, _T("clientTest"), MB_OK);
+
+ // outDouble
+ aAny= invMfc->invoke( OUString(L"outDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ anyOut<<= seqOut[0];
+ sprintf(buff, "MFC outFloat %f", *(double*)anyOut.getValue());
+ MessageBox( NULL, buff, _T("clientTest"), MB_OK);
+
+ // outVariant
+ // we expect a string!! ( VT_BSTR)
+ aAny= invMfc->invoke( OUString(L"outVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ anyOut<<= seqOut[0];
+ sprintf(buff, "MFC outVariant %S", ((OUString*)anyOut.getValue())->getStr());
+ MessageBox( NULL, buff, _T("clientTest"), MB_OK);
+
+ // outDouble
+ aAny= invMfc->invoke( OUString(L"outObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+ Reference<XInvocation> invOut5;
+ seqOut[0]>>= invOut5;
+ // we assume that an object of AxTestControls.Basic is being returned.
+ anyOut= invOut5->getValue( OUString(L"prpString"));
+ OUString tmpStr;
+ anyOut>>=tmpStr;
+ sprintf(buff, "MFC outObject, property: %S", tmpStr.getStr());
+ MessageBox( NULL, buff, _T("clientTest"), MB_OK);
+
+
+ // Sequence parameter MFC ActiveX
+
+ // Sequences are not directly supported.
+
+
+ delete pWin;
+ return hr;
+
+}
+
+
+//VARIANT_TRUE VT_UI1
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/test/ole/OleClient/funcs.cxx b/extensions/test/ole/OleClient/funcs.cxx
new file mode 100644
index 000000000..a72c7c49e
--- /dev/null
+++ b/extensions/test/ole/OleClient/funcs.cxx
@@ -0,0 +1,345 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#include <atlbase.h>
+#include <stdio.h>
+#include "cppuhelper/bootstrap.hxx"
+#include "rtl/process.h"
+#include "typelib/typedescription.hxx"
+
+#include "com/sun/star/bridge/ModelDependent.hpp"
+#include "com/sun/star/bridge/XBridgeSupplier2.hpp"
+#include "com/sun/star/uno/TypeClass.hpp"
+#include "com/sun/star/script/XInvocation.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include <com/sun/star/bridge/oleautomation/NamedArgument.hpp>
+#include "rtl/ustring.hxx"
+
+using namespace com::sun::star::bridge;
+using namespace com::sun::star::bridge::ModelDependent;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::script;
+using namespace com::sun::star::bridge::oleautomation;
+using namespace cppu;
+
+
+template< class T >
+bool equalSequences(const Sequence<T>& seqIn, const Sequence<Any> & returned);
+
+
+Reference< XMultiServiceFactory > objectFactory;
+
+
+Reference<XMultiServiceFactory> getMultiServiceFactory()
+{
+ static Reference< XMultiServiceFactory > factory;
+ if( ! objectFactory.is() )
+ {
+ Reference<XComponentContext> context = defaultBootstrap_InitialComponentContext();
+ factory.set(context->getServiceManager(), UNO_QUERY);
+
+ }
+ return factory;
+}
+
+Reference<XInvocation> getComObject( OUString progId)
+{
+ HRESULT hr= S_OK;
+ Reference< XInvocation > ret;
+ if( ! objectFactory.is())
+ { Reference<XMultiServiceFactory> mgr= getMultiServiceFactory();
+ Reference<XInterface> xInt= mgr->createInstance(
+ "com.sun.star.bridge.oleautomation.Factory");
+ objectFactory.set(xInt, UNO_QUERY);
+ }
+
+ if( objectFactory.is())
+ {
+ Reference<XInterface> xIntAx= objectFactory->createInstance( progId.getStr());
+ if( xIntAx.is() )
+ {
+ Reference< XInvocation > xInv( xIntAx, UNO_QUERY);
+ ret= xInv;
+ }
+ }
+ return ret;
+}
+
+Reference<XInvocation> convertComObject( IUnknown* pUnk)
+{
+ Reference< XMultiServiceFactory > mgr= getMultiServiceFactory();
+ Reference< XInterface > xIntSupplier= mgr->createInstance("com.sun.star.bridge.OleBridgeSupplier2");
+ Reference< XBridgeSupplier2 > xSuppl( xIntSupplier, UNO_QUERY);
+
+ Any any;
+ CComVariant var( pUnk);
+ any <<= (sal_uIntPtr) &var;
+ sal_uInt8 arId[16];
+ rtl_getGlobalProcessId( arId);
+ Any target= xSuppl->createBridge( any, Sequence<sal_Int8>( (sal_Int8*)arId, 16), OLE, UNO );
+
+ Reference<XInvocation> ret;
+ target>>= ret;
+ return ret;
+}
+
+/*
+ Parameter values contains the expected return values. The value at index 0
+ correspond to parameter 0 (left - most). For parameters which are not out or
+ in/out the value must be a void any.
+
+ The number of items in value must be the
+ same as the number of provided parameter during the call on the method.
+
+ The parameter outArgs, indices correspond to the sequences which are
+ arguments to XInvocation::invoke
+ */
+bool checkOutArgs(const Sequence<Any> & outArgs,
+ const Sequence<sal_Int16> & indices, const Sequence<Any> & values)
+{
+ if (values.getLength() != outArgs.getLength())
+ return false;
+ //iterate over all parameters. i represents the parameter index
+ for (int i = 0; i < values.getLength(); i++)
+ {
+ if (values[i].getValueType() == cppu::UnoType<void>::get())
+ continue;
+ //out parameter
+ //Based on the parameter index find the correspondent out value
+ int indexOutSeq = -1;
+ for (int iIndices = indices.getLength() - 1; iIndices >= 0; iIndices --)
+ {
+ if (indices[iIndices] == i)
+ {
+ indexOutSeq = iIndices;
+ break;
+ }
+ }
+ if (indexOutSeq == -1)
+ return false;
+
+ Any value;
+ Any out;
+ values[i] >>= value;
+ outArgs[indexOutSeq] >>=out;
+ NamedArgument naVal;
+ NamedArgument naOut;
+ value >>= naVal;
+ out >>= naOut;
+ if (values[i].getValueType() == cppu::UnoType<NamedArgument>::get())
+ {
+ NamedArgument inNamed;
+ values[i] >>= inNamed;
+ value <<= inNamed.Value;
+ }
+ if (value != outArgs[indexOutSeq])
+ return false;
+ }
+ return true;
+}
+
+/* The returned sequence always contains Any elements
+*/
+bool equalSequences(const Any& orig, const Any& returned)
+{
+ if (orig.getValueTypeClass() != TypeClass_SEQUENCE)
+ {
+ OSL_ASSERT(0);
+ return false;
+ }
+ TypeDescription td(orig.getValueTypeRef());
+ typelib_IndirectTypeDescription * indirect_td = (typelib_IndirectTypeDescription *) td.get();
+
+ switch (indirect_td->pType->eTypeClass)
+ {
+ case TypeClass_CHAR:
+ {
+ Sequence<sal_Unicode> seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ case TypeClass_BOOLEAN:
+ {
+ Sequence<sal_Bool> seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ case TypeClass_BYTE:
+ {
+ Sequence<sal_Int8> seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ case TypeClass_SHORT:
+ {
+ Sequence<sal_Int16> seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ case TypeClass_LONG:
+ {
+ Sequence<sal_Int32> seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ case TypeClass_FLOAT:
+ {
+ Sequence<float> seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ case TypeClass_DOUBLE:
+ {
+ Sequence<double> seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ case TypeClass_STRING:
+ {
+ Sequence<OUString> seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ case TypeClass_ANY:
+ {
+ Sequence<Any> seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ case TypeClass_SEQUENCE:
+ {
+ //Sequence<sal_Unicode> seq;
+ //orig >>= seq;
+ //Sequence<Any> seq2;
+ //returned >>= seq2;
+ //return equalSequences(seq, seq2);
+ break;
+ }
+ case TypeClass_INTERFACE:
+ {
+ Sequence<Reference<XInvocation> > seq;
+ orig >>= seq;
+ Sequence<Any> seq2;
+ returned >>= seq2;
+ return equalSequences(seq, seq2);
+ }
+ default:
+ return false;
+ }
+ return false;
+}
+
+template< class T >
+bool equalSequences(const Sequence<T>& seqIn, const Sequence<Any> & seqOut)
+{
+ if (seqIn.getLength() != seqOut.getLength())
+ return false;
+ int len = seqIn.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Any anyIn;
+ anyIn <<= seqIn[i];
+ Any anyOut = seqOut[i];
+ if (anyIn != anyOut)
+ return false;
+ }
+
+ return true;
+}
+
+void printSequence( Sequence<Any>& val)
+{
+
+// typelib_TypeDescription* desc;
+// val.getValueTypeDescription( &desc);
+// typelib_typedescription_release( desc);
+
+ USES_CONVERSION;
+ char buff[1024];
+ buff[0]=0;
+ char tmpBuf[1024];
+ tmpBuf[0]=0;
+ sal_Int32 i;
+
+ for( i=0; i< val.getLength(); i++)
+ {
+ Any& elem= val[i];
+ switch ( elem.getValueTypeClass())
+ {
+ case TypeClass_BYTE:
+ sprintf( tmpBuf, "sal_Int8 %d \n", *(sal_Int8*)elem.getValue());
+ break;
+ case TypeClass_SHORT:
+ sprintf( tmpBuf, "sal_Int16 %d \n", *(sal_Int16*)elem.getValue());
+ break;
+ case TypeClass_LONG:
+ sprintf( tmpBuf, "sal_Int32 %d \n", *(sal_Int32*)elem.getValue());
+ break;
+ case TypeClass_DOUBLE:
+ sprintf( tmpBuf, "double %f \n", *(double*)elem.getValue());
+ break;
+ case TypeClass_FLOAT:
+ sprintf( tmpBuf, "float %f \n", *(float*)elem.getValue());
+ break;
+ case TypeClass_STRING:
+ sprintf( tmpBuf, "%S \n", (*(OUString*)elem.getValue()).getStr());
+ break;
+ case TypeClass_INTERFACE:
+ {
+ // we assume that the interface is XInvocation of an AxTestControls.Basic component.
+ Reference<XInvocation> inv;
+ elem>>= inv;
+ if( inv.is())
+ {
+ Any prpVal= inv->getValue( OUString( L"prpString"));
+ sprintf( tmpBuf, "Property prpString: %S \n", (*(OUString*)prpVal.getValue()).getStr());
+ }
+ break;
+ }
+ default:break;
+ }
+ strcat( buff, tmpBuf);
+
+ }
+
+ MessageBox( NULL, A2T(buff), _T("clientTest: printing Sequence elements"), MB_OK);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/test/ole/OleClient/readme.txt b/extensions/test/ole/OleClient/readme.txt
new file mode 100644
index 000000000..bcee8edde
--- /dev/null
+++ b/extensions/test/ole/OleClient/readme.txt
@@ -0,0 +1,10 @@
+The program tests the OleObjectFactory service which enables to use COM components
+through XInvocation.
+
+Requirements:
+
+types.rdb and services.rdb and OleClient.ini have to be next to the executable.
+COM component: XCallback_Impl.Simple ( extensions/test/ole/unotocomcalls/XCallback_Impl )
+ActiveX controls: AxTestComponent.Basic ( extensions/test/ole/AxTestComponents)
+ MFCCONTROL.MfcControlCtrl.1 (extensions/test/ole/MfcControl)
+