diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /extensions/test | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
124 files changed, 22762 insertions, 0 deletions
diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.cpp b/extensions/test/ole/AxTestComponents/AxTestComponents.cpp new file mode 100644 index 000000000..ca7d37457 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.cpp @@ -0,0 +1,77 @@ +/* -*- 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 . + */ + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f AxTestComponentsps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include <initguid.h> + +#include "Basic.h" +#include "Foo.h" + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_Basic, CBasic) +OBJECT_ENTRY(CLSID_Foo, CFoo) +END_OBJECT_MAP() + +// DLL Entry Point + +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_AXTESTCOMPONENTSLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) { return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE; } + +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) { return _Module.UnregisterServer(TRUE); } + +//VT_I4 size_t V_ERROR VARIANT VARIANT_FALSE CComVariant FADF_EMBEDDED + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.def b/extensions/test/ole/AxTestComponents/AxTestComponents.def new file mode 100644 index 000000000..5d8c019ad --- /dev/null +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.def @@ -0,0 +1,9 @@ +; AxTestComponents.def : Declares the module parameters. + +LIBRARY "AxTestComponents.DLL" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.dsp b/extensions/test/ole/AxTestComponents/AxTestComponents.dsp new file mode 100644 index 000000000..43fbbe53d --- /dev/null +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.dsp @@ -0,0 +1,325 @@ +# Microsoft Developer Studio Project File - Name="AxTestComponents" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=AxTestComponents - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "AxTestComponents.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "AxTestComponents.mak" CFG="AxTestComponents - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "AxTestComponents - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "AxTestComponents - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "AxTestComponents - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "AxTestComponents - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "AxTestComponents - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "AxTestComponents - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "AxTestComponents - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\Debug +TargetPath=.\Debug\AxTestComponents.dll +InputPath=.\Debug\AxTestComponents.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugU" +# PROP BASE Intermediate_Dir "DebugU" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugU" +# PROP Intermediate_Dir "DebugU" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\DebugU +TargetPath=.\DebugU\AxTestComponents.dll +InputPath=.\DebugU\AxTestComponents.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinSize" +# PROP BASE Intermediate_Dir "ReleaseMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinSize" +# PROP Intermediate_Dir "ReleaseMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinSize +TargetPath=.\ReleaseMinSize\AxTestComponents.dll +InputPath=.\ReleaseMinSize\AxTestComponents.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinDependency" +# PROP BASE Intermediate_Dir "ReleaseMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinDependency" +# PROP Intermediate_Dir "ReleaseMinDependency" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinDependency +TargetPath=.\ReleaseMinDependency\AxTestComponents.dll +InputPath=.\ReleaseMinDependency\AxTestComponents.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Unicode Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinSize" +# PROP BASE Intermediate_Dir "ReleaseUMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinSize" +# PROP Intermediate_Dir "ReleaseUMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinSize +TargetPath=.\ReleaseUMinSize\AxTestComponents.dll +InputPath=.\ReleaseUMinSize\AxTestComponents.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Unicode Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinDependency" +# PROP BASE Intermediate_Dir "ReleaseUMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinDependency" +# PROP Intermediate_Dir "ReleaseUMinDependency" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinDependency +TargetPath=.\ReleaseUMinDependency\AxTestComponents.dll +InputPath=.\ReleaseUMinDependency\AxTestComponents.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "AxTestComponents - Win32 Debug" +# Name "AxTestComponents - Win32 Unicode Debug" +# Name "AxTestComponents - Win32 Release MinSize" +# Name "AxTestComponents - Win32 Release MinDependency" +# Name "AxTestComponents - Win32 Unicode Release MinSize" +# Name "AxTestComponents - Win32 Unicode Release MinDependency" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\AxTestComponents.cpp +# End Source File +# Begin Source File + +SOURCE=.\AxTestComponents.def +# End Source File +# Begin Source File + +SOURCE=.\AxTestComponents.idl +# ADD MTL /tlb ".\AxTestComponents.tlb" /h "AxTestComponents.h" /iid "AxTestComponents_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\AxTestComponents.rc +# End Source File +# Begin Source File + +SOURCE=.\Basic.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Basic.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\Basic.rgs +# End Source File +# End Group +# End Target +# End Project + + diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.idl b/extensions/test/ole/AxTestComponents/AxTestComponents.idl new file mode 100644 index 000000000..6649483a7 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.idl @@ -0,0 +1,251 @@ +/* -*- 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 . + */ +// AxTestComponents.idl : IDL source for AxTestComponents.dll + + +// This file will be processed by the MIDL tool to +// produce the type library (AxTestComponents.tlb) and marshalling code. +// next id 86 +import "oaidl.idl"; +import "ocidl.idl"; + [ + object, + uuid(BFE10EBD-8584-11D4-8335-005004526AB4), + dual, + helpstring("IBasic Interface"), + pointer_default(unique) + ] + interface IBasic : IDispatch + { + [id(82), helpstring("method inBool")] HRESULT inBool([in]VARIANT_BOOL val); + [id(1), helpstring("method inByte")] HRESULT inByte([in] unsigned char val); + [id(2), helpstring("method inShort")] HRESULT inShort([in] short val); + [id(3), helpstring("method inLong")] HRESULT inLong([in] long val); + [id(4), helpstring("method inString")] HRESULT inString([in] BSTR val); + [id(5), helpstring("method inFloat")] HRESULT inFloat([in] float val); + [id(6), helpstring("method inDouble")] HRESULT inDouble([in] double val); + [id(7), helpstring("method inVariant")] HRESULT inVariant([in] VARIANT val); + [id(8), helpstring("method inArray")] HRESULT inArray([in] SAFEARRAY(VARIANT) val); + [id(9), helpstring("method inObject")] HRESULT inObject([in] IDispatch* val); + [id(83), helpstring("method inoutBool")] HRESULT inoutBool([in,out]VARIANT_BOOL* val); + [id(12), helpstring("method inoutByte")] HRESULT inoutByte([in,out] unsigned char* val); + [id(13), helpstring("method inoutShort")] HRESULT inoutShort([in,out] short* val); + [id(14), helpstring("method inoutLong")] HRESULT inoutLong([in,out] long * val); + [id(15), helpstring("method inoutString")] HRESULT inoutString([in, out] BSTR* val); + [id(16), helpstring("method inoutFloat")] HRESULT inoutFloat([in,out] float * val); + [id(17), helpstring("method inoutDouble")] HRESULT inoutDouble([in,out] double * val); + [id(18), helpstring("method inoutVariant")] HRESULT inoutVariant([in,out] VARIANT * val); + [id(19), helpstring("method inoutArray")] HRESULT inoutArray([in,out] SAFEARRAY(VARIANT) * val); + [id(20), helpstring("method inoutObject")] HRESULT inoutObject([in,out] IDispatch** val); + [id(84), helpstring("method outBool")] HRESULT outBool([out] VARIANT_BOOL* val); + [id(23), helpstring("method outByte")] HRESULT outByte([out] unsigned char* val); + [id(24), helpstring("method outShort")] HRESULT outShort([out] short* val); + [id(25), helpstring("method outLong")] HRESULT outLong([out] long* val); + [id(26), helpstring("method outString")] HRESULT outString([out] BSTR* val); + [id(27), helpstring("method outFloat")] HRESULT outFloat([out] float* val); + [id(28), helpstring("method outDouble")] HRESULT outDouble([out] double* val); + [id(29), helpstring("method outVariant")] HRESULT outVariant([out] VARIANT* val); + [id(30), helpstring("method outArray")] HRESULT outArray([out] SAFEARRAY(VARIANT) * val); + [id(31), helpstring("method outObject")] HRESULT outObject([out] IDispatch** val); + [propget, id(85), helpstring("property prpBool")] HRESULT prpBool([out, retval] VARIANT_BOOL *pVal); + [propput, id(85), helpstring("property prpBool")] HRESULT prpBool([in] VARIANT_BOOL newVal); + [propget, id(34), helpstring("property prpByte")] HRESULT prpByte([out, retval] unsigned char *pVal); + [propput, id(34), helpstring("property prpByte")] HRESULT prpByte([in] unsigned char newVal); + [propget, id(35), helpstring("property prpShort")] HRESULT prpShort([out, retval] short *pVal); + [propput, id(35), helpstring("property prpShort")] HRESULT prpShort([in] short newVal); + [propget, id(36), helpstring("property prpLong")] HRESULT prpLong([out, retval] long *pVal); + [propput, id(36), helpstring("property prpLong")] HRESULT prpLong([in] long newVal); + [propget, id(37), helpstring("property prpString")] HRESULT prpString([out, retval] BSTR *pVal); + [propput, id(37), helpstring("property prpString")] HRESULT prpString([in] BSTR newVal); + [propget, id(38), helpstring("property prpFloat")] HRESULT prpFloat([out, retval] float *pVal); + [propput, id(38), helpstring("property prpFloat")] HRESULT prpFloat([in] float newVal); + [propget, id(39), helpstring("property prpDouble")] HRESULT prpDouble([out, retval] double *pVal); + [propput, id(39), helpstring("property prpDouble")] HRESULT prpDouble([in] double newVal); + [propget, id(40), helpstring("property prpVariant")] HRESULT prpVariant([out, retval] VARIANT *pVal); + [propput, id(40), helpstring("property prpVariant")] HRESULT prpVariant([in] VARIANT newVal); + [propget, id(41), helpstring("property prpArray")] HRESULT prpArray([out, retval]SAFEARRAY(VARIANT) *pVal); + [propput, id(41), helpstring("property prpArray")] HRESULT prpArray([in] SAFEARRAY(VARIANT) newVal); + [propget, id(42), helpstring("property prpObject")] HRESULT prpObject([out, retval] IDispatch* *pVal); + [propput, id(42), helpstring("property prpObject")] HRESULT prpObject([in] IDispatch* newVal); + [id(43), helpstring("method mixed1")] HRESULT mixed1( + [in, out] unsigned char* aChar, + [in, out] float *aFloat, + [in,out] VARIANT* inoutVar); + [id(44), helpstring("method inSequenceLong")] HRESULT inSequenceLong([in] SAFEARRAY(long) ar); + [id(45), helpstring("method inSequenceByte")] HRESULT inSequenceByte([in] SAFEARRAY(byte) ar); + [id(46), helpstring("method inSequenceShort")] HRESULT inSequenceShort([in] SAFEARRAY(short) ar); + [id(47), helpstring("method inSequenceString")] HRESULT inSequenceString([in] SAFEARRAY( BSTR) ar); + [id(48), helpstring("method inSequenceFloat")] HRESULT inSequenceFloat([in] SAFEARRAY(float) ar); + [id(49), helpstring("method inSequenceDouble")] HRESULT inSequenceDouble([in] SAFEARRAY(double) ar); + [id(50), helpstring("method inSequenceObject")] HRESULT inSequenceObject([in] SAFEARRAY(IDispatch*) ar); + [id(51), helpstring("method outSequenceByte")] HRESULT outSequenceByte([out] SAFEARRAY(unsigned char)* val); + [id(52), helpstring("method outSequenceShort")] HRESULT outSequenceShort([out] SAFEARRAY(short)* val); + [id(53), helpstring("method outSequenceLong")] HRESULT outSequenceLong([out] SAFEARRAY(long )*val); + [id(54), helpstring("method outSequenceString")] HRESULT outSequenceString([out] SAFEARRAY(BSTR)* val); + [id(55), helpstring("method outSequenceFloat")] HRESULT outSequenceFloat([out] SAFEARRAY(float)* val); + [id(56), helpstring("method outSequenceDouble")] HRESULT outSequenceDouble([out] SAFEARRAY(double)* val); + [id(57), helpstring("method outSequenceObject")] HRESULT outSequenceObject([out] SAFEARRAY(IDispatch*)* val); + [id(58), helpstring("method inoutSequenceByte")] HRESULT inoutSequenceByte([in,out] SAFEARRAY(unsigned char)* val); + [id(59), helpstring("method inoutSequenceShort")] HRESULT inoutSequenceShort([in,out] SAFEARRAY(short)* val); + [id(60), helpstring("method inoutSequenceLong")] HRESULT inoutSequenceLong([in,out] SAFEARRAY( long)*val); + [id(61), helpstring("method inoutSequenceString")] HRESULT inoutSequenceString([in,out] SAFEARRAY(BSTR)* val); + [id(62), helpstring("method inoutSequenceFloat")] HRESULT inoutSequenceFloat([in,out] SAFEARRAY(float)* val); + [id(63), helpstring("method inoutSequenceDouble")] HRESULT inoutSequenceDouble([in,out] SAFEARRAY(double)* val); + [id(64), helpstring("method inoutSequenceObject")] HRESULT inoutSequenceObject([in,out] SAFEARRAY(IDispatch*)* val); + [id(65), helpstring("method inMulDimArrayLong")] HRESULT inMulDimArrayLong([in] SAFEARRAY(long) val ); + [id(66), helpstring("method inMulDimArrayVariant")] HRESULT inMulDimArrayVariant([in] SAFEARRAY(VARIANT) val); + [id(67), helpstring("method inMulDimArrayLong2")] HRESULT inMulDimArrayLong2([in] SAFEARRAY(long) val); + [id(68), helpstring("method inMulDimArrayVariant2")] HRESULT inMulDimArrayVariant2([in] SAFEARRAY(VARIANT) val); + [id(69), helpstring("method inMulDimArrayByte")] HRESULT inMulDimArrayByte([in] SAFEARRAY(unsigned char) val); + [id(70), helpstring("method inMulDimArrayByte2")] HRESULT inMulDimArrayByte2([in] SAFEARRAY(unsigned char) val); + [id(71), helpstring("method outMore")] HRESULT outMore([out]long* val1, [out]long* val2); + + [id(72), helpstring("method optional1")] + HRESULT optional1([in] long val1, [in, optional] VARIANT* val2); + [id(73), helpstring("method optional2")] + HRESULT optional2([out] long* val1, [out, optional] VARIANT* val2); + [id(74), helpstring("method optional3")] + HRESULT optional3([in, optional] VARIANT* val1, [in, optional] VARIANT* val2); + [id(75), helpstring("method optional4")] + HRESULT optional4([in, out, optional] VARIANT* val1, [in, out, optional] VARIANT* val2); + [id(76), helpstring("method optional5")] + HRESULT optional5([out, optional] VARIANT* val1, [out, optional] VARIANT* val2); + //midl creates for val4 a BSTR "4" as default value in the TLB. The midl complains + //but the error message seems to be not for this case. + //in defaultvalue2 val4 has a VT_I4 in the TLB. This must be a bug! + [id(77), helpstring("method defaultvalue1")] + HRESULT defaultvalue1([in, defaultvalue(1)] long val1, + [in, defaultvalue(2)] double* val2, + // [in, defaultvalue(3)] VARIANT val3, //ok + [in, defaultvalue(4)] VARIANT* val4); + + // bug in midl: when val3 and val4 are pointers then the generated header creates + // for all params default values: + //HRESULT STDMETHODCALLTYPE defaultvalue2( + // /* [defaultvalue][in] */ long *val1 = 10, + // /* [defaultvalue][in] */ double *val2 = 3.14, + // /* [defaultvalue][in] */ VARIANT *val3 = 10, + // /* [defaultvalue][in] */ VARIANT *val4 = 100) = 0; + // And that does not compile. + //Therefore we must not include the midl generated header, instead use + // #import to create the interface header + [id(78), helpstring("method defaultvalue2")] + HRESULT defaultvalue2([in, out, defaultvalue(1)]long* val1, + [in, out, defaultvalue(2)] double* val2, + // [in, out, defaultvalue(3)] VARIANT *val3, + [in, out, defaultvalue(4)] VARIANT *val4); + + [id(79), helpstring("method varargfunc1"),vararg] + HRESULT varargfunc1([in] long val1, [in] SAFEARRAY(VARIANT) val2); + [id(80), helpstring("method varargfunc2")] + HRESULT varargfunc2([out] long* val1, [out] SAFEARRAY(VARIANT)* val2); + + + [id(86), helpstring("method inSequenceByteDim2")] HRESULT inSequenceByteDim2([in] SAFEARRAY(byte) val); + [id(87), helpstring("method inCurrency")] HRESULT inCurrency([in] CY val); + [id(88), helpstring("method outCurrency")] HRESULT outCurrency([out] CY* val); + [id(89), helpstring("method inoutCurrency")] HRESULT inoutCurrency([in,out] CY* val); + [id(90), helpstring("method inDate")] HRESULT inDate([in] DATE val); + [id(91), helpstring("method outDate")] HRESULT outDate([out] DATE* val); + [id(92), helpstring("method inoutDate")] HRESULT inoutDate([in,out] DATE* val); + [propget, id(93), helpstring("property prpCY")] HRESULT prpCurrency([out, retval] CY* pVal); + [propput, id(93), helpstring("property prpCY")] HRESULT prpCurrency([in] CY newVal); + [propget, id(94), helpstring("property prpDate")] HRESULT prpDate([out, retval] DATE* pVal); + [propput, id(94), helpstring("property prpDate")] HRESULT prpDate([in] DATE newVal); + [id(95), helpstring("method inDecimal")] HRESULT inDecimal([in] DECIMAL val); + [id(96), helpstring("method outDecimal")] HRESULT outDecimal([out] DECIMAL* val); + [id(97), helpstring("method inoutDecimal")] HRESULT inoutDecimal([in,out] DECIMAL* val); + [propget, id(98), helpstring("property prpDecimal")] HRESULT prpDecimal([out, retval] DECIMAL* pVal); + [propput, id(98), helpstring("property prpDecimal")] HRESULT prpDecimal([in] DECIMAL newVal); + [id(99), helpstring("method inSCode")] HRESULT inSCode([in] SCODE val); + [id(100), helpstring("method outScode")] HRESULT outScode([out] SCODE* val); + [id(101), helpstring("method inoutSCode")] HRESULT inoutSCode([in,out] SCODE* val); + [propget, id(102), helpstring("property prpSCode")] HRESULT prpSCode([out, retval] SCODE* pVal); + [propput, id(102), helpstring("property prpSCode")] HRESULT prpSCode([in] SCODE newVal); + [id(103), helpstring("method inrefLong")] HRESULT inrefLong([in] LONG* val); + [id(104), helpstring("method inrefVARIANT")] HRESULT inrefVariant([in] VARIANT* val); + [id(105), helpstring("method inrefDecimal")] HRESULT inrefDecimal(DECIMAL* val); + [propget, id(106), helpstring("property prpRefLong")] HRESULT prpRefLong([out, retval] long* pVal); + [propputref, id(106), helpstring("property prpRefLong")] HRESULT prpRefLong([in] long* newVal); + [propget, id(107), helpstring("property prprefVariant")] HRESULT prprefVariant([out, retval] VARIANT* pVal); + [propputref, id(107), helpstring("property prprefVariant")] HRESULT prprefVariant([in] VARIANT* newVal); + [propget, id(108), helpstring("property prprefDecimal")] HRESULT prprefDecimal([out, retval] DECIMAL* pVal); + [propputref, id(108), helpstring("property prprefDecimal")] HRESULT prprefDecimal([in] DECIMAL* newVal); + [id(109), helpstring("method optional6")] HRESULT optional6([in,optional] VARIANT* val1, + [in,optional] VARIANT * val2, [in,optional] VARIANT* val3, [in,optional] VARIANT* val4); + [id(110), helpstring("method optional7")] HRESULT optional7([out,optional] VARIANT* val1, + [out,optional] VARIANT * val2, [out,optional] VARIANT* val3, [out,optional] VARIANT* val4); + + [propget, id(111), helpstring("property prpMultiArg1")] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [out, optional, retval] VARIANT* pVal); + [propput, id(111), helpstring("property prpMultiArg1")] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [in] VARIANT* newVal); + [propget, id(112), helpstring("property prpMultiArg2")] HRESULT prpMultiArg2([in] VARIANT val1, [out, retval] VARIANT* pVal); + [propput, id(112), helpstring("property prpMultiArg2")] HRESULT prpMultiArg2([in] VARIANT val1, [in] VARIANT newVal); + [id(113), helpstring("method prpMultiArg2GetValues")] HRESULT prpMultiArg2GetValues([out] VARIANT* val1, [out] VARIANT* valProperty); + [propget, id(114), helpstring("property prpMultiArg3")] HRESULT prpMultiArg3([in,out] LONG* val1, [out, retval] LONG* pVal); + [propput, id(114), helpstring("property prpMultiArg3")] HRESULT prpMultiArg3([in,out] LONG* val1, [in] LONG newVal); + [id(115), helpstring("method inUnknown")] HRESULT inUnknown([in] IUnknown* val); + [id(116), helpstring("method outUnknown")] HRESULT outUnknown([out] IUnknown** val); + [id(117), helpstring("method inoutUnknown")] HRESULT inoutUnknown([in,out] IUnknown** val); + [propget, id(118), helpstring("property prpUnknown")] HRESULT prpUnknown([out, retval] IUnknown** pVal); + [propput, id(118), helpstring("property prpUnknown")] HRESULT prpUnknown([in] IUnknown* newVal); +}; + +[ + object, + uuid(96E6105A-A436-48b3-BFE7-C9302D927CCF), + dual, + helpstring("IFoo Interface"), + pointer_default(unique) +] +interface IFoo : IUnknown +{ + HRESULT Foo([in] IUnknown* val); +}; + +[ + uuid(BFE10EB1-8584-11D4-8335-005004526AB4), + version(1.0), + helpstring("AxTestComponents 1.0 Type Library") +] +library AXTESTCOMPONENTSLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(BFE10EBE-8584-11D4-8335-005004526AB4), + helpstring("Basic Class") + ] + coclass Basic + { + [default] interface IBasic; + }; + + [ + uuid(14DE9D5D-EB9D-4091-8E1B-A1B1672D8C1D), + helpstring("Foo Class") + ] + coclass Foo + { + [default] interface IFoo; + }; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.rc b/extensions/test/ole/AxTestComponents/AxTestComponents.rc new file mode 100644 index 000000000..da5d58f65 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.rc @@ -0,0 +1,155 @@ +/* + * 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 . + */ + +//Microsoft Developer Studio generated resource script. + +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS + + +// Generated from the TEXTINCLUDE 2 resource. + +#include "winres.h" + + +#undef APSTUDIO_READONLY_SYMBOLS + + +// German (Germany) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +#ifdef _WIN32 +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +#pragma code_page(1252) +#endif //_WIN32 + + + +// REGISTRY + + +IDR_BASIC REGISTRY DISCARDABLE "Basic.rgs" +IDR_FOO REGISTRY DISCARDABLE "Basic.rgs" +#endif // German (Germany) resources + + + + +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED + + +// TEXTINCLUDE + + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""AxTestComponents.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC + + +// Version + + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "AxTestComponents Module\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "AxTestComponents\0" + VALUE "LegalCopyright", "Copyright 2000\0" + VALUE "OriginalFilename", "AxTestComponents.DLL\0" + VALUE "ProductName", "AxTestComponents Module\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + + + +// String Table + + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "AxTestComponents" +END + +#endif // English (U.S.) resources + + + + +#ifndef APSTUDIO_INVOKED + + +// Generated from the TEXTINCLUDE 3 resource. + +1 TYPELIB "AxTestComponents.tlb" + + +#endif // not APSTUDIO_INVOKED + diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.sln b/extensions/test/ole/AxTestComponents/AxTestComponents.sln new file mode 100644 index 000000000..eadaa373e --- /dev/null +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.sln @@ -0,0 +1,31 @@ +Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AxTestComponents", "AxTestComponents.vcproj", "{CF6DC513-B04E-420A-A0F9-6D1F4046D098}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release MinDependency|Win32 = Release MinDependency|Win32
+ Release MinSize|Win32 = Release MinSize|Win32
+ Unicode Debug|Win32 = Unicode Debug|Win32
+ Unicode Release MinDependency|Win32 = Unicode Release MinDependency|Win32
+ Unicode Release MinSize|Win32 = Unicode Release MinSize|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Debug|Win32.Build.0 = Debug|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Release MinDependency|Win32.ActiveCfg = Release MinDependency|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Release MinDependency|Win32.Build.0 = Release MinDependency|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Release MinSize|Win32.ActiveCfg = Release MinSize|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Release MinSize|Win32.Build.0 = Release MinSize|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Release MinDependency|Win32.ActiveCfg = Unicode Release MinDependency|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Release MinDependency|Win32.Build.0 = Unicode Release MinDependency|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Release MinSize|Win32.ActiveCfg = Unicode Release MinSize|Win32
+ {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Release MinSize|Win32.Build.0 = Unicode Release MinSize|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.vcproj b/extensions/test/ole/AxTestComponents/AxTestComponents.vcproj new file mode 100644 index 000000000..078daba3d --- /dev/null +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.vcproj @@ -0,0 +1,819 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="AxTestComponents"
+ ProjectGUID="{CF6DC513-B04E-420A-A0F9-6D1F4046D098}"
+ RootNamespace="AxTestComponents"
+ Keyword="AtlProj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Unicode Release MinDependency|Win32"
+ OutputDirectory=".\ReleaseUMinDependency"
+ IntermediateDirectory=".\ReleaseUMinDependency"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ UseOfATL="1"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseUMinDependency/AxTestComponents.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseUMinDependency/AxTestComponents.pch"
+ AssemblerListingLocation=".\ReleaseUMinDependency/"
+ ObjectFile=".\ReleaseUMinDependency/"
+ ProgramDataBaseFileName=".\ReleaseUMinDependency/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\ReleaseUMinDependency/AxTestComponents.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\AxTestComponents.def"
+ ProgramDatabaseFile=".\ReleaseUMinDependency/AxTestComponents.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseUMinDependency/AxTestComponents.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release MinSize|Win32"
+ OutputDirectory=".\ReleaseMinSize"
+ IntermediateDirectory=".\ReleaseMinSize"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ UseOfATL="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseMinSize/AxTestComponents.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseMinSize/AxTestComponents.pch"
+ AssemblerListingLocation=".\ReleaseMinSize/"
+ ObjectFile=".\ReleaseMinSize/"
+ ProgramDataBaseFileName=".\ReleaseMinSize/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\ReleaseMinSize/AxTestComponents.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\AxTestComponents.def"
+ ProgramDatabaseFile=".\ReleaseMinSize/AxTestComponents.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseMinSize/AxTestComponents.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode Release MinSize|Win32"
+ OutputDirectory=".\ReleaseUMinSize"
+ IntermediateDirectory=".\ReleaseUMinSize"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ UseOfATL="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseUMinSize/AxTestComponents.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseUMinSize/AxTestComponents.pch"
+ AssemblerListingLocation=".\ReleaseUMinSize/"
+ ObjectFile=".\ReleaseUMinSize/"
+ ProgramDataBaseFileName=".\ReleaseUMinSize/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\ReleaseUMinSize/AxTestComponents.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\AxTestComponents.def"
+ ProgramDatabaseFile=".\ReleaseUMinSize/AxTestComponents.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseUMinSize/AxTestComponents.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release MinDependency|Win32"
+ OutputDirectory=".\ReleaseMinDependency"
+ IntermediateDirectory=".\ReleaseMinDependency"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ UseOfATL="1"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseMinDependency/AxTestComponents.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseMinDependency/AxTestComponents.pch"
+ AssemblerListingLocation=".\ReleaseMinDependency/"
+ ObjectFile=".\ReleaseMinDependency/"
+ ProgramDataBaseFileName=".\ReleaseMinDependency/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\ReleaseMinDependency/AxTestComponents.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\AxTestComponents.def"
+ ProgramDatabaseFile=".\ReleaseMinDependency/AxTestComponents.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseMinDependency/AxTestComponents.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/AxTestComponents.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Debug/AxTestComponents.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Debug/AxTestComponents.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\AxTestComponents.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/AxTestComponents.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Debug/AxTestComponents.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode Debug|Win32"
+ OutputDirectory=".\DebugU"
+ IntermediateDirectory=".\DebugU"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\DebugU/AxTestComponents.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\DebugU/AxTestComponents.pch"
+ AssemblerListingLocation=".\DebugU/"
+ ObjectFile=".\DebugU/"
+ ProgramDataBaseFileName=".\DebugU/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\DebugU/AxTestComponents.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\AxTestComponents.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\DebugU/AxTestComponents.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\DebugU/AxTestComponents.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath=".\AxTestComponents.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AxTestComponents.def"
+ >
+ </File>
+ <File
+ RelativePath=".\AxTestComponents.idl"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\AxTestComponents.tlb"
+ HeaderFileName="AxTestComponents.h"
+ InterfaceIdentifierFileName="AxTestComponents_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\AxTestComponents.tlb"
+ HeaderFileName="AxTestComponents.h"
+ InterfaceIdentifierFileName="AxTestComponents_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\AxTestComponents.tlb"
+ HeaderFileName="AxTestComponents.h"
+ InterfaceIdentifierFileName="AxTestComponents_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\AxTestComponents.tlb"
+ HeaderFileName="AxTestComponents.h"
+ InterfaceIdentifierFileName="AxTestComponents_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\AxTestComponents.tlb"
+ HeaderFileName="AxTestComponents.h"
+ InterfaceIdentifierFileName="AxTestComponents_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\AxTestComponents.tlb"
+ HeaderFileName="AxTestComponents.h"
+ InterfaceIdentifierFileName="AxTestComponents_i.c"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\AxTestComponents.rc"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Basic.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=" /Ob0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="Foo.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\StdAfx.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\Basic.h"
+ >
+ </File>
+ <File
+ RelativePath="Foo.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\StdAfx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\Basic.rgs"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/extensions/test/ole/AxTestComponents/Basic.cpp b/extensions/test/ole/AxTestComponents/Basic.cpp new file mode 100644 index 000000000..8aad56e8a --- /dev/null +++ b/extensions/test/ole/AxTestComponents/Basic.cpp @@ -0,0 +1,1356 @@ +/* -*- 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 "stdafx.h" +#include "Basic.h" + + + +// CBasic +CBasic::CBasic(): m_cPrpByte(0),m_nPrpShort(0),m_lPrpLong(0),m_fPrpFloat(0), m_dPrpDouble(0),m_PrpArray(0), +m_safearray(NULL), m_bool(VARIANT_FALSE), +m_arByte(0), m_arShort(0), m_arLong(0), m_arString(0), m_arVariant(0), m_arFloat(0), +m_arDouble(0), m_arObject(0), m_arByteDim2(0), m_date(0.), m_scode(0) + +{ + memset(&m_cy, 0, sizeof(CY)); + memset(&m_decimal, 0, sizeof(DECIMAL)); +} + +CBasic::~CBasic() +{ + SafeArrayDestroy(m_safearray); + SafeArrayDestroy(m_arByte); + SafeArrayDestroy(m_arShort); + SafeArrayDestroy(m_arLong); + SafeArrayDestroy(m_arString); + SafeArrayDestroy(m_arVariant); + SafeArrayDestroy(m_arFloat); + SafeArrayDestroy(m_arDouble); + SafeArrayDestroy(m_arObject); + SafeArrayDestroy(m_arByteDim2); + +} +STDMETHODIMP CBasic::inBool(VARIANT_BOOL val) +{ + m_bool = val; + return S_OK; +} +STDMETHODIMP CBasic::inByte(unsigned char val) +{ + m_byte = val; + return S_OK; +} + +STDMETHODIMP CBasic::inShort(short val) +{ + m_short = val; + return S_OK; +} + +STDMETHODIMP CBasic::inLong(long val) +{ + m_long = val; + return S_OK; +} + +STDMETHODIMP CBasic::inString(BSTR val) +{ + m_bstr = val; + return S_OK; +} + +STDMETHODIMP CBasic::inFloat(float val) +{ + m_float = val; + return S_OK; +} + +STDMETHODIMP CBasic::inDouble(double val) +{ + m_double = val; + + CComVariant varDest; + CComVariant varSource(val); + HRESULT hr = VariantChangeType(&varDest, &varSource, 0, VT_BSTR); + return S_OK; +} + +STDMETHODIMP CBasic::inVariant(VARIANT val) +{ + m_var1 = val; + return S_OK; +} + +STDMETHODIMP CBasic::inArray(LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_safearray))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, &m_safearray))) + return hr; + return S_OK; +} + +STDMETHODIMP CBasic::inObject(IDispatch *val) +{ + m_obj = val; + return S_OK; +} + +STDMETHODIMP CBasic::inoutBool(VARIANT_BOOL* val) +{ + VARIANT_BOOL aBool = *val; + *val = m_bool; + m_bool = aBool; + return S_OK; +} + + +STDMETHODIMP CBasic::inoutByte(unsigned char* val) +{ + unsigned char aByte = *val; + *val = m_byte; + m_byte = aByte; + return S_OK; +} + +STDMETHODIMP CBasic::inoutShort(short *val) +{ + short aShort = *val; + *val = m_short; + m_short = aShort; + return S_OK; +} + +STDMETHODIMP CBasic::inoutLong(long *val) +{ + long aLong = *val; + *val = m_long; + m_long = aLong; + return S_OK; +} + +STDMETHODIMP CBasic::inoutString(BSTR *val) +{ + CComBSTR aStr = *val; + HRESULT hr = S_OK; + if (FAILED( hr = m_bstr.CopyTo(val))) + return hr; + m_bstr = aStr; + return S_OK; +} + +STDMETHODIMP CBasic::inoutFloat(float *val) +{ + float aFloat = *val; + *val = m_float; + m_float = aFloat; + return S_OK; +} + +STDMETHODIMP CBasic::inoutDouble(double *val) +{ + double aDouble = *val; + *val = m_double; + m_double = aDouble; + return S_OK; +} + +STDMETHODIMP CBasic::inoutVariant(VARIANT *val) +{ + CComVariant aVar = *val; + HRESULT hr = S_OK; + if (FAILED(hr = VariantCopy(val, &m_var1))) + return hr; + m_var1 = aVar; + return S_OK; +} + +/* The array contains VARIANT according to IDL. + If the VARIANTs contain strings then we append "out" to each string. +*/ +STDMETHODIMP CBasic::inoutArray(LPSAFEARRAY *val) +{ + SAFEARRAY* aAr = NULL; + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayCopy(*val, &aAr))) + return hr; + if (FAILED(hr = SafeArrayCopy(m_safearray, val))) + return hr; + if (FAILED(hr = SafeArrayCopy(aAr, & m_safearray))) + return hr; + return S_OK; +} + +STDMETHODIMP CBasic::inoutObject(IDispatch **val) +{ + CComPtr<IDispatch> disp = *val; + if (*val) + (*val)->Release(); + *val = m_obj; + if (*val) + (*val)->AddRef(); + m_obj = disp; + return S_OK; +} + + +STDMETHODIMP CBasic::outBool(VARIANT_BOOL* val) +{ + *val = m_bool; + return S_OK; +} + +STDMETHODIMP CBasic::outByte(unsigned char *val) +{ + *val= m_byte; + return S_OK; +} + +STDMETHODIMP CBasic::outShort(short *val) +{ + *val= m_short; + return S_OK; +} + +STDMETHODIMP CBasic::outLong(long *val) +{ + *val= m_long; + return S_OK; +} + +STDMETHODIMP CBasic::outString(BSTR *val) +{ + *val= SysAllocString(m_bstr); + return S_OK; +} + +STDMETHODIMP CBasic::outFloat(float *val) +{ + *val= m_float; + return S_OK; +} + +STDMETHODIMP CBasic::outDouble(double *val) +{ + *val= m_double; + return S_OK; +} + +STDMETHODIMP CBasic::outVariant(VARIANT *val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = VariantCopy(val, &m_var1))) + return hr; + return S_OK; +} + +STDMETHODIMP CBasic::outArray(LPSAFEARRAY *val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayCopy(m_safearray, val))) + return false; + return S_OK; +} + +STDMETHODIMP CBasic::outObject(IDispatch* *val) +{ + *val = m_obj; + if (m_obj) + (*val)->AddRef(); + + return S_OK; +} + + +STDMETHODIMP CBasic::get_prpBool(VARIANT_BOOL* pVal) +{ + if (!pVal) return E_POINTER; + *pVal = m_bool; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpBool(VARIANT_BOOL val) +{ + m_bool = val; + return S_OK; +} + + +STDMETHODIMP CBasic::get_prpByte(unsigned char *pVal) +{ + if( !pVal) + return E_POINTER; + *pVal= m_cPrpByte; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpByte(unsigned char newVal) +{ + m_cPrpByte= newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpShort(short *pVal) +{ + if( !pVal) + return E_POINTER; + *pVal= m_nPrpShort; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpShort(short newVal) +{ + m_nPrpShort= newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpLong(long *pVal) +{ + if( !pVal) + return E_POINTER; + *pVal= m_lPrpLong; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpLong(long newVal) +{ + m_lPrpLong= newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpString(BSTR *pVal) +{ + if( !pVal) + return E_POINTER; + m_bstrPrpString.CopyTo( pVal ); + return S_OK; +} + +STDMETHODIMP CBasic::put_prpString(BSTR newVal) +{ + m_bstrPrpString= newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpFloat(float *pVal) +{ + if( !pVal) + return E_POINTER; + *pVal= m_fPrpFloat; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpFloat(float newVal) +{ + m_fPrpFloat= newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpDouble(double *pVal) +{ + if( !pVal) + return E_POINTER; + *pVal= m_dPrpDouble; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpDouble(double newVal) +{ + m_dPrpDouble= newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpVariant(VARIANT *pVal) +{ + if( !pVal) + return E_POINTER; + HRESULT hr = S_OK; + if (FAILED(hr = VariantCopy( pVal, &m_PropVariant))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::put_prpVariant(VARIANT newVal) +{ + m_PropVariant= newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpArray(LPSAFEARRAY *pVal) +{ + if( !pVal) + return E_POINTER; + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayCopy( m_PrpArray, pVal))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::put_prpArray(LPSAFEARRAY newVal) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy( m_PrpArray))) + return hr; + if (FAILED(hr = SafeArrayCopy( newVal, &m_PrpArray))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::get_prpObject(IDispatch **pVal) +{ + if( !pVal) + return E_POINTER; + *pVal= m_PrpObject; + if( *pVal != NULL) + (*pVal)->AddRef(); + return S_OK; +} + +STDMETHODIMP CBasic::put_prpObject(IDispatch *newVal) +{ + m_PrpObject= newVal; + return S_OK; +} + +STDMETHODIMP CBasic::mixed1( + /* [out][in] */ unsigned char *aChar, + /* [out][in] */ float *aFloat, + /* [out][in] */ VARIANT *aVar) + +{ + HRESULT hr= S_OK; + inoutByte(aChar); + inoutFloat(aFloat); + inoutVariant(aVar); + return hr; +} + + + + +// VT_UI1 + +STDMETHODIMP CBasic::inSequenceLong(LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_arLong))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, & m_arLong))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::inSequenceByte( LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_arByte))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, & m_arByte))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::inSequenceShort(LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_arShort))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, & m_arShort))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::inSequenceString(LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_arString))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, & m_arString))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::inSequenceFloat(LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_arFloat))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, & m_arFloat))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::inSequenceDouble(LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_arDouble))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, & m_arDouble))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::inSequenceObject(LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_arObject))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, & m_arObject))) + return hr; + return hr; +} + +void CBasic::printArray( LPSAFEARRAY val, BSTR message, VARTYPE type) +{ + + HRESULT hr= S_OK; + USES_CONVERSION; + long lbound=0; + long ubound= 0; + hr= SafeArrayGetLBound( val, 1, &lbound); + hr= SafeArrayGetUBound( val, 1, &ubound); + long length= ubound - lbound +1; + + CComVariant varElement; + char buf[1024]; + sprintf( buf,"%s", W2A(message)); + + for( long i= 0; i < length ; i++) + { + char tmp[1024]; + long data=0; + CComVariant var; + switch( type) + { + case VT_UI1: + case VT_I2: + case VT_I4: + case VT_ERROR: + hr= SafeArrayGetElement( val, &i, (void*)&data); + sprintf( tmp, "%ld \n", *(long*)&data); + break; + case VT_BSTR: + hr= SafeArrayGetElement( val, &i, (void*)&data); + sprintf( tmp, "%S \n", (BSTR)data); + break; + case VT_VARIANT: + hr= SafeArrayGetElement( val, &i, &var); + sprintf( tmp, "%x \n", var.byref); + break; + case VT_R4: + hr= SafeArrayGetElement( val, &i, (void*)&data); + sprintf( tmp, "%f \n", *(float*) &data); + break; + case VT_R8: ; + hr= SafeArrayGetElement( val, &i, (void*)&data); + sprintf( tmp, "%f \n", *(double*) &data); + break; + case VT_DISPATCH: + // we assume the objects are instances of this component and have the + // property prpString set. + hr= SafeArrayGetElement( val, &i, (void*)&data); + IDispatch* pdisp= ( IDispatch*) data; + CComDispatchDriver driver( pdisp); + CComVariant var; + if( pdisp) + { + driver.GetPropertyByName(L"prpString", &var); + sprintf( tmp, "%x : %S \n", *(long*)&data, var.bstrVal); + } + else + sprintf( tmp, "%x\n", *(long*)&data); + } + + strcat( buf, tmp); + } + MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK); + +} +// V_ERROR OLECHAR VARIANT VT_UI1 + +STDMETHODIMP CBasic::outSequenceByte(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + hr = SafeArrayCopy(m_arByte, val); + return hr; +} + +STDMETHODIMP CBasic::outSequenceShort(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + hr = SafeArrayCopy(m_arShort, val); + return hr; +} + +STDMETHODIMP CBasic::outSequenceLong(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + hr = SafeArrayCopy(m_arLong, val); + return hr; +} + +STDMETHODIMP CBasic::outSequenceString(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + hr = SafeArrayCopy(m_arString, val); + return hr; +} + +STDMETHODIMP CBasic::outSequenceFloat(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + hr = SafeArrayCopy(m_arFloat, val); + return hr; +} + +STDMETHODIMP CBasic::outSequenceDouble(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + hr = SafeArrayCopy(m_arDouble, val); + return hr; +} + +STDMETHODIMP CBasic::outSequenceObject(LPSAFEARRAY* val) +{ + HRESULT hr = S_OK; + hr = SafeArrayCopy(m_arObject, val); + return S_OK; +} + +STDMETHODIMP CBasic::inoutSequenceByte(LPSAFEARRAY* val) +{ + HRESULT hr = S_OK; + SAFEARRAY *arTemp = NULL; + if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) + return hr; + if (FAILED(hr = SafeArrayCopy(m_arByte, val))) + return hr; + m_arByte = arTemp; + return hr; +} + +STDMETHODIMP CBasic::inoutSequenceShort(LPSAFEARRAY* val) +{ + HRESULT hr = S_OK; + SAFEARRAY *arTemp = NULL; + if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) + return hr; + if (FAILED(hr = SafeArrayCopy(m_arShort, val))) + return hr; + m_arShort = arTemp; + return hr; +} + +STDMETHODIMP CBasic::inoutSequenceLong(LPSAFEARRAY* val) +{ + HRESULT hr = S_OK; + SAFEARRAY *arTemp = NULL; + if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) + return hr; + if (FAILED(hr = SafeArrayCopy(m_arLong, val))) + return hr; + m_arLong = arTemp; + return hr; +} + +STDMETHODIMP CBasic::inoutSequenceString(LPSAFEARRAY* val) +{ + HRESULT hr = S_OK; + SAFEARRAY *arTemp = NULL; + if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) + return hr; + if (FAILED(hr = SafeArrayCopy(m_arString, val))) + return hr; + m_arString = arTemp; + return hr; +} + +STDMETHODIMP CBasic::inoutSequenceFloat(LPSAFEARRAY* val) +{ + HRESULT hr = S_OK; + SAFEARRAY *arTemp = NULL; + if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) + return hr; + if (FAILED(hr = SafeArrayCopy(m_arFloat, val))) + return hr; + m_arFloat = arTemp; + return hr; +} + +STDMETHODIMP CBasic::inoutSequenceDouble(LPSAFEARRAY* val) +{ + HRESULT hr = S_OK; + SAFEARRAY *arTemp = NULL; + if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) + return hr; + if (FAILED(hr = SafeArrayCopy(m_arDouble, val))) + return hr; + m_arDouble = arTemp; + return hr; +} + +STDMETHODIMP CBasic::inoutSequenceObject(LPSAFEARRAY* val) +{ + HRESULT hr = S_OK; + SAFEARRAY *arTemp = NULL; + if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) + return hr; + if (FAILED(hr = SafeArrayCopy(m_arObject, val))) + return hr; + m_arObject = arTemp; + return hr; +} + +// 2-dimensional Array +STDMETHODIMP CBasic::inMulDimArrayLong(LPSAFEARRAY val) +{ + printMulArray( val, VT_I4); + return S_OK; +} +// 2-dimensional Array +STDMETHODIMP CBasic::inMulDimArrayVariant(LPSAFEARRAY val) +{ + printMulArray( val, VT_VARIANT); + return S_OK; +} +// 3-dimensional Array +STDMETHODIMP CBasic::inMulDimArrayLong2(LPSAFEARRAY val) +{ + printMulArray( val, VT_I4); + return S_OK; +} +// 3-dimensional Array +STDMETHODIMP CBasic::inMulDimArrayVariant2(LPSAFEARRAY val) +{ + return S_OK; +} + + +STDMETHODIMP CBasic::inMulDimArrayByte(LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_arByteDim2))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, & m_arByteDim2))) + return hr; + return hr; +} +// 3-dimensionales array +STDMETHODIMP CBasic::inMulDimArrayByte2(LPSAFEARRAY val) +{ + + // TODO: Add your implementation code here + //printMulArray( val, VT_UI1); + return S_OK; +} + +// supports 2 and 3 dimensional SAFEARRAY with elements of long or VARIANT +void CBasic::printMulArray( SAFEARRAY* val, VARTYPE type) +{ + HRESULT hr= S_OK; + UINT dims= SafeArrayGetDim( val); + long lbound1; + long ubound1; + long lbound2; + long ubound2; + long lbound3; + long ubound3; + long length1; + long length2; + + char buff[4096]; + buff[0]=0; + + if( dims == 2) + { + hr= SafeArrayGetLBound( val, 1, &lbound1); + hr= SafeArrayGetUBound( val, 1, &ubound1); + length1= ubound1 - lbound1 +1; + + hr= SafeArrayGetLBound( val, 2, &lbound2); + hr= SafeArrayGetUBound( val, 2, &ubound2); + length2= ubound2 - lbound2 + 1; + char tmpBuf[1024]; + tmpBuf[0]=0; + long index[2]; + for( long i= 0; i< length2; i++) + { + for( long j= 0; j<length1; j++) + { + index[0]= j; + index[1]= i; + long longVal; + CComVariant var; + switch( type) + { + case VT_I4: + hr= SafeArrayGetElement( val, index, &longVal); + sprintf( tmpBuf, "(%ld,%ld): %ld\n", index[1], index[0], longVal); + break; + case VT_UI1: + hr= SafeArrayGetElement( val, index, &longVal); + sprintf( tmpBuf, "(%ld,%ld): %d\n", index[1], index[0], (unsigned char)longVal); + break; + case VT_VARIANT: + hr= SafeArrayGetElement( val, index, &var ); + sprintf( tmpBuf, "(%ld,%ld): %d (vartype %d)\n", index[1], index[0], var.byref, var.vt); + break; + } + strcat( buff,tmpBuf); + } + + } + + + } + else if( dims == 3 ) + { + hr= SafeArrayGetLBound( val, 1, &lbound1); + hr= SafeArrayGetUBound( val, 1, &ubound1); + length1= ubound1 - lbound1 +1; + + hr= SafeArrayGetLBound( val, 2, &lbound2); + hr= SafeArrayGetUBound( val, 2, &ubound2); + length2= ubound2 - lbound2 + 1; + + hr= SafeArrayGetLBound( val, 3, &lbound3); + hr= SafeArrayGetUBound( val, 3, &ubound3); + long length3= ubound3 - lbound3 +1; + char tmpBuf[1024]; + tmpBuf[0]=0; + long index[3]; + for( long i= 0; i< length3; i++) + { + for( long j= 0; j<length2; j++) + { + for( long k= 0; k<length1; k++) + { + index[0]= k; + index[1]= j; + index[2]= i; + long longVal; + CComVariant var; + switch( type) + { + case VT_I4: + hr= SafeArrayGetElement( val, index, &longVal); + sprintf( tmpBuf, "(%ld,%ld,%ld): %ld\n", index[2], index[1], index[0], longVal); + break; + case VT_UI1: + hr= SafeArrayGetElement( val, index, &longVal); + sprintf( tmpBuf, "(%ld,%ld,%ld): %d\n", index[2], index[1], index[0], (unsigned char)longVal); + break; + + case VT_VARIANT: + hr= SafeArrayGetElement( val, index, &var ); + sprintf( tmpBuf, "(%ld,%ld,%ld): %d (vartype %d)\n", index[2], index[1], index[0], var.byref, var.vt); + break; + } + strcat( buff,tmpBuf); + } + } + + } + + } + + MessageBox( NULL, A2T( buff), _T("AxTestControl.Basic"), MB_OK); + + +} + + + + +STDMETHODIMP CBasic::outMore(long* val1, long* val2) +{ + // TODO: Add your implementation code here + *val1= 111; + *val2= 112; + return S_OK; +} +// If an optional parameter was not provided then the respective member will +// not be set +STDMETHODIMP CBasic::optional1(/*[in]*/ long val1, /*[in, optional]*/ VARIANT* val2) +{ + m_long = val1; + if (val2->vt != VT_ERROR) + m_var1 = *val2; + return S_OK; +} + +STDMETHODIMP CBasic::optional2(/*[out]*/ long* val1,/*[out, optional]*/ VARIANT* val2) +{ + HRESULT hr = S_OK; + *val1 = m_long; + + if (val2->vt != VT_ERROR) + hr = VariantCopy(val2, & m_var1); + return hr; +} + +STDMETHODIMP CBasic::optional3(/*[in, optional]*/ VARIANT* val1,/*[in, optional]*/ VARIANT* val2) +{ + //if (val1->vt != VT_ERROR) + m_var1 = *val1; + + //if (val2->vt != VT_ERROR) + m_var2 = *val2; + return S_OK; +} + +STDMETHODIMP CBasic::optional4(/*[in, out, optional]*/ VARIANT* val1, + /*[in, out, optional]*/ VARIANT* val2) +{ + HRESULT hr = S_OK; + //return the previously set in values + if (val1->vt != VT_ERROR) + { + CComVariant var1(*val1); + if (FAILED(hr = VariantCopy(val1, & m_var1))) + return hr; + m_var1 = var1; + } + if (val2->vt != VT_ERROR) + { + CComVariant var2(*val2); + if (FAILED(hr = VariantCopy(val2, & m_var2))) + return hr; + m_var2 = var2; + } + return hr; +} + +STDMETHODIMP CBasic::optional5(/*[out, optional]*/ VARIANT* val1, + /*[out, optional]*/ VARIANT* val2) +{ + HRESULT hr = S_OK; + if (FAILED(hr = VariantCopy(val1, &m_var1))) + return hr; + if (FAILED(hr = VariantCopy(val2, &m_var2))) + return hr; + return hr; +} + +STDMETHODIMP CBasic::defaultvalue1(/*[in, defaultvalue(10)]*/ long val1, + /*[in, defaultvalue(3.14)]*/ double* val2, + // /*[in, defaultvalue(10)]*/ VARIANT val3, + /*[in, defaultvalue(100)]*/ VARIANT* val4) +{ + m_long = val1; + m_double = *val2; +// m_var1 = val3; + m_var2 = *val4; + return S_OK; +} +STDMETHODIMP CBasic::defaultvalue2(/*[in, out, defaultvalue(10)]*/ long* val1, + /*[in, out, defaultvalue(3.14)]*/ double* val2, + // /*[in, out, defaultvalue(10)]*/ VARIANT* val3, + /*[in, out, defaultvalue(100)]*/ VARIANT* val4) +{ + HRESULT hr = S_OK; + long aLong = *val1; + double aDouble = *val2; +// CComVariant var1(*val3); + CComVariant var2(*val4); + *val1 = m_long; + *val2 = m_double; + //if (FAILED(hr = VariantCopy(val3, &m_var1))) + // return hr; + if (FAILED(hr = VariantCopy(val4, &m_var2))) + return hr; + m_long = aLong; + m_double = aDouble; +// m_var1 = var1; + m_var2 = var2; + return hr; +} +/* val2 contains the variable argument list. If no such arguments are supplied + then the safearray is invalid. SafeArrayCopy then returns E_INVALIDARG +*/ +STDMETHODIMP CBasic::varargfunc1(/*[in]*/ long val1,/*[in]*/ LPSAFEARRAY val2) +{ + m_long = val1; + + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_safearray))) + return hr; + if (FAILED(hr = SafeArrayCopy(val2, & m_safearray))) + { + if (hr != E_INVALIDARG) + return hr; + } + return S_OK; +} + +STDMETHODIMP CBasic::varargfunc2(/*[out]*/ long* val1, /*[out]*/ SAFEARRAY ** val2) +{ + *val1 = m_long; + HRESULT hr = SafeArrayCopy(m_safearray, val2); + return hr; +} + +STDMETHODIMP CBasic::inSequenceByteDim2(LPSAFEARRAY val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = SafeArrayDestroy(m_arByteDim2))) + return hr; + if (FAILED(hr = SafeArrayCopy(val, & m_arByteDim2))) + return hr; + return hr; +} + + +STDMETHODIMP CBasic::inCurrency(CY val) +{ + m_cy = val; + return S_OK; +} + +STDMETHODIMP CBasic::outCurrency(CY* val) +{ + *val = m_cy; + return S_OK; +} + +STDMETHODIMP CBasic::inoutCurrency(CY* val) +{ + CY tmp = *val; + *val = m_cy; + m_cy = tmp; + return S_OK; +} + +STDMETHODIMP CBasic::inDate(DATE val) +{ + m_date = val; + return S_OK; +} + +STDMETHODIMP CBasic::outDate(DATE* val) +{ + *val = m_date; + return S_OK; +} + +STDMETHODIMP CBasic::inoutDate(DATE* val) +{ + DATE tmp = *val; + *val = m_date; + m_date = tmp; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpCurrency(CY* pVal) +{ + *pVal = m_cy; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpCurrency(CY newVal) +{ + m_cy = newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpDate(DATE* pVal) +{ + *pVal = m_date; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpDate(DATE newVal) +{ + m_date = newVal; + return S_OK; +} + +//VT_I4 DECIMAL_NEG //tagVARIANT DISPATCH_PROPERTYPUT +STDMETHODIMP CBasic::inDecimal(DECIMAL val) +{ + m_decimal = val; + return S_OK; +} + +STDMETHODIMP CBasic::outDecimal(DECIMAL* val) +{ + * val = m_decimal; + return S_OK; +} + +STDMETHODIMP CBasic::inoutDecimal(DECIMAL* val) +{ + DECIMAL tmp; + tmp = * val; + * val = m_decimal; + m_decimal = tmp; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpDecimal(DECIMAL* pVal) +{ + * pVal = m_decimal; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpDecimal(DECIMAL newVal) +{ + m_decimal = newVal; + return S_OK; +} + +STDMETHODIMP CBasic::inSCode(SCODE val) +{ + m_scode = val; + return S_OK; +} + +STDMETHODIMP CBasic::outScode(SCODE* val) +{ + * val = m_scode; + return S_OK; +} + +STDMETHODIMP CBasic::inoutSCode(SCODE* val) +{ + SCODE tmp = *val; + * val = m_scode; + m_scode = tmp; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpSCode(SCODE* pVal) +{ + * pVal = m_scode; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpSCode(SCODE newVal) +{ + m_scode = newVal; + return S_OK; +} + +STDMETHODIMP CBasic::inrefLong(LONG* val) +{ + m_long = * val; + return S_OK; +} + +STDMETHODIMP CBasic::inrefVariant(VARIANT* val) +{ + HRESULT hr = S_OK; + if (FAILED(hr = VariantCopy( & m_var1, val))) + return hr; + return S_OK; +} + +STDMETHODIMP CBasic::inrefDecimal(DECIMAL* val) +{ + m_decimal = * val; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpRefLong(long* pVal) +{ + *pVal = m_long; + return S_OK; +} + +STDMETHODIMP CBasic::putref_prpRefLong(long* newVal) +{ + m_long = * newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prprefVariant(VARIANT* pVal) +{ + HRESULT hr = S_OK; + hr = VariantCopy(pVal, & m_var1); + return hr; +} + +STDMETHODIMP CBasic::putref_prprefVariant(VARIANT* newVal) +{ + m_var1 = * newVal; + return S_OK; +} + +STDMETHODIMP CBasic::get_prprefDecimal(DECIMAL* pVal) +{ + * pVal = m_decimal; + return S_OK; +} + +STDMETHODIMP CBasic::putref_prprefDecimal(DECIMAL* newVal) +{ + m_decimal = *newVal; + return S_OK; +} + + +STDMETHODIMP CBasic::optional6(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4) +{ + HRESULT hr = S_OK; + if (FAILED(hr = m_var1.Copy(val1))) + return hr; + if (FAILED(hr = m_var2.Copy(val2))) + return hr; + if (FAILED(hr = m_var3.Copy(val3))) + return hr; + if (FAILED(hr = m_var4.Copy(val4))) + return hr; + return S_OK; +} + +STDMETHODIMP CBasic::optional7(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4) +{ + HRESULT hr = S_OK; + if (FAILED(hr = VariantCopy(val1, & m_var1))) + return hr; + if (FAILED(hr = VariantCopy(val2, & m_var2))) + return hr; + if (FAILED(hr = VariantCopy(val3, & m_var3))) + return hr; + if (FAILED(hr = VariantCopy(val4, & m_var4))) + return hr; + + return S_OK; +} + +STDMETHODIMP CBasic::get_prpMultiArg1(VARIANT* val1, VARIANT* val2, VARIANT* pVal) +{ + HRESULT hr = S_OK; + CComVariant tmp1(*val1); + CComVariant tmp2(*val2); + + if (FAILED(hr = VariantCopy(val1, & m_var1))) + return hr; + if (FAILED(hr = VariantCopy(val2, & m_var2))) + return hr; + m_var1 = tmp1; + m_var2 = tmp2; + if (FAILED(hr = VariantCopy(pVal, & m_var3))) + return hr; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpMultiArg1(VARIANT* val1, VARIANT* val2, VARIANT* newVal) +{ + HRESULT hr = S_OK; + CComVariant tmp1( * val1); + CComVariant tmp2( * val2); + + if (FAILED(hr = VariantCopy(val1, & m_var1))) + return hr; + if (FAILED(hr = VariantCopy(val2, & m_var2))) + return hr; + m_var1 = tmp1; + m_var2 = tmp2; + + m_var3 = *newVal; + return S_OK; +} + +// tagVARIANT DISPATCH_PROPERTYPUT DISPID_PROPERTYPUT VARIANTARG LOCALE_USER_DEFAULT + +STDMETHODIMP CBasic::get_prpMultiArg2(VARIANT val1, VARIANT* pVal) +{ + HRESULT hr = S_OK; + m_var1 = val1; + + if (FAILED(hr = VariantCopy(pVal, & m_var2))) + return hr; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpMultiArg2(VARIANT val1, VARIANT newVal) +{ + m_var1 = val1; + m_var2 = newVal; + return S_OK; +} + +// returns the values set by prpMultiArg2 +STDMETHODIMP CBasic::prpMultiArg2GetValues(VARIANT* val1, VARIANT* valProperty) +{ + HRESULT hr = S_OK; + if (FAILED(VariantCopy(val1, & m_var1))) + return hr; + if (FAILED(VariantCopy(valProperty, & m_var2))) + return hr; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpMultiArg3(LONG* val1, LONG* pVal) +{ + long aLong = *val1; + *val1 = m_long; + m_long = aLong; + + * pVal = m_long2; + return S_OK; +} + +STDMETHODIMP CBasic::put_prpMultiArg3(LONG* val1, LONG newVal) +{ + long aLong = *val1; + *val1 = m_long; + m_long = aLong; + + m_long2 = newVal; + return S_OK; +} + +STDMETHODIMP CBasic::inUnknown(IUnknown* val) +{ + m_unknown = val; + + return S_OK; +} + +STDMETHODIMP CBasic::outUnknown(IUnknown** val) +{ + m_unknown.CopyTo(val); + return S_OK; +} + +STDMETHODIMP CBasic::inoutUnknown(IUnknown** val) +{ + CComPtr<IUnknown> tmp = *val; + m_unknown.CopyTo(val); + m_unknown = tmp; + return S_OK; +} + +STDMETHODIMP CBasic::get_prpUnknown(IUnknown** pVal) +{ + m_prpUnknown.CopyTo(pVal); + return S_OK; +} + +STDMETHODIMP CBasic::put_prpUnknown(IUnknown* newVal) +{ + m_prpUnknown = newVal; + return S_OK; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/Basic.h b/extensions/test/ole/AxTestComponents/Basic.h new file mode 100644 index 000000000..eec04aa08 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/Basic.h @@ -0,0 +1,259 @@ +/* -*- 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 . + */ +// Basic.h : Declaration of the CBasic + +#ifndef __BASIC_H_ +#define __BASIC_H_ + +#include "resource.h" +#import "AxTestComponents.tlb" no_namespace no_implementation raw_interfaces_only named_guids + + +// CBasic +class ATL_NO_VTABLE CBasic : + public CComObjectRootEx<CComSingleThreadModel>, + public CComCoClass<CBasic, &CLSID_Basic>, + public IDispatchImpl<IBasic, &IID_IBasic, &LIBID_AXTESTCOMPONENTSLib> + { +public: + CBasic(); + ~CBasic(); + + DECLARE_REGISTRY_RESOURCEID(IDR_BASIC) + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CBasic) + COM_INTERFACE_ENTRY(IBasic) + COM_INTERFACE_ENTRY(IDispatch) + END_COM_MAP() + + // IBasic +public: + STDMETHOD(outMore)(/*[out]*/long* val1, /*[out]*/long* val2); + STDMETHOD(inMulDimArrayByte2)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayByte)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayVariant2)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayLong2)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayVariant)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayLong)( LPSAFEARRAY val); + STDMETHOD(inoutSequenceObject)(LPSAFEARRAY* val); + STDMETHOD(inoutSequenceDouble)(LPSAFEARRAY * val); + STDMETHOD(inoutSequenceFloat)(LPSAFEARRAY * val); + STDMETHOD(inoutSequenceString)(LPSAFEARRAY* val); + STDMETHOD(inoutSequenceLong)(LPSAFEARRAY * val); + STDMETHOD(inoutSequenceShort)(LPSAFEARRAY * val); + STDMETHOD(inoutSequenceByte)(LPSAFEARRAY * val); + STDMETHOD(outSequenceObject)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceDouble)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceFloat)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceString)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceLong)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceShort)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceByte)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(inSequenceObject)(LPSAFEARRAY ar); + STDMETHOD(inSequenceDouble)(LPSAFEARRAY ar); + STDMETHOD(inSequenceFloat)(LPSAFEARRAY ar); + STDMETHOD(inSequenceString)(LPSAFEARRAY ar); + STDMETHOD(inSequenceShort)(LPSAFEARRAY ar); + STDMETHOD(inSequenceByte)(LPSAFEARRAY ar); + STDMETHOD(inSequenceLong)(LPSAFEARRAY ar); + STDMETHOD(mixed1)( + /* [out][in] */ unsigned char *aChar, + /* [out][in] */ float *aFloat, + /* [out][in] */ VARIANT *aVar); + STDMETHOD(get_prpObject)(/*[out, retval]*/ IDispatch* *pVal); + STDMETHOD(put_prpObject)(/*[in]*/ IDispatch* newVal); + STDMETHOD(get_prpArray)(/*[out, retval]*/ LPSAFEARRAY *pVal); + STDMETHOD(put_prpArray)(/*[in]*/ LPSAFEARRAY newVal); + STDMETHOD(get_prpVariant)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(put_prpVariant)(/*[in]*/ VARIANT newVal); + STDMETHOD(get_prpDouble)(/*[out, retval]*/ double *pVal); + STDMETHOD(put_prpDouble)(/*[in]*/ double newVal); + STDMETHOD(get_prpFloat)(/*[out, retval]*/ float *pVal); + STDMETHOD(put_prpFloat)(/*[in]*/ float newVal); + STDMETHOD(get_prpString)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_prpString)(/*[in]*/ BSTR newVal); + STDMETHOD(get_prpLong)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_prpLong)(/*[in]*/ long newVal); + STDMETHOD(get_prpShort)(/*[out, retval]*/ short *pVal); + STDMETHOD(put_prpShort)(/*[in]*/ short newVal); + STDMETHOD(get_prpByte)(/*[out, retval]*/ unsigned char *pVal); + STDMETHOD(put_prpByte)(/*[in]*/ unsigned char newVal); + STDMETHOD(get_prpBool)(/*[out, retval]*/ VARIANT_BOOL *pVal); + STDMETHOD(put_prpBool)(/*[in]*/ VARIANT_BOOL newVal); + + STDMETHOD(outObject)(/*[out]*/ IDispatch* *val); + STDMETHOD(outArray)(/*[out]*/ LPSAFEARRAY * val); + STDMETHOD(outVariant)(/*[out]*/ VARIANT* val); + STDMETHOD(outDouble)(/*[out]*/ double* val); + STDMETHOD(outFloat)(/*[out]*/ float* val); + STDMETHOD(outString)(/*[out]*/ BSTR* val); + STDMETHOD(outLong)(/*[out]*/ long* val); + STDMETHOD(outShort)(/*[out]*/ short* val); + STDMETHOD(outByte)(/*[out]*/ unsigned char* val); + STDMETHOD(outBool)(/*[out]*/ VARIANT_BOOL* val); + + STDMETHOD(inoutObject)(/*[in,out]*/ IDispatch* *val); + STDMETHOD(inoutArray)(/*[in,out]*/ LPSAFEARRAY * val); + STDMETHOD(inoutVariant)(/*[in,out]*/ VARIANT * val); + STDMETHOD(inoutDouble)(/*[in,out]*/ double * val); + STDMETHOD(inoutFloat)(/*[in,out]*/ float * val); + STDMETHOD(inoutString)(/*[in, out]*/ BSTR* val); + STDMETHOD(inoutLong)(/*[in,out]*/ long * val); + STDMETHOD(inoutShort)(/*[in,out]*/ short* val); + STDMETHOD(inoutByte)(/*[in,out]*/ unsigned char* val); + STDMETHOD(inoutBool)(/*[in,out]*/ VARIANT_BOOL* val); + + + STDMETHOD(inObject)(/*[in]*/ IDispatch* val); + STDMETHOD(inArray)(/*[in]*/ LPSAFEARRAY val); + STDMETHOD(inVariant)(/*[in]*/ VARIANT val); + STDMETHOD(inDouble)(/*[in]*/ double val); + STDMETHOD(inFloat)(/*[in]*/ float val); + STDMETHOD(inString)(/*[in]*/ BSTR val); + STDMETHOD(inLong)(/*[in]*/ long val); + STDMETHOD(inShort)(/*[in]*/ short val); + STDMETHOD(inByte)(/*[in]*/ unsigned char val); + STDMETHOD(inBool)(/*[in]*/ VARIANT_BOOL val); + + + STDMETHOD(optional1)(/*[in]*/ long val1, /*[in, optional]*/ VARIANT* val2); + STDMETHOD(optional2)(/*[out]*/ long* val1,/*[out, optional]*/ VARIANT* val2); + STDMETHOD(optional3)(/*[in, optional]*/ VARIANT* val1,/*[in, optional]*/ VARIANT* val2); + STDMETHOD(optional4)(/*[in, out, optional]*/ VARIANT* val1,/*[in, out, optional]*/ VARIANT* val2); + STDMETHOD(optional5)(/*[out, optional]*/ VARIANT* val1,/*[out, optional]*/ VARIANT* val2); + + + STDMETHOD(defaultvalue1)(/*[in, defaultvalue(10)]*/ long val1, + /*[in, defaultvalue(3.14)]*/ double* val2, + /*[in, defaultvalue(100)]*/ VARIANT* val4); + + STDMETHOD(defaultvalue2)(/*[in, out, defaultvalue(10)]*/ long* val1, + /*[in, out, defaultvalue(3.14)]*/ double* val2, + /*[in, out, defaultvalue(100)]*/ VARIANT* val4); + + STDMETHOD(varargfunc1)(/*[in]*/ long val1,/*[in]*/ LPSAFEARRAY val2); + + STDMETHOD(varargfunc2)(/*[out]*/ long* val1, /*[out]*/ SAFEARRAY ** val2); + + + // members for property implementations + unsigned char m_cPrpByte; + short m_nPrpShort; + long m_lPrpLong; + float m_fPrpFloat; + double m_dPrpDouble; + CComPtr<IDispatch> m_PrpObject; + CComPtr<IUnknown> m_prpUnknown; + + CComBSTR m_bstrPrpString; + CComVariant m_PropVariant; + LPSAFEARRAY m_PrpArray; +protected: + VARIANT_BOOL m_bool; + unsigned char m_byte; + short m_short; + long m_long; + long m_long2; + float m_float; + double m_double; + CComVariant m_var1; + CComVariant m_var2; + CComVariant m_var3; + CComVariant m_var4; + CComBSTR m_bstr; + CY m_cy; + DATE m_date; + DECIMAL m_decimal; + SCODE m_scode; + SAFEARRAY * m_safearray; + CComPtr<IDispatch> m_obj; + CComPtr<IUnknown> m_unknown; + + SAFEARRAY * m_arByte; + SAFEARRAY * m_arShort; + SAFEARRAY * m_arLong; + SAFEARRAY * m_arString; + SAFEARRAY * m_arVariant; + SAFEARRAY * m_arFloat; + SAFEARRAY * m_arDouble; + SAFEARRAY * m_arObject; + SAFEARRAY * m_arByteDim2; + + static void printArray(LPSAFEARRAY val, BSTR message, VARTYPE type); + static void printMulArray(LPSAFEARRAY val, VARTYPE type); + + +public: + STDMETHOD(inSequenceByteDim2)(LPSAFEARRAY val); + STDMETHOD(inCurrency)(CY val); + STDMETHOD(outCurrency)(CY* val); + STDMETHOD(inoutCurrency)(CY* val); + STDMETHOD(inDate)(DATE val); + STDMETHOD(outDate)(DATE* val); + STDMETHOD(inoutDate)(DATE* val); + STDMETHOD(get_prpCurrency)(CY* pVal); + STDMETHOD(put_prpCurrency)(CY newVal); + STDMETHOD(get_prpDate)(DATE* pVal); + STDMETHOD(put_prpDate)(DATE newVal); + STDMETHOD(inDecimal)(DECIMAL val); + STDMETHOD(outDecimal)(DECIMAL* val); + STDMETHOD(inoutDecimal)(DECIMAL* val); + STDMETHOD(get_prpDecimal)(DECIMAL* pVal); + STDMETHOD(put_prpDecimal)(DECIMAL newVal); + STDMETHOD(inSCode)(SCODE val); + STDMETHOD(outScode)(SCODE* val); + STDMETHOD(inoutSCode)(SCODE* val); + STDMETHOD(get_prpSCode)(SCODE* pVal); + STDMETHOD(put_prpSCode)(SCODE newVal); + STDMETHOD(inrefLong)(LONG* val); + STDMETHOD(inrefVariant)(VARIANT* val); + STDMETHOD(inrefDecimal)(DECIMAL* val); + STDMETHOD(get_prpRefLong)(long* pVal); + STDMETHOD(putref_prpRefLong)(long* newVal); + STDMETHOD(get_prprefVariant)(VARIANT* pVal); + STDMETHOD(putref_prprefVariant)(VARIANT* newVal); + STDMETHOD(get_prprefDecimal)(DECIMAL* pVal); + STDMETHOD(putref_prprefDecimal)(DECIMAL* newVal); + STDMETHOD(optional6)(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4); + STDMETHOD(optional7)(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4); + + STDMETHOD(get_prpMultiArg1)(VARIANT* val1, VARIANT* val2, VARIANT* pVal); + //STDMETHOD(get_prpMultiArg1)(VARIANT* val1, VARIANT* pVal); + STDMETHOD(put_prpMultiArg1)(VARIANT* val1, VARIANT* val2, VARIANT* newVal); + //STDMETHOD(put_prpMultiArg1)(VARIANT* val1, VARIANT* newVal); + STDMETHOD(get_prpMultiArg2)(VARIANT val1, VARIANT* pVal); + STDMETHOD(put_prpMultiArg2)(VARIANT val1, VARIANT newVal); + STDMETHOD(prpMultiArg2GetValues)(VARIANT* val1, VARIANT* valProperty); + STDMETHOD(get_prpMultiArg3)(LONG* val1, LONG* pVal); + STDMETHOD(put_prpMultiArg3)(LONG* val1, LONG newVal); + + // IFoo Methods +public: + STDMETHOD(inUnknown)(IUnknown* val); + STDMETHOD(outUnknown)(IUnknown** val); + STDMETHOD(inoutUnknown)(IUnknown** val); + STDMETHOD(get_prpUnknown)(IUnknown** pVal); + STDMETHOD(put_prpUnknown)(IUnknown* newVal); +}; + +#endif //__BASIC_H_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/Basic.rgs b/extensions/test/ole/AxTestComponents/Basic.rgs new file mode 100644 index 000000000..67fa86008 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/Basic.rgs @@ -0,0 +1,50 @@ +HKCR +{ + AxTestComponents.Basic.1 = s 'Basic Class' + { + CLSID = s '{BFE10EBE-8584-11D4-8335-005004526AB4}' + } + AxTestComponents.Basic = s 'Basic Class' + { + CLSID = s '{BFE10EBE-8584-11D4-8335-005004526AB4}' + CurVer = s 'AxTestComponents.Basic.1' + } + NoRemove CLSID + { + ForceRemove {BFE10EBE-8584-11D4-8335-005004526AB4} = s 'Basic Class' + { + ProgID = s 'AxTestComponents.Basic.1' + VersionIndependentProgID = s 'AxTestComponents.Basic' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{BFE10EB1-8584-11D4-8335-005004526AB4}' + } + } + AxTestComponents.Foo.1 = s 'Foo Class' + { + CLSID = s '{14DE9D5D-EB9D-4091-8E1B-A1B1672D8C1D}' + } + AxTestComponents.Foo = s 'Foo Class' + { + CLSID = s '{14DE9D5D-EB9D-4091-8E1B-A1B1672D8C1D}' + CurVer = s 'AxTestComponents.Foo.1' + } + NoRemove CLSID + { + ForceRemove {14DE9D5D-EB9D-4091-8E1B-A1B1672D8C1D} = s 'Foo Class' + { + ProgID = s 'AxTestComponents.Foo.1' + VersionIndependentProgID = s 'AxTestComponents.Foo' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{BFE10EB1-8584-11D4-8335-005004526AB4}' + } + } + +} diff --git a/extensions/test/ole/AxTestComponents/Foo.cpp b/extensions/test/ole/AxTestComponents/Foo.cpp new file mode 100644 index 000000000..9faefd393 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/Foo.cpp @@ -0,0 +1,30 @@ +/* -*- 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 "stdafx.h" +#include "Foo.h" + +// CBasic +CFoo::CFoo() {} + +CFoo::~CFoo() {} + +STDMETHODIMP CFoo::Foo(IUnknown* pVal) { return S_OK; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/Foo.h b/extensions/test/ole/AxTestComponents/Foo.h new file mode 100644 index 000000000..3d0dc5bb5 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/Foo.h @@ -0,0 +1,54 @@ +/* -*- 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 . + */ +// Basic.h : Declaration of the CBasic + +#pragma once + +#include "resource.h" +#import "AxTestComponents.tlb" no_namespace no_implementation raw_interfaces_only named_guids + + +// CBasic +class ATL_NO_VTABLE CFoo : + public CComObjectRootEx<CComSingleThreadModel>, + public CComCoClass<CFoo, &CLSID_Foo>, + public IFoo + +// public IDispatchImpl<IFoo, &__uuidof(IFoo), &LIBID_AXTESTCOMPONENTSLib, /* wMajor = */ 1, /* wMinor = */ 0> +{ +public: + CFoo(); + ~CFoo(); + + DECLARE_REGISTRY_RESOURCEID(IDR_BASIC) + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CFoo) + COM_INTERFACE_ENTRY(IFoo) + END_COM_MAP() + + +STDMETHOD(Foo)(IUnknown* val); + + // IFoo Methods +public: +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/StdAfx.cpp b/extensions/test/ole/AxTestComponents/StdAfx.cpp new file mode 100644 index 000000000..71ebbdb6b --- /dev/null +++ b/extensions/test/ole/AxTestComponents/StdAfx.cpp @@ -0,0 +1,26 @@ +/* -*- 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 "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include <statreg.h> +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/StdAfx.h b/extensions/test/ole/AxTestComponents/StdAfx.h new file mode 100644 index 000000000..211943ce4 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/StdAfx.h @@ -0,0 +1,46 @@ +/* -*- 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 . + */ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__BFE10EB4_8584_11D4_8335_005004526AB4__INCLUDED_) +#define AFX_STDAFX_H__BFE10EB4_8584_11D4_8335_005004526AB4__INCLUDED_ + +#ifdef _MSC_VER +#pragma once +#endif + +#define STRICT +#define _ATL_APARTMENT_THREADED + +#include <atlbase.h> +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include <atlcom.h> +#include <stdio.h> +#include <string.h> + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__BFE10EB4_8584_11D4_8335_005004526AB4__INCLUDED) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/readme.txt b/extensions/test/ole/AxTestComponents/readme.txt new file mode 100644 index 000000000..6f19ea610 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/readme.txt @@ -0,0 +1,3 @@ +The component does not use the AxTestComponent.h created by the midl +compiler. Instead #import is used. This is because of a bug when +using attribute "defaultvalue" in idl. diff --git a/extensions/test/ole/AxTestComponents/resource.h b/extensions/test/ole/AxTestComponents/resource.h new file mode 100644 index 000000000..e741826b5 --- /dev/null +++ b/extensions/test/ole/AxTestComponents/resource.h @@ -0,0 +1,38 @@ +/* -*- 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 . + */ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by AxTestComponents.rc + +#define IDS_PROJNAME 100 +#define IDR_BASIC 101 +//#define IDR_FOO 501 + +// Next default values for new objects + +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas b/extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas new file mode 100644 index 000000000..88153b174 --- /dev/null +++ b/extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas @@ -0,0 +1,25 @@ +rem +rem This file is part of the LibreOffice project. +rem +rem This Source Code Form is subject to the terms of the Mozilla Public +rem License, v. 2.0. If a copy of the MPL was not distributed with this +rem file, You can obtain one at http://mozilla.org/MPL/2.0/. +rem +rem This file incorporates work covered by the following license notice: +rem +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed +rem with this work for additional information regarding copyright +rem ownership. The ASF licenses this file to you under the Apache +rem License, Version 2.0 (the "License"); you may not use this file +rem except in compliance with the License. You may obtain a copy of +rem the License at http://www.apache.org/licenses/LICENSE-2.0 . +rem +Attribute VB_Name = "Module1" +Option Explicit + +Sub main() + Dim obj As Object + Set obj = CreateObject("dcomtest.writerdemo.wsc") + obj.run +End Sub diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp new file mode 100644 index 000000000..ca477cff6 --- /dev/null +++ b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp @@ -0,0 +1,33 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Module=Module1; Module1.bas +Startup="Sub Main" +HelpFile="" +Command32="" +Name="client_writerdemo" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="StarOffice" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw new file mode 100644 index 000000000..067d7529e --- /dev/null +++ b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw @@ -0,0 +1 @@ +Module1 = 108, 108, 685, 544, diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt b/extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt new file mode 100644 index 000000000..1d5a63492 --- /dev/null +++ b/extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt @@ -0,0 +1,4 @@ +Visual Basic client that instantiates a Windows Script Component
+,dcomtest.writerdemo.wsc. That component is located in
+extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc. Don't forget to
+register that component (right-click,select register).
diff --git a/extensions/test/ole/DCOM/dcom_test/Module1.bas b/extensions/test/ole/DCOM/dcom_test/Module1.bas new file mode 100644 index 000000000..27908068c --- /dev/null +++ b/extensions/test/ole/DCOM/dcom_test/Module1.bas @@ -0,0 +1,55 @@ +rem +rem This file is part of the LibreOffice project. +rem +rem This Source Code Form is subject to the terms of the Mozilla Public +rem License, v. 2.0. If a copy of the MPL was not distributed with this +rem file, You can obtain one at http://mozilla.org/MPL/2.0/. +rem +rem This file incorporates work covered by the following license notice: +rem +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed +rem with this work for additional information regarding copyright +rem ownership. The ASF licenses this file to you under the Apache +rem License, Version 2.0 (the "License"); you may not use this file +rem except in compliance with the License. You may obtain a copy of +rem the License at http://www.apache.org/licenses/LICENSE-2.0 . +rem +Attribute VB_Name = "Module1" +Option Explicit + +Sub main() + +MsgBox "hallo" + +'The service manager is always the starting point +'If there is no office running then an office is started up +Dim objServiceManager As Object +Set objServiceManager = CreateObject("com.sun.star.ServiceManager") + +'Create the CoreReflection service that is later used to create structs +Set objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection") + +'Create the Desktop +Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop") + +'Open a new empty writer document + +Set objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection") +'get a type description class for Size +Set propClass = objCoreReflection.forName("com.sun.star.beans.PropertyValue") + +Dim prop +propClass.CreateObject prop +prop.Name = "Hidden" +prop.Value = True + +'create the actual object +Dim args(0) +Set args(0) = prop + +Dim args2() +'Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args) +Set objDocument = objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args2) + +End Sub diff --git a/extensions/test/ole/DCOM/dcom_test/dcom_test.vbp b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbp new file mode 100644 index 000000000..5b896434f --- /dev/null +++ b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbp @@ -0,0 +1,37 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Module=Module1; ..\..\..\..\..\..\Projects\VBasic\dcom_test\Module1.bas +Startup="Sub Main" +HelpFile="" +Title="dcom_test" +ExeName32="dcom_test.exe" +Path32="..\..\..\..\..\..\Projects\VBasic\dcom_test" +Command32="" +Name="dcom_test" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="StarOffice" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/extensions/test/ole/DCOM/dcom_test/dcom_test.vbw b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbw new file mode 100644 index 000000000..dfe34e0d1 --- /dev/null +++ b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbw @@ -0,0 +1 @@ +Module1 = 1, 1, 849, 604, Z diff --git a/extensions/test/ole/DCOM/dcom_test/readme.txt b/extensions/test/ole/DCOM/dcom_test/readme.txt new file mode 100644 index 000000000..215d6f409 --- /dev/null +++ b/extensions/test/ole/DCOM/dcom_test/readme.txt @@ -0,0 +1,5 @@ +The program creates the com.sun.star.Servicemanager on a remote machine: + +Set objServiceManager = CreateObject("com.sun.star.ServiceManager", "\\jl-1036") + +creates a document and writes in it.
\ No newline at end of file diff --git a/extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc b/extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc new file mode 100644 index 000000000..51419022f --- /dev/null +++ b/extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc @@ -0,0 +1,186 @@ +<?xml version="1.0"?> +<component> + +<?component error="true" debug="true"?> + +<registration + description="writerdemo script component" + progid="dcomtest.writerdemo.WSC" + version="1.00" + classid="{90c5ca1a-5e38-4c6d-9634-b0c740c569ad}" + remotable="true" +> +</registration> + +<public> + <method name="run"> + </method> +</public> + +<script language="JScript"> +<![CDATA[ + +var description = new jscripttest; + +function jscripttest() +{ + + this.run = run; +} + +function run() +{ +//The service manager is always the starting point +//If there is no office running then an office is started up + +var objServiceManager= new ActiveXObject("com.sun.star.ServiceManager","\\jl-1036"); + +//Create the CoreReflection service that is later used to create structs +var objCoreReflection= objServiceManager.createInstance("com.sun.star.reflection.CoreReflection"); + +//Create the Desktop +var objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop"); + +//Open a new empty writer document +var objCoreReflection= objServiceManager.createInstance("com.sun.star.reflection.CoreReflection"); + +//get a type description class for Size +//var propClass = objCoreReflection.forName( "com.sun.star.beans.PropertyValue" ); + +//var propParam= new Array(); +//propClass.createObject(propParam); +//var prop= propParam[0]; +//prop.Name= "Hidden"; +//prop.Value= true; + +//create the actual object +var args= new Array(); +var objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args); + +//Create a text object +var objText= objDocument.getText(); + +//Create a cursor object +var objCursor= objText.createTextCursor(); + +//Inserting some Text +objText.insertString( objCursor, "The first line in the newly created text document.\n", false); + +//Inserting a second line +objText.insertString( objCursor, "Now we're in the second line", false); + +//Create instance of a text table with 4 columns and 4 rows +var objTable= objDocument.createInstance( "com.sun.star.text.TextTable"); +objTable.initialize( 4, 4); + +//Insert the table +objText.insertTextContent( objCursor, objTable, false); + +//Get first row +var objRows= objTable.getRows(); +var objRow= objRows.getByIndex( 0); + +//Set the table background color +objTable.setPropertyValue( "BackTransparent", false); +objTable.setPropertyValue( "BackColor", 13421823); + +//Set a different background color for the first row +objRow.setPropertyValue( "BackTransparent", false); +objRow.setPropertyValue( "BackColor", 6710932); + +//Fill the first table row +insertIntoCell( "A1","FirstColumn", objTable); +insertIntoCell( "B1","SecondColumn", objTable); +insertIntoCell( "C1","ThirdColumn", objTable); +insertIntoCell( "D1","SUM", objTable); + + +objTable.getCellByName("A2").setValue( 22.5); +objTable.getCellByName("B2").setValue( 5615.3); +objTable.getCellByName("C2").setValue( -2315.7); +objTable.getCellByName("D2").setFormula("sum <A2:C2>"); + +objTable.getCellByName("A3").setValue( 21.5); +objTable.getCellByName("B3").setValue( 615.3); +objTable.getCellByName("C3").setValue( -315.7); +objTable.getCellByName("D3").setFormula( "sum <A3:C3>"); + +objTable.getCellByName("A4").setValue( 121.5); +objTable.getCellByName("B4").setValue( -615.3); +objTable.getCellByName("C4").setValue( 415.7); +objTable.getCellByName("D4").setFormula( "sum <A4:C4>"); + +//Change the CharColor and add a Shadow +objCursor.setPropertyValue( "CharColor", 255); +objCursor.setPropertyValue( "CharShadowed", true); + +//Create a paragraph break +//The second argument is a css::text::ControlCharacter::PARAGRAPH_BREAK constant +objText.insertControlCharacter( objCursor, 0 , false); + +//Inserting colored Text. +objText.insertString( objCursor, " This is a colored Text - blue with shadow\n", false); + +//Create a paragraph break ( ControlCharacter::PARAGRAPH_BREAK). +objText.insertControlCharacter( objCursor, 0, false ); + +//Create a TextFrame. +var objTextFrame= objDocument.createInstance("com.sun.star.text.TextFrame"); + +//Create a Size struct. +var objSize= createStruct("com.sun.star.awt.Size"); +objSize.Width= 15000; +objSize.Height= 400; +objTextFrame.setSize( objSize); + +//TextContentAnchorType.AS_CHARACTER = 1 +objTextFrame.setPropertyValue( "AnchorType", 1); + +//insert the frame +objText.insertTextContent( objCursor, objTextFrame, false); + +//Get the text object of the frame +var objFrameText= objTextFrame.getText(); + +//Create a cursor object +var objFrameTextCursor= objFrameText.createTextCursor(); + +//Inserting some Text +objFrameText.insertString( objFrameTextCursor, "The first line in the newly created text frame.", + false); +objFrameText.insertString(objFrameTextCursor, + "With this second line the height of the frame raises.", false ); + +//Create a paragraph break +//The second argument is a css::text::ControlCharacter::PARAGRAPH_BREAK constant +objFrameText.insertControlCharacter( objCursor, 0 , false); + +//Change the CharColor and add a Shadow +objCursor.setPropertyValue( "CharColor", 65536); +objCursor.setPropertyValue( "CharShadowed", false); + +//Insert another string +objText.insertString( objCursor, " That's all for now !!", false ); + +function insertIntoCell( strCellName, strText, objTable) +{ + var objCellText= objTable.getCellByName( strCellName); + var objCellCursor= objCellText.createTextCursor(); + objCellCursor.setPropertyValue( "CharColor",16777215); + objCellText.insertString( objCellCursor, strText, false); +} +function createStruct( strTypeName) +{ + var classSize= objCoreReflection.forName( strTypeName); + var aStruct= new Array(); + classSize.createObject( aStruct); + return aStruct[0]; +} + + +} + +]]> +</script> + +</component> diff --git a/extensions/test/ole/DCOM/scriptComponents/readme.txt b/extensions/test/ole/DCOM/scriptComponents/readme.txt new file mode 100644 index 000000000..5fa3a8bb7 --- /dev/null +++ b/extensions/test/ole/DCOM/scriptComponents/readme.txt @@ -0,0 +1,12 @@ +WriterDemo.wsc +================================================================================= +Register the component by right-clicking on the file in the file explorer and select +register. +The component registered as being remotable.That is, it has got an AppID entry (with +a DllSurrogate subkey).That enables us to use dcomcnfg.exe in order to set AccessPermissions,etc. +which is necessary because of the use of the JScript Array object. The automation +bridge will query for IDispatchEx,which is a call from server to client.Hence the server +needs the proper right within the client. + +The component implements a run function, which runs the demo example that is written +in JScript. diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp b/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp new file mode 100644 index 000000000..ad42dda62 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp @@ -0,0 +1,76 @@ +/* -*- 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 . + */ +// EventListener.cpp : Implementation of DLL Exports. + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f EventListenerps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include <initguid.h> +#include "EventListener.h" + +#include "EventListener_i.c" +#include "EvtListener.h" + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_EvtListener, CEvtListener) +END_OBJECT_MAP() + +// DLL Entry Point + +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_EVENTLISTENERLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) { return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE; } + +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) { return _Module.UnregisterServer(TRUE); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.def b/extensions/test/ole/EventListenerSample/EventListener/EventListener.def new file mode 100644 index 000000000..9d88a68f7 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/EventListener.def @@ -0,0 +1,9 @@ +; EventListener.def : Declares the module parameters.
+
+LIBRARY "EventListener.DLL"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.idl b/extensions/test/ole/EventListenerSample/EventListener/EventListener.idl new file mode 100644 index 000000000..3ed514074 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/EventListener.idl @@ -0,0 +1,60 @@ +/* -*- 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 . + */ + +// EventListener.idl : IDL source for EventListener.dll + + +// This file will be processed by the MIDL tool to +// produce the type library (EventListener.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; + [ + object, + uuid(86653399-24C6-4C2B-9E8A-564175250CB2), + dual, + helpstring("IEvtListener interface"), + pointer_default(unique) + ] + interface IEvtListener : IDispatch + { + [id(1), helpstring("Method disposing")] HRESULT disposing([in] IDispatch* source); + }; + +[ + uuid(E3E61535-3262-45E6-BFD9-EE8AED051BD1), + version(1.0), + helpstring("EventListener 1.0 Type Library") +] +library EVENTLISTENERLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(830E0743-87C1-4C99-A77A-5FBA0C2EBD9A), + helpstring("EvtListener Class") + ] + coclass EvtListener + { + [default] interface IEvtListener; + }; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.rc b/extensions/test/ole/EventListenerSample/EventListener/EventListener.rc new file mode 100644 index 000000000..2de599591 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/EventListener.rc @@ -0,0 +1,154 @@ +/* + * 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 . + */ + +// Microsoft Developer Studio generated resource script. + +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS + + +// Generated from the TEXTINCLUDE 2 resource. + +#include "winres.h" + + +#undef APSTUDIO_READONLY_SYMBOLS + + +// German (Germany) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +#ifdef _WIN32 +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED + + +// TEXTINCLUDE + + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""EventListener.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC + + +// Version + + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "EventListener Module\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "EventListener\0" + VALUE "LegalCopyright", "Copyright 2001\0" + VALUE "OriginalFilename", "EventListener.DLL\0" + VALUE "ProductName", "EventListener Module\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + + + +// String Table + + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "EventListener" +END + +#endif // German (Germany) resources + + + + +// English (USA) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + + + +// REGISTRY + + +IDR_EVTLISTENER REGISTRY DISCARDABLE "EvtListener.rgs" +#endif // English (USA) resources + + + + +#ifndef APSTUDIO_INVOKED + + +// Generated from the TEXTINCLUDE 3 resource. + +1 TYPELIB "EventListener.tlb" + + +#endif // not APSTUDIO_INVOKED + diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.sln b/extensions/test/ole/EventListenerSample/EventListener/EventListener.sln new file mode 100644 index 000000000..3837163ef --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/EventListener.sln @@ -0,0 +1,31 @@ +Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EventListener", "EventListener.vcproj", "{055137B6-A402-4913-AC11-9A096E866F5B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release MinDependency|Win32 = Release MinDependency|Win32
+ Release MinSize|Win32 = Release MinSize|Win32
+ Unicode Debug|Win32 = Unicode Debug|Win32
+ Unicode Release MinDependency|Win32 = Unicode Release MinDependency|Win32
+ Unicode Release MinSize|Win32 = Unicode Release MinSize|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Debug|Win32.Build.0 = Debug|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Release MinDependency|Win32.ActiveCfg = Release MinDependency|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Release MinDependency|Win32.Build.0 = Release MinDependency|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Release MinSize|Win32.ActiveCfg = Release MinSize|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Release MinSize|Win32.Build.0 = Release MinSize|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Release MinDependency|Win32.ActiveCfg = Unicode Release MinDependency|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Release MinDependency|Win32.Build.0 = Unicode Release MinDependency|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Release MinSize|Win32.ActiveCfg = Unicode Release MinSize|Win32
+ {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Release MinSize|Win32.Build.0 = Unicode Release MinSize|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.vcproj b/extensions/test/ole/EventListenerSample/EventListener/EventListener.vcproj new file mode 100644 index 000000000..e8aef5532 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/EventListener.vcproj @@ -0,0 +1,927 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="EventListener"
+ ProjectGUID="{055137B6-A402-4913-AC11-9A096E866F5B}"
+ RootNamespace="EventListener"
+ Keyword="AtlProj"
+ TargetFrameworkVersion="0"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Unicode Release MinSize|Win32"
+ OutputDirectory=".\ReleaseUMinSize"
+ IntermediateDirectory=".\ReleaseUMinSize"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ UseOfATL="2"
+ ATLMinimizesCRunTimeLibraryUsage="true"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseUMinSize/EventListener.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseUMinSize/EventListener.pch"
+ AssemblerListingLocation=".\ReleaseUMinSize/"
+ ObjectFile=".\ReleaseUMinSize/"
+ ProgramDataBaseFileName=".\ReleaseUMinSize/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1031"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\ReleaseUMinSize/EventListener.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\EventListener.def"
+ ProgramDatabaseFile=".\ReleaseUMinSize/EventListener.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseUMinSize/EventListener.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\ReleaseUMinSize/EventListener.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode Debug|Win32"
+ OutputDirectory=".\DebugU"
+ IntermediateDirectory=".\DebugU"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\DebugU/EventListener.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\DebugU/EventListener.pch"
+ AssemblerListingLocation=".\DebugU/"
+ ObjectFile=".\DebugU/"
+ ProgramDataBaseFileName=".\DebugU/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1031"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\DebugU/EventListener.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\EventListener.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\DebugU/EventListener.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\DebugU/EventListener.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\DebugU/EventListener.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release MinDependency|Win32"
+ OutputDirectory=".\ReleaseMinDependency"
+ IntermediateDirectory=".\ReleaseMinDependency"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ UseOfATL="1"
+ ATLMinimizesCRunTimeLibraryUsage="true"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseMinDependency/EventListener.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseMinDependency/EventListener.pch"
+ AssemblerListingLocation=".\ReleaseMinDependency/"
+ ObjectFile=".\ReleaseMinDependency/"
+ ProgramDataBaseFileName=".\ReleaseMinDependency/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1031"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\ReleaseMinDependency/EventListener.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\EventListener.def"
+ ProgramDatabaseFile=".\ReleaseMinDependency/EventListener.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseMinDependency/EventListener.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\ReleaseMinDependency/EventListener.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release MinSize|Win32"
+ OutputDirectory=".\ReleaseMinSize"
+ IntermediateDirectory=".\ReleaseMinSize"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ UseOfATL="2"
+ ATLMinimizesCRunTimeLibraryUsage="true"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseMinSize/EventListener.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseMinSize/EventListener.pch"
+ AssemblerListingLocation=".\ReleaseMinSize/"
+ ObjectFile=".\ReleaseMinSize/"
+ ProgramDataBaseFileName=".\ReleaseMinSize/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1031"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\ReleaseMinSize/EventListener.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\EventListener.def"
+ ProgramDatabaseFile=".\ReleaseMinSize/EventListener.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseMinSize/EventListener.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\ReleaseMinSize/EventListener.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/EventListener.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Debug/EventListener.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1031"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\Debug/EventListener.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\EventListener.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/EventListener.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Debug/EventListener.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/EventListener.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode Release MinDependency|Win32"
+ OutputDirectory=".\ReleaseUMinDependency"
+ IntermediateDirectory=".\ReleaseUMinDependency"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ UseOfATL="1"
+ ATLMinimizesCRunTimeLibraryUsage="true"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseUMinDependency/EventListener.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseUMinDependency/EventListener.pch"
+ AssemblerListingLocation=".\ReleaseUMinDependency/"
+ ObjectFile=".\ReleaseUMinDependency/"
+ ProgramDataBaseFileName=".\ReleaseUMinDependency/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1031"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\ReleaseUMinDependency/EventListener.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\EventListener.def"
+ ProgramDatabaseFile=".\ReleaseUMinDependency/EventListener.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseUMinDependency/EventListener.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\ReleaseUMinDependency/EventListener.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="EventListener.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="EventListener.def"
+ >
+ </File>
+ <File
+ RelativePath="EventListener.idl"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\EventListener.tlb"
+ HeaderFileName="EventListener.h"
+ InterfaceIdentifierFileName="EventListener_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\EventListener.tlb"
+ HeaderFileName="EventListener.h"
+ InterfaceIdentifierFileName="EventListener_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\EventListener.tlb"
+ HeaderFileName="EventListener.h"
+ InterfaceIdentifierFileName="EventListener_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\EventListener.tlb"
+ HeaderFileName="EventListener.h"
+ InterfaceIdentifierFileName="EventListener_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\EventListener.tlb"
+ HeaderFileName="EventListener.h"
+ InterfaceIdentifierFileName="EventListener_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\EventListener.tlb"
+ HeaderFileName="EventListener.h"
+ InterfaceIdentifierFileName="EventListener_i.c"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="EventListener.rc"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="$(OUTDIR)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="$(OUTDIR)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="$(OUTDIR)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="$(OUTDIR)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="$(OUTDIR)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="$(OUTDIR)"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="EvtListener.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="StdAfx.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="_ATL_MIN_CRT"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="EvtListener.h"
+ >
+ </File>
+ <File
+ RelativePath="Resource.h"
+ >
+ </File>
+ <File
+ RelativePath="StdAfx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="EvtListener.rgs"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp new file mode 100644 index 000000000..677981749 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp @@ -0,0 +1,38 @@ +/* -*- 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 . + */ +// EvtListener.cpp : Implementation of CEvtListener +#include "stdafx.h" +#include "EventListener.h" +#include "EvtListener.h" + + +// CEvtListener + +STDMETHODIMP CEvtListener::disposing( IDispatch* source) +{ + ::MessageBox(NULL,_T("XEventListener::disposing"), + _T("EventListener.EvtListener component"), MB_OK); + return S_OK; +} + +CEvtListener::~CEvtListener() +{ + +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h new file mode 100644 index 000000000..6705864db --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h @@ -0,0 +1,52 @@ +/* -*- 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 . + */ +// EvtListener.h : Declaration of CEvtListener + +#pragma once + +#include "resource.h" + + +// CEvtListener +class ATL_NO_VTABLE CEvtListener : + public CComObjectRootEx<CComSingleThreadModel>, + public CComCoClass<CEvtListener, &CLSID_EvtListener>, + public IDispatchImpl<IEvtListener, &IID_IEvtListener, &LIBID_EVENTLISTENERLib> +{ +public: + CEvtListener() + { + } + ~CEvtListener(); + +DECLARE_REGISTRY_RESOURCEID(IDR_EVTLISTENER) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CEvtListener) + COM_INTERFACE_ENTRY(IEvtListener) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IEvtListener +public: + STDMETHOD(disposing)(IDispatch* source); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.rgs b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.rgs new file mode 100644 index 000000000..e0aa9bbb7 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.rgs @@ -0,0 +1,26 @@ +HKCR +{ + EventListener.EvtListener.1 = s 'EvtListener Class' + { + CLSID = s '{830E0743-87C1-4C99-A77A-5FBA0C2EBD9A}' + } + EventListener.EvtListener = s 'EvtListener Class' + { + CLSID = s '{830E0743-87C1-4C99-A77A-5FBA0C2EBD9A}' + CurVer = s 'EventListener.EvtListener.1' + } + NoRemove CLSID + { + ForceRemove {830E0743-87C1-4C99-A77A-5FBA0C2EBD9A} = s 'EvtListener Class' + { + ProgID = s 'EventListener.EvtListener.1' + VersionIndependentProgID = s 'EventListener.EvtListener' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{E3E61535-3262-45E6-BFD9-EE8AED051BD1}' + } + } +} diff --git a/extensions/test/ole/EventListenerSample/EventListener/StdAfx.cpp b/extensions/test/ole/EventListenerSample/EventListener/StdAfx.cpp new file mode 100644 index 000000000..da0608bfd --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/StdAfx.cpp @@ -0,0 +1,32 @@ +/* -*- 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 . + */ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include <statreg.h> +#include <statreg.cpp> +#endif + +#include <atlimpl.cpp> + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/StdAfx.h b/extensions/test/ole/EventListenerSample/EventListener/StdAfx.h new file mode 100644 index 000000000..c901a6dbe --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/StdAfx.h @@ -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 . + */ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__E275407A_804A_477E_9A28_F5CA84E711C3__INCLUDED_) +#define AFX_STDAFX_H__E275407A_804A_477E_9A28_F5CA84E711C3__INCLUDED_ + +#ifdef _MSC_VER +#pragma once +#endif + +#define STRICT +#define _ATL_APARTMENT_THREADED + +#include <atlbase.h> +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include <atlcom.h> + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__E275407A_804A_477E_9A28_F5CA84E711C3__INCLUDED) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/resource.h b/extensions/test/ole/EventListenerSample/EventListener/resource.h new file mode 100644 index 000000000..783a14507 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/EventListener/resource.h @@ -0,0 +1,37 @@ +/* -*- 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 . + */ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by EventListener.rc + +#define IDS_PROJNAME 100 +#define IDR_EVTLISTENER 101 + +// Next default values for new objects + +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/Module1.bas b/extensions/test/ole/EventListenerSample/VBEventListener/Module1.bas new file mode 100644 index 000000000..aafd265a0 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/VBEventListener/Module1.bas @@ -0,0 +1,9 @@ +Attribute VB_Name = "Module1" +Option Explicit + + +Sub Main() + +End Sub + + diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/VBEventListener.cls b/extensions/test/ole/EventListenerSample/VBEventListener/VBEventListener.cls new file mode 100644 index 000000000..f3c09aa4d --- /dev/null +++ b/extensions/test/ole/EventListenerSample/VBEventListener/VBEventListener.cls @@ -0,0 +1,69 @@ +' +' 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 . +' + +VERSION 1.0 CLASS +BEGIN + MultiUse = -1 'True + Persistable = 0 'NotPersistable + DataBindingBehavior = 0 'vbNone + DataSourceBehavior = 0 'vbNone + MTSTransactionMode = 0 'NotAnMTSObject +END +Attribute VB_Name = "VBEventListener" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = True +Attribute VB_PredeclaredId = False +Attribute VB_Exposed = True +Option Explicit +Private interfaces(0) As String +Private bDisposingCalled As Boolean +Private bQuiet As Boolean + +Public Property Get Bridge_ImplementedInterfaces() As Variant + Bridge_ImplementedInterfaces = interfaces +End Property + +Private Sub Class_Initialize() +interfaces(0) = "com.sun.star.lang.XEventListener" +bDisposingCalled = False +bQuiet = False +End Sub + +Private Sub Class_Terminate() + On Error Resume Next + Debug.Print "Terminate VBEventListener" +End Sub + +Public Sub disposing(ByVal source As Object) + If bQuiet = False Then + MsgBox "disposing called" + End If + bDisposingCalled = True +End Sub + +Public Sub setQuiet(quiet As Boolean) + bQuiet = quiet +End Sub + +Public Sub resetDisposing() + bDisposingCalled = False +End Sub + +Public Function disposingCalled() + disposingCalled = bDisposingCalled +End Function diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbp b/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbp new file mode 100644 index 000000000..f89b866be --- /dev/null +++ b/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbp @@ -0,0 +1,38 @@ +Type=OleDll +Class=VBEventListener; VBEventListener.cls +Module=Module1; Module1.bas +Startup="Sub Main" +HelpFile="" +ExeName32="VBasicEventListener.dll" +Command32="" +Name="VBasicEventListener" +HelpContextID="0" +Description="Implementation of UNO XEventListener" +CompatibleMode="1" +CompatibleEXE32="VBasicEventListener.dll" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="StarOffice" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=1 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +ThreadingModel=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbw b/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbw new file mode 100644 index 000000000..76699ee81 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbw @@ -0,0 +1,2 @@ +VBEventListener = 132, 132, 732, 748, +Module1 = 64, 33, 849, 530, diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/readme.txt b/extensions/test/ole/EventListenerSample/VBEventListener/readme.txt new file mode 100644 index 000000000..417c102b0 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/VBEventListener/readme.txt @@ -0,0 +1,7 @@ +VBasicEventListener.dll is an ActiveX component written with VisualBasic. The +component registers on the system with a particular ID. When the library is build +this ID is generated, unless a previously build library exists. Then the ID of that +library is used. In order to use always the same ID, the library must be as binary in +the cvs. + +The library can be used under the licences noted in VBEventListener.cls. diff --git a/extensions/test/ole/EventListenerSample/events.htm b/extensions/test/ole/EventListenerSample/events.htm new file mode 100644 index 000000000..0fae7eee9 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/events.htm @@ -0,0 +1,115 @@ +<!--
+ * 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 .
+-->
+<HTML>
+<HEAD>
+<META NAME="GENERATOR" Content="Microsoft Developer Studio">
+<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
+<TITLE>Document Title</TITLE>
+</HEAD>
+<BODY id=theBody>
+
+<script language="JScript">
+function Main( id)
+{
+var objServiceManager= new ActiveXObject("com.sun.star.ServiceManager");
+
+var objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop");
+
+var args= new Array();
+
+var objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args);
+
+var listener;
+if( id == 0)
+ listener= new XEventListener_Impl();
+else if(id == 1)
+ listener= new ActiveXObject("EventListener.EvtListener");
+objDocument.addEventListener( listener);
+}
+
+
+function XEventListener_Impl()
+{
+ this._environment= "JScript";
+ this._implementedInterfaces= new Array( "com.sun.star.lang.XEventListener");
+
+ //XEventListener
+ this.disposing= XEventListener_disposing;
+}
+
+function XEventListener_disposing( source)
+{
+ alert("JScript Event Listener \n The document was closed");
+}
+</script>
+
+<script language="VBScript">
+SUB MainVB( id)
+Set objServiceManager= CreateObject("com.sun.star.ServiceManager")
+
+Set objCoreReflection= objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
+
+Set objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")
+
+'Open a new empty writer document
+Dim args()
+Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)
+
+Dim eventListener
+select case id
+ case 0
+ Set eventListener= CreateObject("EventListener.EvtListener")
+ case 1
+ Set eventListener= CreateObject("VBasicEventListener.VBEventListener")
+end select
+
+objDocument.addEventListener eventlistener
+END SUB
+
+</script>
+<p>
+The script on this page creates a new StarOffice document and connects an event listener
+to it. When the document is closed then the XEventListener::disposing method is called on the
+listener object. How the listener is set up depends on the button being clicked.
+</p>
+<p>
+The button will run JScript code and that adds a JScript event listener to the document.
+The listener is also implemented in JScript and is on this page.
+</p>
+<button onclick='Main(0)'>JScript go</Button>
+<p>
+
+The button runs JScript code that creates the ActiveX component EventListener.EvtListener that
+is written in C++ and housed in a DLL. Then the event listener is added to the document.
+</p>
+<button onclick='Main( 1)'>JScript go</Button>
+<p>
+The button runs VBScript code that creates the components EventListener.EvtListener and adds it
+to the document.
+</p>
+<button onclick='MainVB(0)'>VBScript</Button>
+<p>
+Runs VBScript code that creates VBasicEventListener.VBEventListener ActiveX component which was
+written with VB.
+</p>
+<button onclick='MainVB(1)'>VBScript</Button>
+
+</body>
+</html>
+
+
diff --git a/extensions/test/ole/EventListenerSample/readme.txt b/extensions/test/ole/EventListenerSample/readme.txt new file mode 100644 index 000000000..0e7b1f646 --- /dev/null +++ b/extensions/test/ole/EventListenerSample/readme.txt @@ -0,0 +1,20 @@ +EventListener
+========================================
+
+The folder EventListener contains an MSDEV project that builds a DLL that
+contains the EventListener.EvtListener ActiveX component. The component
+implements the XEventListener interface according to the rules of the
+OleBridge. The component will be used from the HTML page events.htm.
+
+
+VBEventListener:
+========================================
+
+Contains a Visual Basic project that builds an ActiveX component that implements
+com.sun.star.lang.XEventListener. Its ProgId is
+VBasicEventListener.VBEventListener. The DLL should also be checked in. VB needs
+its TLB, so it uses the same CLSIDs on the next build. The component will create
+a message box when its disposing function has been called.
+
+The project also contains a client that builds a Project1.exe (in the same
+folder) that creates VBEventListener and adds it to a StarOffice document.
diff --git a/extensions/test/ole/JScriptNewStyle.htm b/extensions/test/ole/JScriptNewStyle.htm new file mode 100644 index 000000000..28b928630 --- /dev/null +++ b/extensions/test/ole/JScriptNewStyle.htm @@ -0,0 +1,1071 @@ +<!-- + * 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 . +--> +<HTML> +<HEAD> +<META NAME="GENERATOR" Content="Microsoft Developer Studio"> +<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"> +<TITLE>Document Title</TITLE> +</HEAD> +<BODY id=theBody> + +<script language="JScript"> +function callOleTest( id) +{ + var factory= new ActiveXObject("com.sun.star.ServiceManager"); + var oletest= factory.createInstance("oletest.OleTest"); +// alert(oletest); + + var arr= new Array( 1, 2, 3, 4, 0); + var arrDouble= new Array( 1.2345, 12.345, 123,45, 1234.5, 12345); + var arrBool= new Array( 1, 0, 2, 0, 3); + var arrChar= new Array( '1', 'A', "1", "A", ' ', 55, 56); + var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza"); + var arrAny= new Array( 100, 100.1235,"hallo"); + var arrSeq= new Array( arr, arr, arr); + var arrSeq2= new Array( arrSeq, arrSeq, arrSeq) + +// var ob= new Object(); +// ob.value= "A JScript object"; +// var arrObject= new Array( ob, ob, ob); + + + var arrout1= new Array(); + var arrout2= new Array(); + var arrout3= new Array(); + + var ret, i; + var sfarray, sfarray1, sfarray2, sfarray3; + var value= oletest._GetValueObject(); + var outValue= oletest._GetValueObject(); + outValue.InitOutParam(); + var outValue2= oletest._GetValueObject(); + outValue2.InitOutParam(); + var outValue3= oletest._GetValueObject(); + outValue3.InitOutParam(); + + var inoutValue= oletest._GetValueObject(); +// inoutValue.InitInOutParam(); + + switch( id) + { + // Array in-params + case 1: + value.Set("[]byte", arr) + ret= oletest.methodByte( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() + "<br>"); + document.writeln( "Returns a Sequence< BYTE > <br>" + sfarray.toArray()) ; break; + + case 2: + value.Set("[]double", arrDouble) + ret= oletest.methodDouble( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrDouble.toString() +"<br>"); + document.writeln( "Returns a Sequence< double > <br>" + sfarray.toArray()) ; break; + + case 3: + value.Set("[]boolean", arrBool) + ret= oletest.methodBool( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrBool.toString() +"<br>"); + document.writeln( "Returns a Sequence< BOOL > <br>" + sfarray.toArray()) ; break; + + case 4: + value.Set("[]short", arr) + ret= oletest.methodShort( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() +"<br>"); + document.writeln( "Returns a Sequence< SHORT > <br>" + sfarray.toArray()) ; break; + + case 5: + value.Set("[]unsigned short", arr) + ret= oletest.methodUShort( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() +"<br>"); + document.writeln( "Returns a Sequence< unsigned SHORT > <br>" + sfarray.toArray()) ; break; + + case 6: + value.Set("[]long", arr) + ret= oletest.methodLong( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() +"<br>"); + document.writeln( "Returns a Sequence< LONG > <br>" + sfarray.toArray()) ; break; + + case 7: + value.Set("[]unsigned long", arr) + ret= oletest.methodULong( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() +"<br>"); + document.writeln( "Returns a Sequence< unsigned LONG > <br>" + sfarray.toArray()) ; break; + + case 8: + value.Set("[]char", arrChar) + ret= oletest.methodChar( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrChar.toString() +"<br>"); + document.writeln( "Returns a Sequence< wchar_t > <br>" + sfarray.toArray()) ; break; + + case 9: + value.Set("[]string", arrString) + ret= oletest.methodString( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrString.toString() +"<br>"); + document.writeln( "Returns a Sequence< UString > <br>" + sfarray.toArray()) ; break; + + case 10: + value.Set("[]any", arrAny) + ret= oletest.methodAny( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrAny.toString() +"<br>"); + document.writeln( "Returns a Sequence< UsrAny > <br>" + sfarray.toArray() ) ; break; + + case 11: + var allArray= new Array(); + for(var i= 0; i <3; i++) + { + var value1= oletest._GetValueObject(); + value1.Set("[]long", arr); + allArray[i]= value1; + } + + value.Set("[][]long", allArray); + + ret= oletest.methodSequence( value); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrSeq.toString() +"<br>"); + document.writeln("Returns a Sequence< Sequence < long >> <br>") ; + var arr1= new Array(); + arr1= sfarray.toArray(); + for( i=0; i < arr1.length; i++) + { + sfarray2= new VBArray( arr1[i]); + var arr2= new Array(); + arr2= sfarray2.toArray(); + document.writeln( arr2.toString() + "<br>" ); + } + break; + + case 12: + var array1= new Array(); + for(var i= 0; i <3; i++) + { + var array2 = new Array(); + for( var j= 0; j < 3; j++) + { + var value2= oletest._GetValueObject(); + value2.Set("[]long", arr); + array2[j]= value2; + } + + var value1= oletest._GetValueObject(); + value1.Set("[][]long", array2) + array1[i]= value1; + } + var valueAll= oletest._GetValueObject(); + valueAll.Set("[][][]long",array1); + + ret= oletest.methodSequence2( valueAll); + document.writeln( "Param: " + arrSeq2.toString() +"<br>"); + sfarray1= new VBArray( ret); + arr1= sfarray1.toArray(); + for( i=0; i < arr1.length; i++) + { + sfarray2= new VBArray( arr1[i]); + arr2= sfarray2.toArray(); + + for ( j=0; j < arr2.length; j++) + { + sfarray3= new VBArray( arr2[j]); + arr3= sfarray3.toArray(); + document.write( i+ " "); + document.writeln(j + ": "+ arr3.toString() + "<br>" ); + } + + } + break; + + case 13: + + var ar= new Array(); + for( i=0; i< 3; i++) + { + var ob= new Object(); + var valueObject= oletest._GetValueObject(); + ob.value= "A JScript object!"; + valueObject.Set("com.sun.star.uno.XInterface", ob); +// valueObject.Set("long", 5); + ar[i]= valueObject; + } + value.Set("[]com.sun.star.uno.XInterface", ar); +// value.Set("[]long", ar); + + ret = oletest.methodXInterface( value); + sfarray= new VBArray( ret); + var arRet= sfarray.toArray(); + + document.writeln( "Params : Array containing objects ") + for( index in ar) + { + document.writeln( "object " + index + ": " + ar[index].Get().value +" "); + } + document.writeln( "<br>" ) ; + document.writeln("Return: <br>"); + for( index in arRet) + { + document.writeln( "object " + index + ": " + arRet[index].value + " "); + } + break; + + + + + // Properties: setting and getting values + case 200: + value.Set("[]byte", arr) + oletest.AttrByte = value; + ret= oletest.AttrByte; + sfarray= new VBArray( ret); + document.writeln("Setting AttrByte: " + arr.toString() + "<p>"); + document.writeln("Getting AttrByte: " + sfarray.toArray()); break; + + case 201: + value.Set("[]double", arrDouble) + oletest.AttrDouble= value; + ret= oletest.AttrDouble; + sfarray= new VBArray( ret); + document.writeln("Setting AttrDouble: " + arrDouble.toString() + "<p>"); + document.writeln("Getting AttrDouble: " + sfarray.toArray()); break; + + case 202: + value.Set("[]boolean", arrBool) + oletest.AttrBool= value; + ret= oletest.AttrBool; + sfarray= new VBArray( ret); + document.writeln("Setting AttrBool: " + arrBool.toString() + "<p>"); + document.writeln("Getting AttrBool: " + sfarray.toArray()); break; + + case 203: + value.Set("[]short", arr) + oletest.AttrShort= value; + ret= oletest.AttrShort; + sfarray= new VBArray( ret); + document.writeln("Setting AttrShort: " + arr.toString() + "<p>"); + document.writeln("Getting AttrShort: " + sfarray.toArray()); break; + + case 204: + value.Set("[]unsigned short", arr) + oletest.AttrUShort= value; + ret= oletest.AttrUShort; + sfarray= new VBArray( ret); + document.writeln("Setting AttrUShort: " + arr.toString() + "<p>"); + document.writeln("Getting AttrUShort: " + sfarray.toArray()); break; + + case 205: + value.Set("[]long", arr) + oletest.AttrLong= value; + ret= oletest.AttrLong; + sfarray= new VBArray( ret); + document.writeln("Setting AttrLong: " + arr.toString() + "<p>"); + document.writeln("Getting AttrLong: " + sfarray.toArray()); break; + + case 206: + value.Set("[]unsigned long", arr) + oletest.AttrULong= value; + ret= oletest.AttrULong; + sfarray= new VBArray( ret); + document.writeln("Setting AttrULong: " + arr.toString() + "<p>"); + document.writeln("Getting AttrULong: " + sfarray.toArray()); break; + + case 207: + value.Set("[]char", arrChar) + oletest.AttrChar= value; + ret= oletest.AttrChar; + sfarray= new VBArray( ret); + document.writeln("Setting AttrChar: " + arrChar.toString() + "<p>"); + document.writeln("Getting AttrChar: " + sfarray.toArray()); break; + + case 208: + value.Set("[]string", arrString) + oletest.AttrString= value; + ret= oletest.AttrString; + sfarray= new VBArray( ret); + document.writeln("Setting AttrString: " + arrString.toString() + "<p>"); + document.writeln("Getting AttrString: " + sfarray.toArray()); break; + + case 209: + value.Set("[]any", arrAny) + oletest.AttrAny= value; + ret= oletest.AttrAny; + sfarray= new VBArray( ret); + document.writeln("Setting AttrAny: " + arrAny.toString() + "<p>"); + document.writeln("Getting AttrAny: " + sfarray.toArray()); break; + + case 210: + var allArray= new Array(); + for(var i= 0; i <3; i++) + { + var value1= oletest._GetValueObject(); + value1.Set("[]long", arr); + allArray[i]= value1; + } + + value.Set("[][]long", allArray); + + oletest.AttrSequence= value; + ret= oletest.AttrSequence; + sfarray= new VBArray( ret); + + document.writeln( "Param: " + arrSeq.toString() +"<br>"); + document.writeln("Returns a Sequence< Sequence < long >> <br>") ; + var arr1= new Array(); + arr1= sfarray.toArray(); + for( i=0; i < arr1.length; i++) + { + sfarray2= new VBArray( arr1[i]); + var arr2= new Array(); + arr2= sfarray2.toArray(); + document.writeln( arr2.toString() + "<br>" ); + } + break; + + case 211: + var array1= new Array(); + for(var i= 0; i <3; i++) + { + var array2 = new Array(); + for( var j= 0; j < 3; j++) + { + var value2= oletest._GetValueObject(); + value2.Set("[]long", arr); + array2[j]= value2; + } + + var value1= oletest._GetValueObject(); + value1.Set("[][]long", array2) + array1[i]= value1; + } + var valueAll= oletest._GetValueObject(); + valueAll.Set("[][][]long",array1); + + oletest.AttrSequence2= valueAll; + ret= oletest.AttrSequence2; + sfarray1= new VBArray( ret); + arr1= sfarray1.toArray(); + for( i=0; i < arr1.length; i++) + { + sfarray2= new VBArray( arr1[i]); + arr2= sfarray2.toArray(); + + for ( j=0; j < arr2.length; j++) + { + sfarray3= new VBArray( arr2[j]); + arr3= sfarray3.toArray(); + document.write( i+ " "); + document.writeln(j + ": "+ arr3.toString() + "<br>" ); + } + + } + break; + + case 212: + var ar= new Array(); + for( i=0; i< 3; i++) + { + var ob= new Object(); + var valueObject= oletest._GetValueObject(); + ob.value= "A JScript object!"; + valueObject.Set("com.sun.star.uno.XInterface", ob); + ar[i]= valueObject; + } + value.Set("[]com.sun.star.uno.XInterface", ar); + + oletest.AttrXInterface= value; + ret= oletest.AttrXInterface; + sfarray= new VBArray( ret); + var arRet= sfarray.toArray(); + + document.writeln( "Params : Array containing objects ") + for( index in ar) + { + document.writeln( "object " + index + ": " + ar[index].Get().value +" "); + } + document.writeln( "<br>" ) ; + document.writeln("Return: <br>"); + for( index in arRet) + { + document.writeln( "object " + index + ": " + arRet[index].value + " "); + } + + break; + + // Out-parameter ------------------------------------------------------------ + case (2000): + + oletest.testout_methodByte( outValue ); + alert("byte: " + outValue.Get() ); break; + case (2001): + oletest.testout_methodDouble( outValue ); + alert( "double: " + outValue.Get() ); break; + case (2002): + oletest.testout_methodBool( outValue ); + alert( "boolean: " + outValue.Get() ); break; + case (2003): + oletest.testout_methodShort( outValue ); + alert( "short: " + outValue.Get() ); break; + case (2004): + oletest.testout_methodUShort( outValue ); + alert( "unsigned short: " + outValue.Get() ); break; + case (2005): + oletest.testout_methodLong( outValue ); + alert( "long: " + outValue.Get() ); break; + case (2006): + oletest.testout_methodULong( outValue ); + alert( "unsigned long: " + outValue.Get() ); break; + case (2007): + oletest.testout_methodChar( outValue ); + alert( "char: " + outValue.Get() ); break; + case (2008): + oletest.testout_methodString( outValue ); + alert( "string: " + outValue.Get()); break; + case (2009): + oletest.testout_methodAny( outValue ); + alert( "any: " + outValue.Get() ); break; + case (2010): + oletest.testout_methodSequence( outValue ); + var sfarray= new VBArray( outValue.Get()); + arr= sfarray.toArray(); + document.writeln("use the browser's back arrow to go to the previous page <p>"); + document.writeln( arr.toString()); + break; + case (2011): + oletest.testout_methodSequence2( outValue ); + var sfarray= new VBArray( outValue.Get()); + arr= sfarray.toArray(); + var i; + for( i=0; i < arr.length; i++) + { + var sfarray= new VBArray( arr[i]); + var arr2= new Array(); + arr2= sfarray.toArray(); + document.writeln( arr2.toString() + "<br>" ); + } + break; + case (2012): + oletest.testout_methodMulParams1( outValue, outValue2 ); + document.writeln( "int : " + outValue.Get() + " int :" + outValue2.Get()); break; + case (2013): + oletest.testout_methodMulParams2( outValue, outValue2, outValue3 ); + document.writeln( "int: " + outValue.Get() + " int: " + outValue2.Get() + " string: " + outValue3.Get() ); break; + case (2014): + oletest.testout_methodMulParams3( "hallo", outValue ); + document.writeln( "string: " + outValue.Get() ); break; + case (2015): + oletest.testout_methodXInterface( outValue ); + var out= outValue.Get(); + document.writeln( "string: " + out.AttrAny2); break; + + // INOUT - Parameter ------------------------------------------------------------------------------- + // The in value has to be placed on index 0 of the passed in array + case (500): + inoutValue.InitInOutParam("byte", 100); + oletest.testinout_methodByte( inoutValue ); + alert("byte: " + inoutValue.Get() ); break; + case (501): + inoutValue.InitInOutParam("double", 3.14); + oletest.testinout_methodDouble( inoutValue ); + alert( "double: " + inoutValue.Get() ); break; + case (502): + inoutValue.InitInOutParam("boolean", false); + oletest.testinout_methodBool( inoutValue ); + alert( "boolean: " + inoutValue.Get() ); break; + case (503): + inoutValue.InitInOutParam( "short", 200); + oletest.testinout_methodShort( inoutValue ); + alert( "short: " + inoutValue.Get() ); break; + case (504): + inoutValue.InitInOutParam("unsigned short", 300); + oletest.testinout_methodUShort( inoutValue ); + alert( "unsigned short: " + inoutValue.Get() ); break; + case (505): + inoutValue.InitInOutParam("long", 400); + oletest.testinout_methodLong( inoutValue ); + alert( "long: " + inoutValue.Get() ); break; + case (506): + inoutValue.InitInOutParam( "unsigned long", 500); + oletest.testinout_methodULong( inoutValue ); + alert( "unsigned long: " + inoutValue.Get() ); break; + case (507): + inoutValue.InitInOutParam( "char", "A"); + oletest.testinout_methodChar( inoutValue ); + alert( "char: " + inoutValue.Get() ); break; + case (508): + inoutValue.InitInOutParam("string", "I am a string"); + oletest.testinout_methodString( inoutValue ); + alert( "string: " + inoutValue.Get() ); break; + case (509): + inoutValue.InitInOutParam("[]long", arr); + oletest.testinout_methodAny( inoutValue ); // the method simply returns the argument + sfarray= new VBArray( inoutValue.Get()); + arr= sfarray.toArray(); + alert( "any: " + arr.toString() ); break; + case (510): + inoutValue.InitInOutParam("[]long", arr); + oletest.testinout_methodSequence( inoutValue ); + var sfarray= new VBArray( inoutValue.Get()); + arr= sfarray.toArray(); + document.writeln("use the browser's back arrow to go to the previous page <p>"); + document.writeln( arr.toString()); + break; + case (511): + inoutValue.InitInOutParam( "[][]long", arrSeq); + oletest.testinout_methodSequence2( inoutValue ); + var sfarray= new VBArray( inoutValue.Get()); + arr= sfarray.toArray(); + var i; + for( i=0; i < arr.length; i++) + { + var sfarray= new VBArray( arr[i]); + var arr2= new Array(); + arr2= sfarray.toArray(); + document.writeln( arr2.toString() + "<br>" ); + } + break; + case 512: + var ob= new Object(); + ob.value= "this is a string"; + inoutValue.InitInOutParam( "com.sun.star.script.XInvocation", ob); + oletest.testinout_methodXInterface( inoutValue); + document.write("Out value: " + inoutValue.Get().value ); + break; + + + + + + // Test ANY + // Methods + case 1000: + i= 100; + ret= oletest.methodAnyTest1( i); + document.writeln( "in: " + i + " ret: " + ret); + break; + case 1001: + i= 3.14; + ret= oletest.methodAnyTest1( i); + document.writeln( "in: " + i + " ret: " + ret); + break; + case 1002: + i= "Hallo" + ret= oletest.methodAnyTest1( i); + document.writeln( "in: " + i + " ret: " + ret); + break; + case 1003: + i= arr; + ret= oletest.methodAnyTest1( i); + sfarray= new VBArray( ret); + document.writeln( "in: " + i + " ret: " + sfarray.toArray()); + break; + case 1004: + var obj= new Object(); + obj[1]= "This is index 0"; + ret= oletest.methodAnyTest1( obj); + document.writeln( "in: " + obj + " ret: " + ret); + break; + + + // Test ANY property + case 1010: + i= 100; + oletest.AttrAny2= i; + ret= oletest.AttrAny2; + document.writeln( "set: " + i + " get: " + ret); + break; + case 1011: + i= 3.14; + oletest.AttrAny2= i; + ret= oletest.AttrAny2; + document.writeln( "set: " + i + " get: " + ret); + break; + case 1012: + i= "Hallo" + oletest.AttrAny2= i; + ret= oletest.AttrAny2; + document.writeln( "set: " + i + " get: " + ret); + break; + case 1013: + i= arr; + oletest.AttrAny2= i; + ret= oletest.AttrAny2; + sfarray= new VBArray( ret); + document.writeln( "set: " + i + " get: " + sfarray.toArray()); + break; + case 1014: + var obj= new Object(); + obj[1]= "This is index 0"; + oletest.AttrAny2= obj; + ret= oletest.AttrAny2; + document.writeln( "set: " + obj + " get: " + ret); + break; + + + case 2100: + alert("2100"); + var ret= oletest.retMethodByte(); + var sfarray= VBArray( ret); + document.writeln( sfarray.toArray() ); + break; + + +// case 5000: +// oletest.other_methodAnyIn("hallo"); + + + + } + +} + +function funcOut( out) +{ + out["du"]= 0xffff; +} + +</script> + +<script language="VBScript"> + +sub callBasic(id) + + Dim factory + Set factory= GetObject("", "com.sun.star.ServiceManager") + + Set oletest= factory.createInstance("oletest.OleTest") + + + arrInt= Array(1,2,3,4,5) + arrInt2= Array( -1, -2, 127, 128, 0) + arrDouble= Array(1.1, 2.2, 3.3, 4.4, 5.5) + arrBool= Array(0,1,0,2,0) + arrLong= Array( &Hff, &Hffff, &Hffffff, &Hffffffff) + arrString= Array("Chicken Wings", "Cheeseburger", "Hamburger") + arrChar= Array("a",65, "M") + arrAny= Array("Mickey", 3.14, 100, "A") + + Dim arrDim2Int(1,1) + For i= 0 To 1 + For j= 0 To 1 + arrDim2Int(i,j) = i*2 + j + Next + Next + + Dim arrDim3Int(1,1,1) + For i= 0 To 1 + For j= 0 To 1 + For k=0 To 1 + arrDim3Int(i,j,k) = i*2 + j*2 + k + Next + Next + Next + + + set outValue= factory.Bridge_GetValueObject() + outValue.InitOutParam + set value= factory.Bridge_GetValueObject() + select case id + case 0 + value.Set "[]byte", arrInt + ret= oletest.methodByte(value) + document.writeln "<br> return value: " + printArray ret + case 1 + document.writeln "param: " + printArray arrDouble + ret= oletest.methodDouble(arrDouble) + document.writeln "<br> return value: " + printArray ret + case 2 + document.writeln "param: " + printArray arrBool + ret= oletest.methodBool(arrBool) + document.writeln "<br> return value: " + printArray ret + case 3 + document.writeln "param: " + printArray arrInt2 + ret= oletest.methodShort(arrInt2) + document.writeln "<br> return value: " + printArray ret + case 4 + document.writeln "param: " + printArray arrInt + ret= oletest.methodUShort(arrInt) + document.writeln "<br> return value: " + printArray ret + case 5 + document.writeln "param: " + printArray arrLong + ret= oletest.methodLong(arrLong) + document.writeln "<br> return value: " + printArray ret + case 6 + document.writeln "param: " + printArray arrInt + ret= oletest.methodULong(arrInt) + document.writeln "<br> return value: " + printArray ret + case 7 + document.writeln "param: " + printArray arrString + ret= oletest.methodString(arrString) + document.writeln "<br> return value: " + printArray ret + case 8 + document.writeln "param: " + printArray arrChar + ret= oletest.methodChar(arrChar) + document.writeln "<br> return value: " + printArray ret + case 9 + document.writeln "param: " + printArray arrAny + ret= oletest.methodAny(arrAny) + document.writeln "<br> return value: " + printArray ret + case 10 + document.writeln "param: " + printArray2 arrDim2Int + ret= oletest.methodSequence(arrDim2Int) + document.writeln "<br> return value: " + for each val in ret + document.write "<br> array: " + for each val2 in val + document.write val2 + next + next + + // In Out Parameter -------------------------------------------------- + case 100 + a= 100 + document.write "param: " & CStr( a) & "<br>" + oletest.testinout_methodByte a + document.write a + case 101 + a= 1.11 + document.write "param: " & CStr( a) & "<br>" + oletest.testinout_methodDouble a + document.write a + case 102 + a= 5 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodBool a + document.write a + case 103 + a= -10 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodShort a + document.write a + case 104 + a= 128 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodUShort a + document.write a + case 105 + a= 65556 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodLong a + document.write a + case 106 + a= 65556 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodULong a + document.write a + case 107 + a= "ein test string" + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodString a + document.write a + case 108 + a= "W" + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodChar a + document.write a + case 109 + a= "Ein String im Any" + document.write "param: "& CStr( a) & "<br>" + oletest.other_methodAnyIn a + document.write a +// Attributes ----------------------------------------------------------------- + case 200 + document.write "set: " + printArray arrInt + oletest.AttrByte= arrInt + b= oletest.AttrByte + call printArrayEx( "<br> get: ", "<br>", b) + case 201 + document.write "set: " + printArray arrDouble + oletest.AttrDouble= arrDouble + b= oletest.AttrDouble + call printArrayEx( "<br> get: ", "<br>", b) + case 202 + document.write "set: " + printArray arrBool : + oletest.AttrBool= arrBool + b= oletest.AttrBool + call printArrayEx( "<br> get: ", "<br>", b) + case 203 + document.write "set: " + printArray arrInt2 : + oletest.AttrShort= arrInt2 + b= oletest.AttrShort + call printArrayEx( "<br> get: ", "<br>", b) + case 204 + document.write "set: " + printArray arrInt + oletest.AttrUShort= arrInt + b= oletest.AttrUShort + call printArrayEx( "<br> get: ", "<br>", b) + case 205 + document.write "set: " + printArray arrInt2 + oletest.AttrLong= arrInt2 + b= oletest.AttrLong + call printArrayEx( "<br> get: ", "<br>", b) + case 206 + document.write "set: " + printArray arrInt + oletest.AttrULong= arrInt + b= oletest.AttrULong + call printArrayEx( "<br> get: ", "<br>", b) + case 207 + document.write "set: " + printArray arrString + oletest.AttrString= arrString + b= oletest.AttrString + call printArrayEx( "<br> get: ", "<br>", b) + case 208 + document.write "set: " + printArray arrChar + oletest.AttrChar= arrChar + b= oletest.AttrChar + call printArrayEx( "<br> get: ", "<br>", b) + case 209 + document.write "set: " + printArray arrAny + oletest.AttrAny= arrAny + b= oletest.AttrAny + call printArrayEx( "<br> get: ", "<br>", b) + + case 210 + document.write "set: <br>" + printArray2 arrDim2Int : + oletest.AttrSequence= arrDim2Int + ret= oletest.AttrSequence + document.write "get: " + for each val in ret + document.write "<br> array: " + for each val2 in val + document.write val2 + next + next + +// out params + case 300 + oletest.testout_methodByte( outValue ) + alert("byte: " & outValue.Get() ) + + + end select +end sub +sub printArray( arr) + document.write "array: " + For Each val In arr + document.write CStr(val) & " " + Next +end sub + +// print a 2 dimensional Array + +sub printArray2( arr) + elements1= UBound( arr, 1) - LBound( arr, 1) +1 + elements2= UBound( arr, 2) - LBound( arr, 2) +1 + + For i=0 To elements1 -1 + document.write( "array " & CStr( i) & ": " ) + For j=0 To elements2 -1 + document.write CStr( arr(i,j)) + Next + document.write( "<br>") + Next +end sub + +sub printArrayEx( pre, post, array) + document.write pre + printArray array + document.write post +end sub +</script> + +<div id=out> </div> + +<!-- Insert HTML here --> + +<h2> JScript with _GetValueObject </h2> +Tests Array/Sequence conversion.<br> +All methods receive a Sequence as Parameter. The element type of the Sequence is written on the buttons. +<br> +<button onclick='callOleTest( 1)'>byte</Button> +<button onclick='callOleTest( 2)'>double</Button> +<button onclick='callOleTest( 3)'>boolean</Button> +<button onclick='callOleTest( 4)'>short</Button> +<button onclick='callOleTest( 5)'>unsigned short</Button> +<button onclick='callOleTest( 6)'>long</Button> +<button onclick='callOleTest( 7)'>unsigned long</Button> +<button onclick='callOleTest( 8)'>char</Button> +<button onclick='callOleTest( 10)'>any</Button> +<button onclick='callOleTest( 11)'>sequence<long> </Button> +<button onclick='callOleTest( 12)'>sequence<sequence<long> > </Button> +<button onclick='callOleTest( 13)'>XInterface</Button> +<p> + + +Out Parameter <br> +<button onclick='callOleTest( 2000)'>byte </Button> +<button onclick='callOleTest( 2001)'>double</Button> +<button onclick='callOleTest( 2002)'>boolean</Button> +<button onclick='callOleTest( 2003)'>short</Button> +<button onclick='callOleTest( 2004)'>unsigned short</Button> +<button onclick='callOleTest( 2005)'>long</Button> +<button onclick='callOleTest( 2006)'>unsigned long</Button> +<button onclick='callOleTest( 2007)'>char</Button> +<button onclick='callOleTest( 2008)'>string</Button> +<button onclick='callOleTest( 2009)'>any</Button> +<button onclick='callOleTest( 2010)'>sequence<long> </Button> +<button onclick='callOleTest( 2011)'>sequence<sequence<long> > </Button> +<button onclick='callOleTest( 2012)'>2 out </Button> +<button onclick='callOleTest( 2013)'>3 out </Button> +<button onclick='callOleTest( 2014)'>1 in & 1 out </Button> +<button onclick='callOleTest( 2015)'>XInterface </Button> + +<p> +In Out Parameter <br> +<button onclick='callOleTest( 500)'>byte </Button> +<button onclick='callOleTest( 501)'>double</Button> +<button onclick='callOleTest( 502)'>boolean</Button> +<button onclick='callOleTest( 503)'>short</Button> +<button onclick='callOleTest( 504)'>unsigned short</Button> +<button onclick='callOleTest( 505)'>long</Button> +<button onclick='callOleTest( 506)'>unsigned long</Button> +<button onclick='callOleTest( 507)'>char</Button> +<button onclick='callOleTest( 508)'>string</Button> +<button onclick='callOleTest( 509)'>any</Button> +<button onclick='callOleTest( 510)'>sequence<long> </Button> +<button onclick='callOleTest( 511)'>sequence<sequence<long> > </Button> +<button onclick='callOleTest( 512)'>XInterface </Button> +<p> + +Tests Array/Sequence conversion with Attributes. All params are of type Sequence and + the element type of the Sequence is written on the buttons. <br> +<button onclick='callOleTest( 200)'>byte </Button> +<button onclick='callOleTest( 201)'>double</Button> +<button onclick='callOleTest( 202)'>boolean</Button> +<button onclick='callOleTest( 203)'>short</Button> +<button onclick='callOleTest( 204)'>unsigned short</Button> +<button onclick='callOleTest( 205)'>long</Button> +<button onclick='callOleTest( 206)'>unsigned long</Button> +<button onclick='callOleTest( 207)'>char</Button> +<button onclick='callOleTest( 208)'>string</Button> +<button onclick='callOleTest( 209)'>any</Button> +<button onclick='callOleTest( 210)'>sequence<long> </Button> +<button onclick='callOleTest( 211)'>sequence<sequence<long> > </Button> +<button onclick='callOleTest( 212)'>XInterface </Button> +<p> + +<!-- +Test of Any parameter in a method. Any contains:<br> +<button onclick='callOleTest( 1000)'>integer </Button> +<button onclick='callOleTest( 1001)'>double </Button> +<button onclick='callOleTest( 1002)'>string</Button> +<button onclick='callOleTest( 1003)'>array</Button> +<button onclick='callOleTest( 1004)'>object</Button> +<p> +Test of Any parameter in a property. Any contains:<br> +<button onclick='callOleTest( 1010)'>integer </Button> +<button onclick='callOleTest( 1011)'>double </Button> +<button onclick='callOleTest( 1012)'>string</Button> +<button onclick='callOleTest( 1013)'>array</Button> +<button onclick='callOleTest( 1014)'>object</Button> +<p> +<p> +--> + +<h2> Visual Basic Tests </h2> +Test array /Sequence conversion and return value<br> +Template: <b> Sequence < type > method( Sequence< type > ) </b> +<p> + + +<button onclick='callBasic(0)'>byte</button> +<!-- +<button onclick='callBasic(1)'>double</button> +<button onclick='callBasic(2)'>boolean</button> +<button onclick='callBasic(3)'>short</button> +<button onclick='callBasic(4)'>u short</button> +<button onclick='callBasic(5)'>long</button> +<button onclick='callBasic(6)'>u long</button> +<button onclick='callBasic(7)'>string</button> +<button onclick='callBasic(8)'>char</button> +<button onclick='callBasic(9)'>any</button> <br> +<button onclick='callBasic(10)'>Seq < int ></button> +--> +<p> + + +Out parameter <br> +Template: <b> void method( Sequence < type > ) </b> <br> +<button onclick='callBasic(300)'>byte</button> +<!-- +<button onclick='callBasic(101)'>double</button> +<button onclick='callBasic(102)'>boolean</button> +<button onclick='callBasic(103)'>short</button> +<button onclick='callBasic(104)'>u short</button> +<button onclick='callBasic(105)'>long</button> +<button onclick='callBasic(106)'>u long</button> +<button onclick='callBasic(107)'>string</button> +<button onclick='callBasic(108)'>char</button> +<button onclick='callBasic(109)'>any</button> <br> +--> +<p> +<!-- +Tests Array/Sequence conversion with <b>Attributes</b>. All params are of type Sequence and + the element type of the Sequence is written on the buttons. <br> +<button onclick='callBasic( 200)'>byte </Button> +<button onclick='callBasic( 201)'>double</Button> +<button onclick='callBasic( 202)'>boolean</Button> +<button onclick='callBasic( 203)'>short</Button> +<button onclick='callBasic( 204)'>unsigned short</Button> +<button onclick='callBasic( 205)'>long</Button> +<button onclick='callBasic( 206)'>unsigned long</Button> +<button onclick='callBasic( 207)'>string</Button> +<button onclick='callBasic( 208)'>char</Button> +<button onclick='callBasic( 209)'>any</Button> +<button onclick='callBasic( 210)'>sequence<long> </Button> +--> + + + diff --git a/extensions/test/ole/MfcControl/MfcControl.cpp b/extensions/test/ole/MfcControl/MfcControl.cpp new file mode 100644 index 000000000..7ae701349 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControl.cpp @@ -0,0 +1,90 @@ +/* -*- 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 . + */ +// MfcControl.cpp : Implementation of CMfcControlApp and DLL registration. + +#include "stdafx.h" +#include "MfcControl.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +CMfcControlApp theApp; + +const GUID CDECL BASED_CODE _tlid + = { 0xac221fb3, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } }; +const WORD _wVerMajor = 1; +const WORD _wVerMinor = 0; + +// CMfcControlApp::InitInstance - DLL initialization + +BOOL CMfcControlApp::InitInstance() +{ + BOOL bInit = COleControlModule::InitInstance(); + + if (bInit) + { + // TODO: Add your own module initialization code here. + } + + return bInit; +} + +// CMfcControlApp::ExitInstance - DLL termination + +int CMfcControlApp::ExitInstance() +{ + // TODO: Add your own module termination code here. + + return COleControlModule::ExitInstance(); +} + +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + AFX_MANAGE_STATE(_afxModuleAddrThis); + + if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid)) + return ResultFromScode(SELFREG_E_TYPELIB); + + if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE)) + return ResultFromScode(SELFREG_E_CLASS); + + return NOERROR; +} + +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + AFX_MANAGE_STATE(_afxModuleAddrThis); + + if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor)) + return ResultFromScode(SELFREG_E_TYPELIB); + + if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE)) + return ResultFromScode(SELFREG_E_CLASS); + + return NOERROR; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControl.def b/extensions/test/ole/MfcControl/MfcControl.def new file mode 100644 index 000000000..8c164a7b5 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControl.def @@ -0,0 +1,9 @@ +; MfcControl.def : Declares the module parameters.
+
+LIBRARY "MFCCONTROL.OCX"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/extensions/test/ole/MfcControl/MfcControl.dsp b/extensions/test/ole/MfcControl/MfcControl.dsp new file mode 100644 index 000000000..f327a9893 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControl.dsp @@ -0,0 +1,265 @@ +# Microsoft Developer Studio Project File - Name="MfcControl" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=MfcControl - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "MfcControl.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "MfcControl.mak" CFG="MfcControl - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "MfcControl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "MfcControl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "MfcControl - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "MfcControl - Win32 Unicode Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "MfcControl - Win32 Release" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Ext "ocx" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Ext "ocx" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Registering ActiveX Control... +OutDir=.\Release +TargetPath=.\Release\MfcControl.ocx +InputPath=.\Release\MfcControl.ocx +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "MfcControl - Win32 Debug" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Ext "ocx" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Ext "ocx" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Registering ActiveX Control... +OutDir=.\Debug +TargetPath=.\Debug\MfcControl.ocx +InputPath=.\Debug\MfcControl.ocx +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "MfcControl - Win32 Unicode Debug" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugU" +# PROP BASE Intermediate_Dir "DebugU" +# PROP BASE Target_Ext "ocx" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugU" +# PROP Intermediate_Dir "DebugU" +# PROP Target_Ext "ocx" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Registering ActiveX Control... +OutDir=.\DebugU +TargetPath=.\DebugU\MfcControl.ocx +InputPath=.\DebugU\MfcControl.ocx +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "MfcControl - Win32 Unicode Release" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseU" +# PROP BASE Intermediate_Dir "ReleaseU" +# PROP BASE Target_Ext "ocx" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseU" +# PROP Intermediate_Dir "ReleaseU" +# PROP Target_Ext "ocx" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Registering ActiveX Control... +OutDir=.\ReleaseU +TargetPath=.\ReleaseU\MfcControl.ocx +InputPath=.\ReleaseU\MfcControl.ocx +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "MfcControl - Win32 Release" +# Name "MfcControl - Win32 Debug" +# Name "MfcControl - Win32 Unicode Debug" +# Name "MfcControl - Win32 Unicode Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\MfcControl.cpp +# End Source File +# Begin Source File + +SOURCE=.\MfcControl.def +# End Source File +# Begin Source File + +SOURCE=.\MfcControl.odl +# End Source File +# Begin Source File + +SOURCE=.\MfcControl.rc +# End Source File +# Begin Source File + +SOURCE=.\MfcControlCtl.cpp +# End Source File +# Begin Source File + +SOURCE=.\MfcControlPpg.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\MfcControl.h +# End Source File +# Begin Source File + +SOURCE=.\MfcControlCtl.h +# End Source File +# Begin Source File + +SOURCE=.\MfcControlPpg.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\MfcControlCtl.bmp +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project + diff --git a/extensions/test/ole/MfcControl/MfcControl.h b/extensions/test/ole/MfcControl/MfcControl.h new file mode 100644 index 000000000..49ef5e72f --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControl.h @@ -0,0 +1,52 @@ +/* -*- 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 . + */ +#if !defined(AFX_MFCCONTROL_H__AC221FBC_A0D8_11D4_833B_005004526AB4__INCLUDED_) +#define AFX_MFCCONTROL_H__AC221FBC_A0D8_11D4_833B_005004526AB4__INCLUDED_ + +#ifdef _MSC_VER +#pragma once +#endif + +// MfcControl.h : main header file for MFCCONTROL.DLL + +#if !defined(__AFXCTL_H__) +#error include 'afxctl.h' before including this file +#endif + +#include "resource.h" + +// CMfcControlApp : See MfcControl.cpp for implementation. + +class CMfcControlApp : public COleControlModule +{ +public: + BOOL InitInstance(); + int ExitInstance(); +}; + +extern const GUID CDECL _tlid; +extern const WORD _wVerMajor; +extern const WORD _wVerMinor; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MFCCONTROL_H__AC221FBC_A0D8_11D4_833B_005004526AB4__INCLUDED) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControl.odl b/extensions/test/ole/MfcControl/MfcControl.odl new file mode 100644 index 000000000..f00ebe518 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControl.odl @@ -0,0 +1,82 @@ +// MfcControl.odl : type library source for ActiveX Control project. + +// This file will be processed by the Make Type Library (mktyplib) tool to +// produce the type library (MfcControl.tlb) that will become a resource in +// MfcControl.ocx. + +#include <olectl.h> +#include <idispids.h> + +[ uuid(AC221FB3-A0D8-11D4-833B-005004526AB4), version(1.0), + helpfile("MfcControl.hlp"), + helpstring("MfcControl ActiveX Control module"), + control ] +library MFCCONTROLLib +{ + importlib(STDOLE_TLB); + importlib(STDTYPE_TLB); + + // Primary dispatch interface for CMfcControlCtrl + + [ uuid(AC221FB4-A0D8-11D4-833B-005004526AB4), + helpstring("Dispatch interface for MfcControl Control"), hidden ] + dispinterface _DMfcControl + { + properties: + // NOTE - ClassWizard will maintain property information here. + // Use extreme caution when editing this section. + //{{AFX_ODL_PROP(CMfcControlCtrl) + //}}AFX_ODL_PROP + + methods: + // NOTE - ClassWizard will maintain method information here. + // Use extreme caution when editing this section. + //{{AFX_ODL_METHOD(CMfcControlCtrl) + [id(1)] short inShort(short val); + [id(2)] long inLong(long val); + [id(3)] BSTR inString(BSTR* val); + [id(4)] float inFloat(float val); + [id(5)] double inDouble(double val); + [id(6)] VARIANT inVariant(VARIANT val); + [id(7)] IDispatch* inObject(IDispatch* val); + [id(8)] void outShort([out] short* val); + [id(9)] void outLong([out] long* val); + [id(10)] void outString([out] BSTR* val); + [id(11)] void outFloat([out] float* val); + [id(12)] void outDouble([out] double* val); + [id(13)] void outVariant([out] VARIANT* val); + [id(14)] void outObject([out] IDispatch** val); + //}}AFX_ODL_METHOD + }; + + // Event dispatch interface for CMfcControlCtrl + + [ uuid(AC221FB5-A0D8-11D4-833B-005004526AB4), + helpstring("Event interface for MfcControl Control") ] + dispinterface _DMfcControlEvents + { + properties: + // Event interface has no properties + + methods: + // NOTE - ClassWizard will maintain event information here. + // Use extreme caution when editing this section. + //{{AFX_ODL_EVENT(CMfcControlCtrl) + //}}AFX_ODL_EVENT + }; + + // Class information for CMfcControlCtrl + + [ uuid(AC221FB6-A0D8-11D4-833B-005004526AB4), + helpstring("MfcControl Control"), control ] + coclass MfcControl + { + [default] dispinterface _DMfcControl; + [default, source] dispinterface _DMfcControlEvents; + }; + + + //{{AFX_APPEND_ODL}} + //}}AFX_APPEND_ODL}} +}; +//VT_I2 diff --git a/extensions/test/ole/MfcControl/MfcControl.rc b/extensions/test/ole/MfcControl/MfcControl.rc new file mode 100644 index 000000000..49831c231 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControl.rc @@ -0,0 +1,163 @@ +/* + * 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 . + */ + +//Microsoft Visual C++ generated resource script. + +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS + + +// Generated from the TEXTINCLUDE 2 resource. + +#include "afxres.h" + + +#undef APSTUDIO_READONLY_SYMBOLS + +#ifdef APSTUDIO_INVOKED + + +// TEXTINCLUDE + + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""MfcControl.tlb""\r\n" + "\0" +END + + +#endif // APSTUDIO_INVOKED + + + + +// Version + + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Star Office Entwicklungs GmbH\0" + VALUE "FileDescription", "MfcControl ActiveX Control Module\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "MfcControl\0" + VALUE "LegalCopyright", "Copyright (C) 2000\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "MfcControl.OCX\0" + VALUE "ProductName", "MfcControl ActiveX Control Module\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + + +// Bitmap + + +//IDB_MFCCONTROL BITMAP DISCARDABLE "MfcControlCtl.bmp" + + + +// Dialog + + + +IDD_PROPPAGE_MFCCONTROL DIALOG DISCARDABLE 0, 0, 250, 62 +STYLE WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "TODO: Place controls to manipulate properties of MfcControl Control on this dialog.", + IDC_STATIC,7,25,229,16 +END + + + + +// DESIGNINFO + + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_PROPPAGE_MFCCONTROL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 243 + TOPMARGIN, 7 + BOTTOMMARGIN, 55 + END +END +#endif // APSTUDIO_INVOKED + + + +// String Table + + +STRINGTABLE DISCARDABLE +BEGIN + IDS_MFCCONTROL "MfcControl Control" + IDS_MFCCONTROL_PPG "MfcControl Property Page" + IDS_MFCCONTROL_PPG_CAPTION "General" + +END + + +#ifndef APSTUDIO_INVOKED + + +// Generated from the TEXTINCLUDE 3 resource. + +1 TYPELIB "MfcControl.tlb" + + +#endif // not APSTUDIO_INVOKED + diff --git a/extensions/test/ole/MfcControl/MfcControl.sln b/extensions/test/ole/MfcControl/MfcControl.sln new file mode 100644 index 000000000..24e646c86 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControl.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MfcControl", "MfcControl.vcproj", "{07D59661-3519-4F10-AE9F-22DB0479E25A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ Unicode Debug|Win32 = Unicode Debug|Win32
+ Unicode Release|Win32 = Unicode Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {07D59661-3519-4F10-AE9F-22DB0479E25A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {07D59661-3519-4F10-AE9F-22DB0479E25A}.Debug|Win32.Build.0 = Debug|Win32
+ {07D59661-3519-4F10-AE9F-22DB0479E25A}.Release|Win32.ActiveCfg = Release|Win32
+ {07D59661-3519-4F10-AE9F-22DB0479E25A}.Release|Win32.Build.0 = Release|Win32
+ {07D59661-3519-4F10-AE9F-22DB0479E25A}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
+ {07D59661-3519-4F10-AE9F-22DB0479E25A}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
+ {07D59661-3519-4F10-AE9F-22DB0479E25A}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
+ {07D59661-3519-4F10-AE9F-22DB0479E25A}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/extensions/test/ole/MfcControl/MfcControl.vcproj b/extensions/test/ole/MfcControl/MfcControl.vcproj new file mode 100644 index 000000000..6099d8242 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControl.vcproj @@ -0,0 +1,581 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="MfcControl"
+ ProjectGUID="{07D59661-3519-4F10-AE9F-22DB0479E25A}"
+ RootNamespace="MfcControl"
+ Keyword="MFCProj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Unicode Release|Win32"
+ OutputDirectory=".\ReleaseU"
+ IntermediateDirectory=".\ReleaseU"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Registering ActiveX Control..."
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\ReleaseU/MfcControl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseU/MfcControl.pch"
+ AssemblerListingLocation=".\ReleaseU/"
+ ObjectFile=".\ReleaseU/"
+ ProgramDataBaseFileName=".\ReleaseU/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ OutputFile=".\ReleaseU/MfcControl.ocx"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\MfcControl.def"
+ ProgramDatabaseFile=".\ReleaseU/MfcControl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseU/MfcControl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode Debug|Win32"
+ OutputDirectory=".\DebugU"
+ IntermediateDirectory=".\DebugU"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Registering ActiveX Control..."
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\DebugU/MfcControl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\DebugU/MfcControl.pch"
+ AssemblerListingLocation=".\DebugU/"
+ ObjectFile=".\DebugU/"
+ ProgramDataBaseFileName=".\DebugU/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ OutputFile=".\DebugU/MfcControl.ocx"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\MfcControl.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\DebugU/MfcControl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\DebugU/MfcControl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Registering ActiveX Control..."
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/MfcControl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Release/MfcControl.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ OutputFile=".\Release/MfcControl.ocx"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\MfcControl.def"
+ ProgramDatabaseFile=".\Release/MfcControl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Release/MfcControl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Registering ActiveX Control..."
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/MfcControl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Debug/MfcControl.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ OutputFile=".\Debug/MfcControl.ocx"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\MfcControl.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/MfcControl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Debug/MfcControl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath=".\MfcControl.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MfcControl.def"
+ >
+ </File>
+ <File
+ RelativePath=".\MfcControl.odl"
+ >
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="1"
+ HeaderFileName="MfcControl_h.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="1"
+ HeaderFileName="MfcControl_h.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="1"
+ HeaderFileName="MfcControl_h.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="1"
+ HeaderFileName="MfcControl_h.h"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\MfcControl.rc"
+ >
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\MfcControlCtl.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MfcControlPpg.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\StdAfx.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\MfcControl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MfcControlCtl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MfcControlPpg.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\StdAfx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\MfcControlCtl.bmp"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/extensions/test/ole/MfcControl/MfcControlCtl.cpp b/extensions/test/ole/MfcControl/MfcControlCtl.cpp new file mode 100644 index 000000000..e64ed6570 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControlCtl.cpp @@ -0,0 +1,364 @@ +/* -*- 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 . + */ +// MfcControlCtl.cpp : Implementation of the CMfcControlCtrl ActiveX Control class. + +#include "stdafx.h" +#include "MfcControl.h" +#include "MfcControlCtl.h" +#include "MfcControlPpg.h" + + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +IMPLEMENT_DYNCREATE(CMfcControlCtrl, COleControl) + + + +// Message map + +BEGIN_MESSAGE_MAP(CMfcControlCtrl, COleControl) + //{{AFX_MSG_MAP(CMfcControlCtrl) + // NOTE - ClassWizard will add and remove message map entries + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG_MAP + ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties) +END_MESSAGE_MAP() + + + +// Dispatch map + +BEGIN_DISPATCH_MAP(CMfcControlCtrl, COleControl) + //{{AFX_DISPATCH_MAP(CMfcControlCtrl) + DISP_FUNCTION(CMfcControlCtrl, "inShort", inShort, VT_I2, VTS_I2) + DISP_FUNCTION(CMfcControlCtrl, "inLong", inLong, VT_I4, VTS_I4) + DISP_FUNCTION(CMfcControlCtrl, "inString", inString, VT_BSTR, VTS_PBSTR) + DISP_FUNCTION(CMfcControlCtrl, "inFloat", inFloat, VT_R4, VTS_R4) + DISP_FUNCTION(CMfcControlCtrl, "inDouble", inDouble, VT_R8, VTS_R8) + DISP_FUNCTION(CMfcControlCtrl, "inVariant", inVariant, VT_VARIANT, VTS_VARIANT) + DISP_FUNCTION(CMfcControlCtrl, "inObject", inObject, VT_DISPATCH, VTS_DISPATCH) + DISP_FUNCTION(CMfcControlCtrl, "outShort", outShort, VT_EMPTY, VTS_PI2) + DISP_FUNCTION(CMfcControlCtrl, "outLong", outLong, VT_EMPTY, VTS_PI4) + DISP_FUNCTION(CMfcControlCtrl, "outString", outString, VT_EMPTY, VTS_PBSTR) + DISP_FUNCTION(CMfcControlCtrl, "outFloat", outFloat, VT_EMPTY, VTS_PR4) + DISP_FUNCTION(CMfcControlCtrl, "outDouble", outDouble, VT_EMPTY, VTS_PR8) + DISP_FUNCTION(CMfcControlCtrl, "outVariant", outVariant, VT_EMPTY, VTS_PVARIANT) + DISP_FUNCTION(CMfcControlCtrl, "outObject", outObject, VT_EMPTY, VTS_PDISPATCH) + //}}AFX_DISPATCH_MAP +END_DISPATCH_MAP() + + + +// Event map + +BEGIN_EVENT_MAP(CMfcControlCtrl, COleControl) + //{{AFX_EVENT_MAP(CMfcControlCtrl) + // NOTE - ClassWizard will add and remove event map entries + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_EVENT_MAP +END_EVENT_MAP() + + + +// Property pages + +// TODO: Add more property pages as needed. Remember to increase the count! +BEGIN_PROPPAGEIDS(CMfcControlCtrl, 1) + PROPPAGEID(CMfcControlPropPage::guid) +END_PROPPAGEIDS(CMfcControlCtrl) + + + +// Initialize class factory and guid + +IMPLEMENT_OLECREATE_EX(CMfcControlCtrl, "MFCCONTROL.MfcControlCtrl.1", + 0xac221fb6, 0xa0d8, 0x11d4, 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4) + + + +// Type library ID and version + +IMPLEMENT_OLETYPELIB(CMfcControlCtrl, _tlid, _wVerMajor, _wVerMinor) + + + +// Interface IDs + +const IID BASED_CODE IID_DMfcControl = + { 0xac221fb4, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } }; +const IID BASED_CODE IID_DMfcControlEvents = + { 0xac221fb5, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } }; + + + +// Control type information + +static const DWORD BASED_CODE _dwMfcControlOleMisc = + OLEMISC_ACTIVATEWHENVISIBLE | + OLEMISC_SETCLIENTSITEFIRST | + OLEMISC_INSIDEOUT | + OLEMISC_CANTLINKINSIDE | + OLEMISC_RECOMPOSEONRESIZE; + +IMPLEMENT_OLECTLTYPE(CMfcControlCtrl, IDS_MFCCONTROL, _dwMfcControlOleMisc) + + + +// CMfcControlCtrl::CMfcControlCtrlFactory::UpdateRegistry - +// Adds or removes system registry entries for CMfcControlCtrl + +BOOL CMfcControlCtrl::CMfcControlCtrlFactory::UpdateRegistry(BOOL bRegister) +{ + // TODO: Verify that your control follows apartment-model threading rules. + // Refer to MFC TechNote 64 for more information. + // If your control does not conform to the apartment-model rules, then + // you must modify the code below, changing the 6th parameter from + // afxRegApartmentThreading to 0. + + if (bRegister) + return AfxOleRegisterControlClass( + AfxGetInstanceHandle(), + m_clsid, + m_lpszProgID, + IDS_MFCCONTROL, + IDB_MFCCONTROL, + afxRegApartmentThreading, + _dwMfcControlOleMisc, + _tlid, + _wVerMajor, + _wVerMinor); + else + return AfxOleUnregisterClass(m_clsid, m_lpszProgID); +} + + + +// CMfcControlCtrl::CMfcControlCtrl - Constructor + +CMfcControlCtrl::CMfcControlCtrl() +{ + InitializeIIDs(&IID_DMfcControl, &IID_DMfcControlEvents); + + // TODO: Initialize your control's instance data here. +} + + + +// CMfcControlCtrl::~CMfcControlCtrl - Destructor + +CMfcControlCtrl::~CMfcControlCtrl() +{ + // TODO: Cleanup your control's instance data here. +} + + + +// CMfcControlCtrl::OnDraw - Drawing function + +void CMfcControlCtrl::OnDraw( + CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid) +{ + // TODO: Replace the following code with your own drawing code. + pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH))); + pdc->Ellipse(rcBounds); +} + + + +// CMfcControlCtrl::DoPropExchange - Persistence support + +void CMfcControlCtrl::DoPropExchange(CPropExchange* pPX) +{ + ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); + COleControl::DoPropExchange(pPX); + + // TODO: Call PX_ functions for each persistent custom property. + +} + + + +// CMfcControlCtrl::OnResetState - Reset control to default state + +void CMfcControlCtrl::OnResetState() +{ + COleControl::OnResetState(); // Resets defaults found in DoPropExchange + + // TODO: Reset any other control state here. +} + + + +// CMfcControlCtrl message handlers + + +short CMfcControlCtrl::inShort(short val) +{ + char buf[256]; + sprintf( buf, "inByte: value= %d", val); + ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); + return val+1; +} + +long CMfcControlCtrl::inLong(long val) +{ + char buf[256]; + sprintf( buf, "inLong: value= %d", val); + ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); + return val+1; +} + +BSTR CMfcControlCtrl::inString(BSTR* val) +{ + CString strResult; + strResult= *val; + char buf[256]; + sprintf( buf, "inString: value= %S", *val); + ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); + strResult += L" an appended string"; + return strResult.AllocSysString(); +} + +float CMfcControlCtrl::inFloat(float val) +{ + char buf[256]; + sprintf( buf, "inFloat: value= %f", val); + ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); + return val+1; +} + +double CMfcControlCtrl::inDouble(double val) +{ + char buf[256]; + sprintf( buf, "inDouble: value= %g", val); + ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); + return val+1; +} + +VARIANT CMfcControlCtrl::inVariant(const VARIANT& val) +{ + VARIANT vaResult; + VariantInit(&vaResult); + VariantCopyInd( &vaResult, const_cast<VARIANT*>(&val)); + if( vaResult.vt == VT_BSTR) + { + char buf[256]; + sprintf( buf, "inVariant: value= %S", vaResult.bstrVal); + ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); + + } + return _variant_t( L" a string from CMfcControlCtrl::inVariant"); +} + +LPDISPATCH CMfcControlCtrl::inObject(LPDISPATCH val) +{ + char buf[256]; + _bstr_t bstr; + HRESULT hr= S_OK; + COleVariant var; + DISPID id; + OLECHAR* name=L"prpString"; + if( SUCCEEDED(hr= val->GetIDsOfNames( IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &id))) + { + DISPPARAMS params={0,0,0,0}; + hr= val->Invoke( id, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, ¶ms, &var,0,0); + + } + + if( var.vt== VT_BSTR) + bstr= var.bstrVal; + sprintf( buf, "inObject: value= %S", (wchar_t*)bstr); + ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); + + return NULL; +} + + +void CMfcControlCtrl::outShort(short* val) +{ + *val= 123; +} + +void CMfcControlCtrl::outLong(long* val) +{ + *val= 1234; +} + +void CMfcControlCtrl::outString(BSTR* val) +{ + *val= SysAllocString(L"A string from CMfcControlCtrl::outString "); +} + +void CMfcControlCtrl::outFloat(float* val) +{ + *val= 3.14f; +} + +void CMfcControlCtrl::outDouble(double* val) +{ + *val= 3.145; +} + +void CMfcControlCtrl::outVariant(VARIANT* val) +{ + VariantInit( val); + val->vt= VT_BSTR; + val->bstrVal= SysAllocString( L"a string in a VARIANT"); +} + +void CMfcControlCtrl::outObject(LPDISPATCH* val) +{ + //{BFE10EBE-8584-11D4-005004526AB4} + HRESULT hr= S_OK; + CLSID clsTestControl; + hr= CLSIDFromProgID( L"AxTestComponents.Basic", &clsTestControl); + + IDispatch* pDisp= NULL; + hr= CoCreateInstance( clsTestControl, NULL, CLSCTX_ALL, __uuidof(IDispatch), (void**)&pDisp); + + if( SUCCEEDED( hr) && val) + { + COleVariant var; + DISPID id; + OLECHAR* name=L"prpString"; + if( SUCCEEDED(hr= pDisp->GetIDsOfNames( IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &id))) + { + COleVariant vaParam1(_T("this is property prpString of AxTestComponents.Basic")); + DISPID dispidPut= DISPID_PROPERTYPUT; + DISPPARAMS params; + params.cArgs= 1; + params.cNamedArgs= 1; + params.rgdispidNamedArgs= &dispidPut; + params.rgvarg= &vaParam1; + + hr= pDisp->Invoke( id, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT, ¶ms, &var,0,0); + *val= pDisp; + } + + } + +} +// VT_I1 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControlCtl.h b/extensions/test/ole/MfcControl/MfcControlCtl.h new file mode 100644 index 000000000..b1d74270b --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControlCtl.h @@ -0,0 +1,116 @@ +/* -*- 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 . + */ +#if !defined(AFX_MFCCONTROLCTL_H__AC221FC3_A0D8_11D4_833B_005004526AB4__INCLUDED_) +#define AFX_MFCCONTROLCTL_H__AC221FC3_A0D8_11D4_833B_005004526AB4__INCLUDED_ + +#ifdef _MSC_VER +#pragma once +#endif + +// MfcControlCtl.h : Declaration of the CMfcControlCtrl ActiveX Control class. + + +// CMfcControlCtrl : See MfcControlCtl.cpp for implementation. + +class CMfcControlCtrl : public COleControl +{ + DECLARE_DYNCREATE(CMfcControlCtrl) + +// Constructor +public: + CMfcControlCtrl(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMfcControlCtrl) + public: + virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid); + virtual void DoPropExchange(CPropExchange* pPX); + virtual void OnResetState(); + //}}AFX_VIRTUAL + +// Implementation +protected: + ~CMfcControlCtrl(); + + DECLARE_OLECREATE_EX(CMfcControlCtrl) // Class factory and guid + DECLARE_OLETYPELIB(CMfcControlCtrl) // GetTypeInfo + DECLARE_PROPPAGEIDS(CMfcControlCtrl) // Property page IDs + DECLARE_OLECTLTYPE(CMfcControlCtrl) // Type name and misc status + +// Message maps + //{{AFX_MSG(CMfcControlCtrl) + // NOTE - ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +// Dispatch maps + //{{AFX_DISPATCH(CMfcControlCtrl) + afx_msg short inShort(short val); + afx_msg long inLong(long val); + afx_msg BSTR inString(BSTR* val); + afx_msg float inFloat(float val); + afx_msg double inDouble(double val); + afx_msg VARIANT inVariant(const VARIANT& val); + afx_msg LPDISPATCH inObject(LPDISPATCH val); + afx_msg void outShort(short* val); + afx_msg void outLong(long* val); + afx_msg void outString(BSTR* val); + afx_msg void outFloat(float* val); + afx_msg void outDouble(double* val); + afx_msg void outVariant(VARIANT* val); + afx_msg void outObject(LPDISPATCH* val); + //}}AFX_DISPATCH + DECLARE_DISPATCH_MAP() + +// Event maps + //{{AFX_EVENT(CMfcControlCtrl) + //}}AFX_EVENT + DECLARE_EVENT_MAP() + +// Dispatch and event IDs +public: + enum { + //{{AFX_DISP_ID(CMfcControlCtrl) + dispidInShort = 1L, + dispidInLong = 2L, + dispidInString = 3L, + dispidInFloat = 4L, + dispidInDouble = 5L, + dispidInVariant = 6L, + dispidInObject = 7L, + dispidOutShort = 8L, + dispidOutLong = 9L, + dispidOutString = 10L, + dispidOutFloat = 11L, + dispidOutDouble = 12L, + dispidOutVariant = 13L, + dispidOutObject = 14L, + //}}AFX_DISP_ID + }; +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MFCCONTROLCTL_H__AC221FC3_A0D8_11D4_833B_005004526AB4__INCLUDED) +// BYTE + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControlCtl.png b/extensions/test/ole/MfcControl/MfcControlCtl.png Binary files differnew file mode 100644 index 000000000..77c4758c1 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControlCtl.png diff --git a/extensions/test/ole/MfcControl/MfcControlPpg.cpp b/extensions/test/ole/MfcControl/MfcControlPpg.cpp new file mode 100644 index 000000000..367122363 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControlPpg.cpp @@ -0,0 +1,96 @@ +/* -*- 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 . + */ +// MfcControlPpg.cpp : Implementation of the CMfcControlPropPage property page class. + +#include "stdafx.h" +#include "MfcControl.h" +#include "MfcControlPpg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +IMPLEMENT_DYNCREATE(CMfcControlPropPage, COlePropertyPage) + + + +// Message map + +BEGIN_MESSAGE_MAP(CMfcControlPropPage, COlePropertyPage) + //{{AFX_MSG_MAP(CMfcControlPropPage) + // NOTE - ClassWizard will add and remove message map entries + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + + +// Initialize class factory and guid + +IMPLEMENT_OLECREATE_EX(CMfcControlPropPage, "MFCCONTROL.MfcControlPropPage.1", + 0xac221fb7, 0xa0d8, 0x11d4, 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4) + + + +// CMfcControlPropPage::CMfcControlPropPageFactory::UpdateRegistry - +// Adds or removes system registry entries for CMfcControlPropPage + +BOOL CMfcControlPropPage::CMfcControlPropPageFactory::UpdateRegistry(BOOL bRegister) +{ + if (bRegister) + return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(), + m_clsid, IDS_MFCCONTROL_PPG); + else + return AfxOleUnregisterClass(m_clsid, NULL); +} + + + +// CMfcControlPropPage::CMfcControlPropPage - Constructor + +CMfcControlPropPage::CMfcControlPropPage() : + COlePropertyPage(IDD, IDS_MFCCONTROL_PPG_CAPTION) +{ + //{{AFX_DATA_INIT(CMfcControlPropPage) + // NOTE: ClassWizard will add member initialization here + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_DATA_INIT +} + + + +// CMfcControlPropPage::DoDataExchange - Moves data between page and properties + +void CMfcControlPropPage::DoDataExchange(CDataExchange* pDX) +{ + //{{AFX_DATA_MAP(CMfcControlPropPage) + // NOTE: ClassWizard will add DDP, DDX, and DDV calls here + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_DATA_MAP + DDP_PostProcessing(pDX); +} + + + +// CMfcControlPropPage message handlers + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControlPpg.h b/extensions/test/ole/MfcControl/MfcControlPpg.h new file mode 100644 index 000000000..cb7cd7164 --- /dev/null +++ b/extensions/test/ole/MfcControl/MfcControlPpg.h @@ -0,0 +1,66 @@ +/* -*- 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 . + */ +#if !defined(AFX_MFCCONTROLPPG_H__AC221FC5_A0D8_11D4_833B_005004526AB4__INCLUDED_) +#define AFX_MFCCONTROLPPG_H__AC221FC5_A0D8_11D4_833B_005004526AB4__INCLUDED_ + +#ifdef _MSC_VER +#pragma once +#endif + +// MfcControlPpg.h : Declaration of the CMfcControlPropPage property page class. + + +// CMfcControlPropPage : See MfcControlPpg.cpp.cpp for implementation. + +class CMfcControlPropPage : public COlePropertyPage +{ + DECLARE_DYNCREATE(CMfcControlPropPage) + DECLARE_OLECREATE_EX(CMfcControlPropPage) + +// Constructor +public: + CMfcControlPropPage(); + +// Dialog Data + //{{AFX_DATA(CMfcControlPropPage) + enum { IDD = IDD_PROPPAGE_MFCCONTROL }; + // NOTE - ClassWizard will add data members here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_DATA + +// Implementation +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + +// Message maps +protected: + //{{AFX_MSG(CMfcControlPropPage) + // NOTE - ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MFCCONTROLPPG_H__AC221FC5_A0D8_11D4_833B_005004526AB4__INCLUDED) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/Resource.h b/extensions/test/ole/MfcControl/Resource.h new file mode 100644 index 000000000..598d26ba3 --- /dev/null +++ b/extensions/test/ole/MfcControl/Resource.h @@ -0,0 +1,40 @@ +/* -*- 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 . + */ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by MfcControl.rc + + +#define IDS_MFCCONTROL 1 +#define IDS_MFCCONTROL_PPG 2 + +#define IDS_MFCCONTROL_PPG_CAPTION 200 + +#define IDD_PROPPAGE_MFCCONTROL 200 + + +#define IDB_MFCCONTROL 1 + + +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 32768 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/StdAfx.cpp b/extensions/test/ole/MfcControl/StdAfx.cpp new file mode 100644 index 000000000..13bae5702 --- /dev/null +++ b/extensions/test/ole/MfcControl/StdAfx.cpp @@ -0,0 +1,25 @@ +/* -*- 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 . + */ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/StdAfx.h b/extensions/test/ole/MfcControl/StdAfx.h new file mode 100644 index 000000000..6e8059a1b --- /dev/null +++ b/extensions/test/ole/MfcControl/StdAfx.h @@ -0,0 +1,50 @@ +/* -*- 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 . + */ +#if !defined(AFX_STDAFX_H__AC221FBA_A0D8_11D4_833B_005004526AB4__INCLUDED_) +#define AFX_STDAFX_H__AC221FBA_A0D8_11D4_833B_005004526AB4__INCLUDED_ + +#ifdef _MSC_VER +#pragma once +#endif + +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include <afxctl.h> +#include <afxext.h> +#include <afxdtctl.h> +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> +#endif // _AFX_NO_AFXCMN_SUPPORT + +// Delete the two includes below if you do not wish to use the MFC +// database classes +#include <afxdb.h> +#include <afxdao.h> + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#include <comdef.h> +#endif // !defined(AFX_STDAFX_H__AC221FBA_A0D8_11D4_833B_005004526AB4__INCLUDED_) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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..47709f383 --- /dev/null +++ b/extensions/test/ole/OleClient/axhost.cxx @@ -0,0 +1,39 @@ +/* -*- 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..68a9069fb --- /dev/null +++ b/extensions/test/ole/OleClient/axhost.hxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#pragma once + +#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); +}; + + +/* 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)
+
diff --git a/extensions/test/ole/OleConverterVar1/convTest.cxx b/extensions/test/ole/OleConverterVar1/convTest.cxx new file mode 100644 index 000000000..8fc27177e --- /dev/null +++ b/extensions/test/ole/OleConverterVar1/convTest.cxx @@ -0,0 +1,647 @@ +/* -*- 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 . + */ + + +#pragma warning (disable: 4917) +#if !defined WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <comdef.h> +#include <atlbase.h> +extern CComModule _Module; +#include <atlcom.h> + +#include <stdio.h> +#include <com/sun/star/bridge/ModelDependent.hpp> +#include <com/sun/star/bridge/XBridgeSupplier2.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> + +#include <oletest/XTestSequence.hpp> +#include <rtl/process.h> +#include <com/sun/star/uno/Reference.h> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/bootstrap.hxx> +#include <rtl/string.h> + + +CComModule _Module; +BEGIN_OBJECT_MAP(ObjectMap) +END_OBJECT_MAP() + +#include "smartarray.h" +using namespace com::sun::star::bridge; +using namespace com::sun::star::bridge::ModelDependent; +using namespace com::sun::star::lang; +using namespace com::sun::star::uno; +using namespace oletest; +using namespace cppu; + + +HRESULT doTest(); +HRESULT InitializeParameter(); +void printResultVariantArray( VARIANT & var); +void printVariant( VARIANT & var); + + +int SAL_CALL main( int argc, char* argv[] ) +{ + HRESULT hr; + if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) + { + printf("CoInitializeEx failed \n"); + return -1; + } + + + _Module.Init( ObjectMap, GetModuleHandleA( NULL)); + + if( FAILED(hr=doTest())) + { + _com_error err( hr); + const CHAR * errMsg= err.ErrorMessage(); + MessageBoxA( NULL, errMsg, "Test failed", MB_ICONERROR); + } + + + _Module.Term(); + CoUninitialize(); + return 0; +} +char _c[]={ 1,2,3,4,5}; +short _short[]={0xffff, 1, 11 ,111, 1111 }; +unsigned short _ushort[]={0xffff, 1, 11 ,111, 1111 }; +long _long[]= { 0xffffffff, 11, 111 ,1111, 1111 }; +unsigned long _ulong[]= { 0xffffffff, 11, 111 ,1111, 1111 }; +float _float[]= { 12345.f, 1234.5f, 123.45f, 12.345f, 1.2345f}; +double _double[]= {12345, 1234.5, 123.45, 12.345, 1.2345}; + +CComVariant _variant[]= {L"variant 1", L"variant2", L"variant3"}; +wchar_t _wchar[]= {L'1', L'2', L'3', L'A', L' '}; +BSTR _bstr[]={L"Ich", L"bin", L"ein", L"Hamburger", L"Jung"}; +SmartArray<char> arByte( _c, 5, VT_I1); +SmartArray< short> arShort( _short, 5, VT_I2); +//SmartArray< unsigned short> arUShort( _ushort, 5, VT_UI2); +SmartArray< long> arLong( _long, 5, VT_I4); +//SmartArray< unsigned long> arULong( _ulong, 5, VT_UI4); +//SmartArray< float> arFloat( _float, 5, VT_R4 ); +SmartArray< double> arDouble( _double, 5, VT_R8 ); +//SmartArray< unsigned short> arWChar( _wchar, 5, VT_UI2 ); +SmartArray< wchar_t* > arString( _bstr, 5, VT_BSTR); +SmartArray< VARIANT > arVariant( _variant, 3, VT_VARIANT); + + +HRESULT doTest() +{ + HRESULT hr; + USES_CONVERSION; + CComPtr<IUnknown> spUnkMgr; + + putenv("UNO_TYPES=types.rdb"); + putenv("UNO_SERVICES=services.rdb"); + Reference<XComponentContext> xContext = defaultBootstrap_InitialComponentContext(); + + Reference< XMultiComponentFactory > mgr = xContext->getServiceManager();//createRegistryServiceFactory( OUString(L"services.rdb")); + Reference< XInterface > xIntSupplier= mgr->createInstanceWithContext( + "com.sun.star.bridge.OleBridgeSupplierVar1", xContext); + Reference< XBridgeSupplier2 > xSuppl( xIntSupplier, UNO_QUERY); + Reference <XInterface> xOletest= mgr->createInstanceWithContext( + "oletest.OleTest", xContext); + Any any; + any <<= xOletest; + sal_uInt8 arId[16]; + rtl_getGlobalProcessId( arId); + Any target= xSuppl->createBridge( any, Sequence<sal_Int8>( (sal_Int8*)arId, 16), UNO, OLE); + CComDispatchDriver oletest; + if (target.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass()) + { + VARIANT* pVariant = *(VARIANT**)target.getValue(); + + oletest= pVariant->pdispVal; + + VariantClear(pVariant); + CoTaskMemFree(pVariant); + } + + CComVariant varRet; + CComVariant varParam1; + CComVariant varParam2; + CComVariant varParam3; + CComVariant varParam4; + + long value= 100; + varParam1.vt= VT_I1 | VT_BYREF; + varParam1.plVal= &value; + + // Testing the caching of DISPIDs and the process of acquiring member information + // on demand in IDispatch::Invoke + // Step through the corresponding IDispatch implementation of the ole bridge + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodByte"), &varParam1, &varRet); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodByte"), &varParam1, &varRet); + // Name ok but different case + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"Testinout_methodByte"), &varParam1, &varRet); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"Testinout_methodByte"), &varParam1, &varRet); + // not existing member + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"Testinout"), &varParam1, &varRet); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"Testinout"), &varParam1, &varRet); + + // Property + varParam1.vt= VT_ARRAY | VT_I1; + varParam1.parray= (SAFEARRAY*)arByte; + hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varParam1); + hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varParam1); + // Name ok but different case + hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"attrByte"), &varParam1); + hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"attrByte"), &varParam1); + // not existing member + hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"attr"), &varParam1); + hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"attr"), &varParam1); + + // PropertyGet + hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varRet); + + hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"attrByte"), &varRet); + hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"attrByte"), &varRet); + //not existing member + hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"attrBy"), &varRet); + hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"attrBy"), &varRet); + + DISPID dispid; + LPOLESTR method= L"methodByte"; + hr = oletest.p->GetIDsOfNames(IID_NULL, &method, 1, LOCALE_USER_DEFAULT, &dispid); + + + CComVariant arg[1]; + arg[0].vt= VT_ARRAY | VT_I1; + arg[0].parray= (SAFEARRAY*)arByte; + DISPPARAMS params={ arg,0,1,0}; + + hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, + DISPATCH_METHOD | DISPATCH_PROPERTYPUT, ¶ms, &varRet, NULL, NULL); + + hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, + DISPATCH_METHOD | DISPATCH_PROPERTYPUT, ¶ms, &varRet, NULL, NULL); + + // different case + LPOLESTR method2= L"MEthodByte"; + hr = oletest.p->GetIDsOfNames(IID_NULL, &method2, 1, LOCALE_USER_DEFAULT, &dispid); + + hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, + DISPATCH_METHOD | DISPATCH_PROPERTYPUT, ¶ms, &varRet, NULL, NULL); + + hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, + DISPATCH_METHOD | DISPATCH_PROPERTYPUT, ¶ms, &varRet, NULL, NULL); + + LPOLESTR attrib= L"AttrByte"; + hr = oletest.p->GetIDsOfNames(IID_NULL, &attrib, 1, LOCALE_USER_DEFAULT, &dispid); + + hr = oletest.p->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT, + DISPATCH_METHOD | DISPATCH_PROPERTYPUTREF, ¶ms, &varRet, NULL, NULL); + + hr = oletest.p->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT, + DISPATCH_METHOD | DISPATCH_PROPERTYGET, ¶ms, &varRet, NULL, NULL); + + + CComVariant varByteArray; + varByteArray.vt= VT_ARRAY | VT_I1; + varByteArray.parray= (SAFEARRAY*)arByte; + CComVariant varShortArray; + varShortArray.vt= VT_ARRAY | VT_I2; + varShortArray.parray= (SAFEARRAY*)arShort; + CComVariant varLongArray; + varLongArray.vt= VT_ARRAY | VT_I4; + varLongArray.parray= (SAFEARRAY*)arLong; + CComVariant varDoubleArray; + varDoubleArray.vt= VT_ARRAY | VT_R8; + varDoubleArray.parray= (SAFEARRAY*)arDouble; + CComVariant varStringArray; + varStringArray.vt= VT_ARRAY | VT_BSTR; + varStringArray.parray= (SAFEARRAY*)arString; + CComVariant varArray; + varArray.vt= VT_ARRAY | VT_VARIANT; + varArray.parray= (SAFEARRAY*)arVariant; + + FONTDESC fd={ sizeof( fd), L"ARIAL", 10, FW_NORMAL, 0, 0, 0, 0}; + + + CComPtr< IUnknown > unk1; + CComPtr< IUnknown > unk2; + CComPtr< IUnknown > unk3; + + IUnknown* _unknown[3]; + hr= OleCreateFontIndirect( &fd, __uuidof( IUnknown), (void**)&unk1.p); + hr= OleCreateFontIndirect( &fd, __uuidof( IUnknown), (void**)&unk2.p); + hr= OleCreateFontIndirect( &fd, __uuidof( IUnknown), (void**)&unk3.p); + _unknown[0]= unk1; + _unknown[1]= unk2; + _unknown[2]= unk3; + SmartArray<IUnknown*> arUnknown( _unknown, 3, VT_UNKNOWN); + + CComVariant varUnkArray; + varUnkArray.vt= VT_ARRAY | VT_UNKNOWN; + varUnkArray.parray= (SAFEARRAY*)arUnknown; + + // preparing out parameter; + char byteOut; + CComVariant varOutByte; + varOutByte.vt= VT_BYREF | VT_UI1; + V_I1REF(&varOutByte)= &byteOut; + short shortOut; + CComVariant varOutShort; + varOutShort.vt= VT_BYREF | VT_I2; + V_I2REF( &varOutShort)= &shortOut; + long longOut; + CComVariant varOutLong; + varOutLong.vt= VT_BYREF | VT_I4; + V_I4REF( &varOutLong)= &longOut; + double doubleOut; + CComVariant varOutDouble; + varOutDouble.vt= VT_BYREF | VT_R8; + V_R8REF( &varOutDouble)= &doubleOut; + BSTR bstrOut= NULL; + CComVariant varOutString; + varOutString.vt= VT_BYREF | VT_BSTR; + V_BSTRREF(&varOutString)= &bstrOut; + CComVariant variantOut; + CComVariant varOutAny; + varOutAny.vt= VT_BYREF | VT_VARIANT; + V_VARIANTREF(&varOutAny)= &variantOut; + + CComPtr<IDispatch> dispOut; + CComVariant varOutXInterface; + varOutXInterface.vt= VT_BYREF |VT_DISPATCH; + V_DISPATCHREF(&varOutXInterface)= &dispOut.p; + + // In Parameter ( all of type Sequence ########################################################### + OutputDebugStringA( "In parameter of type Sequence ###########################################\n" + "The functions return the Sequence parameter \n\n"); + + OutputDebugStringA("methodByte | Params: \n"); + printVariant( varByteArray); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodByte"), &varByteArray, &varRet); + OutputDebugStringA("methodByte | return value \n"); + printVariant( varRet); + + OutputDebugStringA("methodShort | Params: \n"); + printVariant( varShortArray); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodShort"), &varShortArray, &varRet); + OutputDebugStringA("methodShort | return value \n"); + printVariant( varRet); + + OutputDebugStringA("methodLong | Params: \n"); + printVariant( varLongArray); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodLong"), &varLongArray, &varRet); + OutputDebugStringA("methodLong | return value \n"); + printVariant( varRet); + + OutputDebugStringA("methodDouble | Params: \n"); + printVariant( varDoubleArray); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodDouble"), &varDoubleArray, &varRet); + OutputDebugStringA("methodDouble | return value \n"); + printVariant( varRet); + + OutputDebugStringA("methodString | Params: \n"); + printVariant( varStringArray); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodString"), &varStringArray, &varRet); + OutputDebugStringA("methodString | return value \n"); + printVariant( varRet); + + OutputDebugStringA("methodAny | Params: \n"); + printVariant( varArray); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodAny"), &varArray, &varRet); + OutputDebugStringA("methodAny | return value \n"); + printVariant( varRet); + + OutputDebugStringA("methodXInterface | Params: \n"); + printVariant( varUnkArray); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodXInterface"), &varUnkArray, &varRet); + OutputDebugStringA("methodAny | return value \n"); + printVariant( varRet); + + // Out Parameter ########################################################################### + OutputDebugStringA("Out parameter ###########################################\n\n"); + + OutputDebugStringA("testout_methodByte \n"); + hr= oletest.InvokeN(static_cast<LPCOLESTR>(L"testout_methodByte"), &varOutByte, 1, &varRet); + OutputDebugStringA("testout_methodByte | out value: \n"); + printVariant( varOutByte); + + OutputDebugStringA("testout_methodShort \n"); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodShort"), &varOutShort, &varRet); + OutputDebugStringA("testout_methodShort | out value: \n"); + printVariant( varOutShort); + + OutputDebugStringA("testout_methodLong \n"); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodLong"), &varOutLong, &varRet); + OutputDebugStringA("testout_methodLong | out value: \n"); + printVariant( varOutLong); + + OutputDebugStringA("testout_methodDouble \n"); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodDouble"), &varOutDouble, &varRet); + OutputDebugStringA("testout_methodDouble | out value: \n"); + printVariant( varOutDouble); + + OutputDebugStringA("testout_methodString \n"); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodString"), &varOutString, &varRet); + OutputDebugStringA("testout_methodString | out value: \n"); + printVariant( varOutString); + + OutputDebugStringA("testout_methodAny \n"); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodAny"), &varOutAny, &varRet); + OutputDebugStringA("methodAny | out value: \n"); + printVariant( varOutAny); + + OutputDebugStringA("testout_methodXInterface \n"); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodXInterface"), &varOutXInterface, &varRet); + OutputDebugStringA("methodAny | out value: \n"); + printVariant( varOutXInterface); + CComDispatchDriver outDisp( *varOutXInterface.ppdispVal); + CComVariant varAttr3; + outDisp.GetPropertyByName(L"AttrAny2", &varAttr3); + ATLTRACE("property OleTest.AttrAny2: %s", W2A(varAttr3.bstrVal)); + + OutputDebugStringA("testout_methodMulParams1 ( 2 out Parameter) \n"); + long longOut2=0; + CComVariant _params[2]; + longOut=0; + _params[0]= varOutLong; + _params[1].vt= VT_BYREF | VT_I4; + V_I4REF(& _params[1])= &longOut2; + hr= oletest.InvokeN( static_cast<LPCOLESTR>(L"testout_methodMulParams1"), (VARIANT*)&_params, 2); + OutputDebugStringA("testout_methodMulParams1 | out values: \n"); + printVariant( _params[1]); + printVariant( _params[0]); + + OutputDebugStringA("testout_methodMulParams2 ( 3 out Parameter) \n"); + CComVariant _params2[3]; + _params2[2]= varOutLong; + _params2[1].vt= VT_BYREF | VT_I4; + V_I4REF(& _params2[1])= &longOut2; + _params2[0]= varOutString; + hr= oletest.InvokeN( static_cast<LPCOLESTR>( L"testout_methodMulParams2"), (VARIANT*)&_params2, 3); + OutputDebugStringA("testout_methodMulParams2 | out values: \n"); + printVariant( _params2[2]); + printVariant( _params2[1]); + printVariant( _params2[0]); + + OutputDebugStringA("testout_methodMulParams3 ( 1 in and 1 out Parameter) \n"); + CComVariant _params3[2]; + _params3[1]= CComBSTR(L" In string"); + _params3[0]= varOutString; + hr= oletest.InvokeN( static_cast<LPCOLESTR>( L"testout_methodMulParams3"), (VARIANT*)&_params3, 2); + OutputDebugStringA("testout_methodMulParams3 | out values: \n"); + printVariant( _params3[1]); + printVariant( _params3[0]); + + //In Out Parameter ########################################################################### + OutputDebugStringA("In Out parameter ###########################################\n\n"); + + *V_I1REF(&varOutByte)= 5; + ATLTRACE("testinout_methodByte | in value: %d \n", *V_I1REF(&varOutByte)); + hr= oletest.InvokeN(static_cast<LPCOLESTR>(L"testinout_methodByte"), &varOutByte, 1, &varRet); + OutputDebugStringA("testinout_methodByte | out value: \n"); + printVariant( varOutByte); + + OutputDebugStringA("testinout_methodShort | in value= 1000 \n"); + *V_UI2REF(&varOutShort)= 1000; + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodShort"), &varOutShort, &varRet); + OutputDebugStringA("testinout_methodShort | out value: \n"); + printVariant( varOutShort); + + OutputDebugStringA("testinout_methodLong | in value= 10000 \n"); + *V_UI4REF(&varOutLong)= 10000; + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodLong"), &varOutLong, &varRet); + OutputDebugStringA("testinout_methodLong | out value: \n"); + printVariant( varOutLong); + + *V_R8REF(&varOutDouble)= 3.14; + ATLTRACE("testinou_methodDouble in value: %f \n",*V_R8REF(&varOutDouble)); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodDouble"), &varOutDouble, &varRet); + OutputDebugStringA("testinout_methodDouble | out value: \n"); + printVariant( varOutDouble); + + SysFreeString( *V_BSTRREF(&varOutString)); + *V_BSTRREF(&varOutString)= SysAllocString( L"this is a in string"); + ATLTRACE("testinout_methodString | value: %s \n", W2A(*V_BSTRREF(&varOutString))); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodString"), &varOutString, &varRet); + OutputDebugStringA("testinout_methodString | out value: \n"); + printVariant( varOutString); + + CComVariant var1(CComBSTR(L" this is a string in a VARIANT")); + CComVariant outVar1; + outVar1.vt= VT_BYREF | VT_VARIANT; + outVar1.pvarVal= &var1; + ATLTRACE("testinout_methodAny | parameter: %s\n", W2A(var1.bstrVal)); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodAny"), &varOutAny, &varRet); + OutputDebugStringA("testinout_methodAny | out value: \n"); + printVariant( varOutAny); + + CComPtr< IUnknown > objectIn = unk1; + CComVariant varOutIFace; + varOutIFace.vt= VT_BYREF | VT_UNKNOWN; + varOutIFace.ppunkVal= &objectIn.p; + (*varOutIFace.ppunkVal)->AddRef(); + OutputDebugStringA("testinout_methodXInterface | in value: \n"); + printVariant(varOutIFace); + hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodXInterface"), &varOutIFace, &varRet); + OutputDebugStringA("testinout_methodXInterface | out value: \n"); + printVariant( varOutIFace); + + // Properties ###################################################################### + OutputDebugStringA(" Properties ###########################################\n\n"); + + OutputDebugStringA("set property \"AttrByte\" | value"); + //CComVariant propArByte; + //propArByte.vt= VT_ARRAY | VT_I1; + varParam1.parray= (SAFEARRAY*)arByte; + printVariant( varParam1); + hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varParam1); + OutputDebugStringA("get property \"AttrByte\" | value:"); + varRet.Clear(); + hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varRet); + printVariant( varRet); + + + return S_OK; + + +} + + +void printVariant( VARIANT & _var) +{ + HRESULT hr; + USES_CONVERSION; + CComVariant var; + hr= VariantCopyInd( &var, &_var); + if( var.vt & VT_ARRAY) + { + VARTYPE type= var.vt ^ VT_ARRAY; + SAFEARRAY * sarray= var.parray; + long lbound; + long ubound; + hr= SafeArrayGetLBound( sarray, 1, &lbound); + hr= SafeArrayGetUBound( sarray, 1, &ubound); + long count= ubound - lbound + 1; + char charValue; + BYTE byteValue; + short shortValue; + long longValue; + double doubleValue; + IUnknown* unkValue; + BSTR bstrValue; + OutputDebugStringA("# Array \n"); + for( long i= 0; i < count; i++) + { +// CComVariant variantValue; + CHAR buf[256]; + wsprintfA( buf, "%d : ", i); + OutputDebugStringA( buf); + VARIANT varTemp; + VariantInit( &varTemp); + VARIANT variantValue; + VariantInit( &variantValue); + switch( type) + { + case VT_UI1: + hr= SafeArrayGetElement( sarray, &i, &byteValue); + varTemp.vt= VT_UI1; + V_UI1( &varTemp)= byteValue; + printVariant( varTemp); + break; + case VT_I1: + hr= SafeArrayGetElement( sarray, &i, &charValue); + varTemp.vt= VT_I1; + V_I1( &varTemp)= charValue; + printVariant( varTemp); + break; + case VT_I2: + hr= SafeArrayGetElement( sarray, &i, &shortValue); + varTemp.vt= VT_I2; + V_I2( &varTemp)= shortValue; + printVariant( varTemp); + break; + + case VT_UI2: + case VT_I4: + hr= SafeArrayGetElement( sarray, &i, &longValue); + varTemp.vt= VT_I4; + V_I4( &varTemp)= longValue; + printVariant( varTemp); + break; + case VT_R8: + hr= SafeArrayGetElement( sarray, &i, &doubleValue); + varTemp.vt= VT_R8; + V_R8( &varTemp)= doubleValue; + printVariant( varTemp); + break; + case VT_BSTR: + hr= SafeArrayGetElement( sarray, &i, &bstrValue); + varTemp.vt= VT_BSTR; + varTemp.bstrVal= bstrValue; + printVariant( varTemp); + break; + case VT_VARIANT: + hr= SafeArrayGetElement( sarray, &i, &varTemp); + printVariant( varTemp); + break; + + case VT_UNKNOWN: + hr= SafeArrayGetElement( sarray, &i, &unkValue); + varTemp.vt= VT_UNKNOWN; + varTemp.punkVal= unkValue; + printVariant( varTemp); + break; + } + + VariantClear( &varTemp); + VariantClear( &variantValue); + } + + } + else + { + CHAR buf[256]; + switch (var.vt) + { + case VT_I1: wsprintfA( buf, " VT_I1: %d \n", V_I1( &var) ); + break; + case VT_UI1: wsprintfA( buf, " VT_UI1: %d \n", V_I1( &var) ); + break; + + case VT_I2: wsprintfA( buf, " VT_I2: %d \n", V_I2( &var) ); + break; + case VT_I4: wsprintfA( buf, " VT_I4: %d \n", V_I4( &var) ); + break; + case VT_R8: + { + +// int decimal, sign; +// char *buffer; +// int precision = 14; +// double source = 3.1415926535; + +// buffer = _ecvt( V_R8(&var), precision, &decimal, &sign ); + sprintf( buf, " VT_R8: %f \n",V_R8( &var) ); + break; + } + case VT_UNKNOWN: + // The object implement IFont + { + CComDispatchDriver disp( var.punkVal); + CComVariant ret; + hr= disp.GetPropertyByName( static_cast<LPCOLESTR>(L"Name"), &ret); + wsprintfA( buf, " VT_UNKNOWN: property \"Name\": %s \n", W2A(ret.bstrVal)); + break; + } + case VT_DISPATCH: + // The object implement IFont + { + CComDispatchDriver disp( var.punkVal); + CComVariant ret; + if( SUCCEEDED( hr= disp.GetPropertyByName( static_cast<LPCOLESTR>(L"Name"), &ret))) + wsprintfA( buf, " VT_DISPATCH: property \"Name\": %s \n", W2A(ret.bstrVal)); + else + wsprintfA( buf, " VT_DISPATCH \n"); + + break; + } + + + case VT_BSTR: + { + CHAR* str= W2A( var.bstrVal); + wsprintfA( buf, " VT_BSTR: %s \n", str); + } + break; + default: + wsprintfA( buf, "\n"); + + } + + OutputDebugStringA( buf); + } + + return; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleConverterVar1/makefile.mk b/extensions/test/ole/OleConverterVar1/makefile.mk new file mode 100644 index 000000000..d37219256 --- /dev/null +++ b/extensions/test/ole/OleConverterVar1/makefile.mk @@ -0,0 +1,57 @@ +# +# 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 . +# + +PRJ=..$/..$/.. + +PRJNAME=extensions +TARGET=convTest +TARGETTYPE=CUI +LIBTARGET=NO + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings --- + +.INCLUDE : settings.mk + +# --- Files --- + +INCPRE+=-I$(ATL_INCLUDE) + + +APP1TARGET= $(TARGET) +APP1OBJS= $(OBJ)$/convTest.obj + + +APP1STDLIBS= \ + $(SALLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(USER32LIB) \ + $(KERNEL32LIB) \ + $(OLE32LIB) \ + $(OLEAUT32LIB) \ + $(UUIDLIB) \ + $(COMDLG32LIB) \ + $(COMPATH)$/atlmfc$/lib$/atls.lib \ + $(ADVAPI32LIB) + +APP1DEF= $(MISC)\$(APP1TARGET).def + +# --- Targets --- +.INCLUDE : target.mk diff --git a/extensions/test/ole/OleConverterVar1/readme.txt b/extensions/test/ole/OleConverterVar1/readme.txt new file mode 100644 index 000000000..67bc8d920 --- /dev/null +++ b/extensions/test/ole/OleConverterVar1/readme.txt @@ -0,0 +1,10 @@ +Currently broken!!
+
+The program test the Service com.sun.star.bridge.OleBridgeSupplierVar1.
+While running in debug mode it writes infos to the debug - output.
+
+The executable needs a services.rdb present with the registered services
+com.sun.star.bridge.OleBridgeSupplierVar1, oletest.OleTest. The OleTest
+component resides in extensions/test/ole/cpnt. The build creates an
+oletest.rdb file that must be merged with the types.rdb and OleTest
+must be registered to the services.rdb.
diff --git a/extensions/test/ole/OleConverterVar1/smartarray.h b/extensions/test/ole/OleConverterVar1/smartarray.h new file mode 100644 index 000000000..1c8fbd6e6 --- /dev/null +++ b/extensions/test/ole/OleConverterVar1/smartarray.h @@ -0,0 +1,222 @@ +/* -*- 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 . + */ +#pragma once + + +template< class sourceType> +class SmartArray +{ + SAFEARRAY *m_array; +public: + + SmartArray( sourceType * parParams, int count, VARTYPE destVartype): m_array(NULL) + { + HRESULT hr= S_OK; + SAFEARRAYBOUND rgsabound[1]; + rgsabound[0].cElements= count; + rgsabound[0].lLbound= 0; + m_array= SafeArrayCreate( destVartype, 1, rgsabound); + SafeArrayLock( m_array); + + void* pData; + if( m_array && (SUCCEEDED( SafeArrayAccessData( m_array, (void**)&pData)) ) ) + { + + for( int i=0; i< count; i++) + { + CComVariant varSource( parParams[i]); + switch (destVartype) + { + case VT_I1: + { + char* p= (char*) pData; + if( SUCCEEDED( hr= varSource.ChangeType( destVartype))) + p[i]= V_I1( &varSource); + break; + } + case VT_I2: + { + short* p= (short*) pData; + if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) + p[i]= V_I2( &varSource); + break; + } + case VT_UI2: + { + unsigned short* p= (unsigned short*) pData; + if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) + p[i]= V_UI2( &varSource); + break; + } + case VT_I4: + { + long* p= (long*)pData; + if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) + p[i]= V_I4( &varSource); + break; + } + case VT_UI4: + { + unsigned long* p= (unsigned long*)pData; + if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) + p[i]= V_UI4( &varSource); + break; + } + case VT_R4: + { + float* p= (float*)pData; + if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) + p[i]= V_R4( &varSource); + break; + } + case VT_R8: + { + double* p= (double*)pData; + if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) + p[i]= V_R8( &varSource); + break; + } + case VT_BOOL: + { + VARIANT_BOOL* p= (VARIANT_BOOL*)pData; + if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) + p[i]= V_BOOL( &varSource); + break; + } + case VT_BSTR: + { + BSTR* pBstr= ( BSTR*)pData; + if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) + pBstr[i]= SysAllocString(V_BSTR( &varSource)); + break; + } + case VT_VARIANT: + { + VARIANT *pVariant= (VARIANT*)pData; + hr= VariantCopy( &pVariant[i], &varSource); break; + } +// case VT_UNKNOWN: +// { +// long* pUnk= (long*)pData; +// pUnk[i]= reinterpret_cast<long>(parParams[i]); +// ((IUnknown*)pUnk[i])->AddRef(); break; +// } +// case VT_DISPATCH: +// { +// long* pDisp= (long*)pData; +// pDisp[i]= (long)parParams[i]; +// ((IDispatch*)pDisp[i])->AddRef(); break; +// } + default: + hr= E_FAIL; + } + } + if( FAILED( hr)) + { + SafeArrayDestroy( m_array); + m_array= NULL; + } + } + SafeArrayUnaccessData( m_array); + } + ~SmartArray(){ + SafeArrayUnlock( m_array); + SafeArrayDestroy( m_array ); + } + + operator bool (){ return m_array == NULL ? false : true; } + + operator SAFEARRAY* (){ return m_array;} + +}; + +template<> +class SmartArray<IUnknown*> +{ + SAFEARRAY *m_array; +public: + + SmartArray( sourceType * parParams, int count, VARTYPE destVartype); +// { +// ATLTRACE("SmartArray<IUnknown>"); +// HRESULT hr= S_OK; +// SAFEARRAYBOUND rgsabound[1]; +// rgsabound[0].cElements= count; +// rgsabound[0].lLbound= 0; +// m_array= SafeArrayCreateVector( VT_UNKNOWN, 0, count); +// SafeArrayLock( m_array); + +// IUnknown* *pData; +// if( m_array && (SUCCEEDED( SafeArrayAccessData( m_array, (void**)&pData)) ) ) +// { + +// for( int i=0; i< count; i++) +// { +// CComVariant varSource( parParams[i]); +// switch (destVartype) +// { + +// case VT_UNKNOWN: +// { +// pData[i]= parParams[i]; +// pData[i]->AddRef(); +// } +// default: +// hr= E_FAIL; +// } +// } +// if( FAILED( hr)) +// { +// SafeArrayDestroy( m_array); +// m_array= NULL; +// } +// } +// SafeArrayUnaccessData( m_array); +// } + ~SmartArray(){ + SafeArrayUnlock( m_array); + SafeArrayDestroy( m_array ); + } + + operator bool (){ return m_array == NULL ? false : true; } + + operator SAFEARRAY* (){ return m_array;} + +}; + +template <> SmartArray <IUnknown*>::SmartArray(sourceType * parParams, int count, VARTYPE destVartype):m_array(NULL) +{ + ATLTRACE("SmartArray<IUnknown>"); + HRESULT hr= S_OK; + m_array= SafeArrayCreateVector( VT_UNKNOWN, 0, count); + SafeArrayLock( m_array); + + IUnknown* *pData; + if( m_array && (SUCCEEDED( SafeArrayAccessData( m_array, (void**)&pData)) ) ) + { + for( int i=0; i< count; i++) + { + pData[i]= parParams[i]; + pData[i]->AddRef(); + } + } + SafeArrayUnaccessData( m_array); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleTest.htm b/extensions/test/ole/OleTest.htm new file mode 100644 index 000000000..acca9fda0 --- /dev/null +++ b/extensions/test/ole/OleTest.htm @@ -0,0 +1,1080 @@ +<!-- + * 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 . +--> +<HTML> +<HEAD> +<META NAME="GENERATOR" Content="Microsoft Developer Studio"> +<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"> +<TITLE>Document Title</TITLE> +</HEAD> +<BODY id=theBody> + +<script language="JScript"> +// XEventListener implementation in JScript -------------------------------------------------- +function XEventListener_Impl() +{ + this._environment= "JScript"; + this._implementedInterfaces= new Array( "com.sun.star.lang.XEventListener"); + + //XEventListener + this.disposing= XEventListener_disposing; + + this.bdisposingCalled= false; + this.bQuiet= true; + this.resetDisposing= XEventListener_resetDisposing; + this.disposingCalled= XEventListener_disposingCalled; +} + +function XEventListener_disposing( source) +{ + if( !this.bQuiet) + alert("JScript Event Listener \n disposing is being called"); + this.bdisposingCalled= true; +} + +function XEventListener_resetDisposing() +{ + this.bdisposingCalled= false; +} + +function XEventListener_disposingCalled() +{ + return this.bdisposingCalled; +} + + +function callOleTest( id) +{ + var factory= new ActiveXObject("com.sun.star.ServiceManager"); + var oletest= factory.createInstance("oletest.OleTest"); +// alert(oletest); + + var arr= new Array( 1, 2, 3, 4, 0); + var arrDouble= new Array( 1.2345, 12.345, 123,45, 1234.5, 12345); + var arrBool= new Array( 1, 0, 2, 0, 3); + var arrChar= new Array( '1', 'A', "1", "A", ' ', 55, 56); + var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza"); + var arrAny= new Array( 100, 100.1235,"hallo"); + var arrSeq= new Array( arr, arr, arr); + var arrSeq2= new Array( arrSeq, arrSeq, arrSeq) + + + var arrout1= new Array(); + var arrout2= new Array(); + var arrout3= new Array(); + + var ret, i; + var sfarray, sfarray1, sfarray2, sfarray3; + var arEventListener= new Array( new XEventListener_Impl(), new XEventListener_Impl(), + new XEventListener_Impl()); + var arEventListener2= new Array( new XEventListener_Impl(), new XEventListener_Impl(), + new XEventListener_Impl()); + var arArEventListener= new Array( arEventListener, arEventListener2); + switch( id) + { + // Array in-params + case 1: ret= oletest.methodByte( arr); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() + "<br>"); + document.writeln( "Returns a Sequence< BYTE > <br>" + sfarray.toArray()) ; break; + + case 2: ret= oletest.methodDouble( arrDouble); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrDouble.toString() +"<br>"); + document.writeln( "Returns a Sequence< double > <br>" + sfarray.toArray()) ; break; + + case 3: ret= oletest.methodBool( arrBool); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrBool.toString() +"<br>"); + document.writeln( "Returns a Sequence< BOOL > <br>" + sfarray.toArray()) ; break; + + case 4: ret= oletest.methodShort( arr); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() +"<br>"); + document.writeln( "Returns a Sequence< SHORT > <br>" + sfarray.toArray()) ; break; + + case 5: ret= oletest.methodUShort( arr); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() +"<br>"); + document.writeln( "Returns a Sequence< unsigned SHORT > <br>" + sfarray.toArray()) ; break; + + case 6: ret= oletest.methodLong( arr); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() +"<br>"); + document.writeln( "Returns a Sequence< LONG > <br>" + sfarray.toArray()) ; break; + + case 7: ret= oletest.methodULong( arr); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arr.toString() +"<br>"); + document.writeln( "Returns a Sequence< unsigned LONG > <br>" + sfarray.toArray()) ; break; + + case 8: ret= oletest.methodChar( arrChar); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrChar.toString() +"<br>"); + document.writeln( "Returns a Sequence< wchar_t > <br>" + sfarray.toArray()) ; break; + + case 9: ret= oletest.methodString( arrString); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrString.toString() +"<br>"); + document.writeln( "Returns a Sequence< UString > <br>" + sfarray.toArray()) ; break; + + case 10: ret= oletest.methodAny( arrAny); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrAny.toString() +"<br>"); + document.writeln( "Returns a Sequence< UsrAny > <br>" + sfarray.toArray() ) ; break; + + case 11: ret= oletest.methodSequence( arrSeq); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrSeq.toString() +"<br>"); + document.writeln("Returns a Sequence< Sequence < long >> <br>") ; + var arr1= new Array(); + arr1= sfarray.toArray(); + for( i=0; i < arr1.length; i++) + { + sfarray2= new VBArray( arr1[i]); + var arr2= new Array(); + arr2= sfarray2.toArray(); + document.writeln( arr2.toString() + "<br>" ); + } + break; + + case 12: ret= oletest.methodSequence2( arrSeq2); + document.writeln( "Param: " + arrSeq2.toString() +"<br>"); + sfarray1= new VBArray( ret); + arr1= sfarray1.toArray(); + for( i=0; i < arr1.length; i++) + { + sfarray2= new VBArray( arr1[i]); + arr2= sfarray2.toArray(); + + for ( j=0; j < arr2.length; j++) + { + sfarray3= new VBArray( arr2[j]); + arr3= sfarray3.toArray(); + document.write( i+ " "); + document.writeln(j + ": "+ arr3.toString() + "<br>" ); + } + + } + break; + + case 13: + var ar= new Array(); + for( i=0; i< 3; i++) + { + var ob= new Object(); + ob.value= "A JScript object!"; + ar[i]= ob; + } + + ret = oletest.methodXInterface( ar); + sfarray= new VBArray( ret); + var arRet= sfarray.toArray(); + + document.writeln( "Params : Array containing objects ") + for( index in ar) + { + document.writeln( "object " + index + ": " + ar[index].value +" "); + } + document.writeln( "<br>" ) ; + document.writeln("Return: <br>"); + for( index in arRet) + { + document.writeln( "object " + index + ": " + arRet[index].value + " "); + } + break; + + case 14: ret= oletest.methodFloat( arrDouble); + sfarray= new VBArray( ret); + document.writeln( "Param: " + arrDouble.toString() +"<br>"); + document.writeln( "Returns a Sequence< float> <br>" + sfarray.toArray()) ; break; + + case 15: + ret= oletest.methodXEventListeners( arEventListener); + sfarray= new VBArray(ret); + _ret= sfarray.toArray(); + for ( key in _ret) + { + if( ! _ret[key].disposingCalled()) + alert("Error! oletest.methodXEventListeners") + } + break; + case 16: + ret= oletest.methodXEventListenersMul( arArEventListener); + sfarray= new VBArray(ret); + _ret= sfarray.toArray(); + for( key in _ret) + { + sfarray2= new VBArray(_ret[key]); + _ret2= sfarray2.toArray(); + for( key2 in _ret2) + { + if( ! _ret2[key2].disposingCalled()) + alert("Error! oletest.methodXEventListeners") + } + } + break; + + + + // Properties: setting and getting values + case 200: oletest.AttrByte = arr; + ret= oletest.AttrByte; + document.writeln("Setting AttrByte: " + arr.toString() + "<p>"); + document.writeln("Getting AttrByte: " + arr.toString()); break; + + case 201: oletest.AttrDouble= arrDouble; + ret= oletest.AttrDouble; + document.writeln("Setting AttrDouble: " + arrDouble.toString() + "<p>"); + document.writeln("Getting AttrDouble: " + arrDouble.toString()); break; + + case 202: oletest.AttrBool= arrBool; + ret= oletest.AttrBool; + document.writeln("Setting AttrBool: " + arrBool.toString() + "<p>"); + document.writeln("Getting AttrBool: " + arrBool.toString()); break; + + case 203: oletest.AttrShort= arr; + ret= oletest.AttrShort; + document.writeln("Setting AttrShort: " + arr.toString() + "<p>"); + document.writeln("Getting AttrShort: " + arr.toString()); break; + + case 204: oletest.AttrUShort= arr; + ret= oletest.AttrUShort; + document.writeln("Setting AttrUShort: " + arr.toString() + "<p>"); + document.writeln("Getting AttrUShort: " + arr.toString()); break; + + case 205: oletest.AttrLong= arr; + ret= oletest.AttrLong; + document.writeln("Setting AttrLong: " + arr.toString() + "<p>"); + document.writeln("Getting AttrLong: " + arr.toString()); break; + + case 206: oletest.AttrULong= arr; + ret= oletest.AttrULong; + document.writeln("Setting AttrULong: " + arr.toString() + "<p>"); + document.writeln("Getting AttrULong: " + arr.toString()); break; + + case 207: oletest.AttrChar= arrChar; + ret= oletest.AttrChar; + document.writeln("Setting AttrChar: " + arrChar.toString() + "<p>"); + document.writeln("Getting AttrChar: " + arrChar.toString()); break; + + case 208: oletest.AttrString= arrString; + ret= oletest.AttrString; + document.writeln("Setting AttrString: " + arrString.toString() + "<p>"); + document.writeln("Getting AttrString: " + arrString.toString()); break; + + case 209: oletest.AttrAny= arrAny; + ret= oletest.AttrAny; + document.writeln("Setting AttrAny: " + arrAny.toString() + "<p>"); + document.writeln("Getting AttrAny: " + arrAny.toString()); break; + + case 210: oletest.AttrSequence= arrSeq; + ret= oletest.AttrSequence; + document.writeln("Setting AttrSequence: " + arrSeq.toString() + "<p>"); + document.writeln("Getting AttrSequence: " + arrSeq.toString()); break; + + case 211: oletest.AttrSequence2= arrSeq2; + ret= oletest.AttrSequence2; + document.writeln("Setting AttrSequence2: " + arrSeq2.toString() + "<p>"); + document.writeln("Getting AttrSequence2: " + arrSeq2.toString()); break; + + case 212: oletest.AttrFloat= arrDouble; + ret= oletest.AttrFloat; + document.writeln("Setting AttrFloat: " + arrDouble.toString() + "<p>"); + document.writeln("Getting AttrFloat: " + arrDouble.toString()); break; + + + + // Out-parameter ------------------------------------------------------------ + case (2000): + oletest.testout_methodByte( arrout1 ); + alert("byte: " + arrout1[0] ); break; + case (2001): + oletest.testout_methodDouble( arrout1 ); + alert( "double: " + arrout1[0] ); break; + case (2002): + oletest.testout_methodBool( arrout1 ); + alert( "boolean: " + arrout1[0] ); break; + case (2003): + oletest.testout_methodShort( arrout1 ); + alert( "short: " + arrout1[0] ); break; + case (2004): + oletest.testout_methodUShort( arrout1 ); + alert( "unsigned short: " + arrout1[0] ); break; + case (2005): + oletest.testout_methodLong( arrout1 ); + alert( "long: " + arrout1[0] ); break; + case (2006): + oletest.testout_methodULong( arrout1 ); + alert( "unsigned long: " + arrout1[0] ); break; + case (2007): + oletest.testout_methodChar( arrout1 ); + alert( "char: " + arrout1[0] ); break; + case (2008): + oletest.testout_methodString( arrout1 ); + alert( "string: " + arrout1[0] ); break; + case (2009): + oletest.testout_methodAny( arrout1 ); + alert( "any: " + arrout1[0] ); break; + case (2010): + oletest.testout_methodSequence( arrout1 ); + var sfarray= new VBArray( arrout1[0]); + arr= sfarray.toArray(); + document.writeln("use the browser's back arrow to go to the previous page <p>"); + document.writeln( arr.toString()); + break; + case (2011): + oletest.testout_methodSequence2( arrout1 ); + var sfarray= new VBArray( arrout1[0]); + arr= sfarray.toArray(); + var i; + for( i=0; i < arr.length; i++) + { + var sfarray= new VBArray( arr[i]); + var arr2= new Array(); + arr2= sfarray.toArray(); + document.writeln( arr2.toString() + "<br>" ); + } + break; + case (2012): + oletest.testout_methodMulParams1( arrout1, arrout2 ); + document.writeln( "int : " + arrout1[0] + " int :" + arrout2[0] ); break; + case (2013): + oletest.testout_methodMulParams2( arrout1, arrout2, arrout3 ); + document.writeln( "int: " + arrout1[0] + " int: " + arrout2[0] + " string: " + arrout3[0] ); break; + case (2014): + oletest.testout_methodMulParams3( "hallo", arrout1 ); + document.writeln( "string: " + arrout1[0] ); break; + case (2015): + oletest.testout_methodXInterface( arrout1 ); + var outVal= arrout1[0]; + alert( outVal.AttrAny2); + document.writeln( "string: " + arrout1[0].AttrAny2); break; + case (2016): + oletest.testout_methodFloat( arrout1 ); + alert( "float: " + arrout1[0] ); break; + case (2017): + var in1= 3.14; + var in2= 1111; + var in3= -2222; + oletest.testout_methodMulParams4( in1, arrout1, in2, arrout2, in3 ); + document.write("param1 [in] float: " + in1 + " param2 [out] float: " + arrout1[0] + + " param3 [in] long: " + in2 + " param4 [out] long: " + arrout2[0] + + " param5 [in] long: " + in3); + break; + + + // INOUT - Parameter ------------------------------------------------------------------------------- + // The in value has to be placed on index 0 of the passed in array + case (500): + arrout1[0]= 100; + oletest.testinout_methodByte( arrout1 ); + alert("byte: " + arrout1[0] ); break; + case (501): + arrout1[0]= 3.14; + oletest.testinout_methodDouble( arrout1 ); + alert( "double: " + arrout1[0] ); break; + case (502): + arrout1[0]= false; + oletest.testinout_methodBool( arrout1 ); + alert( "boolean: " + arrout1[0] ); break; + case (503): + arrout1[0]= 200; + oletest.testinout_methodShort( arrout1 ); + alert( "short: " + arrout1[0] ); break; + case (504): + arrout1[0]= 300; + oletest.testinout_methodUShort( arrout1 ); + alert( "unsigned short: " + arrout1[0] ); break; + case (505): + arrout1[0]= 400; + oletest.testinout_methodLong( arrout1 ); + alert( "long: " + arrout1[0] ); break; + case (506): + arrout1[0]= 500; + oletest.testinout_methodULong( arrout1 ); + alert( "unsigned long: " + arrout1[0] ); break; + case (507): + arrout1[0]= "A"; + oletest.testinout_methodChar( arrout1 ); + alert( "char: " + arrout1[0] ); break; + case (508): + arrout1[0]= "I am a string"; + oletest.testinout_methodString( arrout1 ); + alert( "string: " + arrout1[0] ); break; + case (509): + arrout1[0]= arr; + oletest.testinout_methodAny( arrout1 ); // the method simply returns the argument + sfarray= new VBArray( arrout1[0]); + arr= sfarray.toArray(); + alert( "any: " + arr.toString() ); break; + case (510): + arrout1[0]= arr; + oletest.testinout_methodSequence( arrout1 ); + var sfarray= new VBArray( arrout1[0]); + arr= sfarray.toArray(); + document.writeln("use the browser's back arrow to go to the previous page <p>"); + document.writeln( arr.toString()); + break; + case (511): + arrout1[0]= arrSeq; + oletest.testinout_methodSequence2( arrout1 ); + var sfarray= new VBArray( arrout1[0]); + arr= sfarray.toArray(); + var i; + for( i=0; i < arr.length; i++) + { + var sfarray= new VBArray( arr[i]); + var arr2= new Array(); + arr2= sfarray.toArray(); + document.writeln( arr2.toString() + "<br>" ); + } + break; + case 512: + var ob= new Object(); + ob.value= "this is a string"; + + arrout1[0]= ob; + alert (arrout1[0].value); + oletest.testinout_methodXInterface( arrout1); + alert (arrout1[0].value); + var outValue= arrout1[0]; + for ( key in outValue) + { + document.write( outValue[key] ); + } + document.write("Out value: " + outValue ); + document.write("Out 1 value: " + arrout1[1]); + break; + +// var ob= new Object(); +// ob.value= "this is a string"; +// inoutValue.Set( "object", ob); +// oletest.testinout_methodXInterface( inoutValue); +// document.write("Out value: " + inoutValue.Get().value ); +// break; + + case (513): + arrout1[0]= 3.14; + oletest.testinout_methodFloat( arrout1 ); + alert( "float: " + arrout1[0] ); break; + + + + // Test ANY + // Methods + case 1000: + i= 100; + ret= oletest.methodAnyTest1( i); + document.writeln( "in: " + i + " ret: " + ret); + break; + case 1001: + i= 3.14; + ret= oletest.methodAnyTest1( i); + document.writeln( "in: " + i + " ret: " + ret); + break; + case 1002: + i= "Hallo" + ret= oletest.methodAnyTest1( i); + document.writeln( "in: " + i + " ret: " + ret); + break; + case 1003: + i= arr; + ret= oletest.methodAnyTest1( i); + sfarray= new VBArray( ret); + document.writeln( "in: " + i + " ret: " + sfarray.toArray()); + break; + case 1004: + var obj= new Object(); + obj[1]= "This is index 0"; + ret= oletest.methodAnyTest1( obj); + document.writeln( "in: " + obj + " ret: " + ret); + break; + + + // Test ANY property + case 1010: + i= 100; + oletest.AttrAny2= i; + ret= oletest.AttrAny2; + document.writeln( "set: " + i + " get: " + ret); + break; + case 1011: + i= 3.14; + oletest.AttrAny2= i; + ret= oletest.AttrAny2; + document.writeln( "set: " + i + " get: " + ret); + break; + case 1012: + i= "Hallo" + oletest.AttrAny2= i; + ret= oletest.AttrAny2; + document.writeln( "set: " + i + " get: " + ret); + break; + case 1013: + i= arr; + oletest.AttrAny2= i; + ret= oletest.AttrAny2; + sfarray= new VBArray( ret); + document.writeln( "set: " + i + " get: " + sfarray.toArray()); + break; + case 1014: + var obj= new Object(); + obj[1]= "This is index 0"; + oletest.AttrAny2= obj; + ret= oletest.AttrAny2; + document.writeln( "set: " + obj + " get: " + ret); + break; + + // Structs ---------------------------------------------- + case 1020: + var struct= oletest._GetStruct("com.sun.star.beans.Property"); + struct.Attributes= 1; + struct.Handle= 2; + struct.Name= "some Property" + oletest.methodStruct( struct); + break; + case 1021: + var struct= oletest.retMethodStruct(); + alert( "Property::Attributes : " + struct.Attributes + " \nProperty::Handle : " + + struct.Handle + "\n Property::Name : " + struct.Name); + break; + case 1022: + var struct= oletest._GetStruct("com.sun.star.beans.Property"); + struct.Attributes= 1; + struct.Handle= 2; + struct.Name= "some Property" + oletest.AttrStruct= struct; + + var struct2= oletest.AttrStruct; + alert( "property get: \n Property::Attributes : " + struct2.Attributes + " \nProperty::Handle : " + + struct2.Handle + "\n Property::Name : " + struct2.Name); + break; + + case 2100: + alert("2100"); + var ret= oletest.retMethodByte(); + var sfarray= VBArray( ret); + document.writeln( sfarray.toArray() ); + break; + + + + } + +} + +function funcOut( out) +{ + out["du"]= 0xffff; +} + +</script> + +<script language="VBScript"> + +sub callBasic(id) + + Dim factory + Set factory= GetObject("", "com.sun.star.ServiceManager") + + Set oletest= factory.createInstance("oletest.OleTest") + + + arrInt= Array(1,2,3,4,5) + arrInt2= Array( -1, -2, 127, 128, 0) + arrDouble= Array(1.1, 2.2, 3.3, 4.4, 5.5) + arrBool= Array(0,1,0,2,0) + arrLong= Array( &Hff, &Hffff, &Hffffff, &Hffffffff) + arrString= Array("Chicken Wings", "Cheeseburger", "Hamburger") + arrChar= Array("a",65, "M") + arrAny= Array("Mickey", 3.14, 100, "A") + + Dim arrDim2Int(1,1) + For i= 0 To 1 + For j= 0 To 1 + arrDim2Int(i,j) = i*2 + j + Next + Next + + Dim arrDim3Int(1,1,1) + For i= 0 To 1 + For j= 0 To 1 + For k=0 To 1 + arrDim3Int(i,j,k) = i*2 + j*2 + k + Next + Next + Next + + + select case id + case 0 + document.writeln "param: " + printArray arrInt + ret= oletest.methodByte(arrInt) + document.writeln "<br> return value: " + printArray ret + case 1 + document.writeln "param: " + printArray arrDouble + ret= oletest.methodDouble(arrDouble) + document.writeln "<br> return value: " + printArray ret + case 2 + document.writeln "param: " + printArray arrBool + ret= oletest.methodBool(arrBool) + document.writeln "<br> return value: " + printArray ret + case 3 + document.writeln "param: " + printArray arrInt2 + ret= oletest.methodShort(arrInt2) + document.writeln "<br> return value: " + printArray ret + case 4 + document.writeln "param: " + printArray arrInt + ret= oletest.methodUShort(arrInt) + document.writeln "<br> return value: " + printArray ret + case 5 + document.writeln "param: " + printArray arrLong + ret= oletest.methodLong(arrLong) + document.writeln "<br> return value: " + printArray ret + case 6 + document.writeln "param: " + printArray arrInt + ret= oletest.methodULong(arrInt) + document.writeln "<br> return value: " + printArray ret + case 7 + document.writeln "param: " + printArray arrString + ret= oletest.methodString(arrString) + document.writeln "<br> return value: " + printArray ret + case 8 + document.writeln "param: " + printArray arrChar + ret= oletest.methodChar(arrChar) + document.writeln "<br> return value: " + printArray ret + case 9 + document.writeln "param: " + printArray arrAny + ret= oletest.methodAny(arrAny) + document.writeln "<br> return value: " + printArray ret + case 10 + document.writeln "param: " + printArray2 arrDim2Int + ret= oletest.methodSequence(arrDim2Int) + document.writeln "<br> return value: " + for each val in ret + document.write "<br> array: " + for each val2 in val + document.write val2 + next + next + + // Out Parameter + case 150 + dim rOut + oletest.testout_methodByte rOut + MsgBox rOut +// void testout_methodFloat( [out] float rOut); +// void testout_methodDouble( [out] double rOut); +// void testout_methodBool( [out] boolean rOut); +// void testout_methodShort( [out] short rOut); +// void testout_methodUShort( [out] unsigned short rOut); +// void testout_methodLong( [out] long rOut); +// void testout_methodULong( [out] unsigned long rOut); + + + // In Out Parameter -------------------------------------------------- + case 100 + a= 100 + document.write "param: " & CStr( a) & "<br>" + oletest.testinout_methodByte a + document.write a + case 101 + a= 1.11 + document.write "param: " & CStr( a) & "<br>" + oletest.testinout_methodDouble a + document.write a + case 102 + a= 5 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodBool a + document.write a + case 103 + a= -10 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodShort a + document.write a + case 104 + a= 128 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodUShort a + document.write a + case 105 + a= 65556 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodLong a + document.write a + case 106 + a= 65556 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodULong a + document.write a + case 107 + a= "ein test string" + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodString a + document.write a + case 108 + a= "W" + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodChar a + document.write a + case 109 + a= "Ein String im Any" + document.write "param: "& CStr( a) & "<br>" + oletest.other_methodAnyIn a + document.write a + + case 150 + dim a + document.write "param: "& CStr( a) & "<br>" + oletest.testout_methodByte( a) + document.write a +// Attributes ----------------------------------------------------------------- + case 200 + document.write "set: " + printArray arrInt + oletest.AttrByte= arrInt + b= oletest.AttrByte + call printArrayEx( "<br> get: ", "<br>", b) + case 201 + document.write "set: " + printArray arrDouble + oletest.AttrDouble= arrDouble + b= oletest.AttrDouble + call printArrayEx( "<br> get: ", "<br>", b) + case 202 + document.write "set: " + printArray arrBool : + oletest.AttrBool= arrBool + b= oletest.AttrBool + call printArrayEx( "<br> get: ", "<br>", b) + case 203 + document.write "set: " + printArray arrInt2 : + oletest.AttrShort= arrInt2 + b= oletest.AttrShort + call printArrayEx( "<br> get: ", "<br>", b) + case 204 + document.write "set: " + printArray arrInt + oletest.AttrUShort= arrInt + b= oletest.AttrUShort + call printArrayEx( "<br> get: ", "<br>", b) + case 205 + document.write "set: " + printArray arrInt2 + oletest.AttrLong= arrInt2 + b= oletest.AttrLong + call printArrayEx( "<br> get: ", "<br>", b) + case 206 + document.write "set: " + printArray arrInt + oletest.AttrULong= arrInt + b= oletest.AttrULong + call printArrayEx( "<br> get: ", "<br>", b) + case 207 + document.write "set: " + printArray arrString + oletest.AttrString= arrString + b= oletest.AttrString + call printArrayEx( "<br> get: ", "<br>", b) + case 208 + document.write "set: " + printArray arrChar + oletest.AttrChar= arrChar + b= oletest.AttrChar + call printArrayEx( "<br> get: ", "<br>", b) + case 209 + document.write "set: " + printArray arrAny + oletest.AttrAny= arrAny + b= oletest.AttrAny + call printArrayEx( "<br> get: ", "<br>", b) + + case 210 + document.write "set: <br>" + printArray2 arrDim2Int : + oletest.AttrSequence= arrDim2Int + ret= oletest.AttrSequence + document.write "get: " + for each val in ret + document.write "<br> array: " + for each val2 in val + document.write val2 + next + next + + case 300 + dim aByte + aByte= 100 + call oletest.testinout_methodByte( aByte) + MsgBox aByte + + + case 400 + + set struct= oletest.Bridge_GetStruct("com.sun.star.beans.Property") + struct.Attributes= 1 + struct.Handle= 2 + struct.Name= "some Property" + oletest.methodStruct struct + + case 401 + set struct= oletest.retMethodStruct() + alert( "Property::Attributes : " & struct.Attributes & vblf & " Property::Handle : " _ + & struct.Handle & vblf & " Property::Name : " & struct.Name) + + case 402 + set struct= oletest.Bridge_GetStruct("com.sun.star.beans.Property") + struct.Attributes= 1 + struct.Handle= 2 + struct.Name= "some Property" + oletest.AttrStruct= struct + + set struct2= oletest.AttrStruct + alert( "property get: " & vblf & "Property::Attributes : " & struct2.Attributes & _ + vblf & " Property::Handle : " & struct2.Handle & vblf & " Property::Name : " _ + & struct2.Name) + end select +end sub + +sub printArray( arr) + document.write "array: " + For Each val In arr + document.write CStr(val) & " " + Next +end sub + +// print a 2 dimensional Array + +sub printArray2( arr) + elements1= UBound( arr, 1) - LBound( arr, 1) +1 + elements2= UBound( arr, 2) - LBound( arr, 2) +1 + + For i=0 To elements1 -1 + document.write( "array " & CStr( i) & ": " ) + For j=0 To elements2 -1 + document.write CStr( arr(i,j)) + Next + document.write( "<br>") + Next +end sub + +sub printArrayEx( pre, post, array) + document.write pre + printArray array + document.write post +end sub +</script> + +<div id=out> </div> + +<!-- Insert HTML here --> + +<h2> JScript </h2> +Tests Array/Sequence conversion.<br> +All methods receive a Sequence as Parameter. The element type of the Sequence is written on the buttons. +<br> +<button onclick='callOleTest( 1)'>byte</Button> +<button onclick='callOleTest( 14)'>float</Button> +<button onclick='callOleTest( 2)'>double</Button> +<button onclick='callOleTest( 3)'>boolean</Button> +<button onclick='callOleTest( 4)'>short</Button> +<button onclick='callOleTest( 5)'>unsigned short</Button> +<button onclick='callOleTest( 6)'>long</Button> +<button onclick='callOleTest( 7)'>unsigned long</Button> +<button onclick='callOleTest( 8)'>char</Button> +<button onclick='callOleTest( 9)'>string</Button> +<button onclick='callOleTest( 10)'>any</Button> +<button onclick='callOleTest( 11)'>sequence<long> </Button> +<button onclick='callOleTest( 12)'>sequence<sequence<long> > </Button> +<button onclick='callOleTest( 13)' id=button2 name=button2>XInterface</Button> +<button onclick='callOleTest( 15)'>XEventListener</Button> +<button onclick='callOleTest( 16)'>sequence<XEventListener></Button> +<p> + +<p> +Out Parameter <br> +<button onclick='callOleTest( 2000)'>byte </Button> +<button onclick='callOleTest( 2016)'>float</Button> +<button onclick='callOleTest( 2001)'>double</Button> +<button onclick='callOleTest( 2002)'>boolean</Button> +<button onclick='callOleTest( 2003)'>short</Button> +<button onclick='callOleTest( 2004)'>unsigned short</Button> +<button onclick='callOleTest( 2005)'>long</Button> +<button onclick='callOleTest( 2006)'>unsigned long</Button> +<button onclick='callOleTest( 2007)'>char</Button> +<button onclick='callOleTest( 2008)'>string</Button> +<button onclick='callOleTest( 2009)'>any</Button> +<button onclick='callOleTest( 2010)'>sequence<long> </Button> +<button onclick='callOleTest( 2011)'>sequence<sequence<long> > </Button> +<button onclick='callOleTest( 2012)'>2 out </Button> +<button onclick='callOleTest( 2013)'>3 out </Button> +<button onclick='callOleTest( 2014)'>1 in & 1 out </Button> +<button onclick='callOleTest( 2015)'>XInterface </Button> +<button onclick='callOleTest( 2017)'>mixed out and in </Button> + + +<p> +In Out Parameter <br> +<button onclick='callOleTest( 500)'>byte </Button> +<button onclick='callOleTest( 513)'>float</Button> +<button onclick='callOleTest( 501)'>double</Button> +<button onclick='callOleTest( 502)'>boolean</Button> +<button onclick='callOleTest( 503)'>short</Button> +<button onclick='callOleTest( 504)'>unsigned short</Button> +<button onclick='callOleTest( 505)'>long</Button> +<button onclick='callOleTest( 506)'>unsigned long</Button> +<button onclick='callOleTest( 507)'>char</Button> +<button onclick='callOleTest( 508)'>string</Button> +<button onclick='callOleTest( 509)'>any</Button> +<button onclick='callOleTest( 510)'>sequence<long> </Button> +<button onclick='callOleTest( 511)'>sequence<sequence<long> > </Button> +<button onclick='callOleTest( 512)'>XInterface </Button> +<p> + +Tests Array/Sequence conversion with Attributes. All params are of type Sequence and + the element type of the Sequence is written on the buttons. <br> +<button onclick='callOleTest( 200)'>byte </Button> +<button onclick='callOleTest( 212)'>float</Button> +<button onclick='callOleTest( 201)'>double</Button> +<button onclick='callOleTest( 202)'>boolean</Button> +<button onclick='callOleTest( 203)'>short</Button> +<button onclick='callOleTest( 204)'>unsigned short</Button> +<button onclick='callOleTest( 205)'>long</Button> +<button onclick='callOleTest( 206)'>unsigned long</Button> +<button onclick='callOleTest( 207)'>char</Button> +<button onclick='callOleTest( 208)'>string</Button> +<button onclick='callOleTest( 209)'>any</Button> +<button onclick='callOleTest( 210)'>sequence<long> </Button> +<button onclick='callOleTest( 211)'>sequence<sequence<long> > </Button> +<p> + +Test of Any parameter in a method. Any contains:<br> +<button onclick='callOleTest( 1000)'>integer </Button> +<button onclick='callOleTest( 1001)'>double </Button> +<button onclick='callOleTest( 1002)'>string</Button> +<button onclick='callOleTest( 1003)'>array</Button> +<button onclick='callOleTest( 1004)'>object</Button> +<p> +Test of Any parameter in a property. Any contains:<br> +<button onclick='callOleTest( 1010)'>integer </Button> +<button onclick='callOleTest( 1011)'>double </Button> +<button onclick='callOleTest( 1012)'>string</Button> +<button onclick='callOleTest( 1013)'>array</Button> +<button onclick='callOleTest( 1014)'>object</Button> +<P> +Test of Struct conversions<br> +<button onclick='callOleTest( 1020)'>methodStruct </Button> +<button onclick='callOleTest( 1021)'>return struct</Button> +<button onclick='callOleTest( 1022)'>struct attribute</Button> + + + + +<p> + + +<h2> Visual Basic Tests </h2> +Test array /Sequence conversion and return value<br> +Template: <b> Sequence < type > method( Sequence< type > ) </b> <br> +<!--<font color= red>Multi dimensional arrays are not processed by VBSript</font> <br> --> +<button onclick='callBasic(0)'>byte</button> +<button onclick='callBasic(1)'>double</button> +<button onclick='callBasic(2)'>boolean</button> +<button onclick='callBasic(3)'>short</button> +<button onclick='callBasic(4)'>u short</button> +<button onclick='callBasic(5)'>long</button> +<button onclick='callBasic(6)'>u long</button> +<button onclick='callBasic(7)'>string</button> +<button onclick='callBasic(8)'>char</button> +<button onclick='callBasic(9)'>any</button> <br> +<button onclick='callBasic(10)'>Seq < int ></button> <br> + + +IN/Out parameter <br> +Template: <b> void method(type ) </b> <br> +<button onclick='callBasic(100)'>byte</button> +<button onclick='callBasic(101)'>double</button> +<button onclick='callBasic(102)'>boolean</button> +<button onclick='callBasic(103)'>short</button> +<button onclick='callBasic(104)'>u short</button> +<button onclick='callBasic(105)'>long</button> +<button onclick='callBasic(106)'>u long</button> +<button onclick='callBasic(107)'>string</button> +<button onclick='callBasic(108)'>char</button> +<button onclick='callBasic(109)'>any</button> <br> + +Simple out parameter<br> +<button onclick='callBasic(150)'>byte</button> +<!--<button onclick='callBasic(151)'>double</button> +<button onclick='callBasic(152)'>boolean</button> +<button onclick='callBasic(153)'>short</button> +<button onclick='callBasic(155)'>long</button> +<button onclick='callBasic(157)'>string</button> +<button onclick='callBasic(158)'>char</button> +<button onclick='callBasic(159)'>any</button> <br> +//--> +<br> + + +Tests Array/Sequence conversion with <b>Attributes</b>. All params are of type Sequence and + the element type of the Sequence is written on the buttons. <br> +<button onclick='callBasic( 200)'>byte </Button> +<button onclick='callBasic( 201)'>double</Button> +<button onclick='callBasic( 202)'>boolean</Button> +<button onclick='callBasic( 203)'>short</Button> +<button onclick='callBasic( 204)'>unsigned short</Button> +<button onclick='callBasic( 205)'>long</Button> +<button onclick='callBasic( 206)'>unsigned long</Button> +<button onclick='callBasic( 207)'>string</Button> +<button onclick='callBasic( 208)'>char</Button> +<button onclick='callBasic( 209)'>any</Button> +<button onclick='callBasic( 210)'>sequence<long> </Button> <br> + +In Out parameter <br> +<button onclick='callBasic( 300)'>byte</Button> +<p> +Structs <br> +<button onclick='callBasic(400)'>methodStruct</button> +<button onclick='callBasic(401)'>return Struct</button> +<button onclick='callBasic(402)'>struct attribute</button> + + + diff --git a/extensions/test/ole/ScriptTest.html b/extensions/test/ole/ScriptTest.html new file mode 100644 index 000000000..7cf188f45 --- /dev/null +++ b/extensions/test/ole/ScriptTest.html @@ -0,0 +1,1555 @@ +<HTML> +<HEAD> +<META NAME="GENERATOR" Content="Microsoft Developer Studio"> +<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"> +<TITLE>Document Title</TITLE> +</HEAD> +<BODY id=theBody> + +<script language="JScript"> + +function runJScriptTest( Log) +{ +document.writeln("================================================================================<br>"); +document.writeln("JScript<br>"); +document.writeln("================================================================================<p>"); + +//var name : String = "Fred"; +//print(name); +var arr= new Array( 1, 2, 3, 4, 0); +var arrInt= new Array( 1,2,3,4,5); +var arrDouble= new Array( 1.2345, 12.345, 123.45, 1234.5, 12345); +var arrBool= new Array( true, false, true, false, true); +var arrChar= new Array( '1', 'A'," ", 55); + +var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza"); +var arrAny= new Array( 100, 100.1235,"hallo"); +var arrSeq= new Array( arr, arr, arr); +var arrSeq2= new Array( ); + +var arEventListener= new Array( new XEventListener_Impl(), new XEventListener_Impl(), + new XEventListener_Impl()); +var arEventListener2= new Array( new XEventListener_Impl(), new XEventListener_Impl(), + new XEventListener_Impl()); +var arArEventListener= new Array( arEventListener, arEventListener2); + +var arObj= new Array(); +for( i=0; i< 3; i++) +{ + arObj[i]= new Object(); +} +var outVal= new Array(); +var outVal2= new Array(); +var outVal3= new Array(); + +for( i=0; i < 3; i++) +{ + arrSeq2[i]= new Array(); + for( j= 0; j < 3; j++) + { + arrSeq2[i][j]= new Array(); + for( k= 0; k < 5; k++) + { + arrSeq2[i][j][k]= (i * 3 * 5) + (j * 5) + k; +// document.write(arrSeq2[i][j][k] + " "); + } +// document.write("<br>"); + } +} + + +ret= oletest.methodByte( arr); +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "methodByte"); + +ret= oletest.methodFloat( arrDouble); +_ret= new VBArray( ret).toArray(); +bOk= false; +if( (arrDouble.length == _ret.length) + && (_ret[0] > 1.2344 && _ret[0] < 1.2346) + && (_ret[1] > 12.344 && _ret[1] < 12.346) + && (_ret[2] > 123.44 && _ret[2] < 123.46) + && (_ret[3] > 1234.4 && _ret[3] < 1234.6) + && (_ret[4] > 12344 && _ret[4] < 12346)) + bOk= true; +Log.print( bOk, "methodFloat"); + +ret= oletest.methodDouble( arrDouble); +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arrDouble, _ret), "methodDouble"); + +ret= oletest.methodBool( arrBool); +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arrBool, _ret), "methodBool"); + +ret= oletest.methodShort( arr); +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "methodShort"); + +ret= oletest.methodUShort( arr); +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "methodUShort"); + +ret= oletest.methodLong( arr); +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "methodLong"); + +ret= oletest.methodULong( arr); +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "methodULong"); + +ret= oletest.methodChar( arrChar); +_ret= new VBArray( ret).toArray(); +bOk= false; +if( _ret.length == arrChar.length && _ret[0] == 49 && _ret[1] == 65 && _ret[2] == 32 && _ret[3] == 55) + bOk= true; +Log.print( bOk, "methodChar"); + +ret= oletest.methodString( arrString); +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arrString, _ret), "methodString"); + +ret= oletest.methodAny( arrAny); +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arrAny, _ret), "methodAny"); + +ret= oletest.methodSequence( arrSeq); +_ret= new VBArray( ret).toArray(); +for( i=0; i < _ret.length; i++) +{ + sfarray2= new VBArray( _ret[i]); + var arr2= sfarray2.toArray(); + if( ! isEqualAr(arrSeq[i], arr2)) + { + bOk= false; + break; + } +} +Log.print( bOk, "methodSequence"); + +ret= oletest.methodSequence2( arrSeq2); +arr1= new VBArray( ret).toArray(); +for( i=0; i < arr1.length; i++) +{ + var ar2Dim= arrSeq2[i]; + sfarray2= new VBArray( arr1[i]); + arr2= sfarray2.toArray(); + for ( j=0; j < arr2.length; j++) + { + var ar1Dim= ar2Dim[j]; + sfarray3= new VBArray( arr2[j]); + arr3= sfarray3.toArray(); +// document.write(arr3[j].toString()); + if( ! isEqualAr( arrSeq2[i][j], arr3)) + { + bOk= false; + break; + } + } +} +Log.print( bOk, "methodSequence2"); + +ret= oletest.methodXInterface( arObj); +_ret= new VBArray( ret).toArray(); +bOk= true; +for(i in _ret) +{ + if( _ret[i] !== arObj[i]) + { + bOk= false; + break; + } +} +Log.print( bOk, "methodXInterface"); + + +ret= oletest.methodXEventListeners( arEventListener); +_ret= new VBArray(ret).toArray(); +bOk= true; +for ( key in _ret) +{ + if( ! _ret[key].disposingCalled()) + { + bOk= false; + break; + } +} +Log.print( bOk, "methodXEventListeners"); + +ret= oletest.methodXEventListenersMul( arArEventListener); +_ret= new VBArray(ret).toArray(); +bOk= true; +for( key in _ret) +{ + _ret2= new VBArray(_ret[key]).toArray(); + for( key2 in _ret2) + { + if( ! _ret2[key2].disposingCalled()) + { + bOk= false; + break; + } + } +} +Log.print( bOk, "methodXEventListenersMul"); + +document.writeln("<br>"); +oletest.AttrByte = arr; +ret= oletest.AttrByte; +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "AttrByte"); + +oletest.AttrFloat= arrDouble; +ret= oletest.AttrFloat; +_ret= new VBArray( ret).toArray(); +bOk= false; +if( (arrDouble.length == _ret.length) + && (_ret[0] > 1.2344 && _ret[0] < 1.2346) + && (_ret[1] > 12.344 && _ret[1] < 12.346) + && (_ret[2] > 123.44 && _ret[2] < 123.46) + && (_ret[3] > 1234.4 && _ret[3] < 1234.6) + && (_ret[4] > 12344 && _ret[4] < 12346)) + bOk= true; +Log.print( bOk, "AttrFloat"); + +oletest.AttrDouble= arrDouble; +ret= oletest.AttrDouble; +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arrDouble, _ret), "AttrDouble"); + +oletest.AttrBool= arrBool; +ret= oletest.AttrBool; +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arrBool, _ret), "AttrBool"); + +oletest.AttrShort= arr; +ret= oletest.AttrShort; +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "AttrShort"); + +oletest.AttrUShort= arr; +ret= oletest.AttrUShort; +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "AttrUShort"); + +oletest.AttrLong= arr; +ret= oletest.AttrLong; +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "AttrLong"); + +oletest.AttrULong= arr; +ret= oletest.AttrULong; +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arr, _ret), "AttrULong"); + +oletest.AttrChar= arrChar; +ret= oletest.AttrChar; +_ret= new VBArray(ret).toArray(); +bOk= false; +if( _ret.length == arrChar.length && _ret[0] == 49 && _ret[1] == 65 && _ret[2] == 32 && _ret[3] == 55) + bOk= true; +Log.print( bOk, "AttrChar"); + +oletest.AttrString= arrString; +ret= oletest.AttrString; +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arrString, _ret), "AttrString"); + +oletest.AttrAny= arrAny; +ret= oletest.AttrAny; +_ret= new VBArray( ret).toArray(); +Log.print( isEqualAr( arrAny, _ret), "AttrAny"); + +oletest.AttrSequence= arrSeq; +ret= oletest.AttrSequence; +_ret= new VBArray( ret).toArray(); +for( i=0; i < _ret.length; i++) +{ + sfarray2= new VBArray( _ret[i]); + var arr2= sfarray2.toArray(); + if( ! isEqualAr(arrSeq[i], arr2)) + { + bOk= false; + break; + } +} +Log.print( bOk, "AttrSequence"); + +oletest.AttrSequence2= arrSeq2; +ret= oletest.AttrSequence2; +arr1= new VBArray( ret).toArray(); +for( i=0; i < arr1.length; i++) +{ + var ar2Dim= arrSeq2[i]; + sfarray2= new VBArray( arr1[i]); + arr2= sfarray2.toArray(); + for ( j=0; j < arr2.length; j++) + { + var ar1Dim= ar2Dim[j]; + sfarray3= new VBArray( arr2[j]); + arr3= sfarray3.toArray(); + if( ! isEqualAr( arrSeq2[i][j], arr3)) + { + bOk= false; + break; + } + } +} +Log.print( bOk, "AttrSequence2"); + +oletest.AttrXInterface= arObj; +ret= oletest.AttrXInterface; +_ret= new VBArray( ret).toArray(); +bOk= true; +for(i in _ret) +{ + if( _ret[i] !== arObj[i]) + { + bOk= false; + break; + } +} +Log.print( bOk, "AttrXInterface"); + +ret= oletest.methodXInterface( arObj); +_ret= new VBArray( ret); +_ret= _ret.toArray(); +bOk= true; +for(i in _ret) +{ + if( _ret[i] !== arObj[i]) + { + bOk= false; + break; + } +} +Log.print( bOk, "methodXInterface"); + +document.writeln("<br>"); +var inVal, outVal, retVal; +outVal = new Array(); + +inVal = 77; +retVal = oletest.in_methodByte(inVal) +oletest.testout_methodByte( outVal ); +Log.print( retVal == inVal, "in_methodByte"); +Log.print( outVal[0] == inVal, "testout_methodByte"); + +inVal = 3.14 +retVal = oletest.in_methodFloat(inVal); +oletest.testout_methodFloat( outVal ); +Log.print( retVal > 3.14 && retVal < 3.15, "in_methodFloat"); +Log.print( outVal[0] > 3.13 && outVal[0] < 3.15, "testout_methodFloat"); +//Log.print( outVal[0] == inVal, "testout_methodFloat"); + +retVal = oletest.in_methodDouble(inVal) +oletest.testout_methodDouble( outVal ); +Log.print( retVal == inVal, "in_methodDouble"); +Log.print( outVal[0] == 3.14, "testout_methodDouble" ); + +inVal = true; +retVal = oletest.in_methodBool(inVal); +oletest.testout_methodBool( outVal ); +Log.print(retVal == inVal, "in_methodBool"); +Log.print( outVal[0] == true, "testout_methodBool"); + +inVal = 111 +retVal = oletest.in_methodShort(inVal); +oletest.testout_methodShort( outVal ); +Log.print(retVal == inVal, "in_methodShort"); +Log.print( outVal[0] == inVal, "testout_methodShort"); + +retVal = oletest.in_methodUShort(inVal); +oletest.testout_methodUShort( outVal ); +Log.print(retVal == inVal, "in_methodUShort"); +Log.print( outVal[0] == inVal, "testout_methodUShort"); + +retVal = oletest.in_methodLong(inVal); +oletest.testout_methodLong( outVal ); +Log.print(retVal == inVal, "in_methodLong"); +Log.print( outVal[0] == inVal, "testout_methodLong"); + +retVal = oletest.in_methodULong(inVal); +oletest.testout_methodULong( outVal ); +Log.print(retVal == inVal, "in_methodULong"); +Log.print( outVal[0] == inVal, "testout_methodULong"); + +retVal = oletest.in_methodChar(inVal); +oletest.testout_methodChar( outVal ); +Log.print(retVal == inVal, "in_methodChar"); +Log.print( outVal[0] == inVal, "testout_methodChar"); + +inVal = "Hello World"; +retVal = oletest.in_methodString(inVal); +oletest.testout_methodString( outVal ); +Log.print(retVal == inVal, "in_methodString"); +Log.print( outVal[0] == inVal, "testout_methodString"); + +retVal = oletest.in_methodAny(inVal); +oletest.testout_methodAny( outVal ); +Log.print(retVal == inVal, "in_methodAny"); +Log.print( outVal[0] == inVal, "testout_methodAny"); + +inVal = new Object(); +retVal = oletest.in_methodXInterface(inVal); +oletest.testout_methodXInterface(outVal); +Log.print(retVal === inVal, "in_methodXInterface"); +Log.print(outVal[0] === inVal, "testout_methodXInterface"); + +inVal = oletest; +retVal = oletest.in_methodXInterface(inVal); +oletest.testout_methodXInterface(outVal); +Log.print(retVal === inVal, "in_methodXInterface"); +Log.print(outVal[0] === inVal, "testout_methodXInterface"); + + +oletest.testout_methodSequence( outVal ); +var arr= new VBArray( outVal[0]).toArray(); +Log.print( isEqualAr(arr, new Array( 0,1,2,3,4,5,6,7,8,9)), "testout_methodSequence"); + +oletest.testout_methodSequence2( outVal ); +var arr= new VBArray( outVal[0]).toArray(); +bOk= true; +if( arr.length= 10) +{ + for( i=0; i < arr.length; i++) + { + var arr2= new VBArray( arr[i]).toArray(); + if( ! isEqualAr( arr2, new Array( 0,1,2,3,4,5,6,7,8,9))) + { + bOk= false; + break; + } + } +} +Log.print( bOk, "testout_methodSequence2"); + +oletest.testout_methodMulParams1( outVal, outVal2 ); +Log.print( outVal[0] == 999 && outVal2[0] == 1111, "testout_methodMulParams1"); + +oletest.testout_methodMulParams2( outVal, outVal2, outVal3 ); +Log.print( outVal[0] == 1111 && outVal2[0] == 1222 && outVal3[0] == " another string", + "testout_methodMulParams2"); + +oletest.testout_methodMulParams3( "hallo", outVal ); +Log.print( outVal[0] == "Out Hallo!", "testout_methodMulParams3"); + +var in1= 3.14; +var in2= 1111; +var in3= -2222; +oletest.testout_methodMulParams4( in1, outVal, in2, outVal2, in3 ); +Log.print( (outVal[0] > 4.13 && outVal[0] < 4.15) && (outVal2[0] == 1112), "testout_methodMulParams4"); + +document.writeln("<p>"); + +inVal = 100; +outVal[0]= inVal; +oletest.testinout_methodByte( outVal ); +oletest.testinout_methodByte( outVal ); +Log.print( outVal[0] == inVal, "testinout_methodByte"); + +inVal = 3.14; +outVal[0]= inVal; +oletest.testinout_methodFloat( outVal ); +oletest.testinout_methodFloat( outVal ); +Log.print( outVal[0] > 3.13 && outVal[0] < 3.15, "testinout_methodFloat"); + +inVal = 3.14 +outVal[0]= inVal; +oletest.testinout_methodDouble( outVal ); +oletest.testinout_methodDouble( outVal ); +Log.print( outVal[0] == inVal, "testinout_methodDouble"); + +inVal = true; +outVal[0]= inVal; +oletest.testinout_methodBool( outVal ); +oletest.testinout_methodBool( outVal ); +Log.print( outVal[0] == inVal, "testinout_methodBool"); + +inVal = 200; +outVal[0]= inVal; +oletest.testinout_methodShort( outVal ); +oletest.testinout_methodShort( outVal ); +Log.print( outVal[0] == inVal, "testinout_methodShort"); + +inVal = 300; +outVal[0]= inVal; +oletest.testinout_methodUShort( outVal ); +oletest.testinout_methodUShort( outVal ); +Log.print( outVal[0] == inVal, "testinout_methodUShort"); + +inVal = 400 +outVal[0]= inVal; +oletest.testinout_methodLong( outVal ); +oletest.testinout_methodLong( outVal ); +Log.print( outVal[0] == inVal, "testinout_methodLong"); + +inVal = 500; +outVal[0]= inVal; +oletest.testinout_methodULong( outVal ); +oletest.testinout_methodULong( outVal ); +Log.print( outVal[0] == inVal, "testinout_methodULong"); + +inVal = "B"; +outVal[0]= inVal; +oletest.testinout_methodChar( outVal ); +oletest.testinout_methodChar( outVal ); + +Log.print( outVal[0] == 66, "testinout_methodChar"); + +inVal = "Hello World 2!"; +outVal[0]= inVal; +oletest.testinout_methodString( outVal ); +oletest.testinout_methodString( outVal ); +Log.print( outVal[0] == inVal, "testinout_methodString"); + +inVal = new Object(); +outVal[0]= inVal; +oletest.testinout_methodAny( outVal ); +oletest.testinout_methodAny( outVal ); +Log.print( outVal[0] === inVal, "testinout_methodAny"); + +inVal = arrInt; +outVal[0] = inVal; +oletest.testinout_methodSequence( outVal ); +oletest.testinout_methodSequence( outVal ); +retVal = new VBArray(outVal[0]).toArray(); + +Log.print( isEqualAr(retVal, new Array(3,4,5,6,7)), "testinout_methodSequence"); + + +outVal[0]= arrSeq; +oletest.testinout_methodSequence2( outVal ); +var arr= new VBArray( outVal[0]).toArray(); +var i; +bOk= true; +if( arr.length == 3) +{ + var tmpArr= new Array(2,4,6,8,0); + for( i=0; i < arr.length; i++) + { + var arr2= new VBArray( arr[i]).toArray(); + if( ! isEqualAr( arr2, tmpArr)) + { + bOk= false; + break; + } + } +} +Log.print( bOk, "testinout_methodSequence2"); + + +var ob= new Object(); +var sInVal= "this is a string" +ob.value= sInVal; +outVal[0]= ob; +oletest.testinout_methodXInterface( outVal); +Log.print( outVal[0].value == "out", "testinout_methodXInterface"); +document.writeln("<p>"); + +i= 100; +ret= oletest.methodAnyTest1( i); +Log.print( i == ret, "methodAnyTest1"); + +i= 3.14; +ret= oletest.methodAnyTest1( i); +Log.print( i == ret, "methodAnyTest1"); + +i= "Hallo" +ret= oletest.methodAnyTest1( i); +Log.print( i == ret, "methodAnyTest1"); + +i= arrInt; +ret= oletest.methodAnyTest1( i); +var arr= new VBArray( ret).toArray(); +Log.print( isEqualAr(arr, arrInt), "methodAnyTest1"); + +var obj= new Object(); +ret= oletest.methodAnyTest1( obj); +Log.print( obj == ret, "methodAnyTest1"); + + +document.writeln("<p>"); + +i= 100; +oletest.AttrAny2= i; +ret= oletest.AttrAny2; +Log.print( i == ret, "AttrAny2"); + +i= 3.14; +oletest.AttrAny2= i; +ret= oletest.AttrAny2; +Log.print( i == ret, "AttrAny2"); + +i= "Hallo" +oletest.AttrAny2= i; +ret= oletest.AttrAny2; +Log.print( i == ret, "AttrAny2"); + +i= arrInt; +oletest.AttrAny2= i; +ret= oletest.AttrAny2; +var arr= new VBArray( ret).toArray(); +Log.print( isEqualAr(arr, arrInt), "AttrAny2"); + +var obj= new Object(); +oletest.AttrAny2= obj; +ret= oletest.AttrAny2; +Log.print( obj == ret, "AttrAny2"); + + +document.writeln("<p>"); +// Structs ---------------------------------------------- + +/* var struct= oletest._GetStruct("com.sun.star.beans.Property"); */ +/* struct.Attributes= 1; */ +/* struct.Handle= 2; */ +/* struct.Name= "some Property" */ +/* oletest.methodStruct( struct); */ + +var ret= oletest.retMethodStruct(); +Log.print( ret.Attributes == 127 && ret.Handle == 255 && ret.Name == "OleTest_Property", "retMethodStruct"); + +var astruct= oletest._GetStruct("com.sun.star.beans.Property"); +astruct.Attributes= 1; +astruct.Handle= 2; +astruct.Name= "some Property" +oletest.AttrStruct= astruct; + +var ret= oletest.AttrStruct; +Log.print( ret.Attributes == 127 && ret.Handle == 255 && ret.Name == "OleTest_Property", "AttrStruct"); + +// The function returns the struct. Since structs are passed by value the returned struct +// will be wrapped in another IDispatch object +astruct.Attributes= 1; +astruct.Handle= 2; +astruct.Name= "Property"; +ret= oletest.methodStruct2( astruct); +Log.print( ret.Attributes == 1 && ret.Handle == 2 && ret.Name == "Property", "methodStruct2"); + + +document.writeln("<p>"); +// Test Identity from COM objects in UNO +var listener1= new XEventListener_Impl(); +oletest.setObject(listener1); +ret= oletest.isSame(listener1); +Log.print2( ret, "Ok Testing identity of COM objects<br>","Failed Testing identity of COM objects<br>"); + +var oletest2= oletest.getThis(); +ret= oletest === oletest2; +Log.print2(ret, "Ok Testing identity of UNO objects<br>","Failed Testing identity of UNO objects<br>"); +} + + + + +function isEqualAr( ar1, ar2) +{ + var bOk= false; + if( ar1.length == ar2.length) + { + bOk= true; + for( x in ar1) + { +// document.writeln( ar1[x] + " "); +// document.writeln( ar2[x] + " "); + if( ar1[x] != ar2[x]) + { + bOk= false; + break; + } + } + } + return bOk; +} + +/* function isEqualAr2( ar1, ar2) */ +/* { */ + +/* var bOk= false; */ +/* if( ar1.length == ar2.length) */ +/* { */ +/* bOk= true; */ +/* for( x in ar1) */ +/* { */ +/* document.write( ar1[x]); */ +/* document.write( ar2[x]); */ +/* if( ! isEqualAr( ar1[x], ar2[x])) */ +/* { */ +/* bOk= false; */ +/* break; */ +/* } */ +/* } */ +/* } */ +/* return bOk; */ + +/* } */ + +function XEventListener_Impl() +{ + this._environment= "JScript"; + this._implementedInterfaces= new Array( "com.sun.star.lang.XEventListener"); + + //XEventListener + this.disposing= XEventListener_disposing; + + this.bdisposingCalled= false; + this.bQuiet= true; + this.resetDisposing= XEventListener_resetDisposing; + this.disposingCalled= XEventListener_disposingCalled; +} + +function XEventListener_disposing( source) +{ + if( !this.bQuiet) + alert("JScript Event Listener \n disposing is being called"); + this.bdisposingCalled= true; +} + +function XEventListener_resetDisposing() +{ + this.bdisposingCalled= false; +} + +function XEventListener_disposingCalled() +{ + return this.bdisposingCalled; +} +</script> + +<script language="VBScript"> +Function runVBTest( Log) +document.writeln("================================================================================<br>") +document.writeln("VB Script<br>") +document.writeln("================================================================================<p>") + +Dim arrInt +arrInt= Array(1,2,3,-4,-5, 0) +arrUInt= Array(1,2,3,4,5) +arrDouble= Array( 1.2345, 12.345, 123.45, 1234.5, 12345) +arrBool= Array( true, false, true, false, true) +arrChar= Array("A","B",67) +arrString= Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza") +arrAny= Array( 100, 100.1235,"hallo") + + +Dim arrDim2Int(2,1) +Dim i,j,k +For i= 0 To 1 + For j= 0 To 2 + arrDim2Int(j,i) = i*3 + j + Next +Next + + +Dim arrDim3Int(3,2,1) +For i= 0 To 1 + For j= 0 To 2 + For k= 0 To 3 + arrDim3Int(k,j,i)= i* 3 + j* 4 + k + Next + Next +Next + +Dim arrXEvent(2) +For i= 0 To 2 + Set arrXEvent(i)= new VBEventListener +Next + +Dim arrXEvent2(2,1) +For i= 0 To 1 + For j= 0 To 2 + Set arrXEvent2(j,i)= new VBEventListener + Next +Next + + + +ret= oletest.methodByte( arrUInt) +Log.print isEqualVBAr( ret, arrUInt), "methodByte" + +ret= oletest.methodFloat( arrDouble) +Log.print isEqualVBAr( ret, arrDouble), "methodFloat" + +ret= oletest.methodDouble( arrDouble) +Log.print isEqualVBAr( ret, arrDouble), "methodDouble" + +ret= oletest.methodBool( arrBool) +Log.print isEqualVBAr( ret, arrBool), "methodBool" + +ret= oletest.methodShort( arrInt) +Log.print isEqualVBAr( ret, arrInt), "methodShort" + +ret= oletest.methodUShort( arrUInt) +Log.print isEqualVBAr( ret, arrUInt), "methodUShort" + +ret= oletest.methodLong( arrInt) +Log.print isEqualVBAr( ret, arrInt), "methodLong" + +ret= oletest.methodULong( arrUInt) +Log.print isEqualVBAr( ret, arrUInt), "methodULong" + +ret= oletest.methodChar( arrChar) +bOk= false +if ret(0) = 65 AND ret(1) = 66 AND ret(2) = 67 then + bOk= true +end if +Log.print bOk, "methodChar" + +ret= oletest.methodString( arrString) +Log.print isEqualVBAr( ret, arrString), "methodString" + +ret= oletest.methodAny( arrAny) +Log.print isEqualVBAr( ret, arrAny), "methodAny" + + +ret= oletest.methodSequence( arrDim2Int) +bOk= true + +For i= 0 To 1 + Dim arr1 + arr1= ret(i) + For j= 0 To 2 + if arr1(j) <> arrDim2Int(j,i) then + bOk= false + exit for + end if + Next +Next +Log.print bOk, "methodSequence" + +ret= oletest.methodSequence2( arrDim3Int) +'arrDim3Int(3,2,1) +bOk= true +For i= 0 To 1 + arr1= ret(i) + For j= 0 To 2 + arr2= arr1(j) + For k= 0 To 3 + If arr2(k) <> arrDim3Int(k,j,i) then + bOk= false + exit for + End If + Next + Next +Next +Log.print bOk, "methodSequence2" + +ret= oletest.methodXInterface(arrXEvent) +bOk= true +numArg= UBound( arrXEvent) - LBound( arrXEvent) + 1 +numRet= UBound( ret) - LBound( ret) + 1 +If numArg = numRet then + For i= 0 To numArg - 1 + If NOT (arrXEvent(i) Is ret(i)) then + bOk= false + Exit For + End if + Next +End If +Log.print bOk, "methodXInterface" + +ret= oletest.methodXEventListeners( arrXEvent) +bOk= true +For i= 0 To 2 + If arrXEvent(i).disposingCalled = false then + bOk= false + Exit For + End If +Next +Log.print bOk, "methodXEventListeners" + +ret= oletest.methodXEventListenersMul(arrXEvent2) +bOk= true +For i= 0 To 1 + For j= 0 To 2 + If arrXEvent2(j,i).disposingCalled = false then + bOk= false + Exit For + End If + Next +Next +Log.print bOk, "methodXEventListenersMul" + +' Attributes ------------------------------------------------------ +document.writeln( "<br>" ) +oletest.AttrByte= arrUInt +ret= oletest.AttrByte +Log.print isEqualVBAr( arrUInt, ret), "AttrByte" + +oletest.AttrFloat= arrDouble +ret= oletest.AttrFloat +Log.print isEqualVBAr( arrDouble, ret), "AttrFloat" + +oletest.AttrDouble= arrDouble +ret= oletest.AttrDouble +Log.print isEqualVBAr( arrDouble, ret), "AttrDouble" + +oletest.AttrBool= arrBool +ret= oletest.AttrBool +Log.print isEqualVBAr( arrBool, ret), "AttrBool" + +oletest.AttrShort= arrInt +ret= oletest.AttrShort +Log.print isEqualVBAr( arrInt, ret), "AttrShort" + +oletest.AttrUShort= arrUInt +ret= oletest.AttrUShort +Log.print isEqualVBAr( arrUInt, ret), "AttrUShort" + +oletest.AttrLong= arrInt +ret= oletest.AttrLong +Log.print isEqualVBAr( arrInt, ret), "AttrLong" + +oletest.AttrULong= arrUInt +ret= oletest.AttrULong +Log.print isEqualVBAr( arrUInt, ret), "AttrULong" + +oletest.AttrChar= arrChar +ret= oletest.AttrChar +bOk= false +if ret(0) = 65 AND ret(1) = 66 AND ret(2) = 67 then + bOk= true +end if +Log.print bOk, "AttrChar" + +oletest.AttrString= arrString +ret= oletest.AttrString +Log.print isEqualVBAr( arrString, ret), "AttrString" + +oletest.AttrSequence= arrDim2Int +ret= oletest.AttrSequence +bOk= true +For i= 0 To 1 + arr1= ret(i) + For j= 0 To 2 + if arr1(j) <> arrDim2Int(j,i) then + bOk= false + exit for + end if + Next +Next +Log.print bOk, "AttrSequence" + +oletest.AttrSequence2= arrDim3Int +ret= oletest.AttrSequence2 +'arrDim3Int(3,2,1) +bOk= true +For i= 0 To 1 + arr1= ret(i) + For j= 0 To 2 + arr2= arr1(j) + For k= 0 To 3 + If arr2(k) <> arrDim3Int(k,j,i) then + bOk= false + exit for + End If + Next + Next +Next +Log.print bOk, "AttrSequence2" + +oletest.AttrXInterface= arrXEvent +ret= oletest.AttrXInterface +bOk= true +numArg= UBound( arrXEvent) - LBound( arrXEvent) + 1 +numRet= UBound( ret) - LBound( ret) + 1 +If numArg = numRet then + For i= 0 To numArg - 1 + If NOT (arrXEvent(i) Is ret(i)) then + bOk= false + Exit For + End if + Next +End If +Log.print bOk, "AttrXInterface" + +'out params ================================================================================ +document.writeln("<p>") +Dim inVal, outVal, retVal + +inVal = 111 +retVal = oletest.in_methodByte(inVal) +oletest.testout_methodByte outVal +Log.print inVal = retVal, "in_methodByte" +Log.print outVal = inVal, "testout_methodByte" + +inVal = 3.14 +retVal = oletest.in_methodFloat(inVal) +oletest.testout_methodFloat outVal +Log.print inVal = retVal, "in_methodFloat" +Log.print outVal > 3.13 AND outVal < 3.15, "testout_methodFloat" + +inVal = 3.14 +retVal = oletest.in_methodDouble(inVal) +oletest.testout_methodDouble outVal +Log.print inVal = retVal, "in_methodDouble" +Log.print outVal = 3.14, "testout_methodDouble" + +inVal = true +retVal = oletest.in_methodBool(inVal) +oletest.testout_methodBool outVal +Log.print inVal = retVal, "in_methodBool" +Log.print outVal = inVal, "testout_methodBool" + +inVal = 222 +retVal = oletest.in_methodShort(inVal) +oletest.testout_methodShort outVal +Log.print inVal = retVal, "in_methodShort" +Log.print outVal = inVAl, "testout_methodShort" + +inVal = 333 +retVal = oletest.in_methodUShort(inVal) +oletest.testout_methodUShort outVal +Log.print inVal = retVal, "in_methodUShort" +Log.print outVal = inVal, "testout_methodUShort" + +inVal = 4444 +retVal = oletest.in_methodLong(inVal) +oletest.testout_methodLong outVal +Log.print inVal = retVal, "in_methodLong" +Log.print outVal = inVal, "testout_methodLong" + +inVal = 5555 +retVal = oletest.in_methodULong(inVal) +oletest.testout_methodULong outVal +Log.print inVal = retVal, "in_methodULong" +Log.print outVal = inVal, "testout_methodULong" + +inVal = 65 +retVal = oletest.in_methodChar(inVal) +oletest.testout_methodChar outVal +Log.print inVal = retVal, "in_methodChar" +Log.print outVal = 65, "testout_methodChar" + +inVal = "Hello World 3!" +retVal = oletest.in_methodString(inVal) +oletest.testout_methodString outVal +Log.print inVal = retVal, "in_methodString" +Log.print outVal = inVal, "testout_methodString" + +inVal = "Hello World 4!" +retVal = oletest.in_methodAny(inVal) +oletest.testout_methodAny outVal +Log.print outVal = inVal, "testout_methodAny" + +oletest.testout_methodSequence outVal +Log.print isEqualVBAr(outVal, Array( 0,1,2,3,4,5,6,7,8,9)), "testout_methodSequence" + +oletest.testout_methodSequence2 outVal +count= UBound( outVal) - LBound( outVal) + 1 +ret= False +If count = 10 Then + For Each ar In outVal + ret= isEqualVBAr(ar, Array( 0,1,2,3,4,5,6,7,8,9)) + If ret = false Then + Exit For + End If + Next +End If +Log.print ret, "testout_methodSequence2" + +outVal= Empty +outVal2= Empty +oletest.testout_methodMulParams1 outVal, outVal2 +ret= false +If outVal = 999 AND outVal2 = 1111 Then + ret= true +End If +Log.print ret, "testout_methodMulParams1" + +outVal= Empty +outVal2= Empty +outVal3= Empty +oletest.testout_methodMulParams2 outVal, outVal2, outVal3 +ret = false +If outVal = 1111 AND outVal2 = 1222 AND outVal3 = " another string" Then + ret= true +End If +Log.print ret, "testout_methodMulParams2" + +document.writeln("missing: testout_methodMulParams3 <br>") +document.writeln("missing: testout_methodMulParams4 <br>") + +outVal= Empty +oletest.testout_methodXInterface outVal +ret= false +If outVal Is oletest Then + ret= true +End If +Log.print ret, "testout_methodXInterface" + +Set outVal= Nothing +document.writeln("missing: testout_methodXInterface <br>") + +inVal = 1 +outVal= inVal +oletest.testinout_methodByte outVal +oletest.testinout_methodByte outVal +Log.print inVal = outVal, "testinout_methodByte" + + +document.writeln("missing: testinout_methodFloat <br>") +document.writeln("missing: testinout_methodDouble <br>") +document.writeln("missing: testinout_methodBool <br>") +document.writeln("missing: testinout_methodShort <br>") +document.writeln("missing: testinout_methodUShort <br>") +document.writeln("missing: testinout_methodLong <br>") +document.writeln("missing: testinout_methodULong <br>") +document.writeln("missing: testinout_methodChar <br>") +document.writeln("missing: testinout_methodString <br>") +document.writeln("missing: testinout_methodAny <br>") +document.writeln("missing: testinout_methodSequence <br>") +document.writeln("missing: testinout_methodSequence2 <br>") +document.writeln("missing: testinout_methodXInterface <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: AttrAny2 <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: methodAnyTest1 <br>") +document.writeln("missing: retMethodStruct <br>") +document.writeln("missing: AttrStruct <br>") +document.writeln("missing: methodStruct2 <br>") + +' Test Identity from COM objects in UNO +Dim listener1 +Set listener1= new VBEventListener +call oletest.setObject( listener1) +ret= oletest.isSame(listener1) +Log.print2 ret, "Ok Testing identity of COM objects <br>","Failed Testing identity of COM objects<br>" +' Test identity of UNO objects + +set oletest2= oletest.getThis() +ret= oletest Is oletest2 +Log.print2 ret, "Ok Testing identity of UNO objects<br>","Failed Testing identity of UNO objects<br>" + +End Function + + +Function isEqualVBAr( arr1, arr2) + ret = false + s1= UBound( arr1) - LBound( arr1) + 1 + s2= UBound( arr2) - LBound( arr2) + 1 + + if s1 = s2 then + ret= true + Dim i + for i= 0 To s1 - 1 + if arr1(i) <> arr2(i) then + ret= false + exit for + end if + next + end if + isEqualVBar= ret +End Function + + +'The listener object + +Class VBEventListener + Dim Bridge_ImplementedInterfaces(0) + Dim bDisposingCalled + +'XEventListener::disposing + Function disposing( source) + bDisposingCalled= true + End Function + + Sub Class_Initialize() + bDisposingCalled= false + Bridge_ImplementedInterfaces(0)= "com.sun.star.lang.XEventListener" + End Sub + + Function resetDisposing() + bDisposingCalled= false + End Function + + Function disposingCalled() + disposingCalled= bDisposingCalled + End Function +End Class + + +sub callBasic(id) + + Dim factory + Set factory= GetObject("", "com.sun.star.ServiceManager") + + Set oletest= factory.createInstance("oletest.OleTest") + + + arrInt= Array(1,2,3,4,5) + arrInt2= Array( -1, -2, 127, 128, 0) + arrDouble= Array(1.1, 2.2, 3.3, 4.4, 5.5) + arrBool= Array(0,1,0,2,0) + arrLong= Array( &Hff, &Hffff, &Hffffff, &Hffffffff) + arrString= Array("Chicken Wings", "Cheeseburger", "Hamburger") + arrChar= Array("a",65, "M") + arrAny= Array("Mickey", 3.14, 100, "A") + + Dim arrDim2Int(1,2) + For i= 0 To 1 + For j= 0 To 1 + arrDim2Int(i,j) = i*2 + j + Next + Next + + Dim arrDim3Int(1,1,1) + For i= 0 To 1 + For j= 0 To 1 + For k=0 To 1 + arrDim3Int(i,j,k) = i*2 + j*2 + k + Next + Next + Next + + + select case id + + // Out Parameter + + + + // In Out Parameter -------------------------------------------------- + case 100 + a= 100 + document.write "param: " & CStr( a) & "<br>" + oletest.testinout_methodByte a + document.write a + case 101 + a= 1.11 + document.write "param: " & CStr( a) & "<br>" + oletest.testinout_methodDouble a + document.write a + case 102 + a= 5 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodBool a + document.write a + case 103 + a= -10 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodShort a + document.write a + case 104 + a= 128 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodUShort a + document.write a + case 105 + a= 65556 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodLong a + document.write a + case 106 + a= 65556 + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodULong a + document.write a + case 107 + a= "ein test string" + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodString a + document.write a + case 108 + a= "W" + document.write "param: "& CStr( a) & "<br>" + oletest.testinout_methodChar a + document.write a + case 109 + a= "Ein String im Any" + document.write "param: "& CStr( a) & "<br>" + oletest.other_methodAnyIn a + document.write a + + case 150 + dim a + document.write "param: "& CStr( a) & "<br>" + oletest.testout_methodByte( a) + document.write a +// Attributes ----------------------------------------------------------------- + case 200 + document.write "set: " + printArray arrInt + oletest.AttrByte= arrInt + b= oletest.AttrByte + call printArrayEx( "<br> get: ", "<br>", b) + case 201 + document.write "set: " + printArray arrDouble + oletest.AttrDouble= arrDouble + b= oletest.AttrDouble + call printArrayEx( "<br> get: ", "<br>", b) + case 202 + document.write "set: " + printArray arrBool : + oletest.AttrBool= arrBool + b= oletest.AttrBool + call printArrayEx( "<br> get: ", "<br>", b) + case 203 + document.write "set: " + printArray arrInt2 : + oletest.AttrShort= arrInt2 + b= oletest.AttrShort + call printArrayEx( "<br> get: ", "<br>", b) + case 204 + document.write "set: " + printArray arrInt + oletest.AttrUShort= arrInt + b= oletest.AttrUShort + call printArrayEx( "<br> get: ", "<br>", b) + case 205 + document.write "set: " + printArray arrInt2 + oletest.AttrLong= arrInt2 + b= oletest.AttrLong + call printArrayEx( "<br> get: ", "<br>", b) + case 206 + document.write "set: " + printArray arrInt + oletest.AttrULong= arrInt + b= oletest.AttrULong + call printArrayEx( "<br> get: ", "<br>", b) + case 207 + document.write "set: " + printArray arrString + oletest.AttrString= arrString + b= oletest.AttrString + call printArrayEx( "<br> get: ", "<br>", b) + case 208 + document.write "set: " + printArray arrChar + oletest.AttrChar= arrChar + b= oletest.AttrChar + call printArrayEx( "<br> get: ", "<br>", b) + case 209 + document.write "set: " + printArray arrAny + oletest.AttrAny= arrAny + b= oletest.AttrAny + call printArrayEx( "<br> get: ", "<br>", b) + + case 210 + document.write "set: <br>" + printArray2 arrDim2Int : + oletest.AttrSequence= arrDim2Int + ret= oletest.AttrSequence + document.write "get: " + for each val in ret + document.write "<br> array: " + for each val2 in val + document.write val2 + next + next + + case 300 + dim aByte + aByte= 100 + call oletest.testinout_methodByte( aByte) + MsgBox aByte + + + case 400 + + set struct= oletest.Bridge_GetStruct("com.sun.star.beans.Property") + struct.Attributes= 1 + struct.Handle= 2 + struct.Name= "some Property" + oletest.methodStruct struct + + case 401 + set struct= oletest.retMethodStruct() + alert( "Property::Attributes : " & struct.Attributes & vblf & " Property::Handle : " _ + & struct.Handle & vblf & " Property::Name : " & struct.Name) + + case 402 + set struct= oletest.Bridge_GetStruct("com.sun.star.beans.Property") + struct.Attributes= 1 + struct.Handle= 2 + struct.Name= "some Property" + oletest.AttrStruct= struct + + set struct2= oletest.AttrStruct + alert( "property get: " & vblf & "Property::Attributes : " & struct2.Attributes & _ + vblf & " Property::Handle : " & struct2.Handle & vblf & " Property::Name : " _ + & struct2.Name) + end select +end sub + +sub printArray( arr) + document.write "array: " + For Each val In arr + document.write CStr(val) & " " + Next +end sub + +// print a 2 dimensional Array + +sub printArray2( arr) + elements1= UBound( arr, 1) - LBound( arr, 1) +1 + elements2= UBound( arr, 2) - LBound( arr, 2) +1 + + For i=0 To elements1 -1 + document.write( "array " & CStr( i) & ": " ) + For j=0 To elements2 -1 + document.write CStr( arr(i,j)) + Next + document.write( "<br>") + Next +end sub + +sub printArrayEx( pre, post, array) + document.write pre + printArray array + document.write post +end sub +</script> + +<script language="JScript"> +var arFunctions= new Array(); +arFunctions["methodByte"]= "sequence<byte> methodByte( [in] sequence<byte> aSeq )"; +arFunctions["methodFloat"]= "sequence<float> methodFloat( [in] sequence<float> aSeq)"; +arFunctions["methodDouble"]= "sequence<double> methodDouble( [in] sequence<double> aSeq)"; +arFunctions["methodBool"]= "sequence<boolean> methodBool( [in] sequence<boolean> aSeq)"; +arFunctions["methodShort"]= "sequence<short> methodShort( [in] sequence<short> aSeq)"; +arFunctions["methodUShort"]= "sequence<unsigned short> methodUShort( [in] sequence<unsigned short> aSeq)"; +arFunctions["methodLong"]= "sequence<long> methodLong( [in] sequence<long> aSeq)"; +arFunctions["methodULong"]= "sequence<unsigned long> methodULong( [in] sequence<unsigned long> aSeq)"; +arFunctions["methodString"]= "sequence<string> methodString( [in] sequence<string> aSeq)"; +arFunctions["methodChar"]= "sequence<char> methodChar( [in] sequence<char> aSeq)"; +arFunctions["methodAny"]= "sequence<any> methodAny ( [in] sequence<any> aSeq)"; +arFunctions["methodXInterface"]= "sequence<XInterface> methodXInterface ( [in] sequence<XInterface> aSeq)"; +arFunctions["methodSequence"]= "sequence< sequence <long> > methodSequence( [in] sequence< sequence< long > > aSeq)"; +arFunctions["methodSequence2"]= "sequence< sequence <sequence <long> > > methodSequence2( [in] sequence< sequence< sequence<long> > > aSeq)"; +arFunctions["methodXEventListeners"]= "sequence< com::sun::star::lang::XEventListener > methodXEventListeners( [in] sequence<com::sun::star::lang::XEventListener> aSeq)"; +arFunctions["methodXEventListenersMul"]= "sequence< sequence< com::sun::star::lang::XEventListener > > methodXEventListenersMul( [in] sequence< sequence< com::sun::star::lang::XEventListener> > aSeq)"; +arFunctions["AttrByte"]="[attribute] sequence<byte> AttrByte"; +arFunctions["AttrFloat"]="[attribute] sequence<float> AttrFloat"; +arFunctions["AttrDouble"]="[attribute] sequence<double> AttrDouble"; +arFunctions["AttrBool"]="[attribute] sequence<boolean> AttrBool"; +arFunctions["AttrShort"]="[attribute] sequence<short> AttrShort"; +arFunctions["AttrUShort"]="[attribute] sequence<unsigned short> AttrUShort"; +arFunctions["AttrLong"]="[attribute] sequence<long> AttrLong"; +arFunctions["AttrULong"]="[attribute] sequence<unsigned long> AttrULong"; +arFunctions["AttrString"]="[attribute] sequence<string> AttrString"; +arFunctions["AttrChar"]="[attribute] sequence<char> AttrChar"; +arFunctions["AttrAny"]="[attribute] sequence<any> AttrAny"; +arFunctions["AttrSequence"]="[attribute] sequence< sequence<long> > AttrSequence"; +arFunctions["AttrSequence2"]="[attribute] sequence< sequence< sequence <long> > > AttrSequence2"; +arFunctions["AttrXInterface"]="[attribute] sequence< com::sun::star::uno::XInterface > AttrXInterface"; + +arFunctions["testout_methodByte"]= " void testout_methodByte( [out] byte rOut )"; +arFunctions["testout_methodFloat"]= "void testout_methodFloat( [out] float rOut)"; +arFunctions["testout_methodDouble"]= "void testout_methodDouble( [out] double rOut)"; +arFunctions["testout_methodBool"]= "void testout_methodBool( [out] boolean rOut)"; +arFunctions["testout_methodShort"]= "void testout_methodShort( [out] short rOut)"; +arFunctions["testout_methodUShort"]= "void testout_methodUShort( [out] unsigned short rOut)"; +arFunctions["testout_methodLong"]= "void testout_methodLong( [out] long rOut)"; +arFunctions["testout_methodULong"]= "void testout_methodULong( [out] unsigned long rOut)"; +arFunctions["testout_methodString"]= "void testout_methodString( [out] string rOut)"; +arFunctions["testout_methodChar"]= "void testout_methodChar( [out] char rOut)"; +arFunctions["testout_methodAny"]= "void testout_methodAny( [out] any rOut)"; +arFunctions["testout_methodSequence"]= "void testout_methodSequence( [out] sequence< long > rOut)"; +arFunctions["testout_methodSequence2"]= "void testout_methodSequence2( [out] sequence < sequence< long > > rOut)"; +arFunctions["testout_methodXInterface"]= "void testout_methodXInterface( [out] com::sun::star::uno::XInterface rOut)"; +arFunctions["testout_methodMulParams1"]= "void testout_methodMulParams1( [out] long rout1, [out] long rout2)"; +arFunctions["testout_methodMulParams2"]= "void testout_methodMulParams2( [out] long rout1, [out] long rout2, [out] string rout3)"; +arFunctions["testout_methodMulParams3"]= "void testout_methodMulParams3( [in] string sin, [out] string sout)"; +arFunctions["testout_methodMulParams4"]= "void testout_methodMulParams4( [in] float in1, [out] float out1, [in] long in2, [out] long out2, [in] long in3)"; +arFunctions["testinout_methodByte"]="void testinout_methodByte( [inout] byte rOut )"; +arFunctions["testinout_methodFloat"]="void testinout_methodFloat( [inout] float rOut)"; +arFunctions["testinout_methodDouble"]="void testinout_methodDouble( [inout] double rOut)"; +arFunctions["testinout_methodBool"]="void testinout_methodBool( [inout] boolean rOut)"; +arFunctions["testinout_methodShort"]="void testinout_methodShort( [inout] short rOut)"; +arFunctions["testinout_methodUShort"]="void testinout_methodUShort( [inout] unsigned short rOut)"; +arFunctions["testinout_methodLong"]="void testinout_methodLong( [inout] long rOut)"; +arFunctions["testinout_methodULong"]="void testinout_methodULong( [inout] unsigned long rOut)"; +arFunctions["testinout_methodString"]="void testinout_methodString( [inout] string rOut)"; +arFunctions["testinout_methodChar"]="void testinout_methodChar( [inout] char rOut)"; +arFunctions["testinout_methodAny"]="void testinout_methodAny( [inout] any rOut)"; +arFunctions["testinout_methodSequence"]="void testinout_methodSequence( [inout] sequence< long > rOut)"; +arFunctions["testinout_methodSequence2"]="void testinout_methodSequence2( [inout] sequence < sequence< long > > rOut)"; +arFunctions["testinout_methodXInterface"]="void testinout_methodXInterface( [inout] com::sun::star::script::XInvocation rOut)"; +arFunctions["testinout_methodXInterface2"]="void testinout_methodXInterface2( [inout] com::sun::star::uno::XInterface rOut)"; + +arFunctions["in_methodByte"]= "byte in_methodByte( [in] byte rIn )"; +arFunctions["in_methodFloat"]= "float in_methodFloat( [in] float rIn);" +arFunctions["in_methodDouble"]= "double in_methodDouble( [in] double rIn)"; +arFunctions["in_methodBool"]= "boolean in_methodBool( [in] boolean rIn)"; +arFunctions["in_methodShort"]= "short in_methodShort( [in] short rIn)"; +arFunctions["in_methodUShort"]= "unsigned short in_methodUShort( [in] unsigned short rIn)"; +arFunctions["in_methodLong"]= "long in_methodLong( [in] long rIn)"; +arFunctions["in_methodULong"]= "unsigned long in_methodULong( [in] unsigned long rIn)"; +arFunctions["in_methodHyper"]= "hyper in_methodHyper( [in] hyper rIn)"; +arFunctions["in_methodUHyper"]= "unsigned hyper in_methodHyper( [in] unsigned hyper rIn)"; +arFunctions["in_methodString"]= "string in_methodString( [in] string rIn)"; +arFunctions["in_methodChar"]= "char in_methodChar( [in] char rIn)"; +arFunctions["in_methodAny"]= "any in_methodAny ( [in] any rIn)"; +arFunctions["in_methodXInterface"]= "XInterface in_methodXInterface([in] XInterface rIn)"; + + +arFunctions["methodAnyTest1"]="any methodAnyTest1( [in] any rIn)"; +arFunctions["AttrAny2"]= "[attribute] any AttrAny2"; +arFunctions["retMethodStruct"]= "com::sun::star::beans::Property retMethodStruct()"; +arFunctions["AttrStruct"]= "[attribute] com::sun::star::beans::Property AttrStruct"; +arFunctions["methodStruct2"]= "com::sun::star::beans::Property methodStruct2( [in] com::sun::star::beans::Property aProp)"; + + +var factory= new ActiveXObject("com.sun.star.ServiceManager"); +var oletest= factory.createInstance("oletest.OleTest"); + +Log= new Logger(); + + +runJScriptTest(Log); +runVBTest(Log); +Log.summarize(); + + +function Logger() +{ + this.print= logger_print; + this.print2= logger_print2; + this.summarize= logger_summarize; + this.bAllOk= true; +} +function logger_print( bool, method) +{ + this.print2(bool, "Ok " + arFunctions[method] + "<br>", + "Failed " + arFunctions[method] + "<br>"); +} + +function logger_print2( bool, okString, failedString) +{ + if( bool) + document.writeln( okString); + else + { + document.writeln( failedString); + this.bAllOk= this.bAllOk && false; + } +} + +function logger_summarize() +{ + document.writeln("<p> ==============================================================================<br>"); + if(this.bAllOk) + document.writeln("No errors <br>"); + else + document.writeln("Error ! The test failed! <br>"); +} + + +</script> + +</body> +</html> + + diff --git a/extensions/test/ole/StarBasic_OleClient/oleclient.bas b/extensions/test/ole/StarBasic_OleClient/oleclient.bas new file mode 100644 index 000000000..e640d434d --- /dev/null +++ b/extensions/test/ole/StarBasic_OleClient/oleclient.bas @@ -0,0 +1,622 @@ +rem +rem This file is part of the LibreOffice project. +rem +rem This Source Code Form is subject to the terms of the Mozilla Public +rem License, v. 2.0. If a copy of the MPL was not distributed with this +rem file, You can obtain one at http://mozilla.org/MPL/2.0/. +rem +rem This file incorporates work covered by the following license notice: +rem +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed +rem with this work for additional information regarding copyright +rem ownership. The ASF licenses this file to you under the Apache +rem License, Version 2.0 (the "License"); you may not use this file +rem except in compliance with the License. You may obtain a copy of +rem the License at http://www.apache.org/licenses/LICENSE-2.0 . +rem + +OPTION EXPLICIT +OPTION COMPATIBLE + +Sub Main +COMPATIBILITYMODE(true) + +If runtest = -1 Then + MsgBox "Test Failed!!!" +Else + MsgBox "Test Succeeded" +End If + +End Sub + +Function runtest() As Integer +Dim inBool As Boolean, inBool2 As Boolean, outBool As Boolean +Dim inByte As Integer, inByte2 As Integer +Dim inShort As Integer, inShort2 As Integer +Dim inLong As Long, inLong2 As Long, inLong3 As Long, inLong4 As Long +Dim inString As String, inString2 As String +Dim inFloat As Single, inFloat2 As Single +Dim inDouble As Double, inDouble2 As Double +Dim inVariant, inVariant2 +Dim inAr, inAr2 +Dim inDate As Date,inDate2 As Date, outDate As Date +Dim inCurrency As Currency, inCurrency2 As Currency, outCurrency As Currency +Dim inSCode As New com.sun.star.bridge.oleautomation.SCode +Dim inSCode2 As New com.sun.star.bridge.oleautomation.SCode +Dim inDecimal As Variant, inDecimal2 As Variant, outDecimal As Variant +Dim inrefDecimal As Variant, outrefDecimal As Variant +Dim outSCode As New com.sun.star.bridge.oleautomation.SCode +Dim outByte As Integer +Dim outShort As Integer +Dim outLong, outLong2 As Long +Dim outString As String +Dim outFloat As Single +Dim outDouble As Double +Dim outVariant +'bug #109936 causes an errOr when outObject is used As out param +Dim inObject As Object, inObject2 As Object, outObject As Object +Dim objNOTHING As Object +Dim inUnknown As Object, inUnknown2 As Object, outUnknown As Object + +Dim inArray, outArray, outArray2 +Dim len1, len2 +Dim arString(1) As String +arString(0)= "String one" +arString(1)= "String two" + +Dim factory As Object +factory= createUnoService("com.sun.star.bridge.OleObjectFactory") +Dim obj As Object +obj= factory.createInstance("AxTestComponents.Basic") + +Dim objFoo As Object +objFoo = factory.createInstance("AxTestComponents.Foo") + + +'in parameter ------------------------------------------------------------------- +inBool = true +inByte = 10 +inShort = 11 +inLong = 111 +inString = "Hello World" +inFloat = 3.14 +inDouble = 3.145 +inVariant = "bla" +inDate = NOW() +inCurrency = 12345.6789 +inSCode.Value = &h80020004 +inDecimal = CDec("-9223372036854775808") 'lowest int64 + +obj.inBool(inBool) +obj.inByte(inByte) +obj.inShort(inShort) +obj.inLong(inLong) +obj.inString(inString) +obj.inFloat(inFloat) +obj.inDouble(inDouble) +obj.inVariant(inVariant) +'obj.prpString= "a string property" +obj.inObject(obj) +obj.inArray(arString()) +obj.inDate(inDate) +obj.inCurrency(inCurrency) +obj.inSCode(inSCode) +obj.inUnknown(objFoo) +obj.inDecimal(inDecimal) + +'out parameter ------------------------------------------------------------------------- +outBool = false +obj.outBool(outBool) +outByte = 0 +obj.outByte(outByte) +outShort = 0 +obj.outShort(outShort) +outLong = 0 +obj.outLong(outLong) +outFloat = 0 +obj.outFloat(outFloat) +outDouble = 0 +obj.outDouble(outDouble) +outString = "" +obj.outString(outString) +outVariant = 0 +obj.outVariant(outVariant) +outObject = NOTHING +obj.outObject(outObject) +outArray = 0 +obj.outArray(outArray) +obj.outDate(outDate) +obj.outCurrency(outCurrency) +obj.outSCode(outSCode) +obj.outUnknown(outUnknown) +obj.outDecimal(outDecimal) + + +If inBool <> outBool Or inByte <> outByte Or inShort <> outShort Or inLong <> outLong Or _ + inFloat <> outFloat Or inDouble <> outDouble Or inString <> outString Or _ + inVariant <> outVariant Or NOT equalUnoObjects(obj, outObject) Or NOT _ + equalArrays(arString(), outArray()) Or inDate <> outDate Or inCurrency <> outCurrency Or _ + inSCode.Value <> outSCode.Value Or Not equalUnoObjects(objFoo, outUnknown) Or _ + inDecimal <> outDecimal Then + runtest = -1 + exit Function +End If + + +'in-out parameter ------------------------------------------------------------- +'implementation of inout methods returns the previously set value in out param +inBool = true +inBool2 = inBool +obj.inoutBool(inBool2) +outBool = false +obj.inoutBool(outBool) +inByte = 10 +inByte2 = inByte +obj.inoutByte(inByte2) +outByte = 0 +obj.inoutByte(outByte) +inShort = 10 +inShort2 = inShort +obj.inShort(inShort2) +outShort = 0 +obj.inoutShort(outShort) +inLong = 10 +inLong2 = inLong +obj.inoutLong(inLong2) +outLong = 0 +obj.inoutLong(outLong) +inFloat = 3.14 +inFloat2 = inFloat +obj.inoutFloat(inFloat2) +outFloat = 0 +obj.inoutFloat(outFloat) +inDouble= 3.14 +inDouble2 = inDouble +obj.inoutDouble(inDouble2) +outDouble = 0 +obj.inoutDouble(outDouble) +inString = "in" +inString2 = inString +obj.inoutString(inString2) +outString = "" +obj.inoutString(outString) +inVariant = "in" +inVariant2 = inVariant +obj.inoutVariant(inVariant2) +outVariant = 0 +obj.inoutVariant(outVariant) +inObject = factory.createInstance("AxTestComponents.Basic") +inObject2 = inObject +obj.inoutObject(inObject2) +outObject = NOTHING +obj.inoutObject(outObject) +inAr = arString() +inAr2 = inAr +obj.inoutArray(inAr2) +outArray = 0 +obj.outArray(outArray()) +inDate = NOW() +inDate2 = inDate +obj.inoutDate(inDate2) +outDate = 0 +obj.inoutDate(outDate) +inCurrency = 1234.5678 +inCurrency2 = inCurrency +obj.inoutCurrency(inCurrency2) +outCurrency = 0 +obj.inoutCurrency(outCurrency) +inSCode.Value = &h80020004 +inSCode2 = inSCode +obj.inoutSCode(inSCode2) +outSCode.Value = 0 +obj.inoutSCode(outSCode) +inUnknown = objFoo +inUnknown2 = inUnknown +obj.inoutUnknown(inUnknown2) +outUnknown = Nothing +obj.inoutUnknown(outUnknown) +inDecimal = CDec("18446744073709551615") 'highest positive value of unsigned int64 +inDecimal2 = inDecimal +obj.inoutDecimal(inDecimal2) +outDecimal = 0 +obj.inoutDecimal(outDecimal) + +If inBool <> outBool Or inByte <> outByte Or inShort <> outShort Or inLong <> outLong Or _ + inFloat <> outFloat Or inDouble <> outDouble Or inString <> outString Or _ + inVariant <> outVariant Or NOT equalUnoObjects(inObject, outObject) Or _ + NOT equalArrays(inAr, outArray) Or inDate <> outDate Or inCurrency <> outCurrency Or _ + inSCode.Value <> outSCode.Value Or Not equalUnoObjects(inUnknown, outUnknown) Or _ + inDecimal <> outDecimal Then + runtest = -1 + Exit Function +End If + +'properties ------------------------------------------------------------------------- +inBool = false +outBool = true +obj.prpBool = inBool +outBool = obj.prpBool +inByte = 11 +outByte = 0 +obj.prpByte = inByte +outByte= obj.prpByte +inShort = 127 +outShort = 0 +obj.prpShort= inShort +outShort= obj.prpShort +inLong = 1000 +outLong = 0 +obj.prpLong = inLong +outLong= obj.prpLong +inFloat = 3.14 +outFloat = 0 +obj.prpFloat = inFloat +outFloat= obj.prpFloat +inDouble = 3.123 +outDouble = 0 +obj.prpDouble = inDouble +outDouble= obj.prpDouble +inString = "bla" +outString = "" +obj.prpString = inString +outString = obj.prpString +inObject = obj +outObject = objNOTHING +obj.prpObject = inObject +outObject = obj.prpObject +inVariant = "bla" +outVariant = 0 +obj.prpVariant = inVariant +outVariant= obj.prpVariant +inArray = arString() +outArray = 0 +obj.prpArray = inArray() +outArray= obj.prpArray +inDate = NOW() +outDate = 0 +obj.prpDate = inDate +outDate = obj.prpDate +inCurrency = 1234.5678 +outCurrency = 0 +obj.prpCurrency = inCurrency +outCurrency = obj.prpCurrency +inSCode.Value = &h80020004 +outSCode.Value = 0 +obj.prpSCode = inSCode +outSCode = obj.prpSCode +inUnknown = objFoo +outUnknown= Nothing +obj.prpUnknown = inUnknown +outUnknown = obj.prpUnknown +inDecimal = CDec("18446744073709551615")' highest unsigned int64 +outDecimal = 0 +obj.prpDecimal = inDecimal +outDecimal = obj.prpDecimal + +If inBool <> outBool Or inByte <> outByte Or inShort <> outShort Or inLong <> outLong Or _ + inFloat <> outFloat Or inDouble <> outDouble Or inString <> outString Or _ + inVariant <> outVariant Or NOT equalUnoObjects(inObject, outObject) Or _ + NOT equalArrays(inArray, outArray) Or inDate <> outDate Or inCurrency <> outCurrency Or _ + inSCode.Value <> outSCode.Value Or Not equalUnoObjects(inUnknown, outUnknown) Or _ + inDecimal <> outDecimal Then + runtest = -1 + Exit Function +End If + +' ref parameter ------------------------------------------------------------------------ +obj.inLong(0) +inLong = 123 +outLong = 0 +obj.inLong(0) +obj.inrefLong(inLong) +obj.outLong(outLong) +inVariant = "bla" +outVariant = 0 +obj.inVariant(0) +obj.inrefVariant(inVariant) +obj.outVariant(outVariant) +If inLong <> outLong Or inVariant <> outVariant Then + runtest = -1 + Exit Function +End If + +outLong = 0 +obj.prprefLong = inLong +outLong = obj.prprefLong +outVariant = 0 +obj.prprefVariant = inVariant +outVariant = obj.prprefVariant +If inLong <> outLong Or inVariant <> outVariant Then + runtest = -1 + Exit Function +End If + + +'vararg -------------------------------------------------------------------------------- +inLong=1 +inLong2 = 2 +inLong3 = 3 +obj.varargfunc1(inLong) +outArray = 0 +outLong = 0 +obj.varargfunc2(outLong, outArray) +If inLong <> outLong Then + runtest = -1 + Exit Function +End If +len1 = UBound(outArray) - LBound(outArray) +1 +If len1 <> 0 Then + runtest = -1 + Exit Function +End If +outArray = 0 +obj.varargfunc1(inLong, inLong2, inLong3) +obj.varargfunc2(outLong, outArray) +len1 = UBound(outArray) - LBound(outArray) +1 +If len1 <> 2 Or outArray(0) <> inLong2 Or outArray(1) <> inLong3 Then + runtest = -1 + Exit Function +End If + + +'defaultvalue --------------------------------------------------------------------------- +inLong = 0 +inFloat = 0 +inVariant = 0 +inVariant2 = 0 +'defaults are: 1, 2, 4 +'The third parameter is a VARIANT with a default value of 4. COM gives it the type BSTR +obj.defaultvalue1() +obj.defaultvalue2(inLong, inFloat, inVariant) +If inLong <> 1 Or inFloat <> 2 Or inVariant <> "4" Then + runtest = -1 + Exit Function +End If +inLong = 10 +inFloat = 11 +inLong2 = inLong +inFloat2 = inFloat +inVariant = 0 +inVariant = 0 +obj.defaultvalue1(inLong, inFloat) +obj.defaultvalue2(inLong, inFloat, inVariant) +If inLong <> inLong2 Or inFloat <> inFloat2 Or inVariant <> "4" Then + runtest = -1 + Exit Function +End If + +'optional parameters ---------------------------------------------------------------- +inLong = 100 +outLong = 0 +obj.optional1(inLong) +obj.optional2(outLong) +If inLong <> outLong Then + runtest = -1 + Exit Function +End If + +inLong2 = 101 +outLong2 = 0 +obj.optional1(inLong, inLong2) +obj.optional2(outLong, outLong2) +If inLong <> outLong AND inLong2 <> outLong2 Then + runtest = -1 + Exit Function +End If + +inLong2 = 101 +outLong2 = 0 +obj.optional1(inLong, inLong2) +obj.optional1(inLong) +obj.optional2(outLong, outLong2) +If inLong <> outLong AND inLong2 <> outLong2 Then + runtest = -1 + Exit Function +End If + +inLong = 10 +inLong2 = 100 +outLong = 5 +outLong2 = 6 +obj.optional3() +obj.optional3(inLong, inLong2) +obj.optional4(outLong, outLong2) 'outLong = 10, outLong2 = 100 +If inLong <> outLong AND inLong2 <> outLong2 Then + runtest = -1 + Exit Function +End If +inLong = 10 +inLong2 = 100 +inLong3 = inLong +inLong4 = inLong2 +obj.optional4(inLong, inLong) +outLong = 0 +outLong2 = 0 +obj.optional5(outLong, outLong2) +If inLong3 <> outLong AND inLong4 <> outLong2 Then + runtest = -1 + Exit Function +End If + +inLong = 10 +outLong = 5 +obj.optional3(inLong) +obj.optional4(outLong) +If inLong <> outLong Then + runtest = -1 + Exit Function +End If +inLong = 10 +inLong2 = inLong +outLong = 0 +obj.optional4(inLong) +obj.optional5(outLong) +If inLong2 <> outLong Then + runtest = -1 + Exit Function +End If + +'named arguments------------------------------------------------------------------------- +'all args As named args, different order +obj.optional6(0, 0, 0, 0) +inLong = 1 +inLong2 = 2 +inLong3 = 3 +inLong4 = 4 +obj.optional6(val4:= inLong4, val3:=inLong3, val2:=inLong2, val1:= inLong) +Dim outLong3 As Long +Dim outLong4 As Long +outLong = 0 +outLong2 = 0 +outLong3 = 0 +outLong4 = 0 +obj.optional7(outLong, outLong2, outLong3, outLong4) +If inLong <> outLong Or inLong2 <> outLong2 _ + Or inLong3 <> outLong3 Or inLong4 <> outLong4 Then + runtest = -1 + Exit Function +End If + +'mixed positional and named args with omitted args +Dim scode_paramNotFound As New com.sun.star.bridge.oleautomation.SCode +scode_paramNotFound.Value = &h80020004 + +obj.optional6(0, 0, 0, 0) +'val1 and val3 will be DISP_E_PARAMNOTFOUND +obj.optional6(, inLong2, val4:=inLong4) +Dim outSCode1, outSCode2 +obj.optional7(outSCode, outLong2, outSCode2, outLong4) +If outSCode.Value <> scode_paramNotFound.Value Or inLong2 <> outLong2 _ + Or outSCode2.Value <> scode_paramNotFound.Value Or inLong4 <> outLong4 Then + runtest = -1 + Exit Function +End If + +'mixed positional and named args with omitted args as out -args +inLong = 1 +inLong2 = 2 +inLong3 = 3 +inLong4 = 4 +obj.optional6(inLong, inLong2, inLong3, inLong4) +outLong2 = 0 +outLong3 = 0 +obj.optional7(,outLong2, val3:= outLong3) +If inLong2 <> outLong2 Or inLong3 <> outLong3 Then + runtest = -1 + Exit Function +End If + +'test properties with additional arguments ------------------------------------ +inLong = 10 +inLong2 = 20 +inLong3 = 30 +outLong = 0 +outLong2 = 0 +outLong3 = 0 +obj.prpMultiArg1(0,0) = 0 +'obj.prpMultiArg1 = 0 +obj.prpMultiArg1(inLong,inLong2) = inLong3 +outLong3 = obj.prpMultiArg1(outLong, outLong2) +If outLong <> 10 Or outLong2 <> 02 Or outLong3 <> 30 Then + runtest = -1 + Exit Function +End If + +outLong = 0 +outLong2 = 0 +obj.prpMultiArg1(0,0) = 0 +obj.prpMultiArg1(1) = 3 +outLong2 = obj.prpMultiArg1(outLong) +If outLong <> 1 Or outLong2 <> 3 Then + runtest = -1 + Exit Function +End If + +outLong = 0 +outLong2 = 0 +obj.prpMultiArg1(0,0) = 0 +obj.prpMultiArg1(val2:= 1) = 3 +outLong2 = obj.prpMultiArg1(val2:=outLong) +If outLong <> 1 Or outLong2 <> 3 Then + runtest = -1 + Exit Function +End If + +outLong = -1 +outLong2 = -1 +obj.prpMultiArg2(0) = 0 +outLong = obj.prpMultiArg2GetValues(outLong, outLong2) +If outLong <> 0 Or outLong2 <> 0 Then + runtest = -1 + Exit Function +End If + + +outLong = 0 +outLong2 = 0 +obj.prpMultiArg2(1) = 2 +obj.prpMultiArg2GetValues(outLong, outLong2) +If outLong <> 1 Or outLong2 <> 2 Then + runtest = -1 + Exit Function +End If + + + +' other tests ------------------------------------------------------------------ +obj.inObject(NOTHING) +outObject = NOTHING +'bridge should return an XInterface any with null pointer +'A basic errOr should occur if this is not the case +obj.outObject(outObject) + +If Not IsNull(outObject) Then + runtest = -1 + Exit Function +End If +'Decimal passed by reference +inrefDecimal = CDec("9223372036854775807") 'highest positive value of int64 +obj.inrefDecimal(inrefDecimal) +outrefDecimal = 0 +obj.outDecimal(outrefDecimal) +If inrefDecimal <> outrefDecimal Then + runtest = -1 + Exit Function +End If + +' Test Automation object with dual interfaces ------------------------------------ +dim dispatcher as object +dim oExplorer as object +dispatcher = createUnoService("com.sun.star.bridge.OleObjectFactory") +oExplorer = dispatcher.createInstance("InternetExplorer.Application") +If Not IsNull(oExplorer) Then + oExplorer.visible = true + oExplorer.Navigate2("http://www.openoffice.org") +Else + MsgBox("Could not perform test with Internet Explorer!") +End If + + +End Function + +'One dimensional arrays with simple types. +'lower bound must be 0 +Function equalArrays(ar1, ar2) +Dim len1 +Dim len2 +len1 = UBound(ar1) - LBound(ar1) + 1 +len2 = UBound(ar2) - LBound(ar2) + 1 +If len1 <> len2 Then + equalArrays = false + Exit Function +End If +Dim counter +FOr counter = 0 To len1 - 1 + If ar1(counter) <> ar2(counter) Then + equalArrays = false + Exit Function + End If +Next +equalArrays = true +End Function diff --git a/extensions/test/ole/StarBasic_OleClient/readme.txt b/extensions/test/ole/StarBasic_OleClient/readme.txt new file mode 100644 index 000000000..d3ee22237 --- /dev/null +++ b/extensions/test/ole/StarBasic_OleClient/readme.txt @@ -0,0 +1,10 @@ +oleclient.bas is a StarBasic script that uses the
+"com.sun.star.bridge.OleObjectFactory" service to instantiate
+the ActiveX component "AxTestComponents.Basic" and calls
+functions on it.
+
+------------------------------------------------------------
+Requirements:
+
+ActiveX component: AxTestComponent.Basic must be registered.
+It is contained in extensions/test/ole/AxTestComponents
diff --git a/extensions/test/ole/VisualBasic/AssemblyInfo.vb b/extensions/test/ole/VisualBasic/AssemblyInfo.vb new file mode 100644 index 000000000..c4b1d4ff5 --- /dev/null +++ b/extensions/test/ole/VisualBasic/AssemblyInfo.vb @@ -0,0 +1,51 @@ +'
+' 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 .
+'
+
+Imports System.Reflection
+Imports System.Runtime.CompilerServices
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+
+' TODO: Review the values of the assembly attributes
+
+
+<Assembly: AssemblyTitle("")>
+<Assembly: AssemblyDescription("")>
+<Assembly: AssemblyCompany("StarOffice")>
+<Assembly: AssemblyProduct("")>
+<Assembly: AssemblyCopyright("")>
+<Assembly: AssemblyTrademark("")>
+<Assembly: AssemblyCulture("")>
+
+' Version information for an assembly consists of the following four values:
+
+' Major version
+' Minor Version
+' Build Number
+' Revision
+
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+
+<Assembly: AssemblyVersion("1.0.*")>
+
+
diff --git a/extensions/test/ole/VisualBasic/Module1.vb b/extensions/test/ole/VisualBasic/Module1.vb new file mode 100644 index 000000000..63b8bbdeb --- /dev/null +++ b/extensions/test/ole/VisualBasic/Module1.vb @@ -0,0 +1,871 @@ +'
+' 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 .
+'
+
+Option Strict Off
+Option Explicit On
+Module Module1
+
+Private objServiceManager As Object
+Private objCoreReflection As Object
+Private objOleTest As Object
+Private objEventListener As Object
+'General counter
+Dim i As Integer
+Dim j As Integer
+Dim sError As String
+Dim outHyper, inHyper, retHyper As Object
+
+Public Sub Main()
+ objServiceManager = CreateObject("com.sun.star.ServiceManager")
+ objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
+ ' extensions/test/ole/cpnt
+ objOleTest = objServiceManager.createInstance("oletest.OleTest")
+ ' extensions/test/ole/EventListenerSample/VBEventListener
+ objEventListener = CreateObject("VBasicEventListener.VBEventListener")
+ Debug.Print(TypeName(objOleTest))
+
+
+ testBasics()
+ testHyper()
+ testAny()
+ testObjects()
+ testGetStruct()
+ ''dispose not working i103353
+ 'testImplementedInterfaces()
+ testGetValueObject()
+ testArrays()
+ testProps()
+
+ End Sub
+ Function testProps() As Object
+
+ Dim aToolbarItemProp1 As Object
+ aToolbarItemProp1 = objOleTest.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+ Dim aToolbarItemProp2 As Object
+ aToolbarItemProp2 = objOleTest.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+ Dim aToolbarItemProp3 As Object
+ aToolbarItemProp3 = objOleTest.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+ Dim properties(2) As Object
+
+ aToolbarItemProp1.Name = "CommandURL"
+ aToolbarItemProp1.Value = "macro:///standard.module1.TestIt"
+ aToolbarItemProp2.Name = "Label"
+ aToolbarItemProp2.Value = "Test"
+ aToolbarItemProp3.Name = "Type"
+ aToolbarItemProp3.Value = 0
+
+ properties(0) = aToolbarItemProp1
+ properties(1) = aToolbarItemProp2
+ properties(2) = aToolbarItemProp3
+
+
+ Dim dummy(-1) As Object
+
+ Dim Desktop As Object
+ Desktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
+ Dim Doc As Object
+ Doc = Desktop.loadComponentFromURL("private:factory/swriter", "_blank", 2, dummy)
+ Dim LayoutManager As Object
+ LayoutManager = Doc.currentController.Frame.LayoutManager
+
+ LayoutManager.createElement("private:resource/toolbar/user_toolbar1")
+ LayoutManager.showElement("private:resource/toolbar/user_toolbar1")
+ Dim ToolBar As Object
+ ToolBar = LayoutManager.getElement("private:resource/toolbar/user_toolbar1")
+ Dim settings As Object
+ settings = ToolBar.getSettings(True)
+
+ 'the changes are here:
+ Dim aany As Object
+ aany = objServiceManager.Bridge_GetValueObject()
+ Call aany.Set("[]com.sun.star.beans.PropertyValue", properties)
+ Call settings.insertByIndex(0, aany)
+ Call ToolBar.setSettings(settings)
+
+
+ End Function
+
+
+ Function testBasics() As Object
+ ' In Parameter, simple types
+ '============================================
+ Dim tmpVar As Object
+ Dim ret As Object
+ Dim outByte, inByte, retByte As Byte
+ Dim outBool, inBool, retBool As Boolean
+ Dim outShort, inShort, retShort As Short
+ Dim outUShort, inUShort, retUShort As Short
+ Dim outLong, inLong, retLong As Integer
+ Dim outULong, inULong, retULong As Integer
+ Dim outHyper, inHyper, retHyper As Object
+ Dim outUHyper, inUHyper, retUHyper As Object
+ Dim outFloat, inFloat, retFloat As Single
+ Dim outDouble, inDouble, retDouble As Double
+ Dim outString, inString, retString As String
+ Dim retChar, inChar, outChar, retChar2 As Short
+ Dim outCharAsString, inCharAsString, retCharAsString As String
+ Dim outAny, inAny, retAny As Object
+ Dim outType, inType, retType As Object
+ Dim outXInterface, inXInterface, retXInterface As Object
+ Dim outXInterface2, inXInterface2, retXInterface2 As Object
+
+
+ Dim outVarByte As Object
+ Dim outVarBool As Object
+ Dim outVarShort As Object
+ Dim outVarUShort As Object
+ Dim outVarLong As Object
+ Dim outVarULong As Object
+ Dim outVarFloat As Object
+ Dim outVarDouble As Object
+ Dim outVarString As Object
+ Dim outVarChar As Object
+ Dim outVarAny As Object
+ Dim outVarType As Object
+
+ inByte = 10
+ inBool = True
+ inShort = -10
+ inUShort = -100
+ inLong = -1000
+ inHyper = CDec("-9223372036854775808") 'lowest int64
+ inUHyper = CDec("18446744073709551615") ' highest unsigned int64
+ inULong = 10000
+ inFloat = 3.14
+ inDouble = 3.14
+ inString = "Hello World!"
+ inChar = 65
+ inCharAsString = "A"
+ inAny = "Hello World"
+ inType = objServiceManager.Bridge_CreateType("[]long")
+ inXInterface = objCoreReflection
+ inXInterface2 = objEventListener
+
+ retByte = objOleTest.in_methodByte(inByte)
+ retBool = objOleTest.in_methodBool(inBool)
+ retShort = objOleTest.in_methodShort(inShort)
+ retUShort = objOleTest.in_methodUShort(inUShort)
+ retLong = objOleTest.in_methodLong(inLong)
+ retULong = objOleTest.in_methodULong(inULong)
+ retHyper = objOleTest.in_methodHyper(inHyper)
+ retUHyper = objOleTest.in_methodUHyper(inUHyper)
+ retFloat = objOleTest.in_methodFloat(inFloat)
+ retDouble = objOleTest.in_methodDouble(inDouble)
+ retString = objOleTest.in_methodString(inString)
+ retChar = objOleTest.in_methodChar(inChar)
+ retChar2 = objOleTest.in_methodChar(inCharAsString)
+ retAny = objOleTest.in_methodAny(inAny)
+ retType = objOleTest.in_methodType(inType)
+ retXInterface = objOleTest.in_methodXInterface(inXInterface) ' UNO object
+ retXInterface2 = objOleTest.in_methodXInterface(inXInterface2)
+
+ If retByte <> inByte Or retBool <> inBool Or retShort <> inShort Or retUShort <> inUShort _
+ Or retLong <> inLong Or retULong <> inULong Or retHyper <> inHyper _
+ Or retUHyper <> inUHyper Or retFloat <> inFloat Or retDouble <> inDouble _
+ Or retString <> inString Or retChar <> inChar Or retChar2 <> Asc(inCharAsString) _
+ Or retAny <> inAny Or Not (retType.Name = inType.Name) _
+ Or inXInterface IsNot retXInterface Or inXInterface2 IsNot retXInterface2 Then
+ sError = "in - parameter and return value test failed"
+ MsgBox(sError)
+
+ End If
+
+ 'Out Parameter simple types
+ '================================================
+
+
+ objOleTest.testout_methodByte(outByte)
+ objOleTest.testout_methodFloat(outFloat)
+ objOleTest.testout_methodDouble(outDouble)
+ objOleTest.testout_methodBool(outBool)
+ objOleTest.testout_methodShort(outShort)
+ objOleTest.testout_methodUShort(outUShort)
+ objOleTest.testout_methodLong(outLong)
+ objOleTest.testout_methodULong(outULong)
+ objOleTest.testout_methodHyper(outHyper)
+ objOleTest.testout_methodUHyper(outUHyper)
+ objOleTest.testout_methodString(outString)
+ objOleTest.testout_methodChar(outChar)
+ 'outCharAsString is a string. Therefore the returned sal_Unicode value of 65 will be converted
+ 'to a string "65"
+ objOleTest.testout_methodChar(outCharAsString)
+ objOleTest.testout_methodAny(outAny)
+ objOleTest.testout_methodType(outType)
+ 'objOleTest.in_methodXInterface (inXInterface) ' UNO object
+ Call objOleTest.in_methodXInterface(inXInterface) ' UNO object
+ objOleTest.testout_methodXInterface(outXInterface)
+ Call objOleTest.in_methodXInterface(inXInterface2) ' COM object
+ objOleTest.testout_methodXInterface(outXInterface2)
+
+ If outByte <> inByte Or outFloat <> inFloat Or outDouble <> inDouble _
+ Or outBool <> inBool Or outShort <> inShort Or outUShort <> inUShort _
+ Or outLong <> inLong Or outULong <> inULong Or outHyper <> inHyper _
+ Or outUHyper <> inUHyper Or outString <> inString Or outChar <> inChar _
+ Or Not (outCharAsString = "65") Or outAny <> inAny _
+ Or Not (outType.Name = inType.Name) Or inXInterface IsNot outXInterface _
+ Or inXInterface2 IsNot outXInterface2 Then
+
+ sError = "out - parameter test failed!"
+ MsgBox(sError)
+ End If
+
+ 'Out Parameter simple types (VARIANT var)
+ '====================================================
+ objOleTest.testout_methodByte(outVarByte)
+ objOleTest.testout_methodBool(outVarBool)
+ objOleTest.testout_methodChar(outVarChar)
+ objOleTest.testout_methodShort(outVarShort)
+ objOleTest.testout_methodUShort(outVarUShort)
+ objOleTest.testout_methodLong(outVarLong)
+ objOleTest.testout_methodULong(outVarULong)
+ objOleTest.testout_methodString(outVarString)
+ objOleTest.testout_methodFloat(outVarFloat)
+ objOleTest.testout_methodDouble(outVarDouble)
+ objOleTest.testout_methodAny(outVarAny)
+ objOleTest.testout_methodType(outVarType)
+
+ If outVarByte <> inByte Or outVarBool <> inBool Or outVarChar <> inChar _
+ Or outVarShort <> inShort Or outVarUShort <> inUShort _
+ Or outVarLong <> inLong Or outVarULong <> inULong Or outVarString <> inString _
+ Or outVarFloat <> inFloat Or outVarDouble <> inDouble Or outVarAny <> inAny _
+ Or Not (outVarType.Name = inType.Name) Then
+ sError = "out - parameter (VARIANT) test failed!"
+ MsgBox(sError)
+ End If
+
+ 'In/Out simple types
+ '============================================
+ objOleTest.in_methodByte(0)
+ objOleTest.in_methodBool(False)
+ objOleTest.in_methodShort(0)
+ objOleTest.in_methodUShort(0)
+ objOleTest.in_methodLong(0)
+ objOleTest.in_methodULong(0)
+ objOleTest.in_methodHyper(0)
+ objOleTest.in_methodUHyper(0)
+ objOleTest.in_methodFloat(0)
+ objOleTest.in_methodDouble(0)
+ objOleTest.in_methodString(0)
+ objOleTest.in_methodChar(0)
+ objOleTest.in_methodAny(0)
+ objOleTest.in_methodType(objServiceManager.Bridge_CreateType("boolean"))
+ outXInterface = Nothing
+ Call objOleTest.in_methodXInterface(outXInterface)
+
+ outByte = 10
+ retByte = outByte
+ objOleTest.testinout_methodByte(retByte)
+ objOleTest.testinout_methodByte(retByte)
+ outBool = True
+ retBool = outBool
+ objOleTest.testinout_methodBool(retBool)
+ objOleTest.testinout_methodBool(retBool)
+ outShort = 10
+ retShort = outShort
+ objOleTest.testinout_methodShort(retShort)
+ objOleTest.testinout_methodShort(retShort)
+ outUShort = 20
+ retUShort = outUShort
+ objOleTest.testinout_methodUShort(retUShort)
+ objOleTest.testinout_methodUShort(retUShort)
+ outLong = 30
+ retLong = outLong
+ objOleTest.testinout_methodLong(retLong)
+ objOleTest.testinout_methodLong(retLong)
+ outULong = 40
+ retULong = outULong
+ objOleTest.testinout_methodULong(retLong)
+ objOleTest.testinout_methodULong(retLong)
+ outHyper = CDec("9223372036854775807") 'highest positive value of int64
+ retHyper = outHyper
+ objOleTest.testinout_methodHyper(retHyper)
+ objOleTest.testinout_methodHyper(retHyper)
+ outUHyper = CDec("18446744073709551615") 'highest value of unsigned int64
+ retUHyper = outUHyper
+ objOleTest.testinout_methodUHyper(retUHyper)
+ objOleTest.testinout_methodUHyper(retUHyper)
+ outFloat = 3.14
+ retFloat = outFloat
+ objOleTest.testinout_methodFloat(retFloat)
+ objOleTest.testinout_methodFloat(retFloat)
+ outDouble = 4.14
+ retDouble = outDouble
+ objOleTest.testinout_methodDouble(retDouble)
+ objOleTest.testinout_methodDouble(retDouble)
+ outString = "Hello World!"
+ retString = outString
+ objOleTest.testinout_methodString(retString)
+ objOleTest.testinout_methodString(retString)
+ outChar = 66
+ retChar = outChar
+ objOleTest.testinout_methodChar(retChar)
+ objOleTest.testinout_methodChar(retChar)
+ outCharAsString = "H"
+ retCharAsString = outCharAsString
+ objOleTest.testinout_methodChar(retCharAsString)
+ objOleTest.testinout_methodChar(retCharAsString)
+ outAny = "Hello World 2!"
+ retAny = outAny
+ objOleTest.testinout_methodAny(retAny)
+ objOleTest.testinout_methodAny(retAny)
+ outType = objServiceManager.Bridge_CreateType("long")
+ retType = outType
+ objOleTest.testinout_methodType(retType)
+ objOleTest.testinout_methodType(retType)
+
+ outXInterface = objCoreReflection
+ retXInterface = outXInterface
+ objOleTest.testinout_methodXInterface2(retXInterface)
+
+ If outByte <> retByte Or outBool <> retBool Or outShort <> retShort _
+ Or outUShort <> retUShort Or outLong <> retLong Or outULong <> retULong _
+ Or outHyper <> retHyper Or outUHyper <> outUHyper _
+ Or outFloat <> retFloat Or outDouble <> retDouble _
+ Or outString <> retString Or outChar <> retChar _
+ Or outCharAsString <> retCharAsString _
+ Or outAny <> retAny Or Not (outType.Name = retType.Name) _
+ Or outXInterface IsNot retXInterface Then
+ sError = "in/out - parameter test failed!"
+ MsgBox(sError)
+ End If
+
+ 'Attributes
+ objOleTest.AByte = inByte
+ retByte = 0
+ retByte = objOleTest.AByte
+ objOleTest.AFloat = inFloat
+ retFloat = 0
+ retFloat = objOleTest.AFloat
+ objOleTest.AType = inType
+ retType = Nothing
+
+ retType = objOleTest.AType
+
+ If inByte <> retByte Or inFloat <> retFloat Or Not (inType.Name = retType.Name) Then
+ sError = "Attributes - test failed!"
+ MsgBox(sError)
+ End If
+
+ End Function
+ Function testHyper() As Object
+
+ '======================================================================
+ ' Other Hyper tests
+ Dim emptyVar As Object
+ Dim retAny As Object
+
+ retAny = emptyVar
+ inHyper = CDec("9223372036854775807") 'highest positive value of int64
+ retAny = objOleTest.in_methodAny(inHyper)
+ sError = "hyper test failed"
+ If inHyper <> retAny Then
+ MsgBox(sError)
+ End If
+ inHyper = CDec("-9223372036854775808") 'lowest negative value of int64
+ retAny = objOleTest.in_methodAny(inHyper)
+
+ If inHyper <> retAny Then
+ MsgBox(sError)
+ End If
+ inHyper = CDec("18446744073709551615") 'highest positive value of unsigned int64
+ retAny = objOleTest.in_methodAny(inHyper)
+
+ If inHyper <> retAny Then
+ MsgBox(sError)
+ End If
+ inHyper = CDec(-1)
+ retAny = objOleTest.in_methodAny(inHyper)
+ If inHyper <> retAny Then
+ MsgBox(sError)
+ End If
+ inHyper = CDec(0)
+ retAny = objOleTest.in_methodAny(inHyper)
+ If inHyper <> retAny Then
+ MsgBox(sError)
+ End If
+
+ '==============================================================================
+
+
+ End Function
+ Function testAny() As Object
+ Dim outVAr As Object
+
+ 'Any test. We pass in an any as value object. If it is not correct converted
+ 'then the target component throws a RuntimeException
+ Dim lengthInAny As Integer
+
+ lengthInAny = 10
+ Dim seqLongInAny(10) As Integer
+ For i = 0 To lengthInAny - 1
+ seqLongInAny(i) = i + 10
+ Next
+ Dim anySeqLong As Object
+ anySeqLong = objOleTest.Bridge_GetValueObject()
+ anySeqLong.Set("[]long", seqLongInAny)
+ Dim anySeqRet As Object
+ Err.Clear()
+ On Error Resume Next
+ anySeqRet = objOleTest.other_methodAny(anySeqLong, "[]long")
+
+ If Err.Number <> 0 Then
+ MsgBox("error")
+ End If
+ End Function
+
+ Function testObjects() As Object
+ ' COM obj
+ Dim outVAr As Object
+ Dim retObj As Object
+ 'OleTest receives a COM object that implements XEventListener
+ 'OleTest then calls a disposing on the object. The object then will be
+ 'asked if it has been called
+ objEventListener.setQuiet(True)
+ objEventListener.resetDisposing()
+ retObj = objOleTest.in_methodInvocation(objEventListener)
+ Dim ret As Object
+ ret = objEventListener.disposingCalled
+ If ret = False Then
+ MsgBox("Error")
+ End If
+
+ 'The returned object should be objEventListener, test it by calling disposing
+ ' takes an IDispatch as Param ( EventObject).To provide a TypeMismatch
+ 'we put in another IDispatch
+ retObj.resetDisposing()
+ retObj.disposing(objEventListener)
+ If retObj.disposingCalled = False Then
+ MsgBox("Error")
+ End If
+
+ ' out param gives out the OleTestComponent
+ 'objOleTest.testout_methodXInterface retObj
+ 'outVAr = Null
+ 'retObj.testout_methodAny outVAr
+ 'Debug.Print "test out Interface " & CStr(outVAr)
+ 'If outVAr <> "I am a string in an any" Then
+ ' MsgBox "error"
+ 'End If
+
+
+ 'in out
+ ' in: UNO object, the same is expected as out param
+ ' the function expects OleTest as parameter and sets a value
+
+ Dim myAny As Object
+
+
+
+ Dim objOleTest2 As Object
+ objOleTest2 = objServiceManager.createInstance("oletest.OleTest")
+ 'Set a value
+ objOleTest2.AttrAny2 = "VBString "
+
+ 'testinout_methodXInterfaces substitutes the argument with the object set in in_methodXInterface
+ objOleTest.AttrAny2 = "VBString this string was written in the UNO component to the inout pararmeter"
+ objOleTest.in_methodXInterface(objOleTest)
+ objOleTest.testinout_methodXInterface2(objOleTest2)
+ Dim tmpVar As Object
+ tmpVar = System.DBNull.Value
+ tmpVar = objOleTest2.AttrAny2
+ Debug.Print("in: Uno out: the same object // " & CStr(tmpVar))
+ If tmpVar <> "VBString this string was written in the UNO component to the inout pararmeter" Then
+ MsgBox("error")
+ End If
+
+
+ 'create a struct
+ Dim structClass As Object
+ structClass = objCoreReflection.forName("oletest.SimpleStruct")
+ Dim structInstance As Object
+ structClass.CreateObject(structInstance)
+ structInstance.message = "Now we are in VB"
+ Debug.Print("struct out " & structInstance.message)
+ If structInstance.message <> "Now we are in VB" Then
+ MsgBox("error")
+ End If
+
+ 'put the struct into OleTest. The same struct will be returned with an added String
+ Dim structRet As Object
+ structRet = objOleTest.in_methodStruct(structInstance)
+ Debug.Print("struct in - return " & structRet.message)
+ If structRet.message <> "Now we are in VBThis string was set in OleTest" Then
+ MsgBox("error")
+ End If
+
+
+ End Function
+ Function testGetStruct() As Object
+ 'Bridge_GetStruct
+ '========================================================
+ Dim objDocument As Object
+ objDocument = createHiddenDocument()
+ 'dispose not working i103353
+ 'objDocument.dispose()
+ objDocument.close(True)
+ End Function
+
+ Function testImplementedInterfaces() As Object
+ 'Bridge_ImplementedInterfaces
+ '=================================================
+ ' call a UNO function that takes an XEventListener interface
+ 'We provide a COM implementation (IDispatch) as EventListener
+ 'Open a new empty writer document
+
+ Dim objDocument As Object
+ objDocument = createHiddenDocument()
+ objEventListener.resetDisposing()
+ objDocument.addEventListener(objEventListener)
+ objDocument.dispose()
+ If objEventListener.disposingCalled = False Then
+ MsgBox("Error")
+ End If
+ End Function
+
+ Function testGetValueObject() As Object
+ 'Bridge_GetValueObject
+ '==================================================
+ Dim objVal As Object
+ objVal = objOleTest.Bridge_GetValueObject()
+ Dim arrByte(9) As Byte
+ Dim countvar As Integer
+ For countvar = 0 To 9
+ arrByte(countvar) = countvar
+ Next countvar
+
+ objVal.Set("[]byte", arrByte)
+ Dim ret As Object
+ ret = 0
+ ret = objOleTest.methodByte(objVal)
+ 'Test if ret is the same array
+
+ Dim key As Object
+ key = 0
+ For Each key In ret
+ If ret(key) <> arrByte(key) Then
+ MsgBox("Error")
+ End If
+ Debug.Print(ret(key))
+ Next key
+
+ Dim outByte As Byte
+ outByte = 77
+ Dim retByte As Byte
+ retByte = outByte
+ objVal.InitInOutParam("byte", retByte)
+ objOleTest.testinout_methodByte(objVal)
+ objVal.InitInOutParam("byte", retByte)
+ objOleTest.testinout_methodByte(objVal)
+
+ ret = 0
+ ret = objVal.Get()
+ Debug.Print(ret)
+ If ret <> outByte Then
+ MsgBox("error")
+ End If
+
+ objVal.InitOutParam()
+ Dim inChar As Short
+ inChar = 65
+ objOleTest.in_methodChar(inChar)
+ objOleTest.testout_methodChar(objVal) 'Returns 'A' (65)
+ ret = 0
+ ret = objVal.Get()
+ Debug.Print(ret)
+ If ret <> inChar Then
+ MsgBox("error")
+ End If
+
+ End Function
+
+ Function testArrays() As Object
+ 'Arrays
+ '========================================
+ Dim arrLong(2) As Integer
+ Dim arrObj(2) As Object
+ Dim countvar As Integer
+ For countvar = 0 To 2
+ arrLong(countvar) = countvar + 10
+ Debug.Print(countvar)
+ arrObj(countvar) = CreateObject("VBasicEventListener.VBEventListener")
+ arrObj(countvar).setQuiet(True)
+ Next
+
+ 'Arrays always contain VARIANTS
+ Dim seq() As Object
+ seq = objOleTest.methodLong(arrLong)
+
+ For countvar = 0 To 2
+ Debug.Print(CStr(seq(countvar)))
+ If arrLong(countvar) <> seq(countvar) Then
+ MsgBox("error")
+ End If
+ Next
+ seq = objOleTest.methodXInterface(arrObj)
+ Dim tmp As Object
+ For countvar = 0 To 2
+ seq(countvar).resetDisposing()
+ seq(countvar).disposing(CObj(tmp))
+ If seq(countvar).disposingCalled = False Then
+ MsgBox("Error")
+ End If
+ Next
+
+ 'Array containing interfaces (element type is VT_DISPATCH)
+ Dim arEventListener(2) As Object
+ For countvar = 0 To 2
+ arEventListener(countvar) = CreateObject("VBasicEventListener.VBEventListener")
+ arEventListener(countvar).setQuiet(True)
+ Next
+
+ 'The function calls disposing on the listeners
+ seq = objOleTest.methodXEventListeners(arEventListener)
+ Dim count As Object
+ For countvar = 0 To 2
+ If arEventListener(countvar).disposingCalled = False Then
+ MsgBox("Error")
+ End If
+ Next
+ 'Array containing interfaces (element type is VT_VARIANT which contains VT_DISPATCH
+ Dim arEventListener2(2) As Object
+ For countvar = 0 To 2
+ arEventListener2(countvar) = CreateObject("VBasicEventListener.VBEventListener")
+ arEventListener2(countvar).setQuiet(True)
+ Next
+ seq = objOleTest.methodXEventListeners(arEventListener2)
+ For countvar = 0 To 2
+ If arEventListener2(countvar).disposingCalled = False Then
+ MsgBox("Error")
+ End If
+ Next
+
+ 'Variant containing Array containing interfaces (element type is VT_VARIANT which contains VT_DISPATCH
+ Dim arEventListener3(2) As Object
+ Dim var As Object
+ For countvar = 0 To 2
+ arEventListener3(countvar) = CreateObject("VBasicEventListener.VBEventListener")
+ arEventListener3(countvar).setQuiet(True)
+ Next
+ Dim varContAr As Object
+ varContAr = VB6.CopyArray(arEventListener3)
+ seq = objOleTest.methodXEventListeners(varContAr)
+ For countvar = 0 To 2
+ If arEventListener3(countvar).disposingCalled = False Then
+ MsgBox("Error")
+ End If
+ Next
+
+ 'Get a sequence created in UNO, out param is Variant ( VT_BYREF|VT_VARIANT)
+ Dim seqX As Object
+
+ objOleTest.testout_methodSequence(seqX)
+ Dim key As Object
+ For Each key In seqX
+ Debug.Print(CStr(seqX(key)))
+ If seqX(key) <> key Then
+ MsgBox("error")
+ End If
+ Next key
+ 'Get a sequence created in UNO, out param is array Variant ( VT_BYREF|VT_VARIANT|VT_ARRAY)
+ Dim seqX2() As Object
+ objOleTest.testout_methodSequence(seqX2)
+
+ For Each key In seqX2
+ Debug.Print(CStr(seqX2(key)))
+ Next key
+
+ 'pass it to UNO and get it back
+ Dim seq7() As Object
+ seq7 = objOleTest.methodLong(seqX)
+ Dim key2 As Object
+ For Each key2 In seq7
+ Debug.Print(CStr(seq7(key2)))
+ If seqX2(key) <> key Then
+ MsgBox("error")
+ End If
+ Next key2
+
+ 'array with starting index != 0
+ Dim seqIndex(2) As Integer
+ Dim seq8() As Object
+ Dim longVal1, longVal2 As Integer
+ longVal1 = 1
+ longVal2 = 2
+ seqIndex(1) = longVal1
+ seqIndex(2) = longVal2
+ 'The bridge returns a Safearray of Variants. It does not yet convert to an _
+ 'array of a particular type!
+ 'Comparing of elements from seq8 (Object) with long values worked without _
+ 'explicit cast as is necessary in VS 2008. Also arrays in VS 2008 start at _
+ 'index 0
+ seq8 = objOleTest.methodLong(seqIndex)
+ If longVal1 <> CInt(seq8(1)) And longVal2 <> CInt(seq8(2)) Then
+ MsgBox("error")
+ End If
+
+ 'in out Array
+ ' arrLong is Long Array
+ Dim inoutVar(2) As Object
+
+ For countvar = 0 To 2
+ inoutVar(countvar) = countvar + 10
+ Next
+
+ objOleTest.testinout_methodSequence(inoutVar)
+
+ countvar = 0
+ For countvar = 0 To 2
+ Debug.Print(CStr(inoutVar(countvar)))
+ If inoutVar(countvar) <> countvar + 11 Then
+ MsgBox("error")
+ End If
+ Next
+
+ 'Multidimensional array
+ '============================================================
+ ' Sequence< Sequence<long> > methodSequence( Sequence< Sequence long> >)
+ ' Real multidimensional array Array
+ ' 9 is Dim 1 (least significant) with C API
+ Dim mulAr(9, 1) As Integer
+ For i = 0 To 1
+ For j = 0 To 9
+ mulAr(j, i) = i * 10 + j
+ Next j
+ Next i
+
+ Dim resMul As Object
+ resMul = objOleTest.methodSequence(mulAr)
+
+ Dim countDim1 As Integer
+ Dim countDim2 As Integer
+ Dim arr As Object
+ For countDim2 = 0 To 1
+ arr = resMul(countDim2)
+ For countDim1 = 0 To 9
+ Debug.Print(arr(countDim1))
+ If arr(countDim1) <> mulAr(countDim1, countDim2) Then
+ MsgBox("Error Multidimensional Array")
+ End If
+ Next countDim1
+ Next countDim2
+ IsArray(resMul)
+
+ 'Array of VARIANTs containing arrays
+ Dim mulAr2(1) As Object
+ Dim arr2(9) As Integer
+ For i = 0 To 1
+ ' Dim arr(9) As Long
+ For j = 0 To 9
+ arr2(j) = i * 10 + j
+ Next j
+ mulAr2(i) = VB6.CopyArray(arr2)
+ Next i
+
+ resMul = 0
+ resMul = objOleTest.methodSequence(mulAr2)
+ arr = 0
+ Dim tmpVar As Object
+ For countDim2 = 0 To 1
+ arr = resMul(countDim2)
+ tmpVar = mulAr2(countDim2)
+ For countDim1 = 0 To 9
+ Debug.Print(arr(countDim1))
+ If arr(countDim1) <> tmpVar(countDim1) Then
+ MsgBox("Error Multidimensional Array")
+ End If
+ Next countDim1
+ Next countDim2
+
+ 'Array containing interfaces (element type is VT_DISPATCH)
+ Dim arArEventListener(1, 2) As Object
+ For i = 0 To 1
+ For j = 0 To 2
+ arArEventListener(i, j) = CreateObject("VBasicEventListener.VBEventListener")
+ arArEventListener(i, j).setQuiet(True)
+ Next
+ Next
+ 'The function calls disposing on the listeners
+ seq = objOleTest.methodXEventListenersMul(arArEventListener)
+ For i = 0 To 1
+ For j = 0 To 2
+ If arArEventListener(i, j).disposingCalled = False Then
+ MsgBox("Error")
+ End If
+ Next
+ Next
+
+ 'Array containing interfaces (element type is VT_VARIANT containing VT_DISPATCH)
+ Dim arArEventListener2(1, 2) As Object
+ For i = 0 To 1
+ For j = 0 To 2
+ arArEventListener2(i, j) = CreateObject("VBasicEventListener.VBEventListener")
+ arArEventListener2(i, j).setQuiet(True)
+ Next
+ Next
+ 'The function calls disposing on the listeners
+ seq = objOleTest.methodXEventListenersMul(arArEventListener2)
+ For i = 0 To 1
+ For j = 0 To 2
+ If arArEventListener2(i, j).disposingCalled = False Then
+ MsgBox("Error")
+ End If
+ Next
+ Next
+
+ ' SAFEARRAY of VARIANTS containing SAFEARRAYs
+ 'The ultimate element type is VT_DISPATCH ( XEventListener)
+ Dim arEventListener4(1) As Object
+ Dim seq1(2) As Object
+ Dim seq2(2) As Object
+ For i = 0 To 2
+ seq1(i) = CreateObject("VBasicEventListener.VBEventListener")
+ seq2(i) = CreateObject("VBasicEventListener.VBEventListener")
+ seq1(i).setQuiet(True)
+ seq2(i).setQuiet(True)
+ Next
+ arEventListener4(0) = VB6.CopyArray(seq1)
+ arEventListener4(1) = VB6.CopyArray(seq2)
+ 'The function calls disposing on the listeners
+ seq = objOleTest.methodXEventListenersMul(arEventListener4)
+ For i = 0 To 2
+ If seq1(i).disposingCalled = False Or seq2(i).disposingCalled = False Then
+ MsgBox("Error")
+ End If
+ Next
+
+ End Function
+
+ Function createHiddenDocument() As Object
+ 'Try to create a hidden document
+ Dim objPropValue As Object
+ objPropValue = objOleTest.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+ 'Set the members. If this fails then there is an Error
+ objPropValue.Name = "Hidden"
+ objPropValue.Handle = -1
+ objPropValue.Value = True
+
+ 'create a hidden document
+ 'Create the Desktop
+ Dim objDesktop As Object
+ objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
+ 'Open a new empty writer document
+ Dim args(0) As Object
+ args(0) = objPropValue
+ createHiddenDocument = objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)
+ End Function
+End Module
diff --git a/extensions/test/ole/VisualBasic/Project1.sln b/extensions/test/ole/VisualBasic/Project1.sln new file mode 100644 index 000000000..bea3e0edf --- /dev/null +++ b/extensions/test/ole/VisualBasic/Project1.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Project1", "Project1.vbproj", "{F62D440E-8976-4A6D-91A8-89F09701074F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F62D440E-8976-4A6D-91A8-89F09701074F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F62D440E-8976-4A6D-91A8-89F09701074F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F62D440E-8976-4A6D-91A8-89F09701074F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F62D440E-8976-4A6D-91A8-89F09701074F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/extensions/test/ole/VisualBasic/Project1.vbproj b/extensions/test/ole/VisualBasic/Project1.vbproj new file mode 100644 index 000000000..4fd617432 --- /dev/null +++ b/extensions/test/ole/VisualBasic/Project1.vbproj @@ -0,0 +1,90 @@ +<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <MyType>WindowsFormsWithCustomSubMain</MyType>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{F62D440E-8976-4A6D-91A8-89F09701074F}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>Project1</AssemblyName>
+ <OutputType>WinExe</OutputType>
+ <StartupObject>Project1.Module1</StartupObject>
+ <AssemblyMajorVersion>1</AssemblyMajorVersion>
+ <AssemblyMinorVersion>0</AssemblyMinorVersion>
+ <AssemblyRevisionNumber>0</AssemblyRevisionNumber>
+ <GenerateRevisionNumber>False</GenerateRevisionNumber>
+ <AssemblyCompanyName>StarOffice</AssemblyCompanyName>
+ <RootNamespace>Project1</RootNamespace>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>.\bin\</OutputPath>
+ <DocumentationFile>Project1.xml</DocumentationFile>
+ <DebugSymbols>True</DebugSymbols>
+ <DefineDebug>True</DefineDebug>
+ <DefineTrace>True</DefineTrace>
+ <DefineConstants>Win32=True</DefineConstants>
+ <PlatformTarget>x86</PlatformTarget>
+ <NoWarn>42016,42017,42018,42019,42032</NoWarn>
+ <DebugType>full</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>.\bin\</OutputPath>
+ <DocumentationFile>Project1.xml</DocumentationFile>
+ <DebugSymbols>False</DebugSymbols>
+ <DefineDebug>False</DefineDebug>
+ <DefineTrace>True</DefineTrace>
+ <DefineConstants>Win32=True</DefineConstants>
+ <PlatformTarget>x86</PlatformTarget>
+ <NoWarn>42016,42017,42018,42019,42032</NoWarn>
+ <DebugType>none</DebugType>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.VisualBasic.Compatibility">
+ <Name>Microsoft.VisualBasic.Compatibility</Name>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Drawing">
+ <Name>System.Drawing</Name>
+ </Reference>
+ <Reference Include="System.Windows.Forms">
+ <Name>System.Windows.Forms</Name>
+ </Reference>
+ <Reference Include="System.XML">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Import Include="Microsoft.VisualBasic" />
+ <Import Include="Microsoft.VisualBasic.Compatibility" />
+ <Import Include="System" />
+ <Import Include="System.Collections" />
+ <Import Include="System.Data" />
+ <Import Include="System.Diagnostics" />
+ <Import Include="System.Drawing" />
+ <Import Include="System.Windows.Forms" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.vb" />
+ <Compile Include="Module1.vb">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="My Project\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project>
\ No newline at end of file diff --git a/extensions/test/ole/VisualBasic/readme.txt b/extensions/test/ole/VisualBasic/readme.txt new file mode 100644 index 000000000..0b18430fc --- /dev/null +++ b/extensions/test/ole/VisualBasic/readme.txt @@ -0,0 +1,18 @@ +Runs a test written in VisualBasic. If no error message appears then the test was ok.
+
+Requirements:
+Installed office
+Component oletest.Oletest (extensions/test/ole/cpnt)
+Component VBasicEventListener.VBEventListener (extensions/test/ole/EventListenerSample/VBEventListener
+
+
+OleTest is a UNO component. It needs to be registered with the office rdb. Also there are additional
+types (oletest.rdb in wntmsci7/bin/) which must be merged with the rdb.
+VBEventListener is an ActiveX component. The directory contains a Visual Basic Project and also
+the binary VBasicEventListener.dll. This is necessary because the dll contains the type library
+which is needed by VB. Otherwise VB would generate a new CLSID on a new build.
+The dll must be registered on the system. This is done by
+regsvr32 VBasicEventListener.dll
+or
+by a rebuild of the project.
+
diff --git a/extensions/test/ole/callUnoToJava.htm b/extensions/test/ole/callUnoToJava.htm new file mode 100644 index 000000000..5374adbfa --- /dev/null +++ b/extensions/test/ole/callUnoToJava.htm @@ -0,0 +1,552 @@ +<!-- + * 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 . +--> +<HTML> +<HEAD> +<META NAME="GENERATOR" Content="Microsoft Developer Studio"> +<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"> +<TITLE>Document Title</TITLE> +</HEAD> +<BODY id=theBody> + +<script language="JScript"> +function callOleTest( id) +{ + var factory= new ActiveXObject("com.sun.star.ServiceManager"); + var oletest= factory.createInstance("oletest.OleTest"); +// alert(oletest); + + switch( id) + { + case 1: // Test simple call of JScript object function from UNO + oletest.testInterface( new XCallback_Impl, 1); + break; + + case 2: + // return value is the parameter object + oletest.testInterface( new XCallback_Impl, 2); + break; + + // OUT parameter + + case 3: // Test out parameter of type interface + oletest.testInterface( new XCallback_Impl, 3); + break; + case 4: // Test out parameter of type struct + oletest.testInterface( new XCallback_Impl, 4); + break; + case 5: // Test out parameter of type enum + oletest.testInterface( new XCallback_Impl, 5); + break; + case 6: // Test out parameter of type sequence<any> + oletest.testInterface( new XCallback_Impl, 6); + break; + case 7: // Test out parameter of type any + oletest.testInterface( new XCallback_Impl, 7); + break; + case 8: // Test out parameter of type bool + oletest.testInterface( new XCallback_Impl, 8); + break; + case 9: // Test out parameter of type char + oletest.testInterface( new XCallback_Impl, 9); + break; + case 10: // Test out parameter of type string + oletest.testInterface( new XCallback_Impl, 10); + break; + case 11: // Test out parameter of type float + oletest.testInterface( new XCallback_Impl, 11); + break; + case 12: // Test out parameter of type double + oletest.testInterface( new XCallback_Impl, 12); + break; + case 13: // Test out parameter of type byte + oletest.testInterface( new XCallback_Impl, 13); + break; + case 14: // Test out parameter of type short + oletest.testInterface( new XCallback_Impl, 14); + break; + case 15: // Test out parameter of type long + oletest.testInterface( new XCallback_Impl, 15); + break; + case 30: // outValuesMixed + oletest.testInterface( new XCallback_Impl, 30); + break; + case 31: // outValuesAll + oletest.testInterface( new XCallback_Impl, 31); + break; + + // IN/OUT parameter + + + case 100: // inoutInterface + oletest.testInterface( new XCallback_Impl, 100); + break; + case 101: // inoutStruct + oletest.testInterface( new XCallback_Impl, 101); + break; + case 102: // inoutEnum + oletest.testInterface( new XCallback_Impl, 102); + break; + case 103: // inoutSeqAny + oletest.testInterface( new XCallback_Impl, 103); + break; + case 104: // inoutAny + oletest.testInterface( new XCallback_Impl, 104); + break; + case 105: // inoutBool + oletest.testInterface( new XCallback_Impl, 105); + break; + case 106: // inoutChar + oletest.testInterface( new XCallback_Impl, 106); + break; + case 107: // inoutString + oletest.testInterface( new XCallback_Impl, 107); + break; + case 108: // inoutFloat + oletest.testInterface( new XCallback_Impl, 108); + break; + case 109: // inoutDouble + oletest.testInterface( new XCallback_Impl, 109); + break; + case 110: // inoutByte + oletest.testInterface( new XCallback_Impl, 110); + break; + case 111: // inoutShort + oletest.testInterface( new XCallback_Impl, 111); + break; + case 112: // inoutLong + oletest.testInterface( new XCallback_Impl, 112); + break; + case 120: // inoutValuesAll + oletest.testInterface( new XCallback_Impl, 120); + break; + case 200: // inValues + oletest.testInterface( new XCallback_Impl, 200); + break; + + // Call a COM object that has not been passed as parameter to a UNO component and + // hence no type information is available in the COM wrapper +// case 300: + + // Attributes + + case 400: + oletest.testInterface( new XCallback_Impl, 400); + break; + + case 1000: + oletest.testInterface2(new MultiInterface(), 0); + break; + } + +} + + + +// The class -------------------------------------------- + +function XCallback_Impl() +{ + // XCallback + this._environment= "JScript"; + + this.func1= XCallback_Impl_func1; + this.returnInterface= XCallback_Impl_returnInterface; + // ################################################# + // OUT parameter + + this.outInterface= XCallback_Impl_outInterface; + this.outStruct= XCallback_Impl_outStruct; + this.outEnum= XCallback_Impl_outEnum; + this.outSeqAny= XCallback_Impl_outSeqAny; + this.outAny= XCallback_Impl_outAny; + this.outBool= XCallback_Impl_outBool; + this.outChar= XCallback_Impl_outChar; + this.outString= XCallback_Impl_outString; + this.outFloat= XCallback_Impl_outFloat; + this.outDouble= XCallback_Impl_outDouble; + this.outByte= XCallback_Impl_outByte; + this.outShort= XCallback_Impl_outShort; + this.outLong= XCallback_Impl_outLong; + this.outValuesMixed= XCallback_Impl_outValuesMixed; + this.outValuesAll= XCallback_Impl_outValuesAll; + // ################################################# + // IN/ OUT parameter + + this.inoutInterface= XCallback_Impl_inoutInterface; + this.inoutStruct= XCallback_Impl_inoutStruct; + this.inoutEnum= XCallback_Impl_inoutEnum; + this.inoutSeqAny= XCallback_Impl_inoutSeqAny; + this.inoutAny= XCallback_Impl_inoutAny; + this.inoutBool= XCallback_Impl_inoutBool; + this.inoutChar= XCallback_Impl_inoutChar; + this.inoutString= XCallback_Impl_inoutString; + this.inoutFloat= XCallback_Impl_inoutFloat; + this.inoutDouble= XCallback_Impl_inoutDouble; + this.inoutByte= XCallback_Impl_inoutByte; + this.inoutShort= XCallback_Impl_inoutShort; + this.inoutLong= XCallback_Impl_inoutLong; + this.inoutValuesAll= XCallback_Impl_inoutValuesAll; + // ################################################# + // IN parameter + + this.inValues= XCallback_Impl_inValues; + + // ################################################# + // Attributes + + this.simple= new XSimple_Impl(); + + +} + + +function XCallback_Impl_func1() +{ + alert("XCallback_Impl_func1"); +} +function XCallback_Impl_returnInterface() +{ + alert("XCallback::returnInterface called"); + return new XSimple_Impl(); +} + +function XCallback_Impl_outInterface( outVal) +{ + outVal[0]= new XSimple_Impl(); +} + +function XCallback_Impl_outLong( outVal) +{ + alert("outLong"); +} +function XCallback_Impl_outStruct( outVal) +{ + var factory= new ActiveXObject("com.sun.star.ServiceManager"); + var starCoreReflection = factory.createInstance("com.sun.star.reflection.CoreReflection"); + var structClass = starCoreReflection.forName("oletest.SimpleStruct"); + var outParam= new Array(); + structClass.createObject(outParam); + var aStruct= outParam[0]; + aStruct.message= "a Struct created in JScript"; + outVal[0]= aStruct; + +} +function XCallback_Impl_outEnum( outVal) +{ + outVal[0]= 2; +} +function XCallback_Impl_outSeqAny( outVal) +{ + var ar= new Array(1,2,3); + outVal[0]= ar; +} +function XCallback_Impl_outAny( outVal) +{ + outVal[0]= "this is an Any"; +} +function XCallback_Impl_outBool( outVal) +{ + outVal[0]= true; +} +function XCallback_Impl_outChar( outVal) +{ + outVal[0]= "a"; +} +function XCallback_Impl_outString( outVal) +{ + outVal[0]= "This string was created in JScript"; +} +function XCallback_Impl_outFloat( outVal) +{ + outVal[0]= 3.14; +} +function XCallback_Impl_outDouble( outVal) +{ + outVal[0]= 3.145; +} +function XCallback_Impl_outByte( outVal) +{ + outVal[0]= 100; +} +function XCallback_Impl_outShort( outVal) +{ + outVal[0]= 1000; +} +function XCallback_Impl_outLong( outVal) +{ + outVal[0]= 1000000; +} +function XCallback_Impl_outValuesMixed( inLong, outLong, inString) +{ + alert("inVal long: " + inLong +" inString:" + inString); + outLong[0]= inLong + 1; +} +function XCallback_Impl_outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool, + aChar, aString, aFloat, aDouble, aByte, aShort, aLong) +{ + this.outInterface( xSimple); + this.outStruct( aSimpleStruct); + this.outEnum( aSimpleEnum); + this.outSeqAny( seqAny); + this.outAny( aAny); + this.outBool( aBool); + this.outChar( aChar); + this.outString( aString); + this.outFloat( aFloat); + this.outDouble( aDouble); + this.outByte( aByte); + this.outShort( aShort); + this.outLong( aLong); +} + +function XCallback_Impl_inoutInterface( val) +{ + val[0].func("calling on in parameter"); + val[0]= new XSimple_Impl(); +} +function XCallback_Impl_inoutStruct( val) +{ + alert( val[0].message); + val[0].message= "property message changed in JScript"; +} +function XCallback_Impl_inoutEnum(val) +{ + alert("enum value +" + val); + val[0]= 2; +} +function XCallback_Impl_inoutSeqAny( val) +{ + var vbar = new VBArray(val[0]); + var seq= vbar.toArray(); + alert( seq[0] +" "+seq[1] +" " +seq[2]); + val[0]= new Array("jscript1", "jscript2","jscript3"); +} +function XCallback_Impl_inoutAny(val) +{ + alert( "JScript in any: " + val[0]); + val[0]= "a string from JScript"; +} +function XCallback_Impl_inoutBool(val) +{ + alert( "JScript in bool: " + val[0]); + val[0]= true; +} +function XCallback_Impl_inoutChar(val) +{ + alert( "JScript in char: " + val[0]); + val[0]= 'b'; +} +function XCallback_Impl_inoutString(val) +{ + alert( "JScript in string: " + val[0]); + val[0]= " a JScript string"; +} +function XCallback_Impl_inoutFloat(val) +{ + alert( "JScript in float: " + val[0]); + val[0]= 4.14; +} +function XCallback_Impl_inoutDouble(val) +{ + alert( "JScript in double: " + val[0]); + val[0]= 4.145; +} + +function XCallback_Impl_inoutByte(val) +{ + alert( "JScript in byte: " + val[0]); + val[0]= 100; +} +function XCallback_Impl_inoutShort(val) +{ + alert( "JScript in short: " + val[0]); + val[0]= 1000; +} +function XCallback_Impl_inoutLong(val) +{ + alert( "JScript in long: " + val[0]); + val[0]= 100000; +} +function XCallback_Impl_inoutValuesAll(aXSimple, aStruct, aEnum, aSeq, + aAny, aBool, aChar, aString, aFloat, aDouble, + aByte, aShort, aLong ) +{ + this.inoutInterface( aXSimple); + this.inoutStruct( aStruct); + this.inoutEnum( aEnum); + this.inoutSeqAny( aSeq); + this.inoutAny( aAny); + this.inoutBool( aBool); + this.inoutChar( aChar); + this.inoutString( aString); + this.inoutFloat( aFloat); + this.inoutDouble( aDouble); + this.inoutByte( aByte); + this.inoutShort( aShort); + this.inoutLong( aLong); +} + +function XCallback_Impl_inValues( aChar, aLong, aString) +{ + alert( "char : " + aChar + " long: " + aLong + " string: " + aString); +} + + + +// class MultiInterface implements XSimple, XSimple2, XSimple3 + +function MultiInterface() +{ + this._environment= "JScript"; + this._implementedInterfaces= new Array( "oletest.XSimple", "oletest.XSimple2", "oletest.XSimple3"); + // XSimple --------------- + this.getName= MultiInterface_getName; + this.func= MultiInterface_func; + this.func2= MultiInterface_func2; + this.func3= MultiInterface_func3; + // XSimple2 + this.getName2= MultiInterface_getName2; + // XSimple3 + this.getName3= MultiInterface_getName3; +} + + +function MultiInterface_getName() +{ + return "JScript XSimple called"; +} +function MultiInterface_func( message) +{ + alert("JScript object (XSimple)-- " + message); +} + +function MultiInterface_getName2() +{ + return "JScript XSimple2 called"; +} +function MultiInterface_func2( message) +{ + alert("JScript object (XSimple2) -- " + message); +} + +function MultiInterface_getName3() +{ + return "JScript XSimple3 called"; +} +function MultiInterface_func3( message) +{ + alert("JScript object (XSimple3) -- " + message); +} + + + + +//XCallback_Impl_outValuesMixed( val1, outval, val2) +//{ +//} +//XCallback_Impl_outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool, +// aChar, aString, aFloat, aDouble, aByte, aShort, aLong, aUShort, aULong) +//{ +// +//} + + + +// class XSimple_Impl---------------------------------------------------------------------- +function XSimple_Impl() +{ + //XSimple + this.func= XSimple_Impl_func; +} +function XSimple_Impl_func( message) +{ + alert( "XSimple called." + message); +} + + +</script> + + + +<h2> Object in JScript</h2> + +This test passes a XCallback to a UNO function of the UNO test control. +XCallback is implemented by the JScript class XCallback_Impl. The function +XCallback::func1 is then called from the UNO test control. +<br> +<button onclick='callOleTest( 1)'>go</Button> +<br> +On the UNO object the function testInterface is called which takes +a XCallback as parameter. XCallback is implemented in a JScript object.The function +returns a XSimple Interface. Then the UNO object calls XSimple::notify. This test shall +verify the correct conversion of the return value( IDispatch JScript object) to an XSimple object.<br> +<button onclick='callOleTest( 2)'>go</Button> +<br> +<h1> out parameter </h1> +The a JScript object of class XCallback_Impl is passed to the UNO OleTest Control as parameter. +According to the buttons the OleTest object calls a function on XCallback_Impl that has appropriate type +as out parameter.<br> +<button onclick='callOleTest( 3)'>interface</Button> +<button onclick='callOleTest( 4)'>struct</Button> +<button onclick='callOleTest( 5)'>enum</Button> +<button onclick='callOleTest( 6)'>sequence<any></Button> +<button onclick='callOleTest( 7)'>any</Button> +<button onclick='callOleTest( 8)'>bool</Button> +<button onclick='callOleTest( 9)'>char</Button> +<button onclick='callOleTest( 10)'>string</Button> +<button onclick='callOleTest( 11)'>float</Button> +<button onclick='callOleTest( 12)'>double</Button> +<button onclick='callOleTest( 13)'>byte</Button> +<button onclick='callOleTest( 14)'>short</Button> +<button onclick='callOleTest( 15)'>long</Button> +<br> +Other test without parameters <br> +<button onclick='callOleTest( 30)'>outValuesMixed</Button> +<button onclick='callOleTest( 31)'>outValuesAll</Button> +<h1> in out parameter </h1> +<button onclick='callOleTest( 100)'>interface</Button> +<button onclick='callOleTest( 101)'>struct</Button> +<button onclick='callOleTest( 102)'>enum</Button> +<button onclick='callOleTest( 103)'>sequence<any></Button> +<button onclick='callOleTest( 104)'>any</Button> +<button onclick='callOleTest( 105)'>bool</Button> +<button onclick='callOleTest( 106)'>char</Button> +<button onclick='callOleTest( 107)'>string</Button> +<button onclick='callOleTest( 108)'>float</Button> +<button onclick='callOleTest( 109)'>double</Button> +<button onclick='callOleTest( 110)'>byte</Button> +<button onclick='callOleTest( 111)'>short</Button> +<button onclick='callOleTest( 112)'>long</Button> +<br> +<h1> Attributes </h1> +<button onclick='callOleTest( 400)'>getting XSimple</Button> +<br> + +Other tests with inout parameters <br> +<button onclick='callOleTest( 120)'>inoutValuesAll</Button> +<h1>in parameters </h1> +<button onclick='callOleTest( 200)'>inValues</Button> + +<h1> JScript object implements several interfaces </h1> +<button onclick='callOleTest( 1000)'>go</Button> + + + + +</body> +</html> diff --git a/extensions/test/ole/cpnt/cpnt.cxx b/extensions/test/ole/cpnt/cpnt.cxx new file mode 100644 index 000000000..3369e03d6 --- /dev/null +++ b/extensions/test/ole/cpnt/cpnt.cxx @@ -0,0 +1,1955 @@ +/* -*- 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 . + */ + +#if !defined WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <atlbase.h> +#include <stdio.h> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <tools/diagnose_ex.h> +#include <uno/environment.h> +#include <comphelper/processfactory.hxx> +#include <cppuhelper/factory.hxx> +// OPTIONAL is a constant in com.sun.star.beans.PropertyAttributes but it must be +// undef'd in some header files +#define OPTIONAL OPTIONAL +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/script/XInvocation.hpp> +#include <com/sun/star/reflection/theCoreReflection.hpp> +#include <com/sun/star/reflection/XIdlReflection.hpp> +#include <com/sun/star/lang/XEventListener.hpp> + +#include <cppuhelper/implbase.hxx> +#include <com/sun/star/uno/Reference.h> +#include <rtl/ustring.h> +#include <com/sun/star/uno/Reference.hxx> +#include <oletest/XTestSequence.hpp> +#include <oletest/XTestStruct.hpp> +#include <oletest/XTestOther.hpp> +#include <oletest/XTestInterfaces.hpp> +#include <oletest/XSimple.hpp> +#include <oletest/XSimple2.hpp> +#include <oletest/XSimple3.hpp> +#include <oletest/XTestInParameters.hpp> +#include <oletest/XIdentity.hpp> +#include <com/sun/star/beans/Property.hpp> +using namespace cppu; +using namespace osl; +using namespace oletest; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::registry; +using namespace com::sun::star::script; +using namespace com::sun::star::reflection; + + +#define IMPL_NAME L"oletest.OleTestImpl" // oletest.OleTestImpl in applicat.rdb +#define SERVICE_NAME L"oletest.OleTest" +#define KEY1 L"/oletest.OleTestImpl/UNO/SERVICES" +#define KEY2 L"oletest.OleTest" + +class OComponent : public WeakImplHelper< + XTestSequence, XTestStruct, XTestOther, XTestInterfaces, + XSimple, XTestInParameters, XIdentity > +{ + Reference<XInterface> m_xIntIdentity; + sal_Int32 m_arrayConstructor; + Reference<XMultiServiceFactory> m_rFactory; + + Sequence<sal_Int8> m_seqByte; + Sequence<float> m_seqFloat; + Sequence<double> m_seqDouble; + Sequence<sal_Bool> m_seqBool; + Sequence<sal_Int16> m_seqShort; + Sequence<sal_uInt16> m_seqUShort; + Sequence<sal_Int32> m_seqLong; + Sequence<sal_uInt32> m_seqULong; + Sequence<sal_Unicode> m_seqChar; + Sequence<OUString> m_seqString; + Sequence<Any> m_seqAny; + Sequence<Type> m_seqType; + Sequence<Sequence< sal_Int32> > m_seq1; + Sequence<Sequence< Sequence< sal_Int32> > > m_seq2; + Any m_any; + Type m_type; + Sequence<Reference< XInterface > > m_seqxInterface; + + sal_Int8 m_int8; + sal_uInt8 m_uint8; + sal_Int16 m_int16; + sal_uInt16 m_uint16; + sal_Int32 m_int32; + sal_uInt32 m_uint32; + sal_Int64 m_int64; + sal_uInt64 m_uint64; + float m_float; + double m_double; + OUString m_string; + sal_Unicode m_char; + sal_Bool m_bool; + Reference<XInterface> m_xinterface; + + sal_Int8 m_attr_int8; + sal_uInt8 m_attr_uint8; + sal_Int16 m_attr_int16; + sal_uInt16 m_attr_uint16; + sal_Int32 m_attr_int32; + sal_uInt32 m_attr_uint32; + sal_Int64 m_attr_int64; + sal_uInt64 m_attr_uint64; + float m_attr_float; + double m_attr_double; + OUString m_attr_string; + sal_Unicode m_attr_char; + sal_Bool m_attr_bool; + Any m_attr_any; + Type m_attr_type; + Reference<XInterface> m_attr_xinterface; + Reference<XInvocation> m_attr_xinvocation; + +public: + OComponent( const Reference<XMultiServiceFactory> & rFactory ) : + m_rFactory( rFactory ), m_arrayConstructor(0) {} + ~OComponent(); +public: // XTestSequence + virtual Sequence<sal_Int8> SAL_CALL methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException ); + virtual Sequence<float> SAL_CALL methodFloat(const Sequence< float >& aSeq) throw( RuntimeException ); + virtual Sequence< double > SAL_CALL methodDouble(const Sequence< double >& aSeq) throw( RuntimeException); + virtual Sequence< sal_Bool > SAL_CALL methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException ); + virtual Sequence< sal_Int16 > SAL_CALL methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException ); + virtual Sequence< sal_uInt16 > SAL_CALL methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException ); + virtual Sequence< sal_Int32 > SAL_CALL methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException) ; + virtual Sequence< sal_uInt32 > SAL_CALL methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException ); + virtual Sequence< OUString > SAL_CALL methodString(const Sequence< OUString >& aSeq) throw( RuntimeException ); + virtual Sequence< sal_Unicode > SAL_CALL methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException ); + virtual Sequence< Any > SAL_CALL methodAny(const Sequence< Any >& aSeq) throw( RuntimeException ); + virtual Sequence< Type > SAL_CALL methodType(const Sequence< Type >& aSeq) throw( RuntimeException ); + virtual Sequence< Reference< XInterface > > SAL_CALL methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException) ; + virtual Sequence< Sequence< sal_Int32 > > SAL_CALL methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException ); + virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq) throw( RuntimeException ); + virtual Sequence< Reference<XEventListener> > SAL_CALL methodXEventListeners( const Sequence<Reference<XEventListener> >& aSeq) throw( RuntimeException); + virtual Sequence< Sequence<Reference<XEventListener > > > SAL_CALL methodXEventListenersMul( const Sequence<Sequence<Reference<XEventListener > > >& aSeq ) throw (RuntimeException); + + virtual Sequence< sal_Int8 > SAL_CALL getAttrByte() throw( RuntimeException ); + virtual void SAL_CALL setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException ); + virtual Sequence< float > SAL_CALL getAttrFloat() throw( RuntimeException) ; + virtual void SAL_CALL setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException ); + virtual Sequence< double > SAL_CALL getAttrDouble() throw( RuntimeException) ; + virtual void SAL_CALL setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException ); + virtual Sequence< sal_Bool > SAL_CALL getAttrBool() throw( RuntimeException ); + virtual void SAL_CALL setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw( RuntimeException ); + virtual Sequence< sal_Int16 > SAL_CALL getAttrShort() throw( RuntimeException ); + virtual void SAL_CALL setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException ); + virtual Sequence< sal_uInt16 > SAL_CALL getAttrUShort() throw( RuntimeException ); + virtual void SAL_CALL setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException ); + virtual Sequence< sal_Int32 > SAL_CALL getAttrLong() throw( RuntimeException ); + virtual void SAL_CALL setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException ); + virtual Sequence< sal_uInt32 > SAL_CALL getAttrULong() throw( RuntimeException ); + virtual void SAL_CALL setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException ); + virtual Sequence< OUString > SAL_CALL getAttrString() throw(RuntimeException ); + virtual void SAL_CALL setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException ); + virtual Sequence< sal_Unicode > SAL_CALL getAttrChar() throw( RuntimeException ); + virtual void SAL_CALL setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException ); + virtual Sequence< Any > SAL_CALL getAttrAny() throw( RuntimeException ); + virtual void SAL_CALL setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException ); + virtual Sequence< Type > SAL_CALL getAttrType() throw( RuntimeException ); + virtual void SAL_CALL setAttrType( const Sequence< Type >& _attrtype ) throw (RuntimeException); + virtual Sequence< Sequence< sal_Int32 > > SAL_CALL getAttrSequence() throw( RuntimeException ); + virtual void SAL_CALL setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence_) throw( RuntimeException ); + virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL getAttrSequence2() throw( RuntimeException ); + virtual void SAL_CALL setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_) throw ( RuntimeException ); + virtual Sequence< Reference< XInterface > > SAL_CALL getAttrXInterface() throw(RuntimeException); + virtual void SAL_CALL setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException); + + virtual ::sal_Int8 SAL_CALL getAByte() throw (RuntimeException); + virtual void SAL_CALL setAByte( ::sal_Int8 _abyte ) throw (RuntimeException); + virtual float SAL_CALL getAFloat() throw (RuntimeException); + virtual void SAL_CALL setAFloat( float _afloat ) throw (RuntimeException); + virtual double SAL_CALL getADouble() throw (RuntimeException); + virtual void SAL_CALL setADouble( double _adouble ) throw (RuntimeException); + virtual sal_Bool SAL_CALL getABool() throw (RuntimeException); + virtual void SAL_CALL setABool( sal_Bool _abool ) throw (RuntimeException); + virtual ::sal_Int16 SAL_CALL getAShort() throw (RuntimeException); + virtual void SAL_CALL setAShort( ::sal_Int16 _ashort ) throw (RuntimeException); + virtual ::sal_uInt16 SAL_CALL getAUShort() throw (RuntimeException); + virtual void SAL_CALL setAUShort( ::sal_uInt16 _aushort ) throw (RuntimeException); + virtual ::sal_Int32 SAL_CALL getALong() throw (RuntimeException); + virtual void SAL_CALL setALong( ::sal_Int32 _along ) throw (RuntimeException); + virtual ::sal_uInt32 SAL_CALL getAULong() throw (RuntimeException); + virtual void SAL_CALL setAULong( ::sal_uInt32 _aulong ) throw (RuntimeException); + virtual OUString SAL_CALL getAString() throw (RuntimeException); + virtual void SAL_CALL setAString( const OUString& _astring ) throw (RuntimeException); + virtual ::sal_Unicode SAL_CALL getAChar() throw (RuntimeException); + virtual void SAL_CALL setAChar( ::sal_Unicode _achar ) throw (RuntimeException); + virtual Any SAL_CALL getAAny() throw (RuntimeException); + virtual void SAL_CALL setAAny( const Any& _aany ) throw (RuntimeException); + virtual Type SAL_CALL getAType() throw (RuntimeException); + virtual void SAL_CALL setAType( const Type& _atype ) throw (RuntimeException); + virtual Reference< XInterface > SAL_CALL getAXInterface() throw (RuntimeException); + virtual void SAL_CALL setAXInterface( const Reference<XInterface >& _axinterface ) throw (RuntimeException); + virtual Reference<XInvocation > SAL_CALL getAXInvocation() throw (RuntimeException); + virtual void SAL_CALL setAXInvocation( const Reference< XInvocation >& _axinvocation ) throw (RuntimeException); + + virtual void SAL_CALL testout_methodByte(sal_Int8& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodFloat(float& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodDouble(double& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodBool(sal_Bool& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodShort(sal_Int16& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodLong(sal_Int32& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodULong(sal_uInt32& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodHyper(sal_Int64& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodString(OUString& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodChar(sal_Unicode& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodAny(Any& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodType(Type& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException ); + virtual void SAL_CALL testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException ); + virtual void SAL_CALL testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException ); + virtual void SAL_CALL testout_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException ); + virtual void SAL_CALL testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 in3 ) throw(RuntimeException); + virtual void SAL_CALL testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException); + + virtual void SAL_CALL testinout_methodByte(sal_Int8& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodFloat(float& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodDouble(double& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodBool(sal_Bool& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodShort(sal_Int16& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodLong(sal_Int32& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodHyper(sal_Int64& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodString(OUString& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodAny(Any& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodType(Type& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException ); + virtual void SAL_CALL testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException); + virtual void SAL_CALL testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException); + virtual Any SAL_CALL methodAnyTest1(const Any& rIn) throw( RuntimeException ) ; + virtual Any SAL_CALL getAttrAny2() throw( RuntimeException ) ; + virtual void SAL_CALL setAttrAny2(const Any& AttrAny2_) throw( RuntimeException ) ; + + + // XTestStruct + virtual void SAL_CALL methodStruct(const Property& aProp) throw( RuntimeException ); + + virtual Property SAL_CALL retMethodStruct() throw( RuntimeException ); + + virtual Property SAL_CALL getAttrStruct() throw( RuntimeException ); + virtual void SAL_CALL setAttrStruct(const Property& AttrStruct_) throw( RuntimeException ); + virtual Property SAL_CALL methodStruct2( const Property& aProp ) throw (RuntimeException); + + // XTestOther + virtual void SAL_CALL other_methodAnyIn(const Any& rAny) throw( RuntimeException ); + virtual void SAL_CALL other_methodAnyOut(Any& rAny) throw( RuntimeException ); + virtual Any SAL_CALL other_methodAnyRet() throw( RuntimeException ); + virtual void SAL_CALL in_float( float val) throw ( RuntimeException); + virtual Any SAL_CALL other_methodAny( const Any& rAny, const OUString& typeInAny ) + throw (RuntimeException); + + // XTestInParameters + virtual sal_Int8 SAL_CALL in_methodByte( sal_Int8 rIn ) throw (RuntimeException); + virtual float SAL_CALL in_methodFloat( float rIn ) throw (RuntimeException); + virtual double SAL_CALL in_methodDouble( double rIn ) throw (RuntimeException); + virtual sal_Bool SAL_CALL in_methodBool( sal_Bool rIn ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL in_methodShort( sal_Int16 rIn ) throw (RuntimeException); + virtual sal_uInt16 SAL_CALL in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException); + virtual sal_Int32 SAL_CALL in_methodLong( sal_Int32 rIn ) throw (RuntimeException); + virtual sal_uInt32 SAL_CALL in_methodULong( sal_uInt32 rIn ) throw (RuntimeException); + virtual sal_Int64 SAL_CALL in_methodHyper( sal_Int64 rIn ) throw (RuntimeException); + virtual sal_uInt64 SAL_CALL in_methodUHyper( sal_uInt64 rIn ) throw (RuntimeException); + virtual OUString SAL_CALL in_methodString( const OUString& rIn ) throw (RuntimeException); + virtual sal_Unicode SAL_CALL in_methodChar( sal_Unicode rIn ) throw (RuntimeException); + virtual Any SAL_CALL in_methodAny( const Any& rIn ) throw (RuntimeException); + virtual Type SAL_CALL in_methodType( const Type& rIn ) throw (RuntimeException); + virtual Reference<XInterface> SAL_CALL in_methodXInterface( const Reference< XInterface >& rIn ) throw (RuntimeException); + virtual Reference<XInvocation > SAL_CALL in_methodInvocation( const Reference< XInvocation >& inv ) throw (RuntimeException); + virtual SimpleStruct SAL_CALL in_methodStruct( const SimpleStruct& aStruct ) throw (RuntimeException); + virtual void SAL_CALL in_methodAll( sal_Int8 b, float f, double d, sal_Bool boo, sal_Int16 sh, sal_uInt16 us, sal_Int32 l, sal_uInt32 ul, const OUString& s, sal_Unicode c, const Any& a, const Type& t, const Reference<XInvocation>& inv ) throw (RuntimeException); + + // XTestInterfaces -------------------------------------------------------------------------- + virtual void SAL_CALL testInterface( const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException); + virtual void SAL_CALL testInterface2( const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException); + // XSimple -------------------------------------------------------------------------- + void SAL_CALL func( const OUString &message) throw(css::uno::RuntimeException); + OUString SAL_CALL getName() throw(css::uno::RuntimeException); + + // XIdentity + virtual void SAL_CALL setObject( const Reference< XInterface >& val ) throw (RuntimeException); + virtual sal_Bool SAL_CALL isSame( const Reference< XInterface >& val ) throw (RuntimeException); + virtual Reference< XInterface > SAL_CALL getThis( ) throw (RuntimeException); +}; + +class EventListener: public WeakImplHelper<XEventListener> +{ +public: + EventListener(): bCalled( sal_False) + {} + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw (RuntimeException); + + sal_Bool bCalled; +}; + + +OComponent::~OComponent() +{ +} + + +// functions ============================================================================== + +Reference<XInterface> SAL_CALL OComponent_CreateInstance( const Reference<XMultiServiceFactory> & rSMgr ) throw(RuntimeException) +{ +// Reference<XInterface> xService(static_cast<XWeak*>(new OComponent( rSMgr )), UNO_QUERY); + OComponent* o= new OComponent( rSMgr ); + Reference<XInterface> xService(static_cast<XIdentity*>(o), UNO_QUERY); + return xService; +} + +Sequence<OUString> OComponent_getSupportedServiceNames() +{ + Sequence<OUString> aRet { SERVICE_NAME;//ODataInputStream_getImplementationName() }; + + return aRet; +} + + +extern "C" sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey ) +{ + if(pRegistryKey) + { + try + { + Reference<XRegistryKey> xNewKey = + reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(KEY1); + xNewKey->createKey( KEY2); + return sal_True; + + } + catch(InvalidRegistryException &) + { + TOOLS_WARN_EXCEPTION("extensions.olebridge", ""); + } + } + return sal_False; +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) +{ + static void * pRet= NULL; + if( ! pRet) + { + OUString aImplName( OUString::createFromAscii( pImplName ) ); + if (pServiceManager && aImplName.equals( IMPL_NAME )) + { + Reference<XMultiServiceFactory> xMulFac( + reinterpret_cast< XMultiServiceFactory*>(pServiceManager)); + + Sequence<OUString> seqServiceNames; + Reference<XSingleServiceFactory> xFactory = createOneInstanceFactory( xMulFac, SERVICE_NAME, + OComponent_CreateInstance, seqServiceNames); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + } + return pRet; +} + + +// XTestSequence ============================================================================ +Sequence<sal_Int8> SAL_CALL OComponent::methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException ) +{ + sal_Int8 _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence<float> SAL_CALL OComponent::methodFloat(const Sequence< float>& aSeq) throw( RuntimeException ) +{ + float _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence<double> SAL_CALL OComponent::methodDouble(const Sequence< double >& aSeq) throw( RuntimeException) +{ + double _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence< sal_Bool > SAL_CALL OComponent::methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException) +{ + sal_Bool _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence< sal_Int16 > SAL_CALL OComponent::methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException ) +{ + sal_Int16 _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence< sal_uInt16 > SAL_CALL OComponent::methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException ) +{ + sal_uInt16 _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence< sal_Int32 > SAL_CALL OComponent::methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException) +{ + sal_Int32 _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++) { + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence< sal_uInt32 > SAL_CALL OComponent::methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException) +{ + sal_uInt32 _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence< OUString > SAL_CALL OComponent::methodString(const Sequence< OUString >& aSeq) throw( RuntimeException) +{ + OUString _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++) { + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence< sal_Unicode > SAL_CALL OComponent::methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException) +{ + sal_Unicode _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} +Sequence< Any > SAL_CALL OComponent::methodAny(const Sequence< Any >& aSeq) throw( RuntimeException) +{ + Any _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + TypeClass _t= _x.getValueTypeClass(); + if( _t== TypeClass_STRING) + OUString s(* (rtl_uString**)_x.getValue()); + } + return aSeq; + +} + +Sequence< Type > SAL_CALL OComponent::methodType(const Sequence< Type >& aSeq) throw( RuntimeException ) +{ + Type _x; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + _x= aSeq.getConstArray()[i]; + } + return aSeq; +} + +Sequence< Reference< XInterface > > SAL_CALL OComponent::methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException) +{ + for( sal_Int32 i= 0; i < aSeq.getLength(); i++) + { + Reference<XInterface> xInt= aSeq[i]; + Reference<XEventListener> xList( xInt, UNO_QUERY); + if( xList.is()) + xList->disposing( EventObject()); + } + return aSeq; +} + +Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException) +{ + sal_Int32 value; + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + const Sequence<sal_Int32>& rseq2= aSeq.getConstArray()[i]; + for (sal_Int16 j= 0; j < rseq2.getLength(); j++){ + value= rseq2.getConstArray()[j]; + } + } + return aSeq; +} +Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq) + throw( RuntimeException ) +{ + sal_Int32 value; + sal_Int32 len= aSeq.getLength(); + for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ + const Sequence< Sequence<sal_Int32> >& rseq2= aSeq.getConstArray()[i]; + len= rseq2.getLength(); + + for (sal_Int16 j= 0; j < rseq2.getLength(); j++){ + const Sequence<sal_Int32> & rseq3= rseq2.getConstArray()[j]; + len= rseq3.getLength(); + + for (sal_Int16 k= 0; k < rseq3.getLength(); k++) + value= rseq3.getConstArray()[k]; + } + } + return aSeq; +} + +Sequence< Reference< XEventListener> > SAL_CALL OComponent::methodXEventListeners( const Sequence< Reference <XEventListener> >& aSeq) throw( RuntimeException) +{ + Reference<XEventListener> listener; + for( int i= 0; i < aSeq.getLength(); i++) + { + listener= aSeq[i]; + + listener->disposing( EventObject() ); + } + + return aSeq; +} + +Sequence< Sequence<Reference<XEventListener > > > SAL_CALL OComponent::methodXEventListenersMul( const Sequence<Sequence<Reference<XEventListener > > >& aSeq ) throw (RuntimeException) +{ + Reference<XEventListener> listener; + for( int i= 0; i < aSeq.getLength(); i++) + { + Sequence<Reference<XEventListener> > seqInner= aSeq[i]; + for( int j= 0; j < seqInner.getLength(); j++) + { + listener= seqInner[j]; + listener->disposing( EventObject() ); + } + } + return aSeq; +} + + +Sequence< sal_Int8 > SAL_CALL OComponent::getAttrByte() throw( RuntimeException) +{ + return m_seqByte; +} +void SAL_CALL OComponent::setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException ) +{ + m_seqByte= AttrByte_; +} +Sequence< float > SAL_CALL OComponent::getAttrFloat() throw( RuntimeException ) +{ + return m_seqFloat; +} +void SAL_CALL OComponent::setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException ) +{ + m_seqFloat= AttrFloat_; +} + +Sequence< double > SAL_CALL OComponent::getAttrDouble() throw( RuntimeException ) +{ + return m_seqDouble; +} +void SAL_CALL OComponent::setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException ) +{ + m_seqDouble= AttrDouble_; +} + +Sequence< sal_Bool > SAL_CALL OComponent::getAttrBool() throw( RuntimeException) +{ + return m_seqBool; +} + +void SAL_CALL OComponent::setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw (RuntimeException ) +{ + m_seqBool= AttrBool_; +} + +Sequence< sal_Int16 > SAL_CALL OComponent::getAttrShort() throw( RuntimeException) +{ + return m_seqShort; +} +void SAL_CALL OComponent::setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException ) +{ + m_seqShort= AttrShort_; +} + +Sequence< sal_uInt16 > SAL_CALL OComponent::getAttrUShort() throw( RuntimeException ) +{ + return m_seqUShort; +} +void SAL_CALL OComponent::setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException ) +{ + m_seqUShort= AttrUShort_; +} + +Sequence< sal_Int32 > SAL_CALL OComponent::getAttrLong() throw( RuntimeException) +{ + return m_seqLong; +} +void SAL_CALL OComponent::setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException ) +{ + m_seqLong= AttrLong_; +} + +Sequence< sal_uInt32 > SAL_CALL OComponent::getAttrULong() throw( RuntimeException ) +{ + return m_seqULong; +} +void SAL_CALL OComponent::setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException ) +{ + m_seqULong= AttrULong_; +} + +Sequence< OUString > SAL_CALL OComponent::getAttrString() throw( RuntimeException ) +{ + return m_seqString; +} +void SAL_CALL OComponent::setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException ) +{ + m_seqString= AttrString_; +} + +Sequence< sal_Unicode > SAL_CALL OComponent::getAttrChar() throw( RuntimeException ) +{ + return m_seqChar; +} +void SAL_CALL OComponent::setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException) +{ + m_seqChar= AttrChar_; +} + +Sequence< Any > SAL_CALL OComponent::getAttrAny() throw( RuntimeException) +{ + return m_seqAny; +} +void SAL_CALL OComponent::setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException ) +{ + m_seqAny= AttrAny_; +} + +Sequence< Type > SAL_CALL OComponent::getAttrType() throw( RuntimeException ) +{ + return m_seqType; +} + +void SAL_CALL OComponent::setAttrType( const Sequence< Type >& AttrType_) throw( RuntimeException ) +{ + m_seqType = AttrType_; +} + + +Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::getAttrSequence() throw( RuntimeException) +{ + return m_seq1; +} +void SAL_CALL OComponent::setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence) throw(RuntimeException ) +{ + sal_Int32 x= 0; + for( sal_Int32 i=0; i < AttrSequence.getLength(); i++) + { + Sequence< sal_Int32 > seq= AttrSequence[i]; + + for ( sal_Int32 j=0; j < seq.getLength(); j++) + { + x= seq[j]; + } + } + + m_seq1= AttrSequence; +} + +Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::getAttrSequence2() throw( RuntimeException ) +{ + return m_seq2; +} +void SAL_CALL OComponent::setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_) + throw( RuntimeException ) +{ + m_seq2= AttrSequence2_; +} + +Sequence< Reference< XInterface > > SAL_CALL OComponent::getAttrXInterface() throw(RuntimeException) +{ + return m_seqxInterface; +} +void SAL_CALL OComponent::setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException) +{ + m_seqxInterface= _attrxinterface; +} + + +::sal_Int8 SAL_CALL OComponent::getAByte() throw (RuntimeException) +{ + return m_attr_int8; +} + +void SAL_CALL OComponent::setAByte( ::sal_Int8 _abyte ) throw (RuntimeException) +{ + m_attr_int8 = _abyte; +} + +float SAL_CALL OComponent::getAFloat() throw (RuntimeException) +{ + return m_attr_float; +} + +void SAL_CALL OComponent::setAFloat( float _afloat ) throw (RuntimeException) +{ + m_attr_float = _afloat; +} + +double SAL_CALL OComponent::getADouble() throw (RuntimeException) +{ + return m_attr_double; +} + +void SAL_CALL OComponent::setADouble( double _adouble ) throw (RuntimeException) +{ + m_attr_double = _adouble; +} + +sal_Bool SAL_CALL OComponent::getABool() throw (RuntimeException) +{ + return m_attr_bool; +} + +void SAL_CALL OComponent::setABool( sal_Bool _abool ) throw (RuntimeException) +{ + m_attr_bool = _abool; +} + +::sal_Int16 SAL_CALL OComponent::getAShort() throw (RuntimeException) +{ + return m_attr_int16; +} + +void SAL_CALL OComponent::setAShort( ::sal_Int16 _ashort ) throw (RuntimeException) +{ + m_attr_int16 = _ashort; +} + +::sal_uInt16 SAL_CALL OComponent::getAUShort() throw (RuntimeException) +{ + return m_attr_uint16; +} + +void SAL_CALL OComponent::setAUShort( ::sal_uInt16 _aushort ) throw (RuntimeException) +{ + m_attr_uint16 = _aushort; +} + +::sal_Int32 SAL_CALL OComponent::getALong() throw (RuntimeException) +{ + return m_attr_int32; +} + +void SAL_CALL OComponent::setALong( ::sal_Int32 _along ) throw (RuntimeException) +{ + m_attr_int32 = _along; +} + +::sal_uInt32 SAL_CALL OComponent::getAULong() throw (RuntimeException) +{ + return m_attr_uint32; +} + +void SAL_CALL OComponent::setAULong( ::sal_uInt32 _aulong ) throw (RuntimeException) +{ + m_attr_uint32 = _aulong; +} + +OUString SAL_CALL OComponent::getAString() throw (RuntimeException) +{ + return m_attr_string; +} + +void SAL_CALL OComponent::setAString( const OUString& _astring ) throw (RuntimeException) +{ + m_attr_string = _astring; +} + +::sal_Unicode SAL_CALL OComponent::getAChar() throw (RuntimeException) +{ + return m_attr_char; +} + +void SAL_CALL OComponent::setAChar( ::sal_Unicode _achar ) throw (RuntimeException) +{ + m_attr_char = _achar; +} + +Any SAL_CALL OComponent::getAAny() throw (RuntimeException) +{ + return m_attr_any; +} + +void SAL_CALL OComponent::setAAny( const Any& _aany ) throw (RuntimeException) +{ + m_attr_any = _aany; +} + +Type SAL_CALL OComponent::getAType() throw (RuntimeException) +{ + return m_attr_type; +} + +void SAL_CALL OComponent::setAType( const Type& _atype ) throw (RuntimeException) +{ + m_attr_type = _atype; +} + +Reference< XInterface > SAL_CALL OComponent::getAXInterface() throw (RuntimeException) +{ + return m_attr_xinterface; +} + +void SAL_CALL OComponent::setAXInterface( const Reference<XInterface >& _axinterface ) throw (RuntimeException) +{ + m_attr_xinterface = _axinterface; +} + +Reference<XInvocation > SAL_CALL OComponent::getAXInvocation() throw (RuntimeException) +{ + return m_attr_xinvocation; +} + +void SAL_CALL OComponent::setAXInvocation( const Reference< XInvocation >& _axinvocation ) throw (RuntimeException) +{ + m_attr_xinvocation = _axinvocation; +} + +void SAL_CALL OComponent::testout_methodByte(sal_Int8& rOut) throw( RuntimeException ) +{ + rOut= m_int8; +} +void SAL_CALL OComponent::testout_methodFloat(float& rOut) throw( RuntimeException ) +{ + rOut= m_float; +} +void SAL_CALL OComponent::testout_methodDouble(double& rOut) throw( RuntimeException ) +{ + rOut= m_double; +} + +void SAL_CALL OComponent::testout_methodBool(sal_Bool& rOut) throw( RuntimeException ) +{ + rOut= m_bool; +} +void SAL_CALL OComponent::testout_methodShort(sal_Int16& rOut) throw( RuntimeException ) +{ + rOut= m_int16; +} +void SAL_CALL OComponent::testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException ) +{ + rOut= m_uint16; +} +void SAL_CALL OComponent::testout_methodLong(sal_Int32& rOut) throw( RuntimeException ) +{ + rOut = m_int32; +} +void SAL_CALL OComponent::testout_methodULong(sal_uInt32& rOut) throw( RuntimeException ) +{ + rOut= m_uint32; +} +void SAL_CALL OComponent::testout_methodHyper(sal_Int64& rOut) throw( RuntimeException ) +{ + rOut = m_int64; +} + +void SAL_CALL OComponent::testout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException ) +{ + rOut = m_uint64; +} + +void SAL_CALL OComponent::testout_methodString(OUString& rOut) throw( RuntimeException ) +{ + rOut= m_string; +} +void SAL_CALL OComponent::testout_methodChar(sal_Unicode& rOut) throw( RuntimeException ) +{ + rOut= m_char; +} +void SAL_CALL OComponent::testout_methodAny(Any& rOut) throw( RuntimeException) +{ + rOut = m_any; +} + +void SAL_CALL OComponent::testout_methodType(Type& rOut) throw( RuntimeException ) +{ + rOut = m_type; +} + +void SAL_CALL OComponent::testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException) +{ + rOut.realloc(10); + for( sal_Int16 i= 0; i < rOut.getLength(); i++) rOut.getArray()[i]= i; +} +void SAL_CALL OComponent::testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException ) +{ + rOut.realloc( 10); + for( sal_Int16 i= 0; i < rOut.getLength(); i++){ + Sequence<sal_Int32>& rseq2= rOut.getArray()[i]; + rseq2.realloc( 10); + for (sal_Int16 j= 0; j < rseq2.getLength(); j++){ + rseq2.getArray()[j]= j; + } + } +} +void SAL_CALL OComponent::testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException ) +{ + rout1= 999; + rout2= 1111; +} +void SAL_CALL OComponent::testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException ) +{ + rout1= 1111; + rout2= 1222; + rout3= L" another string"; +} +void SAL_CALL OComponent::testout_methodMulParams3(const OUString&, OUString& sout) throw( RuntimeException ) +{ + sout= L"Out Hallo!"; +} +void SAL_CALL OComponent::testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 ) throw(RuntimeException) +{ + out1= in1 + 1; + out2= in2 + 1; +} + +void SAL_CALL OComponent::testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException) +{ + rOut = m_xinterface; +} + +// XTestInParameters ------------------------------------------------------------ +sal_Int8 SAL_CALL OComponent::in_methodByte( sal_Int8 rIn ) throw (RuntimeException) +{ + m_int8 = rIn; + return rIn; +} +float SAL_CALL OComponent::in_methodFloat( float rIn ) throw (RuntimeException) +{ + m_float = rIn; + return rIn; +} +double SAL_CALL OComponent::in_methodDouble( double rIn ) throw (RuntimeException) +{ + m_double = rIn; + return rIn; +} +sal_Bool SAL_CALL OComponent::in_methodBool( sal_Bool rIn ) throw (RuntimeException) +{ + m_bool = rIn; + return rIn; +} +sal_Int16 SAL_CALL OComponent::in_methodShort( sal_Int16 rIn ) throw (RuntimeException) +{ + m_int16 = rIn; + return rIn; +} +sal_uInt16 SAL_CALL OComponent::in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException) +{ + m_uint16 = rIn; + return rIn; +} +sal_Int32 SAL_CALL OComponent::in_methodLong( sal_Int32 rIn ) throw (RuntimeException) +{ + m_int32 = rIn; + return rIn; +} +sal_uInt32 SAL_CALL OComponent::in_methodULong( sal_uInt32 rIn ) throw (RuntimeException) +{ + m_uint32 = rIn; + return rIn; +} +sal_Int64 SAL_CALL OComponent::in_methodHyper( sal_Int64 rIn ) throw (RuntimeException) +{ + m_int64 = rIn; + return rIn; +} + +sal_uInt64 SAL_CALL OComponent::in_methodUHyper( sal_uInt64 rIn ) throw (RuntimeException) +{ + m_uint64 = rIn; + return rIn; +} + +OUString SAL_CALL OComponent::in_methodString( const OUString& rIn ) throw (RuntimeException) +{ + m_string = rIn; + return rIn; +} +sal_Unicode SAL_CALL OComponent::in_methodChar( sal_Unicode rIn ) throw (RuntimeException) +{ + m_char = rIn; + return rIn; +} +Any SAL_CALL OComponent::in_methodAny( const Any& rIn ) throw (RuntimeException) +{ + m_any = rIn; + return rIn; +} + +Type SAL_CALL OComponent::in_methodType( const Type& rIn ) throw (RuntimeException) +{ + m_type = rIn; + return rIn; +} + +Reference<XInvocation > SAL_CALL OComponent::in_methodInvocation( const Reference< XInvocation >& inv ) + throw (RuntimeException) +{ + //We expect the invocation results from a conversion of VBasicEventListener.VBEventListener +//which implements XEventListener + // extensions/test/ole/EventListenerSample + EventObject event( Reference<XInterface>(static_cast<XTestInParameters*>(this),UNO_QUERY)); + Any anyParam; + anyParam <<= event; + Sequence<Any> params( &anyParam, 1); + Sequence<sal_Int16> outIndex; + Sequence<Any> outParams; + try{ + inv->invoke( OUString("disposing"), + params, outIndex, outParams); + }catch(IllegalArgumentException &) { + } + catch(CannotConvertException &){ + } + catch(InvocationTargetException&) { + } + return inv; +} +Reference<XInterface> SAL_CALL OComponent::in_methodXInterface( const Reference<XInterface >& rIn ) throw (RuntimeException) +{ + m_xinterface = rIn; + return rIn; +} + +SimpleStruct SAL_CALL OComponent::in_methodStruct( const SimpleStruct& aStruct ) + throw (RuntimeException) +{ + SimpleStruct& s= const_cast<SimpleStruct&>(aStruct); + s.message= s.message + OUString( + "This string was set in OleTest"); + return aStruct; +} +void SAL_CALL OComponent::in_methodAll( + sal_Int8, float, double, sal_Bool, sal_Int16, sal_uInt16, + sal_Int32, sal_uInt32, const OUString&, sal_Unicode, + const Any&, const Type&, const Reference<XInvocation>&) throw (RuntimeException) +{ +} + +// INOUT ----------------------------------------------------------------------------------- +void SAL_CALL OComponent::testinout_methodByte(sal_Int8& rOut) throw( RuntimeException ) +{ + sal_Int8 tmp = rOut; + rOut = m_int8; + m_int8 = tmp; +} +void SAL_CALL OComponent::testinout_methodFloat(float& rOut) throw( RuntimeException ) +{ + float tmp = rOut; + rOut = m_float; + m_float = tmp; +} + +void SAL_CALL OComponent::testinout_methodDouble(double& rOut) throw( RuntimeException ) +{ + double tmp = rOut; + rOut = m_double; + m_double = tmp; +} +void SAL_CALL OComponent::testinout_methodBool(sal_Bool& rOut) throw( RuntimeException ) +{ + sal_Bool tmp = rOut; + rOut = m_bool; + m_bool = tmp; +} +void SAL_CALL OComponent::testinout_methodShort(sal_Int16& rOut) throw( RuntimeException ) +{ + sal_Int16 tmp= rOut; + rOut = m_int16; + m_int16 = tmp; +} +void SAL_CALL OComponent::testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException ) +{ + sal_uInt16 tmp = rOut; + rOut = m_uint16; + m_uint16 = tmp; +} +void SAL_CALL OComponent::testinout_methodLong(sal_Int32& rOut) throw( RuntimeException ) +{ + sal_Int32 tmp = rOut; + rOut = m_int32; + m_int32 = tmp; +} +void SAL_CALL OComponent::testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException ) +{ + sal_uInt32 tmp = rOut; + rOut = m_uint32; + m_uint32 = tmp; +} +void SAL_CALL OComponent::testinout_methodHyper(sal_Int64& rOut) throw( RuntimeException ) +{ + sal_Int64 tmp = rOut; + rOut = m_int64; + m_int64 = tmp; +} + +void SAL_CALL OComponent::testinout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException ) +{ + sal_uInt64 tmp = rOut; + rOut = m_uint64; + m_uint64 = tmp; +} + +void SAL_CALL OComponent::testinout_methodString(OUString& rOut) throw( RuntimeException ) +{ + OUString tmp = rOut; + rOut = m_string; + m_string = tmp; +} +void SAL_CALL OComponent::testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException) +{ + sal_Unicode tmp = rOut; + rOut = m_char; + m_char = tmp; +} +void SAL_CALL OComponent::testinout_methodAny(Any& rOut) throw( RuntimeException) +{ + Any tmp = rOut; + rOut = m_any; + m_any = tmp; +} +void SAL_CALL OComponent::testinout_methodType(Type& rOut) throw( RuntimeException) +{ + Type tmp = rOut; + rOut = m_type; + m_type = tmp; +} + + +void SAL_CALL OComponent::testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException) +{ + + sal_Int32* arr= rOut.getArray(); + for ( sal_Int32 i=0; i < rOut.getLength(); i++) + { + rOut.getArray()[i] += 1; + } +} +void SAL_CALL OComponent::testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException ) +{ + for( sal_Int32 i=0; i < rOut.getLength(); i++) + { + Sequence< sal_Int32 >& seq= rOut.getArray()[i]; + + for ( sal_Int32 j=0; j < seq.getLength(); j++) + { + seq.getArray()[j] += seq.getArray()[j]; + } + } +} + +// The parameter should implement XInvocation and a Property "value" +void SAL_CALL OComponent::testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException) +{ + Any any; + any= rOut->getValue( OUString( L"value")); + OUString _s; + any >>= _s; + OUString string(L"out"); + any <<= string; + rOut->setValue( OUString(L"value"), any); + + any= rOut->getValue( OUString( L"value")); + any >>= _s; + +} + +void SAL_CALL OComponent::testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException) +{ + Reference<XInterface> tmp = rOut; + rOut = m_xinterface; + m_xinterface = tmp; +} +Any SAL_CALL OComponent::methodAnyTest1(const Any& rIn) throw( RuntimeException ) +{ + return rIn; +} +Any SAL_CALL OComponent::getAttrAny2() throw( RuntimeException ) +{ + return m_any; +} +void SAL_CALL OComponent::setAttrAny2(const Any& AttrAny2_) throw( RuntimeException ) +{ + m_any= AttrAny2_; +} + + +// XTestStruct ======================================================================================= + +void SAL_CALL OComponent::methodStruct(const Property& aProp) throw( RuntimeException ) +{ + char buff[1024]; + buff[0]= 0; + sprintf( buff,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S", + aProp.Attributes, aProp.Handle, (const sal_Unicode*)aProp.Name); + MessageBox( NULL, A2T(buff), _T("OleTest: methodStruct"), MB_OK); +} + +Property SAL_CALL OComponent::retMethodStruct() throw( RuntimeException ) +{ + Property a(L"OleTest_Property", 255, cppu::UnoType<XInterface>::get(), PropertyAttribute::MAYBEVOID | + PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED | + PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY | + PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT ); + return a; +} + +Property SAL_CALL OComponent::getAttrStruct() throw( RuntimeException) +{ + Property a(L"OleTest_Property", 255, cppu::UnoType<XInterface>::get(), PropertyAttribute::MAYBEVOID | + PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED | + PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY | + PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT ); + return a; + +} + +void SAL_CALL OComponent::setAttrStruct(const Property& AttrStruct_) throw( RuntimeException ) +{ + char buff[1024]; + buff[0]= 0; + sprintf( buff,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S", + AttrStruct_.Attributes, AttrStruct_.Handle, (const sal_Unicode*)AttrStruct_.Name); +// MessageBox( NULL, A2T(buff), _T("OleTest: setAttrStruct"), MB_OK); +} + +Property SAL_CALL OComponent::methodStruct2( const Property& aProp ) throw (RuntimeException) +{ + return aProp; +} + +// XTestOther ================================================================================== +void SAL_CALL OComponent::other_methodAnyIn(const Any& ) throw( RuntimeException ) +{ +} +void SAL_CALL OComponent::other_methodAnyOut(Any& rAny) throw( RuntimeException ) +{ + rAny <<= OUString(L"Ein Any"); +} + +Any SAL_CALL OComponent::other_methodAnyRet() throw(RuntimeException ) +{ + Any a; + a <<= OUString(L"Ein Any"); + return a; +} +void SAL_CALL OComponent::in_float( float val) throw ( RuntimeException) +{ + USES_CONVERSION; + char buff[256]; + sprintf( buff, "parameter : %f", val); + MessageBox( NULL, A2T(buff), _T("OleTest"), MB_OK); +} +Any SAL_CALL OComponent::other_methodAny( const Any& rAny, const OUString& typeInAny ) + throw (RuntimeException) +{ + Type expectedType; + typelib_TypeDescription * pDesc= NULL; + typelib_typedescription_getByName( &pDesc, typeInAny.pData ); + if( pDesc) + { + expectedType = Type( pDesc->pWeakRef ); + typelib_typedescription_release( pDesc); + } + if (rAny.getValueType() != expectedType) + throw RuntimeException(); + + return rAny; +} + +// XTestInterfaces ------------------------------------------------------------------------------------- +void SAL_CALL OComponent::testInterface( const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException) +{ + USES_CONVERSION; + sal_Int32 i=0; + OUString aString; + char buff[1024]; + + Reference<XSimple> xSimple; + SimpleStruct aSimpleStruct; + SimpleEnum aSimpleEnum; + Sequence<Any> seqAny; + Sequence< sal_Int8 > seqByte; + Any outAny; + sal_Bool aBool; + sal_Unicode aChar; + float aFloat; + double aDouble; + sal_Int8 aByte; + sal_Int16 aShort; + sal_Int32 aLong; + + switch( mode) + { + case 1: + xCallback->func1(); break; + case 2: + xSimple= xCallback->returnInterface(); + xSimple->func(L"XCallback::returnInterface"); + break; + + + case 3: + xCallback->outInterface( xSimple); + sprintf( buff, "XCallback::outInterface, value: %x", xSimple.get()); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + xSimple->func(L"XCallback::outInterface works"); + break; + case 4: + xCallback->outStruct( aSimpleStruct); + sprintf( buff,"XCallback::outStruct, SimpleStruct::message: %s", OLE2A( aSimpleStruct.message)); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 5: + xCallback->outEnum( aSimpleEnum); + sprintf( buff,"XCallback::outEnum, SimpleEnum: %d", aSimpleEnum); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 6: + xCallback->outSeqAny( seqAny); + sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength()); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + for( i=0; i < seqAny.getLength(); i++) + { + Any any= seqAny[i]; + if( any.getValueTypeClass() == TypeClass_STRING) + { + any >>= aString; + OutputDebugStringW( aString); + } + + } + break; + case 7: + xCallback->outAny( outAny); + if( outAny.getValueTypeClass() == TypeClass_STRING) + outAny >>= aString; + sprintf( buff,"XCallback::outAny, Any : %s", W2A( aString)); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 8: + xCallback->outBool( aBool); + sprintf( buff,"XCallback::outBool, value: %d", aBool); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 9: + xCallback->outChar( aChar); + sprintf( buff,"XCallback::outChar, value: %C", aChar); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 10: + xCallback->outString( aString); + sprintf( buff,"XCallback::outString, value: %s", W2A( aString)); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 11: + xCallback->outFloat( aFloat); + sprintf( buff,"XCallback::outFloat, value: %f", aFloat); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 12: + xCallback->outDouble( aDouble); + sprintf( buff,"XCallback::outDouble, value: %f", aDouble); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 13: + xCallback->outByte( aByte); + sprintf( buff,"XCallback::outByte, value: %d", aByte); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 14: + xCallback->outShort( aShort); + sprintf( buff,"XCallback::outShort, value: %d", aShort); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 15: + xCallback->outLong( aLong); + sprintf( buff,"XCallback::outLong, value: %d", aLong); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + break; + case 18: + case 19: + case 30: + { + + long outLong= 0; + xCallback->outValuesMixed( 1111, outLong, OUString( L"in string") ); + + sprintf( buff, "oletest.testInterface: outValue: %d", outLong); + MessageBox( NULL, A2T(buff), _T("OleTest"), MB_OK); + break; + } + + case 31: + { + Reference< XSimple > xSimple; + SimpleStruct aSimpleStruct; + SimpleEnum aSimpleEnum; + Sequence<Any> seqAny; + Any aAny; + sal_Bool aBool; + sal_Unicode aChar; + OUString aString; + float aFloat; + double aDouble; + sal_Int8 aByte; + sal_Int16 aShort; + sal_Int32 aLong; + xCallback->outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool, + aChar, aString, + aFloat, aDouble, + aByte, + aShort, aLong); + + MessageBox( NULL, _T("XCallback::outValuesAll returned"), _T("OleTest::testInterface"), MB_OK); + break; + } + case 32: + { + + xCallback->outSeqByte( seqByte); + sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength()); + MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); + for( i=0; i < seqAny.getLength(); i++) + { + Any any= seqAny[i]; + if( any.getValueTypeClass() == TypeClass_STRING) + { + any >>= aString; + OutputDebugStringW( aString); + } + } + break; + } + // ############################################################################ + // IN OUT parameter + // ############################################################################ + case 100: + { + Reference<XSimple> xSimple= static_cast<XSimple*>(this); + xCallback->inoutInterface( xSimple); + xSimple->func(L"XSimple called from OleTest"); + break; + } + case 101: + { + Reference<XIdlReflection> xRefl( theCoreReflection::get(comphelper::getComponentContext(m_rFactory)) ); + Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct"); + Any any; + if( xClass.is()) + xClass->createObject( any); + + if( any.getValueTypeClass() == TypeClass_STRUCT) + { + SimpleStruct* pStruct= ( SimpleStruct*) any.getValue(); + pStruct->message= "This struct was created in OleTest"; + + SimpleStruct aStruct; + any >>= aStruct; + xCallback->inoutStruct( aStruct); + // a Struct should now contain a different message + MessageBox( NULL, W2T(aStruct.message), _T("OleTest in out parameter"), MB_OK); + } + + break; + } + case 102: + { + SimpleEnum aEnum= SimpleEnum_B; + xCallback->inoutEnum( aEnum); + char buff[1024]; + sprintf( buff, "Enum: %d", aEnum); + MessageBox( NULL, A2T(buff), _T("OleTest in out parameter"), MB_OK); + break; + } + case 103: + { + Any arAny[3]; + arAny[0] <<= OUString( L"string 0"); + arAny[1] <<= OUString( L"string 1"); + arAny[2] <<= OUString( L"string 2"); + + Sequence< Any >seqAny( arAny, 3); + xCallback->inoutSeqAny( seqAny); + char buff[1023]; + sprintf( buff, "Sequence length: %d", seqAny.getLength()); + MessageBox( NULL,A2T(buff) , _T("OleTest in out parameter"), MB_OK); + + for( int i=0; i < seqAny.getLength(); i++) + { + Any any; + any <<= seqAny[i]; + if(any.getValueTypeClass() == TypeClass_STRING) + { + OUString str; + any >>= str; + + } + } + + break; + } + case 104: + { + Any any; + OUString s(L" OleTest"); + any <<= s; + xCallback->inoutAny(any); + if( any.getValueTypeClass() == TypeClass_STRING) + { + OUString s= *( rtl_uString**) any.getValue(); + MessageBox( NULL, W2T( s), _T("OleTest: inout value any"), MB_OK); + } + break; + } + case 105: + { + sal_Bool b= sal_True; + xCallback->inoutBool( b); + char buff[1024]; + sprintf( buff, "out value bool: %d", b); + MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); + break; + } + case 106: + { + sal_Unicode uc= L'A'; + xCallback->inoutChar( uc); + char buff[1024]; + sprintf( buff, "out value sal_Unicode: %C", uc); + MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); + break; + } + case 107: + { + OUString s(L"OleTest"); + xCallback->inoutString( s); + char buff[1024]; + sprintf( buff, "out value string: %S", s.getStr()); + MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); + break; + } + case 108: + { + float f= 3.14f; + xCallback->inoutFloat(f); + char buff[1024]; + sprintf( buff, "out value float: %f", f); + MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); + break; + } + case 109: + { + double f= 3.145; + xCallback->inoutDouble( f); + char buff[1024]; + sprintf( buff, "out value double: %g", f); + MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); + break; + } + case 110: + { + sal_Int8 aByte= 0xf; + xCallback->inoutByte( aByte); + char buff[1024]; + sprintf( buff, "out value sal_Int8: %d", aByte); + MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); + break; + } + case 111: + { + sal_Int16 aShort= 0xff; + xCallback->inoutShort( aShort); + char buff[1024]; + sprintf( buff, "out value sal_Int16: %d", aShort); + MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); + break; + } + case 112: + { + sal_Int32 aLong= 0xfffe; + xCallback->inoutLong( aLong); + char buff[1024]; + sprintf( buff, "out value sal_Int32: %d", aLong); + MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); + break; + } + case 120: + { + Reference<XSimple> aXSimple= static_cast<XSimple*>(this); + + SimpleStruct aStruct; + Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY); + if( xRefl.is()) + { + Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct"); + Any any; + if( xClass.is()) + xClass->createObject( any); + + if( any.getValueTypeClass() == TypeClass_STRUCT) + { + SimpleStruct* pStruct= ( SimpleStruct*) any.getValue(); + pStruct->message= "This struct was created in OleTest"; + any >>= aStruct; + } + } + + SimpleEnum aEnum= SimpleEnum_B; + + Sequence< Any > aSeq; + Any arAny[3]; + arAny[0] <<= OUString( L"string 0"); + arAny[1] <<= OUString( L"string 1"); + arAny[2] <<= OUString( L"string 2"); + aSeq = Sequence< Any >( arAny, 3); + + Any aAny; + OUString s(L" OleTest"); + aAny <<= s; + + sal_Bool aBool= sal_True; + sal_Unicode aChar= L'A'; + OUString aString( L"OleTest"); + float aFloat=3.14f; + double aDouble= 3.145; + sal_Int8 aByte= 0xf; + sal_Int16 aShort= 0xff; + sal_Int32 aLong= 0xffe; + + xCallback->inoutValuesAll( aXSimple, aStruct, aEnum, aSeq, + aAny, aBool, aChar, aString, aFloat, aDouble, + aByte, aShort, aLong ); + + aXSimple->func(L"XSimple called from OleTest"); + MessageBox( NULL, W2T(aStruct.message), _T("OleTest"), MB_OK); + + for( int i=0; i < aSeq.getLength(); i++) + { + Any any; + any <<= aSeq[i]; + if(any.getValueTypeClass() == TypeClass_STRING) + { + OUString str; + any >>= str; + + } + } + break; + } + + // ############################################################################ + // IN parameter + // ############################################################################ + + case 200: + + xCallback->inValues( L'a', 0xffffL, OUString(L" a string from OleTest")); + break; + case 201: + { + sal_Int8 arbyte[3]= { 1,2,3}; + Sequence< sal_Int8 > seq( arbyte, 3); + xCallback->inSeqByte( seq); + break; + } + case 202: + { + const int LISTENERS= 3; + Reference<XEventListener> arListeners[LISTENERS]; + EventObject arEvents[LISTENERS]; + + for( int i= 0; i < LISTENERS; i++) + { + Reference<XInterface> aList= static_cast<XWeak*>( new EventListener()); + arListeners[i].set( aList, UNO_QUERY); + } + + xCallback->inSeqXEventListener(Sequence<Reference<XEventListener> > (arListeners, LISTENERS), + Sequence<EventObject>(arEvents, LISTENERS)); + break; + } + + // ############################################################################ + // Call a COM object that has not been passed as parameter to a UNO component and + // hence no type information is available in the COM wrapper + // ############################################################################ + case 300: + { + Reference<XInterface> xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.oleautomation.Factory"); + + Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY); + + Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback"); + Reference<XInvocation> xInv( xIntCallback, UNO_QUERY); + Sequence<sal_Int16> seqIndices; + Sequence<Any> seqOutParams; + xInv->invoke( OUString( L"outValuesAll"), Sequence<Any>(), seqIndices, seqOutParams); + + if( seqOutParams.getLength() == 12) + { + Reference<XSimple> xSimple= *(XSimple**)seqOutParams[0].getValue(); + xSimple->func( L"Call from OleTest on XSimple"); + SimpleStruct aStruct; + seqOutParams[1] >>= aStruct; + SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue(); + + Sequence<Any> seqAny; + seqOutParams[3] >>= seqAny; + for( int i=0; i<seqAny.getLength(); i++) + { + OUString _s; + seqAny[i] >>= _s; + } + + Any _any= *(Any*)seqOutParams[4].getValue(); + sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue(); + sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue(); + OUString _str= *( rtl_uString**)seqOutParams[7].getValue(); + + float _f= *( float*)seqOutParams[8].getValue(); + double _d= *( double*) seqOutParams[9].getValue(); + sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue(); + sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue(); + + sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue(); + + } + break; + } + case 301: + // in / out parameter + { + Reference<XInterface> xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.oleautomation.Factory"); + + Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY); + + Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback"); + Reference<XInvocation> xInv( xIntCallback, UNO_QUERY); + Sequence<sal_Int16> seqIndices; + Sequence<Any> seqOutParams; + + + Any arAny[13]; + Reference<XSimple> xSimple= static_cast<XSimple*>( this); + + arAny[0] <<= xSimple; + SimpleStruct aStruct; + Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY); + if( xRefl.is()) + { + Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct"); + Any any; + if( xClass.is()) + xClass->createObject( any); + + if( any.getValueTypeClass() == TypeClass_STRUCT) + { + SimpleStruct* pStruct= ( SimpleStruct*) any.getValue(); + pStruct->message = "This struct was created in OleTest"; + any >>= aStruct; + } + } + arAny[1] <<= aStruct; + arAny[2] <<= SimpleEnum_C; + + Any arSeqAny[3]; + arSeqAny[0] <<= OUString( L"string 0"); + arSeqAny[1] <<= OUString( L"string 1"); + arSeqAny[2] <<= OUString( L"string 2"); + + arAny[3] <<= Sequence< Any >( arAny, 3); + + OUString str(L" Ein Any param"); + arAny[4] <<= str; + arAny[5] <<= sal_False; + arAny[6] <<= L'B'; + OUString stringParam(L" a string parameter"); + arAny[7] <<= stringParam; + float _float= 3.14f; + arAny[8] <<= _float; + double _double= 3.145; + arAny[9] <<= _double; + sal_Int8 _byte= -1; + arAny[10] <<= _byte; + sal_Int16 _short= -1; + arAny[11] <<= _short; + sal_Int32 _long= -1; + arAny[12] <<= _long; + + Sequence<Any> params( arAny, 13); + + xInv->invoke( OUString( L"inoutValuesAll"), params, seqIndices, seqOutParams); + + if( seqOutParams.getLength() == 12) + { + Reference<XSimple> xSimple= *(XSimple**)seqOutParams[0].getValue(); + xSimple->func( L"Call from OleTest on XSimple"); + SimpleStruct aStruct; + seqOutParams[1] >>= aStruct; + SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue(); + + Sequence<Any> seqAny; + seqOutParams[3] >>= seqAny; + for( int i=0; i<seqAny.getLength(); i++) + { + OUString _s; + seqAny[i] >>= _s; + } + + Any _any= *(Any*)seqOutParams[4].getValue(); + sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue(); + sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue(); + OUString _str= *( rtl_uString**)seqOutParams[7].getValue(); + + float _f= *( float*)seqOutParams[8].getValue(); + double _d= *( double*) seqOutParams[9].getValue(); + sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue(); + sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue(); + + sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue(); + + } + break; + } + case 303: + { + Reference<XInterface> xIntFact = m_rFactory->createInstance( + L"com.sun.star.bridge.oleautomation.Factory"); + + Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY); + + Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback"); + Reference<XInvocation> xInv( xIntCallback, UNO_QUERY); + Sequence<sal_Int16> seqIndices; + Sequence<Any> seqOutParams; + + Any arAny[3]; + sal_Unicode aChar=L'a'; + arAny[0] <<= aChar; + sal_Int32 aLong= 0xffffffff; + arAny[1] <<= aLong; + OUString aString(L" a string parameter"); + arAny[2] <<= aString; + + xInv->invoke( OUString( L"inValues"), Sequence<Any>(arAny,3), seqIndices, seqOutParams); + + break; + } + // ############################################################################ + // Attributes + // ############################################################################ + + case 400: + Reference<XSimple> simple= xCallback->getsimple(); + simple->func(L"OleTest calls on XSimple"); + break; + + + } + +} + +void SAL_CALL OComponent::setObject( const Reference< XInterface >& val ) throw (RuntimeException) +{ + m_xIntIdentity= val; +} + +sal_Bool SAL_CALL OComponent::isSame( const Reference< XInterface >& val ) throw (RuntimeException) +{ + if( m_xIntIdentity == val) + return sal_True; + else + return sal_False; +} + +Reference< XInterface > SAL_CALL OComponent::getThis( ) throw (RuntimeException) +{ + Reference<XInterface> ret(static_cast<XIdentity*>(this), UNO_QUERY); + return ret; +} + +void SAL_CALL EventListener::disposing( const css::lang::EventObject& ) throw (RuntimeException) +{ + bCalled= sal_True; +} + +// XSimple -------------------------------------------------------------------------- +void SAL_CALL OComponent::func( const OUString &message)throw(css::uno::RuntimeException) +{ + USES_CONVERSION; + + MessageBox( NULL, W2T( message.getStr()), _T("OleTest: XSimple::func"), MB_OK); +} +// XSimple -------------------------------------------------------------------------- +OUString SAL_CALL OComponent::getName()throw(css::uno::RuntimeException) +{ + return L"XSimple"; +} +void SAL_CALL OComponent::testInterface2( const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException) +{ + switch( mode) + { + case 0: + { + xSimple->func( L"OleTest is calling XSimple"); + Reference<XSimple2> xSimple2( xSimple, UNO_QUERY); + if( xSimple2.is()) + xSimple2->func2( L"OleTest is calling XSimple2"); + Reference<XSimple3> xSimple3( xSimple, UNO_QUERY); + if( xSimple3.is()) + xSimple3->func3( L"OleTest is calling XSimple3"); + + break; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/cpnt/exports.dxp b/extensions/test/ole/cpnt/exports.dxp new file mode 100644 index 000000000..51703a046 --- /dev/null +++ b/extensions/test/ole/cpnt/exports.dxp @@ -0,0 +1,2 @@ +component_writeInfo +component_getFactory diff --git a/extensions/test/ole/cpnt/makefile.mk b/extensions/test/ole/cpnt/makefile.mk new file mode 100644 index 000000000..ad9d07bac --- /dev/null +++ b/extensions/test/ole/cpnt/makefile.mk @@ -0,0 +1,66 @@ +# +# 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 . +# +PRJ=..$/..$/.. + +PRJNAME= extensions +TARGET= oletest +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +INCPRE+= -I$(ATL_INCLUDE) + +SLOFILES= \ + $(SLO)$/cpnt.obj + +SHL1TARGET= $(TARGET) + +SHL1STDLIBS= \ + $(SALLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET) +SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + + +ALLTAR : $(MISC)$/$(TARGET).cppumaker.done + + +.INCLUDE : target.mk + +ALLIDLFILES:= ..$/idl$/oletest.idl + +$(BIN)$/oletest.rdb: $(ALLIDLFILES) + idlc -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $? + regmerge $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)} + touch $@ + +$(MISC)$/$(TARGET).cppumaker.done: $(BIN)$/oletest.rdb + $(CPPUMAKER) -O$(INCCOM) -BUCR $< -X$(SOLARBINDIR)/types.rdb + $(TOUCH) $@ + diff --git a/extensions/test/ole/cpnt/readme.txt b/extensions/test/ole/cpnt/readme.txt new file mode 100644 index 000000000..ccac8066a --- /dev/null +++ b/extensions/test/ole/cpnt/readme.txt @@ -0,0 +1,21 @@ +cpnt.cxx contains a UNO component that is uses to test the olebridge within a +JavaScript context. In particular it has functions using out, in/out and +sequence parameter that have to be specifically treated in JScript because they +are represented by IDispatch objects. Other clients, such as VBScript, VB and +C++ applications can also use this component for testing. +The service name is oletest.OleTest. +The uno types are also build in this folder. The idl file is in ..\idl. The +types rdb is in wntmscixx.pro\bin\oletest.rdb + +The service is used by: +OleTest.htm +JScriptNewStyle.htm +ScriptTest.html + + +Prerequisites: + +The oletest.dll must be registered, for example in the services.rdb, using +regcomp. Then the uno types contained in oletest.rdb (wntmscixx/bin) must be merged +for example in the offapi.rdb. This is done with regmerge. + diff --git a/extensions/test/ole/cppToUno/makefile.mk b/extensions/test/ole/cppToUno/makefile.mk new file mode 100644 index 000000000..e40aa94f3 --- /dev/null +++ b/extensions/test/ole/cppToUno/makefile.mk @@ -0,0 +1,56 @@ +# +# 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 . +# + +PRJ=..$/..$/.. + +PRJNAME=extensions +TARGET=testcppuno +TARGETTYPE=CUI +LIBTARGET=NO + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings --- + +.INCLUDE : settings.mk + +# --- Files --- + +INCPRE+=-I$(ATL_INCLUDE) + + + +APP1TARGET= $(TARGET) +APP1OBJS= $(OBJ)$/testcppuno.obj + +APP1STDLIBS= \ + $(SALLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(USER32LIB) \ + $(KERNEL32LIB) \ + $(OLE32LIB) \ + $(OLEAUT32LIB) \ + $(UUIDLIB) \ + $(COMDLG32LIB) \ + $(GDI32LIB) + +APP1DEF= $(MISC)$/$(APP1TARGET).def + +# --- Targets --- +.INCLUDE : target.mk diff --git a/extensions/test/ole/cppToUno/readme.txt b/extensions/test/ole/cppToUno/readme.txt new file mode 100644 index 000000000..ae0189818 --- /dev/null +++ b/extensions/test/ole/cppToUno/readme.txt @@ -0,0 +1,8 @@ +testcppuno.exe currently tests the conversion of SAFEARRAYs. There is +no output from the program. Just step through the code. + +To run the test, the service oletest.OleTest ( extensions/test/ole/cpnt) +must be in the same directory as the office dlls and it must be registered +at the applicat.rdb. Also the type information must have been merged with +applicat.rdb. The program requires an office to be present. Put testcppuno +into the Office/program folder and run it there. diff --git a/extensions/test/ole/cppToUno/testcppuno.cxx b/extensions/test/ole/cppToUno/testcppuno.cxx new file mode 100644 index 000000000..e64541ed2 --- /dev/null +++ b/extensions/test/ole/cppToUno/testcppuno.cxx @@ -0,0 +1,206 @@ +/* -*- 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 . + */ + + +#pragma warning(disable: 4917) +#if !defined WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <comdef.h> +#include <atlbase.h> +#include <atlcom.h> +#include <stdio.h> +#include <com/sun/star/bridge/ModelDependent.hpp> +#include <com/sun/star/bridge/XBridgeSupplier2.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <oletest/XCallback.hpp> +#include <rtl/process.h> +#include <cppuhelper/servicefactory.hxx> +#include <rtl/string.h> + + +using namespace com::sun::star::lang; +using namespace com::sun::star::uno; +using namespace com::sun::star::bridge; +using namespace com::sun::star::bridge::ModelDependent; +using namespace cppu; + +HRESULT doTest(); +bool incrementMultidimensionalIndex( + sal_Int32 dimensions, + const sal_Int32 * parDimensionLengths, + sal_Int32 * parMultidimensionalIndex); + +int SAL_CALL main( int /*argc*/, char** /*argv*/ ) +{ + HRESULT hr; + if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) + { + printf("CoInitializeEx failed \n"); + return -1; + } + + + if( FAILED(hr=doTest())) + { + _com_error err( hr); + const CHAR * errMsg= err.ErrorMessage(); + MessageBoxA( NULL, errMsg, "Test failed", MB_ICONERROR); + } + + CoUninitialize(); + return 0; +} + + +HRESULT doTest() +{ + HRESULT hr= S_OK; + long j = 0; + SAFEARRAY* par; + CComDispatchDriver disp; + CComVariant result; + CComVariant param1; + CComPtr<IUnknown> spUnkFactory; + if( SUCCEEDED( spUnkFactory.CoCreateInstance(L"com.sun.star.ServiceManager"))) + { + disp= spUnkFactory; + param1= L"oletest.OleTest"; + disp.Invoke1( L"createInstance", ¶m1, &result); + + disp= result.pdispVal; + + // disp contains now oletest.OleTest + + // one dimensional array + par= SafeArrayCreateVector( VT_UI1, 0, 5); + unsigned char arbyte[]= { 1,2,3,4,5}; + for(long i= 0; i < 5;i++) + hr= SafeArrayPutElement( par, &i, &arbyte[i]); + + result.Clear(); + param1.vt= VT_ARRAY| VT_UI1; + param1.byref= par; + disp.Invoke1(L"methodByte", ¶m1, &result); + SafeArrayDestroy( par); + + + // two dimensional array + SAFEARRAYBOUND bounds[2]; + // least significant dimension first, Dimension 1 + bounds[0].cElements= 3; + bounds[0].lLbound= 0; + // Dimension 2 + bounds[1].cElements= 2; + bounds[1].lLbound= 0; + par= SafeArrayCreate( VT_I4, 2, bounds ); + + long uBound1; + long uBound2; + hr= SafeArrayGetUBound( par, 1, &uBound1); + hr= SafeArrayGetUBound( par, 2, &uBound2); + + long index2[2]; + memset( index2, 0, 2 * sizeof( long) ); + long dimLengths[]={3,2}; + + long data; + do + { + data= index2[1] * 3 + index2[0] +1; + hr= SafeArrayPutElement( par, index2, &data); + }while( incrementMultidimensionalIndex( 2, dimLengths, index2) ); + + long* pdata; + long (*dataL)[2][3]; + hr= SafeArrayAccessData( par, (void**)&pdata); + dataL= (long(*)[2][3])pdata; + + for (long i= 0; i < 2; i ++) + { + for(long j= 0; j < 3; j++) + data= (*dataL)[i][j]; + } + hr= SafeArrayUnaccessData(par); + + result.Clear(); + param1.vt= VT_ARRAY | VT_I4; + param1.byref= par; + disp.Invoke1(L"methodSequence", ¶m1, &result); + + SAFEARRAY* arRet= result.parray; + + for(long i= 0; i < 2 ; i++) + { + CComVariant varx; + varx.Clear(); + hr= SafeArrayGetElement( arRet, &i, &varx); + SAFEARRAY* ari= varx.parray; + + for( j= 0; j < 3; j++) + { + CComVariant varj; + varj.Clear(); + hr= SafeArrayGetElement( ari, &j, &varj); + } + + + } + SafeArrayDestroy( par); + } + + return hr; +} + +// left index is least significant +bool incrementMultidimensionalIndex( + sal_Int32 dimensions, + const sal_Int32 * parDimensionLengths, + sal_Int32 * parMultidimensionalIndex) +{ + if( dimensions < 1) + return sal_False; + + bool ret= sal_True; + bool carry= sal_True; // to get into the while loop + + sal_Int32 currentDimension= 0; //most significant is 1 + while( carry) + { + parMultidimensionalIndex[ currentDimension ]++; + // if carryover, set index to 0 and handle carry on a level above + if( parMultidimensionalIndex[ currentDimension] > (parDimensionLengths[ currentDimension] - 1)) + parMultidimensionalIndex[ currentDimension]= 0; + else + carry= sal_False; + + currentDimension ++; + // if dimensions drops below 1 and carry is set than then all indices are 0 again + // this is signalled by returning sal_False + if( currentDimension > dimensions - 1 && carry) + { + carry= sal_False; + ret= sal_False; + } + } + return ret; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/cpptest/cpptest.cxx b/extensions/test/ole/cpptest/cpptest.cxx new file mode 100644 index 000000000..ff083a052 --- /dev/null +++ b/extensions/test/ole/cpptest/cpptest.cxx @@ -0,0 +1,101 @@ +/* -*- 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 . + */ + +// cpptest.cpp : Defines the entry point for the console application. + +#ifdef _MSC_VER +#pragma once +#endif +#pragma warning(disable : 4917) +#include <comdef.h> +#include <atlbase.h> +#include <atlcom.h> + +HRESULT doTest(); + +int main(int /*argc*/, char** /*argv*/) +{ + HRESULT hr; + if (FAILED(hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) + { + printf("CoInitializeEx failed \n"); + return -1; + } + + if (FAILED(hr = doTest())) + { + _com_error err(hr); + const CHAR* errMsg = err.ErrorMessage(); + MessageBoxA(NULL, errMsg, "Test failed", MB_ICONERROR); + } + + CoUninitialize(); + return 0; +} + +HRESULT doTest() +{ + HRESULT hr; + CComPtr<IUnknown> spUnkMgr; + + if (FAILED(hr = spUnkMgr.CoCreateInstance(L"com.sun.star.ServiceManager"))) + return hr; + + IDispatchPtr starManager; + // var starManager=new ActiveXObject("com.sun.star.ServiceManager"); + if (FAILED(hr = starManager.CreateInstance(_T("com.sun.star.ServiceManager")))) + { + fprintf(stderr, "creating ServiceManager failed\n"); + return hr; + } + // var starDesktop=starManager.createInstance("com.sun.star.frame.Desktop"); + _variant_t varP1(L"com.sun.star.frame.Desktop"); + _variant_t varRet; + CComDispatchDriver dispMgr(starManager); + if (FAILED(hr = dispMgr.Invoke1(L"createInstance", &varP1, &varRet))) + { + fprintf(stderr, "createInstance of Desktop failed\n"); + return hr; + } + CComDispatchDriver dispDesk(varRet.pdispVal); + varP1.Clear(); + varRet.Clear(); + // var bOK=new Boolean(true); + + // var noArgs=new Array(); + // var oDoc=starDesktop.loadComponentFromURL("private:factory/swriter", "Test", 40, noArgs); + IDispatchPtr oDoc; + SAFEARRAY* ar = SafeArrayCreateVector(VT_DISPATCH, 0, 0); + _variant_t args[4]; + args[3] = _variant_t(L"private:factory/swriter"); + args[2] = _variant_t(L"Test"); + args[1] = _variant_t((long)40); + args[0].vt = VT_ARRAY | VT_DISPATCH; + args[0].parray = ar; + if (FAILED(hr = dispDesk.InvokeN(L"loadComponentFromURL", args, 4, &varRet))) + { + fprintf(stderr, "loadComponentFromURL failed\n"); + return hr; + } + CComDispatchDriver dispDoc(varRet.pdispVal); + varRet.Clear(); + return S_OK; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/cpptest/makefile.mk b/extensions/test/ole/cpptest/makefile.mk new file mode 100644 index 000000000..984701c15 --- /dev/null +++ b/extensions/test/ole/cpptest/makefile.mk @@ -0,0 +1,55 @@ +# +# 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 . +# + +PRJ=..$/..$/.. + +PRJNAME=extensions +TARGET=cppTest +TARGETTYPE=CUI +LIBTARGET=NO + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings --- + +.INCLUDE : settings.mk + +# --- Files --- + +INCPRE+=-I$(ATL_INCLUDE) + + +APP1TARGET= $(TARGET) +APP1OBJS= $(OBJ)$/cppTest.obj + +APP1STDLIBS= \ + $(SALLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(USER32LIB) \ + $(KERNEL32LIB) \ + $(OLE32LIB) \ + $(OLEAUT32LIB) \ + $(UUIDLIB) \ + $(COMDLG32LIB) \ + comsupp.lib + +APP1DEF= $(MISC)\$(APP1TARGET).def + +# --- Targets --- +.INCLUDE : target.mk diff --git a/extensions/test/ole/cpptest/readme.txt b/extensions/test/ole/cpptest/readme.txt new file mode 100644 index 000000000..0fd339280 --- /dev/null +++ b/extensions/test/ole/cpptest/readme.txt @@ -0,0 +1,4 @@ +Creates the com.sun.star.ServiceManager with CoCreateInstance in a cpp program. +This little program can be used as starting point for further tests. + +It needs uwinapi.dll, which is in the program folder of OOo (URE\bin in OOo 3.0) diff --git a/extensions/test/ole/idl/oletest.idl b/extensions/test/ole/idl/oletest.idl new file mode 100644 index 000000000..b23f20b21 --- /dev/null +++ b/extensions/test/ole/idl/oletest.idl @@ -0,0 +1,301 @@ +/* -*- 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 <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/script/XInvocation.idl> +#include <com/sun/star/beans/XPropertySet.idl> +#include <com/sun/star/lang/XEventListener.idl> + + +module oletest +{ + +interface XTestSequence: com::sun::star::uno::XInterface +{ + sequence<byte> methodByte( [in] sequence<byte> aSeq ); + sequence<float> methodFloat( [in] sequence<float> aSeq); + sequence<double> methodDouble( [in] sequence<double> aSeq); + sequence<boolean> methodBool( [in] sequence<boolean> aSeq); + sequence<short> methodShort( [in] sequence<short> aSeq); + sequence<unsigned short> methodUShort( [in] sequence<unsigned short> aSeq); + sequence<long> methodLong( [in] sequence<long> aSeq); + sequence<unsigned long> methodULong( [in] sequence<unsigned long> aSeq); + sequence<string> methodString( [in] sequence<string> aSeq); + sequence<char> methodChar( [in] sequence<char> aSeq); + sequence<any> methodAny ( [in] sequence<any> aSeq); + sequence<type> methodType ( [in] sequence<type> aSeq); + sequence<com::sun::star::uno::XInterface> methodXInterface ( [in] sequence<com::sun::star::uno::XInterface> aSeq); + sequence< sequence <long> > methodSequence( [in] sequence< sequence< long > > aSeq); + sequence< sequence <sequence <long> > > methodSequence2( [in] sequence< sequence< sequence<long> > > aSeq); + sequence< com::sun::star::lang::XEventListener > methodXEventListeners( [in] sequence<com::sun::star::lang::XEventListener> aSeq); + sequence< sequence< com::sun::star::lang::XEventListener > > methodXEventListenersMul( [in] sequence< sequence< com::sun::star::lang::XEventListener> > aSeq); + + [attribute] sequence<byte> AttrByte; + [attribute] sequence<float> AttrFloat; + [attribute] sequence<double> AttrDouble; + [attribute] sequence<boolean> AttrBool; + [attribute] sequence<short> AttrShort; + [attribute] sequence<unsigned short> AttrUShort; + [attribute] sequence<long> AttrLong; + [attribute] sequence<unsigned long> AttrULong; + [attribute] sequence<string> AttrString; + [attribute] sequence<char> AttrChar; + [attribute] sequence<any> AttrAny; + [attribute] sequence<type> AttrType; + [attribute] sequence< sequence<long> > AttrSequence; + [attribute] sequence< sequence< sequence <long> > > AttrSequence2; + [attribute] sequence< com::sun::star::uno::XInterface > AttrXInterface; + + [attribute] byte AByte; + [attribute] float AFloat; + [attribute] double ADouble; + [attribute] boolean ABool; + [attribute] short AShort; + [attribute] unsigned short AUShort; + [attribute] long ALong; + [attribute] unsigned long AULong; + [attribute] string AString; + [attribute] char AChar; + [attribute] any AAny; + [attribute] type AType; + [attribute] com::sun::star::uno::XInterface AXInterface; + [attribute] com::sun::star::script::XInvocation AXInvocation; + + void testout_methodByte( [out] byte rOut ); + void testout_methodFloat( [out] float rOut); + void testout_methodDouble( [out] double rOut); + void testout_methodBool( [out] boolean rOut); + void testout_methodShort( [out] short rOut); + void testout_methodUShort( [out] unsigned short rOut); + void testout_methodLong( [out] long rOut); + void testout_methodULong( [out] unsigned long rOut); + void testout_methodHyper( [out] hyper rOut); + void testout_methodUHyper( [out] unsigned hyper rOut); + void testout_methodString( [out] string rOut); + void testout_methodChar( [out] char rOut); + void testout_methodAny ( [out] any rOut); + void testout_methodType ( [out] type rOut); + void testout_methodSequence( [out] sequence< long > rOut); + void testout_methodSequence2( [out] sequence < sequence< long > > rOut); + void testout_methodXInterface( [out] com::sun::star::uno::XInterface rOut); + + void testout_methodMulParams1( [out] long rout1, [out] long rout2); + void testout_methodMulParams2( [out] long rout1, [out] long rout2, [out] string rout3); + void testout_methodMulParams3( [in] string sin, [out] string sout); + void testout_methodMulParams4( [in] float in1, [out] float out1, [in] long in2, [out] long out2, [in] long in3); + + void testinout_methodByte( [inout] byte rOut ); + void testinout_methodFloat( [inout] float rOut); + void testinout_methodDouble( [inout] double rOut); + void testinout_methodBool( [inout] boolean rOut); + void testinout_methodShort( [inout] short rOut); + void testinout_methodUShort( [inout] unsigned short rOut); + void testinout_methodLong( [inout] long rOut); + void testinout_methodULong( [inout] unsigned long rOut); + void testinout_methodHyper( [inout] hyper rOut); + void testinout_methodUHyper( [inout] unsigned hyper rOut); + void testinout_methodString( [inout] string rOut); + void testinout_methodChar( [inout] char rOut); + void testinout_methodAny ( [inout] any rOut); + void testinout_methodType ( [inout] type rOut); + void testinout_methodSequence( [inout] sequence< long > rOut); + void testinout_methodSequence2( [inout] sequence < sequence< long > > rOut); + void testinout_methodXInterface( [inout] com::sun::star::script::XInvocation rOut); + void testinout_methodXInterface2( [inout] com::sun::star::uno::XInterface rOut); + + any methodAnyTest1( [in] any rIn); + [attribute] any AttrAny2; + +}; +interface XTestStruct: com::sun::star::uno::XInterface +{ +// Method taking structs as arguments + void methodStruct( [in] com::sun::star::beans::Property aProp); +// Methods returning structs + com::sun::star::beans::Property retMethodStruct(); +// Attributes as structs + [attribute] com::sun::star::beans::Property AttrStruct; + + com::sun::star::beans::Property methodStruct2( [in] com::sun::star::beans::Property aProp); +}; + + +struct SimpleStruct +{ + string message; +}; + +interface XTestInParameters: com::sun::star::uno::XInterface +{ + byte in_methodByte( [in] byte rIn ); + float in_methodFloat( [in] float rIn); + double in_methodDouble( [in] double rIn); + boolean in_methodBool( [in] boolean rIn); + short in_methodShort( [in] short rIn); + unsigned short in_methodUShort( [in] unsigned short rIn); + long in_methodLong( [in] long rIn); + unsigned long in_methodULong( [in] unsigned long rIn); + hyper in_methodHyper( [in] hyper rIn); + unsigned hyper in_methodUHyper( [in] unsigned hyper rIn); + string in_methodString( [in] string rIn); + char in_methodChar( [in] char rIn); + any in_methodAny ( [in] any rIn); + type in_methodType ( [in] type rIn); + com::sun::star::uno::XInterface in_methodXInterface([in] com::sun::star::uno::XInterface rIn); + com::sun::star::script::XInvocation in_methodInvocation( [in] com::sun::star::script::XInvocation inv); + SimpleStruct in_methodStruct( [in] SimpleStruct aStruct); + void in_methodAll( [in] byte b, [in] float f, [in] double d, [in] boolean abool, [in]short sh, + [in] unsigned short us, [in] long l, [in] unsigned long ul, + [in] string s, [in] char c, [in] any a, [in] type t, [in] com::sun::star::script::XInvocation inv); +}; + + +enum SimpleEnum +{ + A, + B, + C +}; + +interface XTestOther: com::sun::star::uno::XInterface +{ + // Any test + void other_methodAnyIn( [in] any rAny); + void other_methodAnyOut( [out] any rAny); + any other_methodAnyRet(); + void in_float( [in] float val); + //typeInAny determines what type must be in rAny. If rAny contains + //a different type then an exception is being thrown + any other_methodAny([in] any rAny, [in] string typeInAny); +}; + + +interface XSimple: com::sun::star::uno::XInterface +{ + void func( [in] string message); + string getName(); +}; + +interface XSimple2: com::sun::star::uno::XInterface +{ + void func2( [in] string message); + string getName2(); +}; + +interface XSimple3: com::sun::star::uno::XInterface +{ + void func3( [in] string message); + string getName3(); +}; + + +interface XCallback: com::sun::star::uno::XInterface +{ + void func1(); + oletest::XSimple returnInterface(); + void outInterface( [out] oletest::XSimple outInterface); + void outStruct( [out] oletest::SimpleStruct outStruct); + void outEnum( [out] oletest::SimpleEnum outEnum); + void outSeqAny( [out] sequence<any> outSeqAny); + void outSeqByte( [out] sequence<byte> outVal); + void outAny( [out] any outAny); + void outBool( [out] boolean outBool); + void outChar( [out] char outChar); + void outString( [out] string outString); + void outFloat( [out] float outFloat); + void outDouble( [out] double outDouble); + void outByte( [out] byte outByte); + void outShort( [out] short outShort); + void outLong( [out] long outLong); + void outValuesMixed( [in] long lval, [out] long outval, [in] string sval); + void outValuesAll( [out] oletest::XSimple outInterface, + [out] SimpleStruct outStruct , + [out] SimpleEnum outEnum, + [out] sequence<any> outSeqAny, + [out] any outAny, + [out] boolean outBool, + [out] char outChar, + [out] string outString, + [out] float outFloat, + [out] double outDouble, + [out] byte outByte, + [out] short outShort, + [out] long outLong); +// IN OUT parameters + void inoutInterface( [inout] oletest::XSimple inoutVal); + void inoutStruct( [inout] oletest::SimpleStruct inoutVal); + void inoutEnum( [inout] oletest::SimpleEnum inoutVal); + void inoutSeqAny( [inout] sequence<any> inoutVal); + void inoutAny( [inout] any inoutVal); + void inoutBool( [inout] boolean inoutVal); + void inoutChar( [inout] char inoutVal); + void inoutString( [inout] string inoutVal); + void inoutFloat( [inout] float inoutVal); + void inoutDouble( [inout] double inoutVal); + void inoutByte( [inout] byte inoutVal); + void inoutShort( [inout] short inoutVal); + void inoutLong( [inout] long inoutVal); + + void inoutValuesAll( [inout] oletest::XSimple aXSimple, + [inout] oletest::SimpleStruct aStruct, + [inout] oletest::SimpleEnum aEnum, + [inout] sequence<any> aSeq, + [inout] any aAny, + [inout] boolean aBool, + [inout] char aChar, + [inout] string aString, + [inout] float aFloat, + [inout] double aDouble, + [inout] byte aByte, + [inout] short aShort, + [inout] long aLong); + + // IN parameter + + void inValues( [in] char aChar, [in] long aLong, [in] string aString); + void inSeqByte( [in] sequence<byte> val); + void inSeqXEventListener( [in] sequence<com::sun::star::lang::XEventListener> listener, [in] + sequence<com::sun::star::lang::EventObject> events); + + // Attributes + [attribute] oletest::XSimple simple; + + + + +}; + +interface XTestInterfaces: com::sun::star::uno::XInterface +{ + // Any test + void testInterface( [in] oletest::XCallback xCallback, [in] long mode); + void testInterface2( [in] oletest::XSimple xSimple, [in] long mode); +}; + +interface XIdentity: com::sun::star::uno::XInterface +{ + void setObject([in] com::sun::star::uno::XInterface val); + boolean isSame( [in] com::sun::star::uno::XInterface val); + + com::sun::star::uno::XInterface getThis(); +}; + +}; // oletest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unloading/makefile.mk b/extensions/test/ole/unloading/makefile.mk new file mode 100644 index 000000000..53c0b3d89 --- /dev/null +++ b/extensions/test/ole/unloading/makefile.mk @@ -0,0 +1,61 @@ +# +# 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 . +# +PRJ=..$/..$/.. + +PRJNAME= extensions +TARGET= unloadtest +TARGETTYPE=CUI +COMP1TYPELIST=$(TARGET1) + +ENABLE_EXCEPTIONS=TRUE + +USE_DEFFILE= TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# ------------------------------------------------------------------ + +APP1NOSAL=TRUE + +APP1TARGET= $(TARGET) + +APP1OBJS= $(OBJ)$/unloadTest.obj + +APP1STDLIBS= \ + $(SALLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) + +# all: \ +# $(BINDIR) \ +# $(BINDIR)$/test.ini \ +# ALLTAR + +# $(BINDIR) : +# @@-$(MKDIR) $(BINDIR) + +# $(BINDIR)$/test.ini : .$/unloadtest.ini +# -$(GNUCOPY) .$/unloadtest.ini $(BINDIR) + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + diff --git a/extensions/test/ole/unloading/readme.txt b/extensions/test/ole/unloading/readme.txt new file mode 100644 index 000000000..d8b467ddf --- /dev/null +++ b/extensions/test/ole/unloading/readme.txt @@ -0,0 +1,6 @@ +This project builds a unloadtest.exe.
+
+Function: Tests if the unloading mechanism works with the olebrdg.dll.
+In several tests, all services are created and destroyed and rtl_unloadUnusedModules is called.
+
+Usage: copy into the <Office>\program directory and run there.
diff --git a/extensions/test/ole/unloading/unloadTest.cxx b/extensions/test/ole/unloading/unloadTest.cxx new file mode 100644 index 000000000..b6825fad2 --- /dev/null +++ b/extensions/test/ole/unloading/unloadTest.cxx @@ -0,0 +1,199 @@ +/* -*- 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 <osl/module.hxx> +#include <osl/time.h> +#include <rtl/ustring.hxx> +#include <cppuhelper/factory.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/bootstrap.hxx> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/registry/XSimpleRegistry.hpp> + +#include <stdio.h> + +using namespace ::osl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::cppu; +using namespace ::com::sun::star::registry; + + +sal_Bool test1(); +sal_Bool test2(); +sal_Bool test3(); +sal_Bool test4(); + +int main(int, char**) +{ + sal_Bool bTest1= test1(); + sal_Bool bTest2= test2(); + sal_Bool bTest3= test3(); + sal_Bool bTest4= test4(); + + if( bTest1 && bTest2 && bTest3 && bTest4) + printf("\n#########################\n Test was successful\n#######################\n"); + + return 0; +} + +sal_Bool test1() +{ + printf("\n Test1: com.sun.star.bridge.oleautomation.BridgeSupplier\n"); + Reference<XSimpleRegistry> xreg= createSimpleRegistry(); + xreg->open( OUString("services.rdb"), + sal_False, sal_False ); + + Reference< XComponentContext > context= bootstrap_InitialComponentContext(xreg); + Reference<XMultiComponentFactory> fac= context->getServiceManager(); + OUString sService1("com.sun.star.bridge.oleautomation.BridgeSupplier"); + Reference<XInterface> xint1= fac->createInstanceWithContext( sService1, context); + + OUString sModule("oleautobridge.uno" SAL_DLLEXTENSION); + oslModule hMod= osl_loadModule( sModule.pData, 0); + osl_unloadModule( hMod); + + rtl_unloadUnusedModules( NULL); + + OUString sFactoryFunc("component_getFactory"); + void* pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); + // true, instance alive + sal_Bool bTest1= pSymbol ? sal_True : sal_False; + + xint1=0; + rtl_unloadUnusedModules( NULL); + pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); + sal_Bool bTest2= pSymbol ? sal_False : sal_True; + + Reference<XComponent> xcomp( context, UNO_QUERY); + xcomp->dispose(); + + return bTest2 && bTest1; +} + +sal_Bool test2() +{ + printf("Test2: com.sun.star.bridge.OleBridgeSupplierVar1\n"); + Reference<XSimpleRegistry> xreg= createSimpleRegistry(); + xreg->open( OUString("services.rdb"), + sal_False, sal_False ); + + Reference< XComponentContext > context= bootstrap_InitialComponentContext(xreg); + Reference<XMultiComponentFactory> fac= context->getServiceManager(); + OUString sService2("com.sun.star.bridge.OleBridgeSupplierVar1"); + Reference<XInterface> xint= fac->createInstanceWithContext( sService2, context); + + OUString sModule("oleautobridge.uno" SAL_DLLEXTENSION); + oslModule hMod= osl_loadModule( sModule.pData, 0); + osl_unloadModule( hMod); + + rtl_unloadUnusedModules( NULL); + OUString sFactoryFunc("component_getFactory"); + void* pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); + // true, instance alive + sal_Bool bTest1= pSymbol ? sal_True : sal_False; + + xint=0; + rtl_unloadUnusedModules( NULL); + pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); + sal_Bool bTest2= pSymbol ? sal_False : sal_True; + + Reference<XComponent> xcomp( context, UNO_QUERY); + xcomp->dispose(); + return bTest1 && bTest2; +} + +sal_Bool test3() +{ + printf("Test3: com.sun.star.bridge.oleautomation.Factory\n"); + Reference<XSimpleRegistry> xreg= createSimpleRegistry(); + xreg->open( OUString("services.rdb"), + sal_False, sal_False ); + + Reference< XComponentContext > context= bootstrap_InitialComponentContext(xreg); + + Reference<XMultiComponentFactory> fac= context->getServiceManager(); + OUString sService("com.sun.star.bridge.oleautomation.Factory"); + Reference<XInterface> xint= fac->createInstanceWithContext( sService, context); + + + OUString sModule("oleautobridge.uno" SAL_DLLEXTENSION); + oslModule hMod= osl_loadModule( sModule.pData, 0); + osl_unloadModule( hMod); + + rtl_unloadUnusedModules( NULL); + OUString sFactoryFunc("component_getFactory"); + void* pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); + // true, instance alive + sal_Bool bTest1= pSymbol ? sal_True : sal_False; + + xint=0; + rtl_unloadUnusedModules( NULL); + pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); + sal_Bool bTest2= pSymbol ? sal_False : sal_True; + + Reference<XComponent> xcomp( context, UNO_QUERY); + xcomp->dispose(); + + return bTest1 && bTest2; +} + +sal_Bool test4() +{ + void* pSymbol= NULL; + sal_Bool bTest1= sal_False; + sal_Bool bTest2= sal_False; + oslModule hMod= NULL; + OUString sModule("oleautobridge.uno" SAL_DLLEXTENSION); + OUString sFactoryFunc("component_getFactory"); + { + printf("Test4: com.sun.star.bridge.oleautomation.ApplicationRegistration\n"); + Reference<XSimpleRegistry> xreg= createSimpleRegistry(); + xreg->open( OUString("services.rdb"), + sal_False, sal_False ); + + Reference< XComponentContext > context= bootstrap_InitialComponentContext(xreg); + Reference<XMultiComponentFactory> fac= context->getServiceManager(); + OUString sService4("com.sun.star.bridge.oleautomation.ApplicationRegistration"); + Reference<XInterface> xint= fac->createInstanceWithContext( sService4, context); + + hMod= osl_loadModule( sModule.pData, 0); + osl_unloadModule( hMod); + + rtl_unloadUnusedModules( NULL); + void* pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); + // true, instance alive + bTest1= pSymbol ? sal_True : sal_False; + // ApplicationRegistration is a one-instance-service, therefore kill service manager first + Reference<XComponent> xcomp( context, UNO_QUERY); + xcomp->dispose(); + + } + rtl_unloadUnusedModules( NULL); + pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); + bTest2= pSymbol ? sal_False : sal_True; + + return bTest1 && bTest2; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp b/extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp new file mode 100644 index 000000000..fcefb8f0c --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp @@ -0,0 +1,28 @@ +/* -*- 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 . + */ +// stdafx.cpp : source file that includes just the standard includes +// Test.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/Test/StdAfx.h b/extensions/test/ole/unoTocomCalls/Test/StdAfx.h new file mode 100644 index 000000000..0274335ce --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/Test/StdAfx.h @@ -0,0 +1,47 @@ +/* -*- 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 . + */ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently + +#if !defined(AFX_STDAFX_H__180FF568_6F5C_11D4_8330_005004526AB4__INCLUDED_) +#define AFX_STDAFX_H__180FF568_6F5C_11D4_8330_005004526AB4__INCLUDED_ + +#ifdef _MSC_VER +#pragma once +#endif + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include <stdio.h> +#include <windows.h> +#include <comdef.h> +#include <atlbase.h> +extern CComModule _Module; +#include <atlcom.h> +#include <atlimpl.cpp> + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__180FF568_6F5C_11D4_8330_005004526AB4__INCLUDED_) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.cpp b/extensions/test/ole/unoTocomCalls/Test/Test.cpp new file mode 100644 index 000000000..b10900dbc --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/Test/Test.cpp @@ -0,0 +1,240 @@ +/* -*- 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 . + */ +// Test.cpp : Defines the entry point for the console application. + + +#include "stdafx.h" +#include "../XCallback_Impl/XCallback_Impl.h" +#include "../XCallback_Impl/XCallback_Impl_i.c" + +CComModule _Module; +BEGIN_OBJECT_MAP(ObjectMap) +END_OBJECT_MAP() + +HRESULT doTest(); + +int main(int argc, char* argv[]) +{ + 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); + } + + + _Module.Term(); + CoUninitialize(); + + + return 0; +} + + +HRESULT doTest() +{ + HRESULT hr= S_OK; + + CComPtr<IUnknown> spUnk; + hr= spUnk.CoCreateInstance(L"com.sun.star.ServiceManager"); + if( FAILED( hr)) + return hr; + + CComDispatchDriver manager( spUnk); + CComVariant param( L"oletest.OleTest"); + CComVariant retVal; + hr= manager.Invoke1((LPCOLESTR)L"createInstance", ¶m, &retVal ); + + CComDispatchDriver oletest( retVal.punkVal); + + spUnk.Release(); + + hr= spUnk.CoCreateInstance(L"XCallback_Impl.Callback"); + if( FAILED( hr)) + return hr; + + CComQIPtr<IDispatch> paramDisp(spUnk); + + + + // out parameters + + CComVariant param1( paramDisp); + CComVariant param2(1); + + // oletest calls XCallback::func1 + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::returnInterface + param2= 2; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outInterface + param2= 3; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outStruct + param2= 4; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outEnum + param2= 5; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outSeqAny + param2= 6; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outAny + param2= 7; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outBool + param2= 8; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outChar + param2= 9; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outString + param2= 10; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outFloat + param2= 11; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outDouble + param2= 12; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outByte + param2= 13; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outShort + param2= 14; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outLong + param2= 15; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outValuesMixed + param2= 30; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::outValuesAll + param2= 31; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + + // XCallback::outSeqByte + // Does not work currently because Sequences are always converted to + // SAFEARRAY( VARIANT) + // param2= 32; + // hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + + + // in / out parameters + + // XCallback::inoutInterface + param2= 100; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutStruct + param2= 101; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutEnum + param2= 102; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutSeqAny + param2= 103; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutAny + param2= 104; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutBool + param2= 105; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutChar + param2= 106; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutString + param2= 107; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutFloat + param2= 108; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutDouble + param2= 109; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutByte + param2= 110; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutShort + param2= 111; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutLong + param2= 112; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutValuesAll + param2=120; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + + // in parameters + + // XCallback::inValues + param2= 200; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inSeqByte + // SAFEARRAY( VARIANT) + param2= 201; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + //XCallback::inSeqXEventListener + param2= 202; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + + // The UNO test component OleTest calls on XCallback_Impl.Callback directly + // that is the COM object has not been past a parameter but rather OleTest + // creates the COM object itself + + // XCallback::outValuesAll + // does not work currently + param2= 300; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutValuesAll + param2= 301; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + // XCallback::inoutValues + param2= 302; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + + // XCallback::inValues + param2= 303; + hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); + + // Test a COM object which implements several interfaces. + + + CComQIPtr<IDispatch> dispSimple; + hr= dispSimple.CoCreateInstance(L"XCallback_Impl.Simple"); + CComVariant varSimple( dispSimple); + param2= 0; + hr= oletest.Invoke2(L"testInterface2", &varSimple, ¶m2); + + return hr; +} +// VARIANT CComVariant VT_UNKNOWN VT_DISPATCH V_UI1 CComDispatchDriver WINAPI + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.dsp b/extensions/test/ole/unoTocomCalls/Test/Test.dsp new file mode 100644 index 000000000..d9ef4e865 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/Test/Test.dsp @@ -0,0 +1,114 @@ +# Microsoft Developer Studio Project File - Name="Test" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=Test - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Test.mak" CFG="Test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Test - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "Test - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Test - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "Test - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "Test - Win32 Release" +# Name "Test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\Test.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project + diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.sln b/extensions/test/ole/unoTocomCalls/Test/Test.sln new file mode 100644 index 000000000..428b73625 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/Test/Test.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test.vcproj", "{13AE4BE8-2467-4B35-800F-154379D54C24}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {13AE4BE8-2467-4B35-800F-154379D54C24}.Debug|Win32.ActiveCfg = Debug|Win32
+ {13AE4BE8-2467-4B35-800F-154379D54C24}.Debug|Win32.Build.0 = Debug|Win32
+ {13AE4BE8-2467-4B35-800F-154379D54C24}.Release|Win32.ActiveCfg = Release|Win32
+ {13AE4BE8-2467-4B35-800F-154379D54C24}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.vcproj b/extensions/test/ole/unoTocomCalls/Test/Test.vcproj new file mode 100644 index 000000000..f31d1ffc4 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/Test/Test.vcproj @@ -0,0 +1,247 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="Test"
+ ProjectGUID="{13AE4BE8-2467-4B35-800F-154379D54C24}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Test.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Debug/Test.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Debug/Test.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/Test.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Test.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Release/Test.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Release/Test.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Release/Test.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath=".\StdAfx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Test.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\StdAfx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs new file mode 100644 index 000000000..bc1525d7e --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs @@ -0,0 +1,27 @@ +HKCR +{ + XCallback_Impl.Basic.1 = s 'Basic Class' + { + CLSID = s '{A0F04CB7-8494-11D4-8335-005004526AB4}' + } + XCallback_Impl.Basic = s 'Basic Class' + { + CLSID = s '{A0F04CB7-8494-11D4-8335-005004526AB4}' + CurVer = s 'XCallback_Impl.Basic.1' + } + NoRemove CLSID + { + ForceRemove {A0F04CB7-8494-11D4-8335-005004526AB4} = s 'Basic Class' + { + ProgID = s 'XCallback_Impl.Basic.1' + VersionIndependentProgID = s 'XCallback_Impl.Basic' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}' + } + } +} + diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs new file mode 100644 index 000000000..ee718304d --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs @@ -0,0 +1,27 @@ +HKCR +{ + XCallback_Impl.BasicTest.1 = s 'BasicTest Class' + { + CLSID = s '{A0F04CBD-8494-11D4-8335-005004526AB4}' + } + XCallback_Impl.BasicTest = s 'BasicTest Class' + { + CLSID = s '{A0F04CBD-8494-11D4-8335-005004526AB4}' + CurVer = s 'XCallback_Impl.BasicTest.1' + } + NoRemove CLSID + { + ForceRemove {A0F04CBD-8494-11D4-8335-005004526AB4} = s 'BasicTest Class' + { + ProgID = s 'XCallback_Impl.BasicTest.1' + VersionIndependentProgID = s 'XCallback_Impl.BasicTest' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}' + } + } +} + diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp new file mode 100644 index 000000000..c60a18219 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp @@ -0,0 +1,505 @@ +/* -*- 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 . + */ +// Callback.cpp : Implementation of CCallback +#include "stdafx.h" +#include "XCallback_Impl.h" +#include "Callback.h" + + +// CCallback + + +STDMETHODIMP CCallback::func1() +{ + MessageBox( NULL, _T("Callback::func1 called"),_T(""), MB_OK); + return S_OK; +} + +STDMETHODIMP CCallback::returnInterface(IDispatch **ppdisp) +{ + if( ! ppdisp) + return E_POINTER; + CComPtr<IDispatch> spDisp; + spDisp.CoCreateInstance( L"XCallback_Impl.Simple"); + *ppdisp= spDisp; + (*ppdisp)->AddRef(); + return S_OK; +} + +STDMETHODIMP CCallback::outInterface(IDispatch **ppdisp) +{ +// return S_OK; + if( ! ppdisp) + return E_POINTER; + CComPtr<IDispatch> spDisp; + spDisp.CoCreateInstance( L"XCallback_Impl.Simple"); + *ppdisp= spDisp; + (*ppdisp)->AddRef(); + +// MessageBox( NULL, _T("CCallback::outInterface"), _T(""), MB_OK); + return S_OK; +} + +STDMETHODIMP CCallback::outValuesMixed(long val, long *pval, BSTR string) +{ + USES_CONVERSION; + char buff[1024]; + *pval = val+1; + sprintf( buff, "param1: %d, param2 out: %d, param3: %S", val, *pval, string); + MessageBox( NULL, A2T(buff), A2T("XCallback_Impl.Callback"), MB_OK); + return S_OK; +} + + +STDMETHODIMP CCallback::outValuesAll( + /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdisp, + /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppSimpleStruct, + /* [out] */ long __RPC_FAR *aSimpleEnum, + /* [out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *outSeq, + /* [out] */ VARIANT __RPC_FAR *varAny, + /* [out] */ VARIANT_BOOL __RPC_FAR *aBool, + /* [out] */ short __RPC_FAR *aChar, + /* [out] */ BSTR __RPC_FAR *aString, + /* [out] */ float __RPC_FAR *aFloat, + /* [out] */ double __RPC_FAR *aDouble, + /* [out] */ unsigned char __RPC_FAR *aByte, + /* [out] */ short __RPC_FAR *aShort, + /* [out] */ long __RPC_FAR *aLong) +//) +{ +// if( ! ppdisp || ! ppSimpleStruct || ! aSimpleEnum || +// ! outSeq || !varAny ||! aBool || ! aChar || +// ! aString || ! aFloat || ! aDouble || ! aByte || +// ! aShort || ! aLong || ! aUShort || ! aULong) +// return E_POINTER; + + HRESULT hr=S_OK; + hr= outInterface( ppdisp); + hr= outStruct( ppSimpleStruct); + hr= outEnum( aSimpleEnum); + hr= outSeqAny( outSeq); + hr= outAny( varAny); + hr= outBool( aBool); + hr= outChar( aChar); + hr= outString( aString); + hr= outFloat( aFloat); + hr= outDouble( aDouble); + hr= outByte( aByte); + hr= outShort( aShort); + hr= outLong( aLong); + return hr; +} + +STDMETHODIMP CCallback::outStruct(IDispatch **outStruct) +{ +// return S_OK; + if( !outStruct) + return E_POINTER; + HRESULT hr= E_FAIL; +// MessageBox( NULL, _T("CCallback::outStruct"), _T(""), MB_OK); + + CComPtr<IDispatch> _dispMgr; + if( SUCCEEDED(hr= _dispMgr.CoCreateInstance(L"com.sun.star.ServiceManager"))) + { + CComDispatchDriver manager( _dispMgr); + CComVariant param1(L"com.sun.star.reflection.CoreReflection"); + CComVariant varRet; + hr= manager.Invoke1( L"createInstance", ¶m1, &varRet); + + CComDispatchDriver reflection( varRet.pdispVal); + param1= L"oletest.SimpleStruct"; + varRet.Clear(); + hr= reflection.Invoke1( L"forName", ¶m1, &varRet); + + CComDispatchDriver classSimpleStruct( varRet.pdispVal); + + CComPtr<IDispatch> dispStruct; + param1.vt= VT_DISPATCH | VT_BYREF; + param1.ppdispVal= &dispStruct; + if( SUCCEEDED( hr= classSimpleStruct.Invoke1(L"createObject", ¶m1))) + { + // Set the value + CComDispatchDriver simpleStruct( dispStruct); + param1=L" this is a property string"; + hr= simpleStruct.PutPropertyByName(L"message", ¶m1); + *outStruct= dispStruct; + (*outStruct)->AddRef(); + hr= S_OK; + } + } + return hr; +} + +STDMETHODIMP CCallback::outEnum(long *outEnum) +{ + if( !outEnum) + return E_POINTER; + *outEnum= 1; + return S_OK; +} + +STDMETHODIMP CCallback::outSeqAny(LPSAFEARRAY* outSeq) +{ +// _CrtDbgBreak(); + SAFEARRAY* pArr= SafeArrayCreateVector( VT_VARIANT, 0, 3); + CComVariant var[3]; + var[0]=L" variant 0"; + var[1]=L" variant 1"; + var[2]=L"variant 2"; + for( long i=0; i<3; i++) + { + SafeArrayPutElement( pArr, &i, (void*)&var[i]); + } + + *outSeq= pArr; + return S_OK; +} + +// ATLASSERT //VT_EMPTY + + +STDMETHODIMP CCallback::outAny(VARIANT *outAny) +{ + if( ! outAny) + return E_POINTER; + outAny->vt= VT_BSTR; + outAny->bstrVal= SysAllocString( L"This is a string in a VARIANT"); + + return S_OK; +} + +STDMETHODIMP CCallback::outBool(VARIANT_BOOL *outBool) +{ + if( ! outBool) + return E_POINTER; + *outBool= VARIANT_TRUE; + return S_OK; +} + +STDMETHODIMP CCallback::outChar(short *outChar) +{ + if( !outChar) + return E_POINTER; + *outChar= (short)L'A'; + return S_OK; +} + +STDMETHODIMP CCallback::outString(BSTR *outString) +{ + if( !outString) + return E_POINTER; + *outString= SysAllocString(L"This is a BSTR"); + return S_OK; +} + +STDMETHODIMP CCallback::outFloat(float *outFloat) +{ + if( !outFloat) + return E_POINTER; + *outFloat= 3.14f; + return S_OK; +} + +STDMETHODIMP CCallback::outDouble(double *outDouble) +{ + if(!outDouble) + return E_POINTER; + + *outDouble= 3.145; + return S_OK; +} + + + +STDMETHODIMP CCallback::outShort(short *outShort) +{ + if(!outShort) + return E_POINTER; + *outShort= -1; + return S_OK; +} + +STDMETHODIMP CCallback::outLong(long *outLong) +{ + if(!outLong) + return E_POINTER; + *outLong= 0xffffffff; + return S_OK; +} + + + +STDMETHODIMP CCallback::outByte(unsigned char* outByte) +{ + if(!outByte) + return E_POINTER; + *outByte= 0xff; + return S_OK; +} + +STDMETHODIMP CCallback::inoutInterface(IDispatch **ppdisp) +{ + if( !ppdisp) + return E_POINTER; + CComDispatchDriver disp( *ppdisp); + CComVariant param1(L""); + disp.Invoke1(L"func", ¶m1); + + (*ppdisp)->Release(); + + CComPtr<IDispatch> outDisp; + outDisp.CoCreateInstance( L"XCallback_Impl.Simple"); + *ppdisp= outDisp; + (*ppdisp)->AddRef(); + + return S_OK; +} + +STDMETHODIMP CCallback::inoutStruct(IDispatch **inoutVal) +{ + if( !inoutVal) + return E_POINTER; + HRESULT hr= S_OK; + USES_CONVERSION; + CComVariant var; + CComDispatchDriver disp( *inoutVal); + + hr= disp.GetPropertyByName(L"message", &var); + MessageBox( NULL, W2T(var.bstrVal), _T("XCallback_Impl.Callback"), MB_OK); + + (*inoutVal)->Release(); + + CComDispatchDriver dispStruct; + hr= outStruct( &dispStruct.p); + var.Clear(); + var= L"This struct was created in XCallback_Imp.Callback"; + hr= dispStruct.PutPropertyByName(L"message", &var); + + *inoutVal= dispStruct; + (*inoutVal)->AddRef(); + return hr; +} + +STDMETHODIMP CCallback::inoutEnum(long *inoutVal) +{ + if( !inoutVal) + return E_POINTER; + *inoutVal= *inoutVal+1; + + return S_OK; +} + +STDMETHODIMP CCallback::inoutSeqAny(LPSAFEARRAY *pArray) +{ + if( !pArray) + return E_POINTER; + HRESULT hr= S_OK; + long lbound=0; + long ubound=0; + hr= SafeArrayGetLBound( *pArray, 1, &lbound); + hr= SafeArrayGetUBound( *pArray, 1, &ubound); + long count= ubound - lbound + 1; + + // the Array is supposet to contain variants + CComVariant var; + for( long i=0; i<count; i++) + { + var.Clear(); + hr= SafeArrayGetElement( *pArray, &i, (void*)&var); + } + + SafeArrayDestroy( *pArray); + + outSeqAny( pArray); + return S_OK; +} + +STDMETHODIMP CCallback::inoutAny(VARIANT *inoutVal) +{ + if( !inoutVal) + return E_POINTER; + USES_CONVERSION; + if( inoutVal->vt= VT_BSTR) + MessageBox( NULL, W2T( inoutVal->bstrVal), _T("XCallback_Impl.Callback"), MB_OK); + + VariantClear( inoutVal); + inoutVal->vt= VT_BSTR; + inoutVal->bstrVal=SysAllocString( L" [string] XCallback_Impl.Callback inoutAny"); + return S_OK; +} + +STDMETHODIMP CCallback::inoutBool(VARIANT_BOOL *inoutVal) +{ + if( !inoutVal) + return E_POINTER; + + *inoutVal= *inoutVal == VARIANT_TRUE ? VARIANT_FALSE : VARIANT_TRUE; + return S_OK; +} + +STDMETHODIMP CCallback::inoutChar(short *inoutVal) +{ + if( !inoutVal) + return E_POINTER; + USES_CONVERSION; + char buff[256]; + sprintf( buff, "character value: %C", *inoutVal); + MessageBox( NULL, A2T(buff), _T("XCallback_Impl.Callback"), MB_OK); + *inoutVal= L'B'; + return S_OK; +} + +STDMETHODIMP CCallback::inoutString(BSTR *inoutVal) +{ + if( !inoutVal) + return E_POINTER; + USES_CONVERSION; + MessageBox( NULL, W2T(*inoutVal), _T("XCallback_Impl.Callback"), MB_OK); + SysFreeString(*inoutVal); + *inoutVal= SysAllocString(L"a string from XCallback_Impl.Callback"); + + return S_OK; +} + +STDMETHODIMP CCallback::inoutFloat(float *inoutVal) +{ + if( !inoutVal) + return E_POINTER; + *inoutVal = *inoutVal+1; + return S_OK; +} + +STDMETHODIMP CCallback::inoutDouble(double *inoutVal) +{ + if( !inoutVal) + return E_POINTER; + *inoutVal= *inoutVal+1; + return S_OK; +} + +STDMETHODIMP CCallback::inoutByte(unsigned char *inoutVal) +{ + if( !inoutVal) + return E_POINTER; + *inoutVal= 0xff; + return S_OK; +} + +STDMETHODIMP CCallback::inoutShort(short *inoutVal) +{ + if( !inoutVal) + return E_POINTER; + *inoutVal= -1; + return S_OK; +} + +STDMETHODIMP CCallback::inoutLong(long* inoutVal) +{ + if( !inoutVal) + return E_POINTER; + *inoutVal= 0xffffffff; + return S_OK; +} + +STDMETHODIMP CCallback::inoutValuesAll( + /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aXSimple, + /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aStruct, + /* [out][in] */ long __RPC_FAR *aEnum, + /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *aSeq, + /* [out][in] */ VARIANT __RPC_FAR *aAny, + /* [out][in] */ VARIANT_BOOL __RPC_FAR *aBool, + /* [out][in] */ short __RPC_FAR *aChar, + /* [out][in] */ BSTR __RPC_FAR *aString, + /* [out][in] */ float __RPC_FAR *aFloat, + /* [out][in] */ double __RPC_FAR *aDouble, + /* [out][in] */ unsigned char __RPC_FAR *aByte, + /* [out][in] */ short __RPC_FAR *aShort, + /* [out][in] */ long __RPC_FAR *aLong) +{ + inoutInterface( aXSimple); + inoutStruct( aStruct); + inoutEnum( aEnum); + inoutSeqAny( aSeq); + inoutAny( aAny); + inoutBool( aBool); + inoutChar( aChar); + inoutString( aString); + inoutFloat( aFloat); + inoutDouble( aDouble); + inoutByte( aByte); + inoutShort( aShort); + inoutLong( aLong); + + return S_OK; +} + + +STDMETHODIMP CCallback::inValues(short aChar, long aLong, BSTR aString) +{ + USES_CONVERSION; + wchar_t _char= (wchar_t) aChar; + char buff[1024]; + sprintf( buff, "Parameters: char= %C, long= %d, string= %s", _char, aLong, W2A(aString)); + MessageBox( NULL, A2T(buff), _T("XCallback_Impl.Callback"), MB_OK); + return S_OK; +} + +STDMETHODIMP CCallback::outSeqByte(LPSAFEARRAY * outVal) +{ + // TODO: Add your implementation code here + + return S_OK; +} + +STDMETHODIMP CCallback::inSeqByte( LPSAFEARRAY listeners) +{ + + return S_OK; +} + +STDMETHODIMP CCallback::inSeqXEventListener( LPSAFEARRAY listeners, LPSAFEARRAY events) +{ + HRESULT hr= S_OK; + long ubound= 0; + long lbound= 0; + long count= 0; + hr= SafeArrayGetUBound( listeners, 1, &ubound); + hr= SafeArrayGetLBound( listeners, 1, &lbound); + count= ubound - lbound +1; + + // We assume that the count of EventObjects in events is the same + for( long i = 0; i < count; i++) + { + CComVariant varListener; + CComVariant varEvent; + hr= SafeArrayGetElement( listeners, &i, &varListener); + hr= SafeArrayGetElement( events, &i, &varEvent); + if( varListener.vt == VT_DISPATCH && varEvent.vt == VT_DISPATCH) + { + CComDispatchDriver disp( varListener.pdispVal); + hr= disp.Invoke1(L"disposing", &varEvent); + } + + } + + return S_OK; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h new file mode 100644 index 000000000..941d1202f --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h @@ -0,0 +1,126 @@ +/* -*- 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 . + */ +// Callback.h : Declaration of the CCallback + +#pragma once + +#include "resource.h" + + +// CCallback +class ATL_NO_VTABLE CCallback : + public CComObjectRootEx<CComSingleThreadModel>, + public CComCoClass<CCallback, &CLSID_Callback>, + public IDispatchImpl<ICallback, &IID_ICallback, &LIBID_XCALLBACK_IMPLLib> +{ +public: + CCallback() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_CALLBACK) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CCallback) + COM_INTERFACE_ENTRY(ICallback) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// ICallback +public: + STDMETHOD(inSeqByte)(/*[in]*/ LPSAFEARRAY val); + STDMETHOD(inSeqXEventListener)(/*[in]*/ LPSAFEARRAY listener, LPSAFEARRAY event); + STDMETHOD(outSeqByte)(/*[out]*/ LPSAFEARRAY* outVal); + STDMETHOD(inValues)(/*[in]*/short aChar, /*[in]*/ long aLong, /*[in]*/ BSTR aString); + STDMETHOD(inoutLong)(/*[in,out]*/ long* inoutVal); + STDMETHOD(inoutShort)(/*[in,out]*/ short* inoutVal); + STDMETHOD(inoutByte)(/*[in,out]*/ unsigned char* inoutVal); + STDMETHOD(inoutDouble)(/*[in,out]*/ double* inoutVal); + STDMETHOD(inoutFloat)(/*[in,out]*/ float* inoutVal); + STDMETHOD(inoutString)(/*[in,out]*/ BSTR *inoutVal); + STDMETHOD(inoutChar)(/*[in,out]*/ short* inoutVal); + STDMETHOD(inoutBool)(/*[in,out]*/ VARIANT_BOOL * inoutVal); + STDMETHOD(inoutAny)(/*[in,out]*/ VARIANT* inoutVal); + STDMETHOD(inoutSeqAny)(/*[in,out]*/ LPSAFEARRAY* pArray); + STDMETHOD(inoutEnum)(/*[in,out]*/ long * inoutVal); + STDMETHOD(inoutStruct)(/*[in,out]*/ IDispatch** inoutVal); + STDMETHOD(inoutInterface)(/*[in,out]*/ IDispatch** ppdisp); + STDMETHOD(inoutValuesAll)( + /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aXSimple, + /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aStruct, + /* [out][in] */ long __RPC_FAR *aEnum, + /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *aSeq, + /* [out][in] */ VARIANT __RPC_FAR *aAny, + /* [out][in] */ VARIANT_BOOL __RPC_FAR *aBool, + /* [out][in] */ short __RPC_FAR *aChar, + /* [out][in] */ BSTR __RPC_FAR *aString, + /* [out][in] */ float __RPC_FAR *aFloat, + /* [out][in] */ double __RPC_FAR *aDouble, + /* [out][in] */ unsigned char __RPC_FAR *aByte, + /* [out][in] */ short __RPC_FAR *aShort, + /* [out][in] */ long __RPC_FAR *aLong); + + STDMETHOD(outByte)( unsigned char* outByte); + STDMETHOD(outLong)(/*[out]*/ long* outLong); + STDMETHOD(outShort)(/*[out]*/ short *outShort); + STDMETHOD(outDouble)(/*[out]*/ double* outDouble); + STDMETHOD(outFloat)(/*[out]*/ float* outFloat); + STDMETHOD(outString)(/*[out]*/ BSTR * outString); + STDMETHOD(outChar)(short* outChar); + STDMETHOD(outBool)(VARIANT_BOOL* outBool); + STDMETHOD(outAny)(VARIANT* outAny); + STDMETHOD(outSeqAny)(/*[out]*/LPSAFEARRAY* outSeq); + STDMETHOD(outEnum)(/*[out]*/ long* outEnum); + STDMETHOD(outStruct)(/*[out]*/ IDispatch** outStruct); + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE outValuesAll( + /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdisp, + /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppSimpleStruct, + /* [out] */ long __RPC_FAR *aSimpleEnum, + /* [out] */ LPSAFEARRAY* outSeq, + /* [out] */ VARIANT __RPC_FAR *varAny, + /* [out] */ VARIANT_BOOL __RPC_FAR *aBool, + /* [out] */ short __RPC_FAR *aChar, + /* [out] */ BSTR __RPC_FAR *aString, + /* [out] */ float __RPC_FAR *aFloat, + /* [out] */ double __RPC_FAR *aDouble, + /* [out] */ unsigned char __RPC_FAR *aByte, + /* [out] */ short __RPC_FAR *aShort, + /* [out] */ long __RPC_FAR *aLong); +// ); + +// STDMETHOD(outValuesAll)( +// /*[out]*/ IDispatch** ppdisp, +// /*[out]*/ IUnknown** ppSimpleStruct, +// /*[out]*/ long* aSimpleEnum, +// /*[out]*/ VARIANT* ArrayAny, +// /*[out]*/ VARIANT* varAny, +// /*[out]*/ VARIANT_BOOL * aBool, +// /*[out]*/ unsigned short* aChar, +// /*[out]*/ BSTR* aString, /*[out]*/ float* aFloat, +// /*[out]*/ double* aDouble, +// /*[out]*/ signed char* aByte, /*[out]*/ short* aShort, /*[out]*/long* aLong, /*[out]*/ unsigned short* aUShort, /*[out]*/ unsigned long* aULong); + STDMETHOD(outValuesMixed)(/*[in]*/ long val, /*[out]*/ long* pval, /*[in]*/ BSTR string); + STDMETHOD(outInterface)(/*[out]*/ IDispatch** ppdisp); + STDMETHOD(returnInterface)(/*[out, retval]*/ IDispatch** ppdisp); + STDMETHOD(func1)(); +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs new file mode 100644 index 000000000..b3f9e071b --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs @@ -0,0 +1,27 @@ +HKCR +{ + XCallback_Impl.Callback.1 = s 'Callback Class' + { + CLSID = s '{180FF560-6F5C-11D4-8330-005004526AB4}' + } + XCallback_Impl.Callback = s 'Callback Class' + { + CLSID = s '{180FF560-6F5C-11D4-8330-005004526AB4}' + CurVer = s 'XCallback_Impl.Callback.1' + } + NoRemove CLSID + { + ForceRemove {180FF560-6F5C-11D4-8330-005004526AB4} = s 'Callback Class' + { + ProgID = s 'XCallback_Impl.Callback.1' + VersionIndependentProgID = s 'XCallback_Impl.Callback' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}' + } + } +} + diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp new file mode 100644 index 000000000..5b7183cdb --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp @@ -0,0 +1,73 @@ +/* -*- 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 . + */ +// Simple.cpp : Implementation of CSimple +#include "stdafx.h" +#include "XCallback_Impl.h" +#include "Simple.h" + + +// CSimple + + +STDMETHODIMP CSimple::func(BSTR message) +{ + USES_CONVERSION; + MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK); + return S_OK; +} + + +STDMETHODIMP CSimple::func2(BSTR message) +{ + USES_CONVERSION; + MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK); + return S_OK; +} + +STDMETHODIMP CSimple::func3(BSTR message) +{ + USES_CONVERSION; + MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK); + return S_OK; +} + + +STDMETHODIMP CSimple::get__implementedInterfaces(LPSAFEARRAY *pVal) +{ + HRESULT hr= S_OK; + SAFEARRAY *pArr= SafeArrayCreateVector( VT_BSTR, 0, 3); + if( pArr) + { long index=0; + BSTR name1= SysAllocString(L"oletest.XSimple"); + BSTR name2= SysAllocString(L"oletest.XSimple2"); + BSTR name3= SysAllocString(L"oletest.XSimple3"); + + hr= SafeArrayPutElement( pArr, & index, name1); + index++; + hr|= SafeArrayPutElement( pArr, &index, name2); + index++; + hr|= SafeArrayPutElement( pArr, &index, name3); + *pVal= pArr; + + } + *pVal= pArr; + return hr; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h new file mode 100644 index 000000000..8abe56270 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h @@ -0,0 +1,55 @@ +/* -*- 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 . + */ +// Simple.h : Declaration of the CSimple + +#pragma once + +#include "resource.h" + + +// CSimple +class ATL_NO_VTABLE CSimple : + public CComObjectRootEx<CComSingleThreadModel>, + public CComCoClass<CSimple, &CLSID_Simple>, + public IDispatchImpl<ISimple, &IID_ISimple, &LIBID_XCALLBACK_IMPLLib> +{ +public: + CSimple() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_SIMPLE) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CSimple) + COM_INTERFACE_ENTRY(ISimple) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// ISimple +public: + + STDMETHOD(get__implementedInterfaces)(/*[out, retval]*/ LPSAFEARRAY *pVal); + STDMETHOD(func3)(/*[in]*/ BSTR message); + STDMETHOD(func2)(/*[in]*/ BSTR message); + STDMETHOD(func)( BSTR message); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs new file mode 100644 index 000000000..19237bf36 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs @@ -0,0 +1,27 @@ +HKCR +{ + XCallback_Impl.Simple.1 = s 'Simple Class' + { + CLSID = s '{180FF565-6F5C-11D4-8330-005004526AB4}' + } + XCallback_Impl.Simple = s 'Simple Class' + { + CLSID = s '{180FF565-6F5C-11D4-8330-005004526AB4}' + CurVer = s 'XCallback_Impl.Simple.1' + } + NoRemove CLSID + { + ForceRemove {180FF565-6F5C-11D4-8330-005004526AB4} = s 'Simple Class' + { + ProgID = s 'XCallback_Impl.Simple.1' + VersionIndependentProgID = s 'XCallback_Impl.Simple' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}' + } + } +} + diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp new file mode 100644 index 000000000..da0608bfd --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp @@ -0,0 +1,32 @@ +/* -*- 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 . + */ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include <statreg.h> +#include <statreg.cpp> +#endif + +#include <atlimpl.cpp> + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h new file mode 100644 index 000000000..678114bae --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h @@ -0,0 +1,45 @@ +/* -*- 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 . + */ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__180FF556_6F5C_11D4_8330_005004526AB4__INCLUDED_) +#define AFX_STDAFX_H__180FF556_6F5C_11D4_8330_005004526AB4__INCLUDED_ + +#ifdef _MSC_VER +#pragma once +#endif + +#define STRICT +#define _ATL_APARTMENT_THREADED + +#include <stdio.h> +#include <atlbase.h> +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include <atlcom.h> + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__180FF556_6F5C_11D4_8330_005004526AB4__INCLUDED) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp new file mode 100644 index 000000000..739695914 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp @@ -0,0 +1,78 @@ +/* -*- 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 . + */ +// XCallback_Impl.cpp : Implementation of DLL Exports. + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f XCallback_Implps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include <initguid.h> +#include "XCallback_Impl.h" + +#include "XCallback_Impl_i.c" +#include "Callback.h" +#include "Simple.h" + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_Callback, CCallback) +OBJECT_ENTRY(CLSID_Simple, CSimple) +END_OBJECT_MAP() + +// DLL Entry Point + +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_XCALLBACK_IMPLLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) { return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE; } + +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) { return _Module.UnregisterServer(TRUE); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.def b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.def new file mode 100644 index 000000000..b2d5e9627 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.def @@ -0,0 +1,10 @@ +; XCallback_Impl.def : Declares the module parameters.
+
+LIBRARY "XCallback_Impl.DLL"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
+
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp new file mode 100644 index 000000000..6897d0d81 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp @@ -0,0 +1,337 @@ +# Microsoft Developer Studio Project File - Name="XCallback_Impl" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=XCallback_Impl - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "XCallback_Impl.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "XCallback_Impl.mak" CFG="XCallback_Impl - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "XCallback_Impl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "XCallback_Impl - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "XCallback_Impl - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "XCallback_Impl - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "XCallback_Impl - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "XCallback_Impl - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "XCallback_Impl - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\Debug +TargetPath=.\Debug\XCallback_Impl.dll +InputPath=.\Debug\XCallback_Impl.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugU" +# PROP BASE Intermediate_Dir "DebugU" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugU" +# PROP Intermediate_Dir "DebugU" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\DebugU +TargetPath=.\DebugU\XCallback_Impl.dll +InputPath=.\DebugU\XCallback_Impl.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinSize" +# PROP BASE Intermediate_Dir "ReleaseMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinSize" +# PROP Intermediate_Dir "ReleaseMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinSize +TargetPath=.\ReleaseMinSize\XCallback_Impl.dll +InputPath=.\ReleaseMinSize\XCallback_Impl.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinDependency" +# PROP BASE Intermediate_Dir "ReleaseMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinDependency" +# PROP Intermediate_Dir "ReleaseMinDependency" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinDependency +TargetPath=.\ReleaseMinDependency\XCallback_Impl.dll +InputPath=.\ReleaseMinDependency\XCallback_Impl.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Unicode Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinSize" +# PROP BASE Intermediate_Dir "ReleaseUMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinSize" +# PROP Intermediate_Dir "ReleaseUMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinSize +TargetPath=.\ReleaseUMinSize\XCallback_Impl.dll +InputPath=.\ReleaseUMinSize\XCallback_Impl.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Unicode Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinDependency" +# PROP BASE Intermediate_Dir "ReleaseUMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinDependency" +# PROP Intermediate_Dir "ReleaseUMinDependency" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinDependency +TargetPath=.\ReleaseUMinDependency\XCallback_Impl.dll +InputPath=.\ReleaseUMinDependency\XCallback_Impl.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "XCallback_Impl - Win32 Debug" +# Name "XCallback_Impl - Win32 Unicode Debug" +# Name "XCallback_Impl - Win32 Release MinSize" +# Name "XCallback_Impl - Win32 Release MinDependency" +# Name "XCallback_Impl - Win32 Unicode Release MinSize" +# Name "XCallback_Impl - Win32 Unicode Release MinDependency" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\Callback.cpp +# End Source File +# Begin Source File + +SOURCE=.\Simple.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\XCallback_Impl.cpp +# End Source File +# Begin Source File + +SOURCE=.\XCallback_Impl.def +# End Source File +# Begin Source File + +SOURCE=.\XCallback_Impl.idl +# ADD MTL /tlb ".\XCallback_Impl.tlb" /h "XCallback_Impl.h" /iid "XCallback_Impl_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\XCallback_Impl.rc +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Callback.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\Simple.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\Callback.rgs +# End Source File +# Begin Source File + +SOURCE=.\Simple.rgs +# End Source File +# End Group +# End Target +# End Project + + diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl new file mode 100644 index 000000000..de56aac45 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl @@ -0,0 +1,144 @@ +/* -*- 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 . + */ +// XCallback_Impl.idl : IDL source for XCallback_Impl.dll + + +// This file will be processed by the MIDL tool to +// produce the type library (XCallback_Impl.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; + [ + object, + uuid(180FF55F-6F5C-11D4-8330-005004526AB4), + dual, + helpstring("ICallback Interface"), + pointer_default(unique) + ] + interface ICallback : IDispatch + { + [id(1), helpstring("method func1")] HRESULT func1(); + [id(2), helpstring("method returnInterface")] HRESULT returnInterface([out, retval] IDispatch** ppdisp); + [id(3), helpstring("method outInterface")] HRESULT outInterface([out] IDispatch** ppdisp); + [id(4), helpstring("method outValuesMixed")] HRESULT outValuesMixed([in] long val, [out] long* pval, [in] BSTR string); + [id(5), helpstring("method outValuesAll")] HRESULT outValuesAll([out] IDispatch** ppdisp, [out] IDispatch** ppSimpleStruct, [out] long* aSimpleEnum, + [out] SAFEARRAY( VARIANT)* outSeq, + [out] VARIANT* varAny, + [out] VARIANT_BOOL * aBool, + [out] short* aChar, + [out] BSTR* aString , + [out] float* aFloat, + [out] double* aDouble, + [out] unsigned char* aByte, + [out] short* aShort, + [out]long* aLong); +// ); + [id(6), helpstring("method outStruct")] HRESULT outStruct([out] IDispatch** outStruct); + [id(7), helpstring("method outEnum")] HRESULT outEnum([out] long* outEnum); + [id(8), helpstring("method outSeqAny")] HRESULT outSeqAny([out] SAFEARRAY( VARIANT)* outSeq); + [id(9), helpstring("method outAny")] HRESULT outAny([out] VARIANT* outAny); + [id(10), helpstring("method outBool")] HRESULT outBool([out]VARIANT_BOOL* outBool); + [id(11), helpstring("method outChar")] HRESULT outChar([out] short* outChar); + [id(12), helpstring("method outString")] HRESULT outString([out] BSTR * outString); + [id(13), helpstring("method outFloat")] HRESULT outFloat([out] float* outFloat); + [id(14), helpstring("method outDouble")] HRESULT outDouble([out] double* outDouble); + [id(16), helpstring("method outShort")] HRESULT outShort([out] short *outShort); + [id(17), helpstring("method outLong")] HRESULT outLong([out] long* outLong); + [id(20), helpstring("method outByte")] HRESULT outByte([out] unsigned char* outByte); + [id(21), helpstring("method inoutInterface")] HRESULT inoutInterface([in,out] IDispatch** ppdisp); + [id(22), helpstring("method inoutStruct")] HRESULT inoutStruct([in,out] IDispatch** inoutVal); + [id(23), helpstring("method inoutEnum")] HRESULT inoutEnum([in,out] long * inoutVal); + [id(24), helpstring("method inoutSeqAny")] HRESULT inoutSeqAny([in,out] SAFEARRAY(VARIANT)* pArray); + [id(25), helpstring("method inoutAny")] HRESULT inoutAny([in,out] VARIANT* inoutVal); + [id(26), helpstring("method inoutBool")] HRESULT inoutBool([in,out] VARIANT_BOOL * inoutVal); + [id(27), helpstring("method inoutChar")] HRESULT inoutChar([in,out] short* inoutVal); + [id(28), helpstring("method inoutString")] HRESULT inoutString([in,out] BSTR *inoutVal); + [id(29), helpstring("method inoutFloat")] HRESULT inoutFloat([in,out] float* inoutVal); + [id(30), helpstring("method inoutDouble")] HRESULT inoutDouble([in,out] double* inoutVal); + [id(31), helpstring("method inoutByte")] HRESULT inoutByte([in,out] unsigned char* inoutVal); + [id(32), helpstring("method inoutShort")] HRESULT inoutShort([in,out] short* inoutVal); + [id(33), helpstring("method inoutLong")] HRESULT inoutLong([in,out] long* inoutVal); + [id(34), helpstring("method inoutValueAll")] HRESULT inoutValuesAll( + [in,out] IDispatch** aXSimple, + [in,out] IDispatch** aStruct, + [in,out] long* aEnum, + [in,out] SAFEARRAY( VARIANT)* aSeq, + [in,out] VARIANT* aAny, + [in,out] VARIANT_BOOL* aBool, + [in,out] short* aChar, + [in,out] BSTR* aString, + [in,out] float* aFloat, + [in,out] double* aDouble, + [in,out] unsigned char* aByte, + [in,out] short* aShort, + [in,out] long* aLong); + [id(35), helpstring("method inValues")] HRESULT inValues([in]short aChar, [in] long aLong, [in] BSTR aString); + [id(36), helpstring("method outSeqByte")] HRESULT outSeqByte([out] SAFEARRAY(unsigned char)* outVal); + [id(37), helpstring("method inSeqByte")] HRESULT inSeqByte([in] SAFEARRAY(VARIANT) val); + [id(38), helpstring("method inSeqXEventListener")] HRESULT inSeqXEventListener([in] SAFEARRAY(VARIANT) listener, + [in] SAFEARRAY(VARIANT) event); + + }; + [ + object, + uuid(180FF564-6F5C-11D4-8330-005004526AB4), + dual, + helpstring("ISimple Interface"), + pointer_default(unique) + ] + interface ISimple : IDispatch + { + [id(1), helpstring("method func")] HRESULT func( [in] BSTR message); + [id(2), helpstring("method func2")] HRESULT func2([in] BSTR message); + [id(3), helpstring("method func3")] HRESULT func3([in] BSTR message); + [propget, id(4), helpstring("property _implementedInterfaces")] HRESULT _implementedInterfaces([out, retval] SAFEARRAY(BSTR) *pVal); + }; + + + +[ + uuid(180FF553-6F5C-11D4-8330-005004526AB4), + version(1.0), + helpstring("XCallback_Impl 1.0 Type Library") +] +library XCALLBACK_IMPLLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(180FF560-6F5C-11D4-8330-005004526AB4), + helpstring("Callback Class") + ] + coclass Callback + { + [default] interface ICallback; + }; + [ + uuid(180FF565-6F5C-11D4-8330-005004526AB4), + helpstring("Simple Class") + ] + coclass Simple + { + [default] interface ISimple; + }; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc new file mode 100644 index 000000000..f544b17ca --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc @@ -0,0 +1,154 @@ +/* + * 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 "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS + + +// Generated from the TEXTINCLUDE 2 resource. + +#include "winres.h" + + +#undef APSTUDIO_READONLY_SYMBOLS + + +// German (Germany) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +#ifdef _WIN32 +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +#pragma code_page(1252) +#endif //_WIN32 + + + +// REGISTRY + + +IDR_CALLBACK REGISTRY DISCARDABLE "Callback.rgs" +IDR_SIMPLE REGISTRY DISCARDABLE "Simple.rgs" +#endif // German (Germany) resources + + + + +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED + + +// TEXTINCLUDE + + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""XCallback_Impl.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC + + +// Version + + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "XCallback_Impl Module\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "XCallback_Impl\0" + VALUE "LegalCopyright", "Copyright 2000\0" + VALUE "OriginalFilename", "XCallback_Impl.DLL\0" + VALUE "ProductName", "XCallback_Impl Module\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + + + +// String Table + + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "XCallback_Impl" +END + +#endif // English (U.S.) resources + + + + +#ifndef APSTUDIO_INVOKED + + +// Generated from the TEXTINCLUDE 3 resource. + +1 TYPELIB "XCallback_Impl.tlb" + + +#endif // not APSTUDIO_INVOKED + + diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.sln b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.sln new file mode 100644 index 000000000..62b109fe4 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.sln @@ -0,0 +1,31 @@ +Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XCallback_Impl", "XCallback_Impl.vcproj", "{92A6B531-401E-4900-8217-169A96F4168D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release MinDependency|Win32 = Release MinDependency|Win32
+ Release MinSize|Win32 = Release MinSize|Win32
+ Unicode Debug|Win32 = Unicode Debug|Win32
+ Unicode Release MinDependency|Win32 = Unicode Release MinDependency|Win32
+ Unicode Release MinSize|Win32 = Unicode Release MinSize|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {92A6B531-401E-4900-8217-169A96F4168D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Debug|Win32.Build.0 = Debug|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Release MinDependency|Win32.ActiveCfg = Release MinDependency|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Release MinDependency|Win32.Build.0 = Release MinDependency|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Release MinSize|Win32.ActiveCfg = Release MinSize|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Release MinSize|Win32.Build.0 = Release MinSize|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Release MinDependency|Win32.ActiveCfg = Unicode Release MinDependency|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Release MinDependency|Win32.Build.0 = Unicode Release MinDependency|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Release MinSize|Win32.ActiveCfg = Unicode Release MinSize|Win32
+ {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Release MinSize|Win32.Build.0 = Unicode Release MinSize|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.vcproj b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.vcproj new file mode 100644 index 000000000..1a9068d31 --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.vcproj @@ -0,0 +1,816 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="XCallback_Impl"
+ ProjectGUID="{92A6B531-401E-4900-8217-169A96F4168D}"
+ RootNamespace="XCallback_Impl"
+ Keyword="AtlProj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Unicode Release MinSize|Win32"
+ OutputDirectory=".\ReleaseUMinSize"
+ IntermediateDirectory=".\ReleaseUMinSize"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ UseOfATL="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseUMinSize/XCallback_Impl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseUMinSize/XCallback_Impl.pch"
+ AssemblerListingLocation=".\ReleaseUMinSize/"
+ ObjectFile=".\ReleaseUMinSize/"
+ ProgramDataBaseFileName=".\ReleaseUMinSize/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\ReleaseUMinSize/XCallback_Impl.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\XCallback_Impl.def"
+ ProgramDatabaseFile=".\ReleaseUMinSize/XCallback_Impl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseUMinSize/XCallback_Impl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release MinSize|Win32"
+ OutputDirectory=".\ReleaseMinSize"
+ IntermediateDirectory=".\ReleaseMinSize"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ UseOfATL="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseMinSize/XCallback_Impl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseMinSize/XCallback_Impl.pch"
+ AssemblerListingLocation=".\ReleaseMinSize/"
+ ObjectFile=".\ReleaseMinSize/"
+ ProgramDataBaseFileName=".\ReleaseMinSize/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\ReleaseMinSize/XCallback_Impl.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\XCallback_Impl.def"
+ ProgramDatabaseFile=".\ReleaseMinSize/XCallback_Impl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseMinSize/XCallback_Impl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode Release MinDependency|Win32"
+ OutputDirectory=".\ReleaseUMinDependency"
+ IntermediateDirectory=".\ReleaseUMinDependency"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ UseOfATL="1"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseUMinDependency/XCallback_Impl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseUMinDependency/XCallback_Impl.pch"
+ AssemblerListingLocation=".\ReleaseUMinDependency/"
+ ObjectFile=".\ReleaseUMinDependency/"
+ ProgramDataBaseFileName=".\ReleaseUMinDependency/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\ReleaseUMinDependency/XCallback_Impl.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\XCallback_Impl.def"
+ ProgramDatabaseFile=".\ReleaseUMinDependency/XCallback_Impl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseUMinDependency/XCallback_Impl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release MinDependency|Win32"
+ OutputDirectory=".\ReleaseMinDependency"
+ IntermediateDirectory=".\ReleaseMinDependency"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ UseOfATL="1"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\ReleaseMinDependency/XCallback_Impl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\ReleaseMinDependency/XCallback_Impl.pch"
+ AssemblerListingLocation=".\ReleaseMinDependency/"
+ ObjectFile=".\ReleaseMinDependency/"
+ ProgramDataBaseFileName=".\ReleaseMinDependency/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\ReleaseMinDependency/XCallback_Impl.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\XCallback_Impl.def"
+ ProgramDatabaseFile=".\ReleaseMinDependency/XCallback_Impl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\ReleaseMinDependency/XCallback_Impl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode Debug|Win32"
+ OutputDirectory=".\DebugU"
+ IntermediateDirectory=".\DebugU"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\DebugU/XCallback_Impl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\DebugU/XCallback_Impl.pch"
+ AssemblerListingLocation=".\DebugU/"
+ ObjectFile=".\DebugU/"
+ ProgramDataBaseFileName=".\DebugU/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\DebugU/XCallback_Impl.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\XCallback_Impl.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\DebugU/XCallback_Impl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\DebugU/XCallback_Impl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Performing registration"
+ CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
+ Outputs="$(OutDir)\regsvr32.trg"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/XCallback_Impl.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\Debug/XCallback_Impl.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Debug/XCallback_Impl.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ ModuleDefinitionFile=".\XCallback_Impl.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/XCallback_Impl.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Debug/XCallback_Impl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath=".\Callback.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Simple.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\StdAfx.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\XCallback_Impl.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\XCallback_Impl.def"
+ >
+ </File>
+ <File
+ RelativePath=".\XCallback_Impl.idl"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\XCallback_Impl.tlb"
+ HeaderFileName="XCallback_Impl.h"
+ InterfaceIdentifierFileName="XCallback_Impl_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\XCallback_Impl.tlb"
+ HeaderFileName="XCallback_Impl.h"
+ InterfaceIdentifierFileName="XCallback_Impl_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\XCallback_Impl.tlb"
+ HeaderFileName="XCallback_Impl.h"
+ InterfaceIdentifierFileName="XCallback_Impl_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\XCallback_Impl.tlb"
+ HeaderFileName="XCallback_Impl.h"
+ InterfaceIdentifierFileName="XCallback_Impl_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\XCallback_Impl.tlb"
+ HeaderFileName="XCallback_Impl.h"
+ InterfaceIdentifierFileName="XCallback_Impl_i.c"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateStublessProxies="true"
+ TypeLibraryName=".\XCallback_Impl.tlb"
+ HeaderFileName="XCallback_Impl.h"
+ InterfaceIdentifierFileName="XCallback_Impl_i.c"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\XCallback_Impl.rc"
+ >
+ <FileConfiguration
+ Name="Unicode Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinSize|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release MinDependency|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(OUTDIR);$(NoInherit)"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\Callback.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Simple.h"
+ >
+ </File>
+ <File
+ RelativePath=".\StdAfx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\Callback.rgs"
+ >
+ </File>
+ <File
+ RelativePath=".\Simple.rgs"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h new file mode 100644 index 000000000..2864478cd --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h @@ -0,0 +1,39 @@ +/* -*- 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 . + */ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by XCallback_Impl.rc + +#define IDS_PROJNAME 100 +#define IDR_CALLBACK 101 +#define IDR_SIMPLE 102 +#define IDR_SIMPLESTRUCT 103 + +// Next default values for new objects + +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 104 +#endif +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/readme.txt b/extensions/test/ole/unoTocomCalls/readme.txt new file mode 100644 index 000000000..feb46b11e --- /dev/null +++ b/extensions/test/ole/unoTocomCalls/readme.txt @@ -0,0 +1,9 @@ +The directory XCallback_Impl contains a MSDEV project that
+creates a dll containing the ActiveX components
+XCallback_Impl.Simple and XCallback_Impl.Callback
+Callback implements functions defined in oletest.XCallback
+and Simple implements functions defined in oletest.XSimple.
+These interfaces are build in extensions/test/ole/cpnt
+
+The projects in unoToComCalls test the functionality of COM
+and JScript object which implement UNO interfaces.
diff --git a/extensions/test/pgp/TestPGP.java b/extensions/test/pgp/TestPGP.java new file mode 100644 index 000000000..ce719a530 --- /dev/null +++ b/extensions/test/pgp/TestPGP.java @@ -0,0 +1,95 @@ +/* + * 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 . + */ + + +import com.sun.star.bridge.UnoUrlResolver; +import com.sun.star.bridge.XUnoUrlResolver; +import com.sun.star.comp.helper.Bootstrap; +import com.sun.star.connection.XConnection; +import com.sun.star.connection.XConnector; +import com.sun.star.container.XSet; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.pgp.SimplePGPMailerFactoryReg; +import com.sun.star.uno.IBridge; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.uno.XNamingService; + + + +public class TestPGP { + + + static void doSomething(Object r) throws com.sun.star.uno.Exception, Exception { + XNamingService rName = UnoRuntime.queryInterface(XNamingService.class, r); + + if(rName != null) { + System.err.println("got the remote naming service !"); + Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager"); + + XMultiServiceFactory rSmgr = UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr); + if(rSmgr != null) { + System.err.println("got the remote service manager !"); + } + + XSet set= UnoRuntime.queryInterface(XSet.class, rSmgr); + if( set == null) { + System.err.println(" couldn't get XSet from ServiceFactory"); + return; + } + SimplePGPMailerFactoryReg mailerReg= new SimplePGPMailerFactoryReg(); + XSingleServiceFactory factory= mailerReg.getServiceFactory( + "com.sun.star.pgp.SimplePGPMailerImpl", rSmgr, null, null); + + if( factory == null) { + System.err.println("couldn't create PGP factory !"); + return; + } + set.insert(factory ); + System.err.println("PGP factory inserted into service manager"); + + } + } + + + + public static void main(String argv[]) throws Exception { + if(argv.length != 1) { + System.err.println("usage : testoffice protocol:host:port"); + System.exit(-1); + } + + XUnoUrlResolver resolver = UnoUrlResolver.create(Bootstrap.createInitialComponentContext(null)); + + XConnector xConnector = UnoRuntime.queryInterface(XConnector.class, resolver.resolve("com.sun.star.connection.Connector")); + XConnection xConnection = xConnector.connect(argv[0]); + + String rootOid = "classic_uno"; + IBridge iBridge = UnoRuntime.getBridgeByName("java", null, "remote", null, new Object[]{"iiop", xConnection, null}); + + Object rInitialObject = iBridge.mapInterfaceFrom(rootOid, new Type(XInterface.class)); + + if(rInitialObject != null) { + System.err.println("got the remote object"); + doSomething(rInitialObject); + } + } +} + diff --git a/extensions/test/pgp/makefile.mk b/extensions/test/pgp/makefile.mk new file mode 100644 index 000000000..d5805fbe1 --- /dev/null +++ b/extensions/test/pgp/makefile.mk @@ -0,0 +1,62 @@ +# +# 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 . +# + +PRJ=..$/.. + +PRJNAME := extensions +PACKAGE := +TARGET := test_com_sun_star_pgp + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# Files -------------------------------------------------------- + +APPLICATRDB := $(SOLARBINDIR)$/applicat.rdb +RDB := $(APPLICATRDB) + +JARFILES= jurt.jar + +GENJAVACLASSFILES= \ + $(CLASSDIR)$/com$/sun$/star$/beans$/PropertyValue.class \ + $(CLASSDIR)$/com$/sun$/star$/beans$/PropertyState.class \ + $(CLASSDIR)$/com$/sun$/star$/container$/XSet.class \ + +JAVACLASSFILES= \ + $(CLASSDIR)$/$(PACKAGE)$/TestPGP.class + + +TYPES={$(subst,.class, $(subst,$/,. $(subst,$(CLASSDIR)$/,-T $(GENJAVACLASSFILES))))} +GENJAVAFILES = {$(subst,.class,.java $(subst,$/class, $(GENJAVACLASSFILES)))} +JAVAFILES= $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) $(GENJAVAFILES) + +# --- Targets ------------------------------------------------------ + +.IF "$(depend)" == "" +ALL : $(GENJAVAFILES) ALLTAR +.ELSE +ALL: ALLDEP +.ENDIF + +.INCLUDE : target.mk + +$(GENJAVAFILES) : $(RDB) + javamaker @$(mktmp -BUCR -O$(OUT) $(TYPES) $(RDB)) + +$(JAVACLASSFILES) : $(GENJAVAFILES) diff --git a/extensions/test/pgp/readme.txt b/extensions/test/pgp/readme.txt new file mode 100644 index 000000000..8d4868770 --- /dev/null +++ b/extensions/test/pgp/readme.txt @@ -0,0 +1,33 @@ +The program TestPGP instantiates a SimplePGPMailerFactory and adds + it to the ServiceManager obtained from a running StarOffice. +Then PGP can be used from within StarOffice. + +Prerequisites: +StarOffice needs an entry in Office/user/sofficerc under the Common + section: + + Port2=socket:hamburg-11070:1111 // old style +as of 569 m +Connection=socket,hamburg-11070,port=1111;iiop; + +Please note the semicolons! + + hamburg-11070 is the host running the office and 1111 is a + freely choosable port number. + + + For the program to run make sure that the office has access + to classes.zip, libreoffice.jar, pgp.jar and swingall.jar. + + Therefore do the necessary entries in + Office/user/config/javarc + under SystemClasspath. + +There is a bug with jdk1.1.8, therefore use 1.2 instead. + +The TestPGP is called without ;iiop; : + +java TestPGP "socket,host=localhost,port=1111" + + + |