summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse
diff options
context:
space:
mode:
authorVeronika Irvine <torres>2001-05-11 13:46:50 +0000
committerVeronika Irvine <torres>2001-05-11 13:46:50 +0000
commit3275970ab8046022b8d2069b5c21bf117c223db7 (patch)
tree23ac5a3259be894e958f59fdd4103679c544e889 /bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse
downloadeclipse.platform.swt-3275970ab8046022b8d2069b5c21bf117c223db7.tar.gz
eclipse.platform.swt-3275970ab8046022b8d2069b5c21bf117c223db7.tar.xz
eclipse.platform.swt-3275970ab8046022b8d2069b5c21bf117c223db7.zip
initializing database with SWT 0.105
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COM.java562
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java1024
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java15
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DROPFILES.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/GUID.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java22
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java42
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java61
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnum.java25
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IFont.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java35
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java55
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersist.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java31
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStorage.java144
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStream.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java155
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java26
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java15
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java15
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java50
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java26
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java26
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/package.html13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OLE.java420
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java588
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java1306
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java521
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEvent.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java269
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java68
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFile.java128
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java626
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFunctionDescription.java24
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleListener.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleParameterDescription.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java179
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyDescription.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/Variant.java524
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/package.html13
66 files changed, 7668 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java
new file mode 100755
index 0000000000..1583e9dac0
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java
@@ -0,0 +1,14 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class CAUUID {
+
+ public int cElems;
+ public int pElems;
+
+ public static final int sizeof = 8;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COM.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COM.java
new file mode 100755
index 0000000000..1d5bd02e7c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COM.java
@@ -0,0 +1,562 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.internal.win32.*;
+
+public class COM extends OS {
+
+ static {
+ /* Initialize OLE */
+ // OleInitialize Initializes the COM library on the current apartment
+ // and identifies the concurrency model as single-thread apartment (STA).
+ // To use any other threading model, you must call CoInitializeEx
+ OS.OleInitialize(0);
+ }
+
+ /* Constants */
+
+ // !!!! GUIDs for Home Page Browser !!!!
+ public static final GUID IIDIEditorSiteTime = IIDFromString("{6BD2AEFE-7876-45e6-A6E7-3BFCDF6540AA}");
+ public static final GUID IIDIEditorSiteProperty = IIDFromString("{D381A1F4-2326-4f3c-AFB9-B7537DB9E238}");
+ public static final GUID IIDIEditorBaseProperty = IIDFromString("{61E55B0B-2647-47c4-8C89-E736EF15D636}");
+ public static final GUID IIDIEditorSite = IIDFromString("{CDD88AB9-B01D-426E-B0F0-30973E9A074B}");
+ public static final GUID IIDIEditorService = IIDFromString("{BEE283FE-7B42-4FF3-8232-0F07D43ABCF1}");
+ public static final GUID IIDIEditorManager = IIDFromString("{EFDE08C4-BE87-4B1A-BF84-15FC30207180}");
+
+
+ public static final GUID IIDIAdviseSink = IIDFromString("{0000010F-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIAdviseSink2 = IIDFromString("{00000125-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIBindCtx = IIDFromString("{0000000E-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIClassFactory = IIDFromString("{00000001-0000-0000-C000-000000000046}");
+ public static final GUID IIDIClassFactory2 = IIDFromString("{B196B28F-BAB4-101A-B69C-00AA00341D07}");
+ public static final GUID IIDIConnectionPoint = IIDFromString("{B196B286-BAB4-101A-B69C-00AA00341D07}");
+ public static final GUID IIDIConnectionPointContainer = IIDFromString("{B196B284-BAB4-101A-B69C-00AA00341D07}");
+ //public static final GUID IIDICreateErrorInfo = IIDFromString("{22F03340-547D-101B-8E65-08002B2BD119}");
+ //public static final GUID IIDICreateTypeInfo = IIDFromString("{00020405-0000-0000-C000-000000000046}");
+ //public static final GUID IIDICreateTypeLib = IIDFromString("{00020406-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIDataAdviseHolder = IIDFromString("{00000110-0000-0000-C000-000000000046}");
+ public static final GUID IIDIDataObject = IIDFromString("{0000010E-0000-0000-C000-000000000046}");
+ public static final GUID IIDIDispatch = IIDFromString("{00020400-0000-0000-C000-000000000046}");
+ public static final GUID IIDIDropSource = IIDFromString("{00000121-0000-0000-C000-000000000046}");
+ public static final GUID IIDIDropTarget = IIDFromString("{00000122-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIEnumConnectionPoints = IIDFromString("{B196B285-BAB4-101A-B69C-00AA00341D07}");
+ //public static final GUID IIDIEnumConnections = IIDFromString("{B196B287-BAB4-101A-B69C-00AA00341D07}");
+ public static final GUID IIDIEnumFORMATETC = IIDFromString("{00000103-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIEnumMoniker = IIDFromString("{00000102-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIEnumOLEVERB = IIDFromString("{00000104-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIEnumSTATDATA = IIDFromString("{00000105-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIEnumSTATSTG = IIDFromString("{0000000D-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIEnumString = IIDFromString("{00000101-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIEnumUnknown = IIDFromString("{00000100-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIEnumVARIANT = IIDFromString("{00020404-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIErrorInfo = IIDFromString("{1CF2B120-547D-101B-8E65-08002B2BD119}");
+ //public static final GUID IIDIErrorLog = IIDFromString("{3127CA40-446E-11CE-8135-00AA004BB851}");
+ //public static final GUID IIDIExternalConnection = IIDFromString("{00000019-0000-0000-C000-000000000046}");
+ public static final GUID IIDIFont = IIDFromString("{BEF6E002-A874-101A-8BBA-00AA00300CAB}");
+ //public static final GUID IIDIFontDisp = IIDFromString("{BEF6E003-A874-101A-8BBA-00AA00300CAB}");
+ //public static final GUID IIDILockBytes = IIDFromString("{0000000A-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIMalloc = IIDFromString("{00000002-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIMallocSpy = IIDFromString("{0000001D-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIMarshal = IIDFromString("{00000003-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIMessageFilter = IIDFromString("{00000016-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIMoniker = IIDFromString("{0000000F-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIOleAdviseHolder = IIDFromString("{00000111-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIOleCache = IIDFromString("{0000011E-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIOleCache2 = IIDFromString("{00000128-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIOleCacheControl = IIDFromString("{00000129-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleClientSite = IIDFromString("{00000118-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleCommandTarget = IIDFromString("{B722BCCB-4E68-101B-A2BC-00AA00404770}");
+ public static final GUID IIDIOleContainer = IIDFromString("{0000011B-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleControl = IIDFromString("{B196B288-BAB4-101A-B69C-00AA00341D07}");
+ public static final GUID IIDIOleControlSite = IIDFromString("{B196B289-BAB4-101A-B69C-00AA00341D07}");
+ public static final GUID IIDIOleInPlaceActiveObject = IIDFromString("{00000117-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleInPlaceFrame = IIDFromString("{00000116-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleInPlaceObject = IIDFromString("{00000113-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleInPlaceSite = IIDFromString("{00000119-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleInPlaceUIWindow = IIDFromString("{00000115-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIOleItemContainer = IIDFromString("{0000011C-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleLink = IIDFromString("{0000011D-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleObject = IIDFromString("{00000112-0000-0000-C000-000000000046}");
+ public static final GUID IIDIOleWindow = IIDFromString("{00000114-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIParseDisplayName = IIDFromString("{0000011A-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIPerPropertyBrowsing = IIDFromString("{376BD3AA-3845-101B-84ED-08002B2EC713}");
+ public static final GUID IIDIPersist = IIDFromString("{0000010C-0000-0000-C000-000000000046}");
+ public static final GUID IIDIPersistFile = IIDFromString("{0000010B-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIPersistMemory = IIDFromString("{BD1AE5E0-A6AE-11CE-BD37-504200C10000}");
+ //public static final GUID IIDIPersistPropertyBag = IIDFromString("{37D84F60-42CB-11CE-8135-00AA004BB851}");
+ public static final GUID IIDIPersistStorage = IIDFromString("{0000010A-0000-0000-C000-000000000046}");
+ public static final GUID IIDIPersistStream = IIDFromString("{00000109-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIPersistStreamInit = IIDFromString("{7FD52380-4E07-101B-AE2D-08002B2EC713}");
+ //public static final GUID IIDIPicture = IIDFromString("{7BF80980-BF32-101A-8BBB-00AA00300CAB}");
+ //public static final GUID IIDIPictureDisp = IIDFromString("{7BF80981-BF32-101A-8BBB-00AA00300CAB}");
+ //public static final GUID IIDIPropertyBag = IIDFromString("{55272A00-42CB-11CE-8135-00AA004BB851}");
+ public static final GUID IIDIPropertyNotifySink = IIDFromString("{9BFBBC02-EFF1-101A-84ED-00AA00341D07}");
+ //public static final GUID IIDIPropertyPage = IIDFromString("{B196B28D-BAB4-101A-B69C-00AA00341D07}");
+ //public static final GUID IIDIPropertyPage2 = IIDFromString("{01E44665-24AC-101B-84ED-08002B2EC713}");
+ //public static final GUID IIDIPropertyPageSite = IIDFromString("{B196B28C-BAB4-101A-B69C-00AA00341D07}");
+ public static final GUID IIDIProvideClassInfo = IIDFromString("{B196B283-BAB4-101A-B69C-00AA00341D07}");
+ public static final GUID IIDIProvideClassInfo2 = IIDFromString("{A6BC3AC0-DBAA-11CE-9DE3-00AA004BB851}");
+ //public static final GUID IIDIPSFactoryBuffer = IIDFromString("{D5F569D0-593B-101A-B569-08002B2DBF7A}");
+ //public static final GUID IIDIRootStorage = IIDFromString("{00000012-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIROTData = IIDFromString("{F29F6BC0-5021-11CE-AA15-00006901293F}");
+ //public static final GUID IIDIRpcChannelBuffer = IIDFromString("{D5F56B60-593B-101A-B569-08002B2DBF7A}");
+ //public static final GUID IIDIRpcProxyBuffer = IIDFromString("{D5F56A34-593B-101A-B569-08002B2DBF7A}");
+ //public static final GUID IIDIRpcStubBuffer = IIDFromString("{D5F56AFC-593B-101A-B569-08002B2DBF7A}");
+ //public static final GUID IIDIRunnableObject = IIDFromString("{00000126-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIRunningObjectTable = IIDFromString("{00000010-0000-0000-C000-000000000046}");
+ //public static final GUID IIDISimpleFrameSite = IIDFromString("{742B0E01-14E6-101B-914E-00AA00300CAB}");
+ public static final GUID IIDISpecifyPropertyPages = IIDFromString("{B196B28B-BAB4-101A-B69C-00AA00341D07}");
+ //public static final GUID IIDIStdMarshalInfo = IIDFromString("{00000018-0000-0000-C000-000000000046}");
+ public static final GUID IIDIStorage = IIDFromString("{0000000B-0000-0000-C000-000000000046}");
+ public static final GUID IIDIStream = IIDFromString("{0000000C-0000-0000-C000-000000000046}");
+ //public static final GUID IIDISupportErrorInfo = IIDFromString("{DF0B3D60-548F-101B-8E65-08002B2BD119}");
+ //public static final GUID IIDITypeComp = IIDFromString("{00020403-0000-0000-C000-000000000046}");
+ //public static final GUID IIDITypeLib = IIDFromString("{00020402-0000-0000-C000-000000000046}");
+ public static final GUID IIDIUnknown = IIDFromString("{00000000-0000-0000-C000-000000000046}");
+ //public static final GUID IIDIViewObject = IIDFromString("{0000010D-0000-0000-C000-000000000046}");
+ public static final GUID IIDIViewObject2 = IIDFromString("{00000127-0000-0000-C000-000000000046}");
+
+ //public static final int ADVF_DATAONSTOP = 64;
+ //public static final int ADVF_NODATA = 1;
+ //public static final int ADVF_ONLYONCE = 2;
+ //public static final int ADVF_PRIMEFIRST = 4;
+ //public static final int ADVFCACHE_FORCEBUILTIN = 16;
+ //public static final int ADVFCACHE_NOHANDLER = 8;
+ //public static final int ADVFCACHE_ONSAVE = 32;
+ public static final int CF_TEXT = 1;
+ public static final int CF_BITMAP = 2;
+ public static final int CF_METAFILEPICT = 3;
+ public static final int CF_SYLK = 4;
+ public static final int CF_DIF = 5;
+ public static final int CF_TIFF = 6;
+ public static final int CF_OEMTEXT = 7;
+ public static final int CF_DIB = 8;
+ public static final int CF_PALETTE = 9;
+ public static final int CF_PENDATA = 10;
+ public static final int CF_RIFF = 11;
+ public static final int CF_WAVE = 12;
+ public static final int CF_UNICODETEXT = 13;
+ public static final int CF_ENHMETAFILE = 14;
+ public static final int CF_HDROP = 15;
+ public static final int CF_LOCALE = 16;
+ public static final int CF_MAX = 17;
+ public static final int CLSCTX_INPROC_HANDLER = 2;
+ public static final int CLSCTX_INPROC_SERVER = 1;
+ public static final int CLSCTX_LOCAL_SERVER = 4;
+ public static final int CLSCTX_REMOTE_SERVER = 16;
+ public static final int CO_E_CLASSSTRING = -2147221005;
+ //public static final int COINIT_APARTMENTTHREADED = 2; Apartment model
+ //public static final int COINIT_DISABLE_OLE1DDE = 4; Don't use DDE for Ole1 support.
+ //public static final int COINIT_MULTITHREADED = 0; OLE calls objects on any thread.
+ //public static final int COINIT_SPEED_OVER_MEMORY = 8; Trade memory for speed.
+ public static final int DATADIR_GET = 1;
+ public static final int DATADIR_SET = 2;
+ public static final int DISP_E_EXCEPTION = 0x80020009;
+ public static final int DISP_E_MEMBERNOTFOUND = -2147352573;
+ public static final int DISP_E_UNKNOWNINTERFACE = 0x80020001;
+ //public static final int DISPID_AMBIENT_APPEARANCE = -716;
+ //public static final int DISPID_AMBIENT_AUTOCLIP = -715;
+ public static final int DISPID_AMBIENT_BACKCOLOR = -701;
+ //public static final int DISPID_AMBIENT_CHARSET = -727;
+ //public static final int DISPID_AMBIENT_CODEPAGE = -725;
+ //public static final int DISPID_AMBIENT_DISPLAYASDEFAULT = -713;
+ //public static final int DISPID_AMBIENT_DISPLAYNAME = -702;
+ public static final int DISPID_AMBIENT_FONT = -703;
+ public static final int DISPID_AMBIENT_FORECOLOR = -704;
+ public static final int DISPID_AMBIENT_LOCALEID = -705;
+ public static final int DISPID_AMBIENT_MESSAGEREFLECT = -706;
+ public static final int DISPID_AMBIENT_OFFLINEIFNOTCONNECTED = -5501;
+ //public static final int DISPID_AMBIENT_PALETTE = -726;
+ //public static final int DISPID_AMBIENT_RIGHTTOLEFT = -732;
+ //public static final int DISPID_AMBIENT_SCALEUNITS = -707;
+ public static final int DISPID_AMBIENT_SHOWGRABHANDLES = -711;
+ public static final int DISPID_AMBIENT_SHOWHATCHING = -712;
+ public static final int DISPID_AMBIENT_SILENT = -5502;
+ public static final int DISPID_AMBIENT_SUPPORTSMNEMONICS = -714;
+ //public static final int DISPID_AMBIENT_TEXTALIGN = -708;
+ //public static final int DISPID_AMBIENT_TOPTOBOTTOM = -733;
+ //public static final int DISPID_AMBIENT_TRANSFERPRIORITY = -728;
+ public static final int DISPID_AMBIENT_UIDEAD = -710;
+ public static final int DISPID_AMBIENT_USERMODE = -709;
+ public static final int DISPID_BACKCOLOR = -501;
+ public static final int DISPID_FONT = -512;
+ public static final int DISPID_FONT_BOLD = 3;
+ public static final int DISPID_FONT_CHARSET = 8;
+ public static final int DISPID_FONT_ITALIC = 4;
+ public static final int DISPID_FONT_NAME = 0;
+ public static final int DISPID_FONT_SIZE = 2;
+ public static final int DISPID_FONT_STRIKE = 6;
+ public static final int DISPID_FONT_UNDER = 5;
+ public static final int DISPID_FONT_WEIGHT = 7;
+ public static final int DISPID_FORECOLOR = -513;
+ //public static final int DISPID_READYSTATE = -525;
+ //public static final int DISPID_READYSTATECHANGE = -609;
+ public static final int DRAGDROP_S_DROP = 0x00040100; //Successful drop took place
+ public static final int DRAGDROP_S_CANCEL = 0x00040101; // Drag-drop operation canceled
+ public static final int DRAGDROP_S_USEDEFAULTCURSORS = 0x00040102; // Use the default cursor
+ public static final int DROPEFFECT_NONE = 0; // Drop target cannot accept the data.
+ public static final int DROPEFFECT_COPY = 1; // Drop results in a copy. The original data is untouched by
+ // the drag source.
+ public static final int DROPEFFECT_MOVE = 2; // Drag source should remove the data.
+ public static final int DROPEFFECT_LINK = 4; // Drag source should create a link to the original data.
+ public static final int DROPEFFECT_SCROLL = 0x80000000; // Scrolling is about to start or is currently
+ // occurring in the target. This value is used in
+ // addition to the other values.
+ public static final int DV_E_FORMATETC = -2147221404;
+ public static final int DV_E_STGMEDIUM = -2147221402;
+ public static final int DV_E_TYMED = -2147221399;
+ public static final int DVASPECT_CONTENT = 1;
+ //public static final int DVASPECT_DOCPRINT = 8;
+ //public static final int DVASPECT_ICON = 4;
+ //public static final int DVASPECT_THUMBNAIL = 2;
+ public static final int E_FAIL = -2147467259; //Unspecified failure.
+ public static final int E_INVALIDARG = -2147024809;
+ public static final int E_NOINTERFACE = -2147467262; //QueryInterface did not recognize the requested interface.
+ public static final int E_NOTIMPL = -2147467263; //Member function contains no implementation.
+ //public static final int E_NOTLICENSED = -2147221230;
+ //public static final int E_OUTOFMEMORY = -2147024882; //Function failed to allocate necessary memory.
+ //public static final int E_POINTER = -2147467261;
+ public static final int GMEM_FIXED = 0; //Global Memory Constants
+ //public static final int GMEM_MOVABLE = 2;
+ //public static final int GMEM_NODISCARD = 32;
+ public static final int GMEM_ZEROINIT = 64;
+ public static final int GUIDKIND_DEFAULT_SOURCE_DISP_IID = 1;
+ public static final int IMPLTYPEFLAG_FDEFAULT = 1;
+ //public static final int IMPLTYPEFLAG_FDEFAULTVTABLE = 2048;
+ public static final int IMPLTYPEFLAG_FRESTRICTED = 4;
+ public static final int IMPLTYPEFLAG_FSOURCE = 2;
+ public static final int LOCALE_SYSTEM_DEFAULT = 1024; //Locale Constants
+ public static final int LOCALE_USER_DEFAULT = 2048;
+ //public static final int MEMCTX_TASK = 1; //dwMemContext values for COM's task memory allocation service
+ //public static final int OLEACTIVATEAUTO = 3; //Object is activated based on the object's default method of activation
+ //public static final int OLEACTIVATEDOUBLECLICK = 2; //Object is activated when the OLE container control is double-clicked
+ //public static final int OLEACTIVATEGETFOCUS = 1; //Object is activated when the OLE container control gets the focus
+ //public static final int OLEACTIVATEMANUAL = 0; //OLE object isn't automatically activated
+ //public static final int OLEAUTOMATIC = 0; //Object is updated each time the linked data changes
+ //public static final int OLECHANGED = 0; //Object's data has changed
+ public static final int OLECLOSE_NOSAVE = 1;
+ //public static final int OLECLOSE_PROMPTSAVE = 2;
+ public static final int OLECLOSE_SAVEIFDIRTY = 0;
+ //public static final int OLECLOSED = 2; //Application file containing the linked object's data has been closed
+ //public static final int OLECONTF_EMBEDDINGS = 1; //The OLECONTF enumeration indicates the kind of objects to be enumerated by the returned IEnumUnknown interface
+ //public static final int OLECONTF_LINKS = 2;
+ //public static final int OLECONTF_ONLYIFRUNNING = 16;
+ //public static final int OLECONTF_ONLYUSER = 8;
+ //public static final int OLECONTF_OTHERS = 4;
+ //public static final int OLEDEACTIVATEMANUAL = 1; //The OLE object can only be deactivated programatically via the #doVerb: method."
+ //public static final int OLEDEACTIVATEONLOSEFOCUS = 0; //The OLE object is deactivated whenever focus is given to another widget in the receiver's shell.
+ //public static final int OLEDECBORDER = 1; //a border is displayed around the receiver.
+ //public static final int OLEDECBORDERANDNIBS = 3; //border and resize nibs are displayed.
+ //public static final int OLEDECNIBS = 2; //resize nibs are displayed around the reciever.
+ //public static final int OLEDECNONE = 0; //no special trimmings are displayed around the receiver.
+ //public static final int OLEDISPLAYCONTENT = 0; //Object's data is displayed in the OLE container control
+ //public static final int OLEDISPLAYICON = 1; //Object's icon is displayed in the OLE container control
+ //public static final int OLEEITHER = 2; //OLE container control can contain either a linked or an embedded object
+ public static final int OLEEMBEDDED = 1; //OLE container control contains an embedded object
+ //public static final int OLEFROZEN = 1; //Object is updated whenever the user saves the linked document from within the application in which it was created
+ public static final int OLEIVERB_DISCARDUNDOSTATE = -6; //close the OLE object and discard the undo state
+ //public static final int OLEIVERB_HIDE = -3; //hide the OLE object
+ public static final int OLEIVERB_INPLACEACTIVATE = -5; //open the OLE for editing in-place
+ //public static final int OLEIVERB_OPEN = -2; //open the OLE object for editing in a separate window
+ public static final int OLEIVERB_PRIMARY = 0; //opens the OLE object for editing
+ //public static final int OLEIVERB_PROPERTIES = -7; //request the OLE object properties dialog
+ //public static final int OLEIVERB_SHOW = -1; //show the OLE object
+ //public static final int OLEIVERB_UIACTIVATE = -4; //activate the UI for the OLE object
+ public static final int OLELINKED = 0; //OLE container control contains a linked object
+ //public static final int OLEMANUAL = 2; //Object is updated only when the Action property is set to 6 (Update)
+ //public static final int OLEMISC_ACTIVATEWHENVISIBLE = 256;
+ //public static final int OLEMISC_ACTSLIKEBUTTON = 4096;
+ //public static final int OLEMISC_ACTSLIKELABEL = 8192;
+ //public static final int OLEMISC_ALIGNABLE = 32768;
+ //public static final int OLEMISC_ALWAYSRUN = 2048;
+ //public static final int OLEMISC_CANLINKBYOLE1 = 32;
+ //public static final int OLEMISC_CANTLINKINSIDE = 16;
+ //public static final int OLEMISC_IGNOREACTIVATEWHENVISIBLE = 524288;
+ //public static final int OLEMISC_IMEMODE = 262144;
+ //public static final int OLEMISC_INSERTNOTREPLACE = 4;
+ //public static final int OLEMISC_INSIDEOUT = 128;
+ //public static final int OLEMISC_INVISIBLEATRUNTIME = 1024;
+ //public static final int OLEMISC_ISLINKOBJECT = 64;
+ //public static final int OLEMISC_NOUIACTIVATE = 16384;
+ //public static final int OLEMISC_ONLYICONIC = 2;
+ //public static final int OLEMISC_RECOMPOSEONRESIZE = 1;
+ //public static final int OLEMISC_RENDERINGISDEVICEINDEPENDENT = 512;
+ //public static final int OLEMISC_SETCLIENTSITEFIRST = 131072;
+ //public static final int OLEMISC_SIMPLEFRAME = 65536;
+ //public static final int OLEMISC_STATIC = 8;
+ //public static final int OLEMISC_SUPPORTSMULTILEVELUNDO = 2097152;
+ //public static final int OLEMISC_WANTSTOMENUMERGE = 1048576;
+ //public static final int OLENONE = 3; //OLE container control doesn't contain an object
+ //public static final int OLERENAMED = 3; //Application file containing the linked object's data has been renamed
+ //public static final int OLERENDER_ASIS = 3; //Ole Create rendering formats
+ public static final int OLERENDER_DRAW = 1;
+ //public static final int OLERENDER_FORMAT = 2;
+ //public static final int OLERENDER_NONE = 0;
+ //public static final int OLESAVED = 1; //Object's data has been saved by the application that created the object
+ //public static final int OLESIZEAUTOSIZE = 2; //OLE container control is automatically resized to display the entire object
+ //public static final int OLESIZECLIP = 0; //Object's image is clipped by the OLE container control's borders
+ //public static final int OLESIZESTRETCH = 1; //Object's image is sized to fill the OLE container control
+ //public static final int OLESIZEZOOM = 3; //Object's image is stretched but in proportion
+ //public static final int OLEWHICHMK_CONTAINER = 1;
+ //public static final int OLEWHICHMK_OBJFULL = 3;
+ //public static final int OLEWHICHMK_OBJREL = 2;
+ public static final int S_FALSE = 1; //Used for functions that semantically return a Boolean FALSE result to indicate that the function succeeded.
+ public static final int S_OK = 0; //Function succeeded.
+ public static final int STG_E_FILENOTFOUND = 0x80030002;
+ public static final int STG_S_CONVERTED = 0x00030200;
+ //public static final int STGC_CONSOLIDATE = 8;
+ //public static final int STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4;
+ public static final int STGC_DEFAULT = 0;
+ //public static final int STGC_ONLYIFCURRENT = 2;
+ //public static final int STGC_OVERWRITE = 1;
+ public static final int STGM_CONVERT = 0x00020000;
+ public static final int STGM_CREATE = 0x00001000;
+ public static final int STGM_DELETEONRELEASE = 0x04000000;
+ public static final int STGM_DIRECT = 0x00000000;
+ public static final int STGM_DIRECT_SWMR = 0x00400000;
+ public static final int STGM_FAILIFTHERE = 0x00000000;
+ public static final int STGM_NOSCRATCH = 0x00100000;
+ public static final int STGM_NOSNAPSHOT = 0x00200000;
+ public static final int STGM_PRIORITY = 0x00040000;
+ public static final int STGM_READ = 0x00000000;
+ public static final int STGM_READWRITE = 0x00000002;
+ public static final int STGM_SHARE_DENY_NONE = 0x00000040;
+ public static final int STGM_SHARE_DENY_READ = 0x00000030;
+ public static final int STGM_SHARE_DENY_WRITE = 0x00000020;
+ public static final int STGM_SHARE_EXCLUSIVE = 0x00000010;
+ public static final int STGM_SIMPLE = 0x08000000;
+ public static final int STGM_TRANSACTED = 0x00010000;
+ public static final int STGM_WRITE = 0x00000001;
+ public static final int STGTY_STORAGE = 1;
+ public static final int STGTY_STREAM = 2;
+ public static final int STGTY_LOCKBYTES = 3;
+ public static final int STGTY_PROPERTY = 4;
+ //public static final int TYMED_ENHMF = 64; //Values for tymed
+ //public static final int TYMED_FILE = 2;
+ //public static final int TYMED_GDI = 16;
+ public static final int TYMED_HGLOBAL = 1;
+ //public static final int TYMED_ISTORAGE = 8;
+ //public static final int TYMED_ISTREAM = 4;
+ //public static final int TYMED_MFPICT = 32;
+ //public static final int TYMED_NULL = 0;
+
+ public static final short DISPATCH_METHOD = 0x1; //Dispatch Constants
+ public static final short DISPATCH_PROPERTYGET = 0x2;
+ public static final short DISPATCH_PROPERTYPUT = 0x4;
+ public static final short DISPATCH_PROPERTYPUTREF = 0x8;
+ //public static final short DISPID_CONSTRUCTOR = -6;
+ //public static final short DISPID_DESTRUCTOR = -7;
+ //public static final short DISPID_EVALUATE = -5;
+ //public static final short DISPID_NEWENUM = -4;
+ public static final short DISPID_PROPERTYPUT = -3;
+ //public static final short DISPID_UNKNOWN = -1;
+ //public static final short DISPID_VALUE = 0;
+
+ // Variant types
+ public static final short VT_BOOL = 11; // Boolean; True=-1, False=0.
+ public static final short VT_BSTR = 8; // Binary String.
+ public static final short VT_BYREF = 16384; // By reference - must be combined with one of the othre VT values
+ public static final short VT_CY = 6; // Currency.
+ public static final short VT_DATE = 7; // Date.
+ public static final short VT_DISPATCH = 9; // IDispatch
+ public static final short VT_EMPTY = 0; // Not specified.
+ public static final short VT_ERROR = 10; // Scodes.
+ public static final short VT_I2 = 2; // 2-byte signed int.
+ public static final short VT_I4 = 3; // 4-byte signed int.
+ public static final short VT_NULL = 1; // Null.
+ public static final short VT_R4 = 4; // 4-byte real.
+ public static final short VT_R8 = 5; // 8-byte real.
+ public static final short VT_UI1 = 17; // Unsigned char.
+ public static final short VT_UI4 = 19; // Unsigned int.
+ public static final short VT_UNKNOWN = 13; // IUnknown FAR*.
+ public static final short VT_VARIANT = 12; // VARIANT FAR*.
+
+public static final native int CLSIDFromProgID(char[] lpszProgID, GUID pclsid);
+public static final native int CLSIDFromString(char[] lpsz, GUID pclsid);
+public static final native int CoCreateInstance(
+ GUID rclsid,
+ int pUnkOuter,
+ int dwClsContext,
+ GUID riid,
+ int[] ppv
+);
+
+public static final native void CoFreeUnusedLibraries();
+public static final native int CoGetClassObject(GUID rclsid, int dwClsContext, int pServerInfo, GUID riid, int[] ppv);
+public static final native int CoLockObjectExternal(
+ int pUnk, //Pointer to object to be locked or unlocked
+ boolean fLock, //TRUE = lock, FALSE = unlock
+ boolean fLastUnlockReleases //TRUE = release all pointers to object
+);
+public static final native int CoTaskMemAlloc(int cb); //Size in bytes of memory block to be allocated
+public static final native void CoTaskMemFree(int pv);
+public static final native int DoDragDrop(
+ int pDataObject, //Pointer to the data object
+ int pDropSource, //Pointer to the source
+ int dwOKEffect, //Effects allowed by the source
+ int[] pdwEffect //Pointer to effects on the source
+);
+
+public static final native void DragFinish(int hDrop);
+
+public static final native int DragQueryFile(
+ int hDrop,
+ int iFile,
+ byte[] lpszFile,
+ int cch
+);
+
+public static final native int GetClassFile(
+ char[] szFileName, //Pointer to filename for which you are requesting a CLSID
+ GUID clsid //Pointer to location for returning the CLSID
+);
+public static final native int GetClipboardFormatName(
+ int format,
+ byte[] lpszFormatName,
+ int cchMaxCount);
+public static final native int IIDFromString(char[] lpsz, GUID lpiid);
+private static GUID IIDFromString(String lpsz) {
+ // create a null terminated array of char
+ char[] buffer = (lpsz +"\0").toCharArray();
+
+ // invoke system method
+ GUID lpiid = new GUID();
+ if (COM.IIDFromString(buffer, lpiid) == COM.S_OK)
+ return lpiid;
+ return null;
+}
+public static final native boolean IsEqualGUID(GUID rguid1, GUID rguid2);
+public static final native void MoveMemory( byte[] Destination, DROPFILES Source, int Length);
+public static final native void MoveMemory(char[] Destination, int SourcePtr, int Length);
+public static final native void MoveMemory(double[] Destination, int SourcePtr, int Length);
+public static final native void MoveMemory(float[] Destination, int SourcePtr, int Length);
+public static final native void MoveMemory(short[] Destination, int SourcePtr, int Length);
+public static final native void MoveMemory(int DestinationPtr, double[] Source, int Length);
+public static final native void MoveMemory(int DestinationPtr, float[] Source, int Length);
+public static final native void MoveMemory(int DestinationPtr, short[] Source, int Length);
+public static final native void MoveMemory( int Destination, FORMATETC Source, int Length);
+public static final native void MoveMemory(int DestinationPtr, GUID Source, int Length);
+public static final native void MoveMemory(int DestinationPtr, OLEINPLACEFRAMEINFO Source, int Length);
+public static final native void MoveMemory( int Destination, STATSTG Source, int Length);
+public static final native void MoveMemory( int Destination, STGMEDIUM Source, int Length);
+public static final native void MoveMemory(DISPPARAMS Destination, int SourcePtr, int Length);
+public static final native void MoveMemory(FORMATETC Destination, int Source, int Length);
+public static final native void MoveMemory(GUID Destination, int SourcePtr, int Length);
+public static final native void MoveMemory(STATSTG Destination, int Source, int Length);
+public static final native void MoveMemory(TYPEATTR Destination, int SourcePtr, int Length);
+public static final native void MoveMemory (RECT Destination, int Source, int Length);
+public static final native void MoveMemory (FUNCDESC1 Destination, int Source, int Length);
+public static final native void MoveMemory (VARDESC1 Destination, int Source, int Length);
+public static final native void MoveMemory (FUNCDESC2 Destination, int Source, int Length);
+public static final native void MoveMemory (VARDESC2 Destination, int Source, int Length);
+
+public static final native int OleCreate( GUID rclsid, GUID riid, int renderopt, FORMATETC pFormatEtc, int pClientSite, int pStg, int[] ppvObject);
+public static final native int OleCreateFromFile(
+ GUID rclsid, //Reserved. Must be CLSID_NULL
+ char[] lpszFileName, //Pointer to full path of file used to create object
+ GUID riid, //Reference to the identifier of the interface to be used to
+ // communicate with new object
+ int renderopt, //Value from OLERENDER
+ FORMATETC pFormatEtc, //Pointer to the FORMATETC structure
+ int pClientSite, //Pointer to an interface
+ int pStg, //Pointer tothe interface to be used as object storage
+ int[] ppvObj); //Address of output variable that receives the interface pointer
+ // requested in riid
+public static final native int OleCreatePropertyFrame(int hwndOwner,int x, int y, char[] lpszCaption, int cObjects, int[] lplpUnk, int cPages, int lpPageClsID, int lcid, int dwReserved, int lpvReserved);
+public static final native int OleDraw(int pUnk, //Pointer to the view object to be drawn
+ int dwAspect, //How the object is to be represented
+ int hdcDraw, //Device context on which to draw
+ int lprcBounds);//Pointer to the rectangle in which the object is drawn
+public static final native int OleFlushClipboard();
+public static final native int OleGetClipboard(int[] ppDataObject);
+public static final native int OleIsCurrentClipboard(int pDataObject);
+public static final native boolean OleIsRunning(int pObject);
+public static final native int OleLoad(
+ int pStg, //Pointer to the storage object from which to load
+ GUID riid, //Reference to the identifier of the interface
+ int pClientSite, //Pointer to the client site for the object
+ int[] ppvObj //Address of output variable that receives the interface pointer requested in riid
+);
+public static final native int OleRun(int pUnknown);
+public static final native int OleSave(int pPS, int pStg,boolean fSameAsLoad);
+public static final native int OleSetClipboard(int pDataObject);
+public static final native int OleSetContainedObject(int pUnk, boolean fContained);
+public static final native int OleSetMenuDescriptor(int holemenu, int hwndFrame, int hwndActiveObject, int lpFrame, int lpActiveObj);
+public static final native int OleTranslateColor(int clr, int hpal, int[] pcolorref);
+public static final native int ProgIDFromCLSID(
+ GUID clsid, //CLSID for which the ProgID is requested
+ int[] lplpszProgID //Address of output variable that receives a pointer to the requested ProgID string
+);
+public static final native int RegisterClipboardFormat(byte[] lpszFormat);
+public static final native int RegisterDragDrop(
+ int hwnd, //Handle to a window that can accept drops
+ int pDropTarget //Pointer to object that is to be target of drop
+);
+public static final native void ReleaseStgMedium(
+ STGMEDIUM pmedium //Pointer to storage medium to be freed
+);
+public static final native int RevokeDragDrop(
+ int hwnd //Handle to a window that can accept drops
+);
+public static final native int StgCreateDocfile(char[] pwcsName, int grfMode, int reserved, int[] ppstgOpen);
+public static final native int StgIsStorageFile(
+ char[] pwcsName //Points to a path of the file to check
+);
+public static final native int StgOpenStorage(
+ char[] pwcsName, //Points to the path of the file containing storage object
+ int pstgPriority, //Points to a previous opening of a root storage object
+ int grfMode, //Specifies the access mode for the object
+ int snbExclude, //Points to an SNB structure specifying elements to be excluded
+ int reserved, //Reserved; must be zero
+ int[] ppstgOpen //Address of output variable that receives the IStorage interface pointer
+);
+public static final native int SysAllocString(char [] sz);
+public static final native void SysFreeString(int bstr);
+public static final native int SysStringByteLen(int bstr);
+public static final native int VariantChangeType(int pvargDest, int pvarSrc, short wFlags, short vt);
+public static final native int VariantClear(int pvarg);
+public static final native void VariantInit(int pvarg);
+public static final native int VtblCall (int fnNumber, int ppVtbl);
+public static final native int VtblCall (int fnNumber, int ppVtbl, char[] arg0);
+public static final native int VtblCall (int fnNumber, int ppVtbl, char[] arg0, char[] arg1);
+public static final native int VtblCall (int fnNumber, int ppVtbl, char[] arg0, int arg1);
+public static final native int VtblCall (int fnNumber, int ppVtbl, char[] arg0, int arg1, int arg2, int arg3, int[] arg4);
+public static final native int VtblCall (int fnNumber, int ppVtbl, char[] arg0, int arg1, int arg2, int arg3, int arg4, int[] arg5);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int[] arg0);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, int[] arg1);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, int arg1);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, int arg1, int[] arg2);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, int arg1, int arg2);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, int arg1, int arg2, int[] arg3);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, int arg1, DVTARGETDEVICE arg2, SIZE arg3);
+public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, GUID arg2, int arg3, int[] arg4);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, FORMATETC arg1, int[] arg2);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, GUID arg1);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, GUID arg1, int arg2, int arg3);
+public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, GUID arg1, int arg2, int arg3, DISPPARAMS arg4, int arg5, EXCEPINFO arg6, int[] arg7);
+public static final native int VtblCall(int ppVtbl, int fnNumber, int arg0, STATSTG arg1, int[] arg2);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, MSG arg1, int arg2, int arg3, int arg4, RECT arg5);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, SIZE arg1);
+public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, boolean arg1);
+public static final native int VtblCall(int fnNumber, int ppVtbl, CAUUID arg0);
+public static final native int VtblCall(int ppVtbl, int fnNumber, CONTROLINFO arg0);
+public static final native int VtblCall (int fnNumber, int ppVtbl, FORMATETC arg0);
+public static final native int VtblCall(int fnNumber, int ppVtbl, FORMATETC arg0, STGMEDIUM arg1);
+public static final native int VtblCall(int fnNumber, int ppVtbl, FORMATETC arg0, STGMEDIUM arg1, boolean arg2);
+public static final native int VtblCall (int ppVtbl, int fnNumber, GUID arg0);
+public static final native int VtblCall(int ppVtbl, int fnNumber, GUID arg0, int[] arg1);
+public static final native int VtblCall (int fnNumber, int ppVtbl, GUID arg0, int arg1, int arg2, int arg3, int[] arg4);
+public static final native int VtblCall(int fnNumber, int ppVtbl, GUID arg0, int arg1, int arg2, int arg3, int arg4);
+public static final native int VtblCall(int fnNumber, int ppVtbl, GUID arg0, int arg1, OLECMD arg2, OLECMDTEXT arg3);
+public static final native int VtblCall(int fnNumber, int ppVtbl, LICINFO arg0);
+public static final native int VtblCall(int fnNumber, int ppVtbl, RECT arg0, int arg1, boolean arg2);
+public static final native int VtblCall(int fnNumber, int ppVtbl, RECT arg0, RECT arg1);
+public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int[] arg1, int[] arg2, int[] arg3, int[] arg4);
+public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int[] arg1, int arg2, int[] arg3);
+
+public static final native int WriteClassStg(int pStg, GUID rclsid);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java
new file mode 100755
index 0000000000..bef6d7e995
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java
@@ -0,0 +1,1024 @@
+package org.eclipse.swt.internal.ole.win32;
+
+import java.util.Hashtable;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.win32.*;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class COMObject {
+
+ private int ppVtable;
+
+ static private final int MAX_ARG_COUNT = 12;
+ static private final int MAX_VTABLE_LENGTH = 80;
+ static private Callback[][] Callbacks = new Callback[MAX_VTABLE_LENGTH][MAX_ARG_COUNT];
+ static private Hashtable ObjectMap = new Hashtable();
+
+public COMObject(int[] argCounts) {
+ int[] callbackAddresses = new int[argCounts.length];
+ for (int i = 0, length = argCounts.length; i < length; i++){
+ if ((Callbacks[i][argCounts[i]]) == null) {
+ Callbacks[i][argCounts[i]] = new Callback(this.getClass(), "callback"+i, argCounts[i] + 1, true);
+ }
+ callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress();
+ }
+
+ int pVtable = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4 * argCounts.length);
+ COM.MoveMemory(pVtable, callbackAddresses, 4 * argCounts.length);
+ ppVtable = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4);
+ COM.MoveMemory(ppVtable, new int[] {pVtable}, 4);
+ ObjectMap.put(new Integer(ppVtable), this);
+}
+
+public static GUID IIDFromString(String lpsz) {
+ // create a null terminated array of char
+ char[] buffer = (lpsz +"\0").toCharArray();
+
+ // invoke system method
+ GUID lpiid = new GUID();
+ if (COM.IIDFromString(buffer, lpiid) == COM.S_OK)
+ return lpiid;
+ return null;
+}
+
+static int callback0(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method0(args);
+}
+static int callback1(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method1(args);
+}
+static int callback2(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method2(args);
+}
+static int callback3(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method3(args);
+}
+static int callback4(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method4(args);
+}
+static int callback5(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method5(args);
+}
+static int callback6(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method6(args);
+}
+static int callback7(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method7(args);
+}
+static int callback8(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method8(args);
+}
+static int callback9(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method9(args);
+}
+static int callback10(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method10(args);
+}
+static int callback11(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method11(args);
+}
+static int callback12(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method12(args);
+}
+static int callback13(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method13(args);
+}
+static int callback14(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method14(args);
+}
+static int callback15(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method15(args);
+}
+static int callback16(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method16(args);
+}
+static int callback17(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method17(args);
+}
+static int callback18(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method18(args);
+}
+static int callback19(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method19(args);
+}
+static int callback20(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method20(args);
+}
+static int callback21(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method21(args);
+}
+static int callback22(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method22(args);
+}
+static int callback23(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method23(args);
+}
+static int callback24(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method24(args);
+}
+static int callback25(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method25(args);
+}
+static int callback26(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method26(args);
+}
+static int callback27(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method27(args);
+}
+static int callback28(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method28(args);
+}
+static int callback29(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method29(args);
+}
+static int callback30(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method30(args);
+}
+static int callback31(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method31(args);
+}
+static int callback32(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method32(args);
+}
+static int callback33(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method33(args);
+}
+static int callback34(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method34(args);
+}
+static int callback35(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method35(args);
+}
+static int callback36(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method36(args);
+}
+static int callback37(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method37(args);
+}
+static int callback38(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method38(args);
+}
+static int callback39(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method39(args);
+}
+static int callback40(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method40(args);
+}
+static int callback41(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method41(args);
+}
+static int callback42(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method42(args);
+}
+static int callback43(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method43(args);
+}
+static int callback44(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method44(args);
+}
+static int callback45(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method45(args);
+}
+static int callback46(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method46(args);
+}
+static int callback47(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method47(args);
+}
+static int callback48(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method48(args);
+}
+static int callback49(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method49(args);
+}
+static int callback50(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method50(args);
+}
+static int callback51(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method51(args);
+}
+static int callback52(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method52(args);
+}
+static int callback53(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method53(args);
+}
+static int callback54(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method54(args);
+}
+static int callback55(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method55(args);
+}
+static int callback56(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method56(args);
+}
+static int callback57(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method57(args);
+}
+static int callback58(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method58(args);
+}
+static int callback59(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method59(args);
+}
+static int callback60(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method60(args);
+}
+static int callback61(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method61(args);
+}
+static int callback62(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method62(args);
+}
+static int callback63(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method63(args);
+}
+static int callback64(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method64(args);
+}
+static int callback65(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method65(args);
+}
+static int callback66(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method66(args);
+}
+static int callback67(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method67(args);
+}
+static int callback68(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method68(args);
+}
+static int callback69(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method69(args);
+}
+static int callback70(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method70(args);
+}
+static int callback71(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method71(args);
+}
+static int callback72(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method72(args);
+}
+static int callback73(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method73(args);
+}
+static int callback74(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method74(args);
+}
+static int callback75(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method75(args);
+}
+static int callback76(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method76(args);
+}
+static int callback77(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method77(args);
+}
+static int callback78(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method78(args);
+}
+static int callback79(int[] callbackArgs) {
+ // find the object on which this call was invoked
+ int address = callbackArgs[0];
+ Object object = ObjectMap.get(new Integer(address));
+ if (object == null) return COM.E_FAIL;
+ int[] args = new int[callbackArgs.length - 1];
+ System.arraycopy(callbackArgs, 1, args, 0, args.length);
+ return ((COMObject) object).method79(args);
+}
+public void dispose() {
+ // free the memory for this reference
+ int[] pVtable = new int[1];
+ OS.MoveMemory(pVtable, ppVtable, 4);
+ OS.GlobalFree(pVtable[0]);
+ OS.GlobalFree(ppVtable);
+
+ // remove this ppVtable from the list
+ ObjectMap.remove(new Integer(ppVtable));
+
+ ppVtable = 0;
+}
+public int getAddress () {
+ return ppVtable;
+}
+public int method0(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method1(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method2(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method3(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method4(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method5(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method6(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method7(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method8(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method9(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method10(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method11(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method12(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method13(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method14(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method15(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method16(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method17(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method18(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method19(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method20(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method21(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method22(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method23(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method24(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method25(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method26(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method27(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method28(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method29(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method30(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method31(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method32(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method33(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method34(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method35(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method36(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method37(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method38(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method39(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method40(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method41(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method42(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method43(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method44(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method45(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method46(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method47(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method48(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method49(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method50(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method51(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method52(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method53(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method54(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method55(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method56(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method57(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method58(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method59(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method60(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method61(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method62(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method63(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method64(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method65(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method66(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method67(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method68(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method69(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method70(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method71(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method72(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method73(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method74(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method75(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method76(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method77(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method78(int[] args) {
+ return COM.E_NOTIMPL;
+}
+public int method79(int[] args) {
+ return COM.E_NOTIMPL;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java
new file mode 100755
index 0000000000..08cfe9319a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java
@@ -0,0 +1,17 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class CONTROLINFO
+{
+ public int cb;
+ public int hAccel;
+ public short cAccel;
+ public short filler;
+ public int dwFlags;
+
+ public static final int sizeof = 16;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java
new file mode 100755
index 0000000000..7177ca2654
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java
@@ -0,0 +1,15 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class COSERVERINFO {
+ public int dwReserved1;
+ public int pwszName;
+ public int pAuthInfo;
+ public int dwReserved2;
+
+ public static final int sizeof = 16;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java
new file mode 100755
index 0000000000..e55bcb0030
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java
@@ -0,0 +1,17 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class DISPPARAMS
+{
+ public int rgvarg;
+ public int rgdispidNamedArgs;
+ public int cArgs;
+ public int cNamedArgs;
+
+ public static final int sizeof = 16;
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DROPFILES.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DROPFILES.java
new file mode 100755
index 0000000000..c34ffd0cbc
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DROPFILES.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class DROPFILES {
+ public int pFiles; // Offset of the file list from the beginning of this structure, in bytes.
+ //public POINT pt; // Drop point. The coordinates depend on fNC.
+ public int pt_x;
+ public int pt_y;
+ public int fNC; // Nonclient area flag. If this member is TRUE, pt specifies the screen
+ // coordinates of a point in a window's nonclient area. If it is FALSE,
+ // pt specifies the client coordinates of a point in the client area.
+ public int fWide; // Value that indicates whether the file contains ANSI or Unicode
+ // characters. If it is zero, it contains ANSI characters. Otherwise, it
+ // contains Unicode characters.
+
+ public static final int sizeof = 20;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java
new file mode 100755
index 0000000000..f5ae048ad2
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java
@@ -0,0 +1,18 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class DVTARGETDEVICE
+{
+ public int tdSize;
+ public short tdDriverNameOffset;
+ public short tdDeviceNameOffset;
+ public short tdPortNameOffset;
+ public short tdExtDevmodeOffset;
+ public byte tdData;
+
+ public static final int sizeof = 13;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java
new file mode 100755
index 0000000000..ed85c472da
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class EXCEPINFO
+{
+ public short wCode;
+ public short wReserved;
+ public int bstrSource;
+ public int bstrDescription;
+ public int bstrHelpFile;
+ public int dwHelpContext;
+ public int pvReserved;
+ public int pfnDeferredFillIn;
+ public int scode;
+
+ public static final int sizeof = 32;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java
new file mode 100755
index 0000000000..1b177e7044
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java
@@ -0,0 +1,17 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class FORMATETC
+{
+ public int cfFormat;
+ public int ptd;
+ public int dwAspect;
+ public int lindex;
+ public int tymed;
+
+ public static final int sizeof = 20;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java
new file mode 100755
index 0000000000..50fddbb9cd
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java
@@ -0,0 +1,32 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class FUNCDESC1 {
+ public int memid;
+ public int lprgscode;
+ public int lprgelemdescParam;
+ public int funckind;
+ public int invkind;
+ public int callconv;
+ public short cParams;
+ public short cParamsOpt;
+ public short oVft;
+ public short cScodes;
+ //ELEMDESC elemdescFunc;
+ //TYPEDESC elemdescFunc.tdesc
+ public int elemdescFunc_tdesc_union;
+ public short elemdescFunc_tdesc_vt;
+ public short elemdescFunc_tdesc_filler;
+ //PARAMDESC elemdescFunc.paramdesc
+ public int elemdescFunc_paramdesc_pparamdescex;
+ public short elemdescFunc_paramdesc_wParamFlags;
+ public short elemdescFunc_paramdesc_filler;
+ public short wFuncFlags;
+
+ public static final int sizeof = 50;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java
new file mode 100755
index 0000000000..cba1125f53
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java
@@ -0,0 +1,32 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class FUNCDESC2 {
+ public int memid;
+ public int lprgscode;
+ public int lprgelemdescParam;
+ public int funckind;
+ public int invkind;
+ public int callconv;
+ public short cParams;
+ public short cParamsOpt;
+ public short oVft;
+ public short cScodes;
+ //ELEMDESC elemdescFunc;
+ //TYPEDESC elemdescFunc.tdesc
+ public int elemdescFunc_tdesc_union;
+ public short elemdescFunc_tdesc_vt;
+ public short elemdescFunc_tdesc_filler;
+ //IDLDESC elemdescFunc.idldesc
+ public int elemdescFunc_idldesc_dwReserved;
+ public short elemdescFunc_idldesc_wIDLFlags;
+ public short elemdescFunc_idldesc_filler;
+ public short wFuncFlags;
+
+ public static final int sizeof = 50;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/GUID.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/GUID.java
new file mode 100755
index 0000000000..2a3af7d23d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/GUID.java
@@ -0,0 +1,23 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class GUID
+{
+ public int data1;
+ public short data2;
+ public short data3;
+ public byte b0;
+ public byte b1;
+ public byte b2;
+ public byte b3;
+ public byte b4;
+ public byte b5;
+ public byte b6;
+ public byte b7;
+
+ public static final int sizeof = 16;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java
new file mode 100755
index 0000000000..ad71bed45f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IClassFactory2 extends IUnknown
+{
+public IClassFactory2(int address) {
+ super(address);
+}
+public int CreateInstanceLic(int pUnkOuter, int pUnkReserved, GUID riid, int bstrKey, int ppvObject[]) {
+ return COM.VtblCall(7, address, pUnkOuter, pUnkReserved, riid, bstrKey, ppvObject);
+}
+public int GetLicInfo(LICINFO licInfo) {
+ return COM.VtblCall(5, address, licInfo);
+}
+public int RequestLicKey(int dwReserved, int[] pBstrKey) {
+ return COM.VtblCall(6, address, dwReserved, pBstrKey);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java
new file mode 100755
index 0000000000..ee7dd708ea
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java
@@ -0,0 +1,19 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IConnectionPoint extends IUnknown
+{
+public IConnectionPoint(int address) {
+ super(address);
+}
+public int Advise(int pUnk, int[] pdwCookie) {
+ return COM.VtblCall(5, address, pUnk, pdwCookie);
+}
+public int Unadvise(int dwCookie) {
+ return COM.VtblCall(6, address, dwCookie);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java
new file mode 100755
index 0000000000..d4ce46a4d9
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IConnectionPointContainer extends IUnknown
+{
+public IConnectionPointContainer(int address) {
+ super(address);
+}
+public int FindConnectionPoint(GUID riid, int[] ppCP) {
+ return COM.VtblCall(4, address, riid, ppCP);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java
new file mode 100755
index 0000000000..e513252fe1
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java
@@ -0,0 +1,42 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IDataObject extends IUnknown {
+/**
+ * IDataObject constructor comment.
+ * @param address int
+ */
+public IDataObject(int address) {
+ super(address);
+}
+public int EnumFormatEtc(int dwDirection, int[] ppenumFormatetc) {
+ return COM.VtblCall(8, address, dwDirection, ppenumFormatetc);
+}
+public int GetData(FORMATETC pFormatetc, STGMEDIUM pmedium) {
+ //Called by a data consumer to obtain data from a source data object.
+ //The GetData method renders the data described in the specified FORMATETC
+ //structure and transfers it through the specified STGMEDIUM structure.
+ //The caller then assumes responsibility for releasing the STGMEDIUM structure.
+ return COM.VtblCall(3, address, pFormatetc, pmedium);
+}
+public int GetDataHere(FORMATETC pFormatetc, STGMEDIUM pmedium) {
+ //Called by a data consumer to obtain data from a source data object.
+ //This method differs from the GetData method in that the caller must
+ //allocate and free the specified storage medium.
+ return COM.VtblCall(4, address, pFormatetc, pmedium);
+}
+public int QueryGetData(FORMATETC pFormatetc) {
+ return COM.VtblCall(5, address, pFormatetc);
+}
+public int SetData(
+ FORMATETC pFormatetc, // Pointer to the FORMATETC structure
+ STGMEDIUM pmedium, // Pointer to STGMEDIUM structure
+ boolean fRelease // Indicates which object owns the storage medium after the call is completed
+ ){
+ return COM.VtblCall(7, address, pFormatetc, pmedium, fRelease);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java
new file mode 100755
index 0000000000..171ce98771
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java
@@ -0,0 +1,61 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.internal.win32.*;
+
+public class IDispatch extends IUnknown
+{
+public IDispatch(int address) {
+ super(address);
+}
+public int GetIDsOfNames(GUID riid, String[] rgszNames, int cNames, int lcid, int[] rgDispId) {
+
+ char[] buffer;
+ int size = rgszNames.length;
+
+ // create an array to hold the addresses
+ int hHeap = OS.GetProcessHeap();
+ int ppNames = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, size*4);
+ int[] memTracker = new int[size];
+
+ try {
+ // add the address of each string to the array
+
+ for (int i=0; i<size; i++){
+ // create a null terminated array of char for each String
+ int nameSize = rgszNames[i].length();
+ buffer = new char[nameSize +1];
+ rgszNames[i].getChars(0, nameSize, buffer, 0);
+ // get the address of the start of the array of char
+ int pName = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, buffer.length * 2);
+ OS.MoveMemory(pName, buffer, buffer.length * 2);
+ // copy the address to the array of addresses
+ COM.MoveMemory(ppNames + 4*i, new int[]{pName}, 4);
+ // keep track of the Global Memory so we can free it
+ memTracker[i] = pName;
+ }
+
+ return COM.VtblCall(5, address, new GUID(), ppNames, cNames, lcid, rgDispId);
+
+ } finally {
+ // free the memory
+ for (int i=0; i<memTracker.length; i++){
+ OS.HeapFree(hHeap, 0, memTracker[i]);
+ }
+ OS.HeapFree(hHeap, 0, ppNames);
+ }
+}
+public int GetTypeInfo(int iTInfo, int lcid, int[] ppTInfo ){
+ return COM.VtblCall(4, address, iTInfo, lcid, ppTInfo);
+}
+public int GetTypeInfoCount(int[] pctinfo ){
+ return COM.VtblCall(3, address, pctinfo);
+}
+public int Invoke(int dispIdMember, GUID riid, int lcid, int dwFlags, DISPPARAMS pDispParams, int pVarResult, EXCEPINFO pExcepInfo, int pArgErr[]) {
+ return COM.VtblCall(6, address, dispIdMember, riid, lcid, dwFlags, pDispParams, pVarResult, pExcepInfo, pArgErr);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnum.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnum.java
new file mode 100755
index 0000000000..eb1841b0cf
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnum.java
@@ -0,0 +1,25 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IEnum extends IUnknown
+{
+public IEnum(int address) {
+ super(address);
+}
+public int Clone( int[] ppenum ){
+ return COM.VtblCall(6, address, ppenum);
+}
+public int Next(int celt, int rgelt, int[] pceltFetched ){
+ return COM.VtblCall(3, address, celt, rgelt, pceltFetched);
+}
+public int Reset() {
+ return COM.VtblCall(5, address);
+}
+public int Skip(int celt){
+ return COM.VtblCall(4, address, celt);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java
new file mode 100755
index 0000000000..7fb4fb70f4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java
@@ -0,0 +1,12 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IEnumFORMATETC extends IEnum {
+public IEnumFORMATETC(int address) {
+ super(address);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java
new file mode 100755
index 0000000000..3753815363
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java
@@ -0,0 +1,12 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IEnumSTATSTG extends IEnum {
+public IEnumSTATSTG(int address) {
+ super(address);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IFont.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IFont.java
new file mode 100755
index 0000000000..e0422317f6
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IFont.java
@@ -0,0 +1,19 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IFont extends IUnknown {
+/**
+ * IFont constructor comment.
+ * @param address int
+ */
+public IFont(int address) {
+ super(address);
+}
+public int get_hFont(int[] phfont){
+ return COM.VtblCall(3, address, phfont);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java
new file mode 100755
index 0000000000..0fb02bb76d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java
@@ -0,0 +1,13 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IMoniker extends IPersist
+{
+public IMoniker(int address) {
+ super(address);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java
new file mode 100755
index 0000000000..be82303bfe
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java
@@ -0,0 +1,35 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IOleCommandTarget extends IUnknown {
+/**
+ * IOleCommandTarget constructor comment.
+ * @param address int
+ */
+public IOleCommandTarget(int address) {
+ super(address);
+}
+public int Exec(
+ GUID pguidCmdGroup, // Pointer to command group
+ int nCmdID, // Identifier of command to execute
+ int nCmdExecOpt, // Options for executing the command
+ int pvaIn, // Pointer to input arguments
+ int pvaOut // Pointer to command output
+){
+ return COM.VtblCall(4, address, pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut);
+}
+public int QueryStatus(
+ GUID pguidCmdGroup, // Pointer to command group
+ int cCmds, // Number of commands in prgCmds array
+ OLECMD prgCmds, // Array of commands
+ OLECMDTEXT pCmdText // Pointer to name or status of command
+){
+ // we only support querying for one command at a time
+ if (cCmds > 1) return COM.E_INVALIDARG;
+ return COM.VtblCall(3, address, pguidCmdGroup, cCmds, prgCmds, pCmdText);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java
new file mode 100755
index 0000000000..169935b094
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IOleControl extends IUnknown
+{
+public IOleControl(int address) {
+ super(address);
+}
+public int GetControlInfo(CONTROLINFO pCI) {
+ return COM.VtblCall(3, address, pCI);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java
new file mode 100755
index 0000000000..ef0defed9e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java
@@ -0,0 +1,18 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.internal.win32.*;
+
+public class IOleInPlaceActiveObject extends IOleWindow
+{
+public IOleInPlaceActiveObject(int address) {
+ super(address);
+}
+public int ResizeBorder(RECT prcBorder, int pUIWindow, boolean fFrameWindow) {
+ return COM.VtblCall(8, address, prcBorder, pUIWindow, fFrameWindow);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java
new file mode 100755
index 0000000000..5963096daa
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.internal.win32.*;
+
+public class IOleInPlaceObject extends IOleWindow
+{
+public IOleInPlaceObject(int address) {
+ super(address);
+}
+public int InPlaceDeactivate() {
+ return COM.VtblCall(5, address);
+}
+public int SetObjectRects(RECT lprcPosRect, RECT lprcClipRect) {
+ return COM.VtblCall(7, address, lprcPosRect, lprcClipRect);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java
new file mode 100755
index 0000000000..a84c3851a6
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java
@@ -0,0 +1,19 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IOleLink extends IUnknown
+{
+public IOleLink(int address) {
+ super(address);
+}
+public int BindIfRunning() {
+ return COM.VtblCall(10, address);
+}
+public int GetSourceMoniker(int[] ppmk) {
+ return COM.VtblCall(6, address, ppmk);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java
new file mode 100755
index 0000000000..1559123ad8
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java
@@ -0,0 +1,55 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.internal.win32.*;
+
+public class IOleObject extends IUnknown
+{
+public IOleObject(int address) {
+ super(address);
+}
+public int Advise(int pAdvSink, int pdwConnection[]) {
+ return COM.VtblCall(19, address, pAdvSink, pdwConnection);
+}
+public int Close(int dwSaveOption) {
+ return COM.VtblCall(6, address, dwSaveOption);
+}
+public int DoVerb(int iVerb, MSG lpmsg, int pActiveSite, int lindex, int hwndParent, RECT lprcPosRect) {
+ return COM.VtblCall(11, address, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
+}
+public int GetExtent(int dwDrawAspect, SIZE pSizel) {
+ return COM.VtblCall(18, address, dwDrawAspect, pSizel);
+}
+public int SetClientSite(int pClientSite) {
+ return COM.VtblCall(3, address, pClientSite);
+}
+public int SetExtent(int dwDrawAspect, SIZE pSizel) {
+ return COM.VtblCall(17, address, dwDrawAspect, pSizel);
+}
+public int SetHostNames(String szContainerApp, String szContainerObj) {
+
+ // create a null terminated array of char
+ char[] buffer1 = null;
+ if (szContainerApp != null) {
+ int count1 = szContainerApp.length();
+ buffer1 = new char[count1 + 1];
+ szContainerApp.getChars(0, count1, buffer1, 0);
+ }
+
+ // create a null terminated array of char
+ char[] buffer2 = null;
+ if (szContainerObj != null) {
+ int count2 = szContainerObj.length();
+ buffer2 = new char[count2 + 1];
+ szContainerObj.getChars(0, count2, buffer2, 0);
+ }
+ return COM.VtblCall(5, address, buffer1, buffer2);
+}
+public int Update() {
+ return COM.VtblCall(13, address);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java
new file mode 100755
index 0000000000..1a7d21a3b5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java
@@ -0,0 +1,19 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IOleWindow extends IUnknown {
+/**
+ * ProxyIOleWindow constructor comment.
+ * @param address int
+ */
+public IOleWindow(int address) {
+ super(address);
+}
+public int GetWindow(int phwnd[]) {
+ return COM.VtblCall(3, address, phwnd);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersist.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersist.java
new file mode 100755
index 0000000000..a8ed520f9e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersist.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IPersist extends IUnknown
+{
+public IPersist(int address) {
+ super(address);
+}
+public int GetClassID(GUID pClassID) {
+ return COM.VtblCall(3, address, pClassID);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java
new file mode 100755
index 0000000000..e3a5f164ee
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java
@@ -0,0 +1,31 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IPersistStorage extends IPersist
+{
+public IPersistStorage(int address) {
+ super(address);
+}
+public int IsDirty() {
+ return COM.VtblCall(4, address);
+}
+public int InitNew(int pStg) {
+ return COM.VtblCall(5, address, pStg);
+}
+public int Load(int pStg) {
+ return COM.VtblCall(6, address, pStg);
+}
+public int Save(int pStgSave, boolean fSameAsLoad) {
+ return COM.VtblCall(7, address, pStgSave, fSameAsLoad);
+}
+public int SaveCompleted(int pStgNew) {
+ return COM.VtblCall(8, address, pStgNew);
+}
+public int HandsOffStorage(){
+ return COM.VtblCall(9, address);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java
new file mode 100755
index 0000000000..ecaa8db5dc
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IProvideClassInfo extends IUnknown
+{
+public IProvideClassInfo(int address) {
+ super(address);
+}
+public int GetClassInfo(int[] ppTI) {
+ return COM.VtblCall(3, address, ppTI);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java
new file mode 100755
index 0000000000..d82afd0a23
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IProvideClassInfo2 extends IProvideClassInfo
+{
+public IProvideClassInfo2(int address) {
+ super(address);
+}
+public int GetGUID(int dwGuidKind, GUID pGUID) {
+ return COM.VtblCall(4, address, dwGuidKind, pGUID);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java
new file mode 100755
index 0000000000..667cc850d6
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class ISpecifyPropertyPages extends IUnknown {
+
+public ISpecifyPropertyPages(int address) {
+ super(address);
+}
+public int GetPages(CAUUID pPages){
+ return COM.VtblCall(3, address, pPages);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStorage.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStorage.java
new file mode 100755
index 0000000000..3324b33b4e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStorage.java
@@ -0,0 +1,144 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IStorage extends IUnknown
+{
+public IStorage(int address) {
+ super(address);
+}
+public int Commit(int grfCommitFlag) {
+ return COM.VtblCall(9, address, grfCommitFlag);
+}
+public int CopyTo(
+ int ciidExclude, //Number of elements in rgiidExclude
+ GUID rgiidExclude, //Array of interface identifiers (IIDs)
+ String[] snbExclude, //Points to a block of stream names in the storage object
+ int pstgDest //Points to destination storage object
+ ){
+ // we only support snbExclude = null
+ if (snbExclude != null) {
+ return COM.E_INVALIDARG;
+ }
+ return COM.VtblCall(7, address, ciidExclude, rgiidExclude, 0, pstgDest);
+}
+public int CreateStorage(
+ String pwcsName, //Pointer to the name of the new storage object
+ int grfMode, //Access mode for the new storage object
+ int reserved1, //Reserved; must be zero
+ int reserved2, //Reserved; must be zero
+ int[] ppStg //Pointer to new storage object
+){
+
+ // create a null terminated array of char
+ char[] buffer = null;
+ if (pwcsName != null) {
+ buffer = (pwcsName+"\0").toCharArray();
+ }
+
+ return COM.VtblCall(5, address, buffer, grfMode, reserved1, reserved2, ppStg);
+}
+public int CreateStream(
+ String pwcsName, //Pointer to the name of the new stream
+ int grfMode, //Access mode for the new stream
+ int reserved1, //Reserved; must be zero
+ int reserved2, //Reserved; must be zero
+ int[] ppStm //Pointer to new stream object
+){
+
+ // create a null terminated array of char
+ char[] buffer = null;
+ if (pwcsName != null) {
+ buffer = (pwcsName+"\0").toCharArray();
+ }
+
+ return COM.VtblCall(3, address, buffer, grfMode, reserved1, reserved2, ppStm);
+}
+public int DestroyElement(String pwcsName) {
+
+ // create a null terminated array of char
+ char[] buffer = null;
+ if (pwcsName != null) {
+ buffer = (pwcsName+"\0").toCharArray();
+ }
+ return COM.VtblCall(12, address, buffer);
+}
+public int EnumElements(
+ int reserved1, //Reserved; must be zero
+ int reserved2, //Reserved; must be NULL
+ int reserved3, //Reserved; must be zero
+ int[] ppenum //Pointer to output variable that
+ // receives the IEnumSTATSTG interface
+){
+ return COM.VtblCall(11, address, reserved1, reserved2, reserved3, ppenum);
+}
+public int OpenStorage(
+ String pwcsName, //Pointer to the name of the
+ // storage object to open
+ int pstgPriority, //Must be NULL.
+ int grfMode, //Access mode for the new storage object
+ String snbExclude[], //Must be NULL.
+ int reserved, //Reserved; must be zero
+ int[] ppStg //Pointer to opened storage object
+){
+
+ // create a null terminated array of char
+ char[] buffer = null;
+ if (pwcsName != null) {
+ buffer = (pwcsName+"\0").toCharArray();
+ }
+
+ // we only support the case where snbExclude = null
+ if (snbExclude != null) {
+ return COM.E_INVALIDARG;
+ }
+ return COM.VtblCall(6, address, buffer, pstgPriority, grfMode, 0, reserved, ppStg);
+}
+public int OpenStream(
+ String pwcsName, //Pointer to name of stream to open
+ int reserved1, //Reserved; must be NULL
+ int grfMode, //Access mode for the new stream
+ int reserved2, //Reserved; must be zero
+ int[] ppStm //Pointer to output variable
+ // that receives the IStream interface pointer
+) {
+
+ // create a null terminated array of char
+ char[] buffer = null;
+ if (pwcsName != null) {
+ buffer = (pwcsName+"\0").toCharArray();
+ }
+
+ return COM.VtblCall(4, address, buffer, reserved1, grfMode, reserved2, ppStm);
+}
+public int RenameElement(
+ String pwcsOldName, //Pointer to the name of the
+ // element to be changed
+ String pwcsNewName //Pointer to the new name for
+ // the specified element
+){
+
+ // create a null terminated array of char
+ char[] buffer1 = null;
+ if (pwcsOldName != null) {
+ buffer1 = (pwcsOldName+"\0").toCharArray();
+ }
+ // create a null terminated array of char
+ char[] buffer2 = null;
+ if (pwcsNewName != null) {
+ buffer2 = (pwcsNewName+"\0").toCharArray();
+ }
+ return COM.VtblCall(13, address, buffer1, buffer2);
+}
+public int Revert() {
+ return COM.VtblCall(10, address);
+}
+public int SetClass(
+ GUID clsid //CLSID to be assigned to the storage object
+){
+ return COM.VtblCall(15, address, clsid);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStream.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStream.java
new file mode 100755
index 0000000000..b4bff056b3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStream.java
@@ -0,0 +1,30 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IStream extends IUnknown {
+public IStream(int address) {
+ super(address);
+}
+public int Clone(
+ int[] ppstm //Pointer to location for pointer to the new stream object
+){
+ return COM.VtblCall(13, address, ppstm);
+}
+public int Commit( int grfCommitFlags //Specifies how changes are committed
+){
+ return COM.VtblCall(8, address, grfCommitFlags);
+}
+public int Read(int pv, int cb, int[] pcbWritten) {
+ return COM.VtblCall(3, address, pv, cb, pcbWritten);
+}
+public int Revert(){
+ return COM.VtblCall(9, address);
+}
+public int Write(int pv, int cb, int[] pcbWritten) {
+ return COM.VtblCall(4, address, pv, cb, pcbWritten);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java
new file mode 100755
index 0000000000..9135807800
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java
@@ -0,0 +1,155 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.swt.internal.win32.OS;
+
+public class ITypeInfo extends IUnknown
+{
+
+public ITypeInfo(int address) {
+ super(address);
+}
+public int GetDocumentation(int index, String[] name, String[] docString, int[] pdwHelpContext, String[] helpFile ) {
+ int[] pBstrName = null;
+ if (name != null) pBstrName = new int[1];
+ int[] pBstrDocString = null;
+ if (docString != null) pBstrDocString = new int[1];
+ int[] pBstrHelpFile = null;
+ if (helpFile != null) pBstrHelpFile = new int[1];
+ int rc = COM.VtblCall(12, address, index, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
+ if (name != null && pBstrName[0] != 0) {
+ int size = COM.SysStringByteLen(pBstrName[0]);
+ if (size > 0){
+ // get the unicode character array from the global memory and create a String
+ char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
+ COM.MoveMemory(buffer, pBstrName[0], size);
+ name[0] = new String(buffer);
+ int subindex = name[0].indexOf("\0");
+ if (subindex > 0)
+ name[0] = name[0].substring(0, subindex);
+ }
+ COM.SysFreeString(pBstrName[0]);
+ }
+ if (docString != null && pBstrDocString[0] != 0) {
+ int size = COM.SysStringByteLen(pBstrDocString[0]);
+ if (size > 0){
+ // get the unicode character array from the global memory and create a String
+ char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
+ COM.MoveMemory(buffer, pBstrDocString[0], size);
+ docString[0] = new String(buffer);
+ int subindex = docString[0].indexOf("\0");
+ if (subindex > 0)
+ docString[0] = docString[0].substring(0, subindex);
+ }
+ COM.SysFreeString(pBstrDocString[0]);
+ }
+ if (helpFile != null && pBstrHelpFile[0] != 0) {
+ int size = COM.SysStringByteLen(pBstrHelpFile[0]);
+ if (size > 0){
+ // get the unicode character array from the global memory and create a String
+ char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
+ COM.MoveMemory(buffer, pBstrHelpFile[0], size);
+ helpFile[0] = new String(buffer);
+ int subindex = helpFile[0].indexOf("\0");
+ if (subindex > 0)
+ helpFile[0] = helpFile[0].substring(0, subindex);
+ }
+ COM.SysFreeString(pBstrHelpFile[0]);
+ }
+ return rc;
+}
+public int GetFuncDesc(int index, int[] ppFuncDesc) {
+ return COM.VtblCall(5, address, index, ppFuncDesc);
+}
+public int GetIDsOfNames(String[] rgszNames, int cNames, int[] pMemId) {
+
+ char[] buffer;
+ int size = rgszNames.length;
+
+ // create an array to hold the addresses
+ int hHeap = OS.GetProcessHeap();
+ int ppNames = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, size*4);
+ int[] memTracker = new int[size];
+
+ try {
+ // add the address of each string to the array
+
+ for (int i=0; i<size; i++){
+ // create a null terminated array of char for each String
+ int nameSize = rgszNames[i].length();
+ buffer = new char[nameSize +1];
+ rgszNames[i].getChars(0, nameSize, buffer, 0);
+ // get the address of the start of the array of char
+ int pName = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, buffer.length * 2);
+ OS.MoveMemory(pName, buffer, buffer.length * 2);
+ // copy the address to the array of addresses
+ COM.MoveMemory(ppNames + 4*i, new int[]{pName}, 4);
+ // keep track of the Global Memory so we can free it
+ memTracker[i] = pName;
+ }
+
+ return COM.VtblCall(10, address, ppNames, cNames, pMemId);
+
+ } finally {
+ // free the memory
+ for (int i=0; i<memTracker.length; i++){
+ OS.HeapFree(hHeap, 0, memTracker[i]);
+ }
+ OS.HeapFree(hHeap, 0, ppNames);
+ }
+}
+
+public int GetImplTypeFlags(int index, int[] pImplTypeFlags) {
+ return COM.VtblCall(9, address, index, pImplTypeFlags);
+}
+public int GetNames(int memid, String[] names, int cMaxNames, int[] pcNames){
+
+ int nameSize = names.length;
+ int[] rgBstrNames = new int[nameSize];
+ int rc = COM.VtblCall(7, address, memid, rgBstrNames, nameSize, pcNames);
+
+ if (rc == COM.S_OK) {
+ for (int i = 0; i < pcNames[0]; i++) {
+ int size = COM.SysStringByteLen(rgBstrNames[i]);
+ if (size > 0){
+ // get the unicode character array from the global memory and create a String
+ char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
+ COM.MoveMemory(buffer, rgBstrNames[i], size);
+ names[i] = new String(buffer);
+ int subindex = names[i].indexOf("\0");
+ if (subindex > 0)
+ names[i] = names[i].substring(0, subindex);
+ }
+ COM.SysFreeString(rgBstrNames[i]);
+ }
+ }
+
+ return rc;
+}
+public int GetRefTypeInfo(int hRefType, int[] ppTInfo) {
+ return COM.VtblCall(14, address, hRefType, ppTInfo);
+}
+public int GetRefTypeOfImplType(int index, int[] pRefType) {
+ return COM.VtblCall(8, address, index, pRefType);
+}
+public int GetTypeAttr(int[] ppTypeAttr) {
+ return COM.VtblCall(3, address, ppTypeAttr);
+}
+public int GetVarDesc(int index, int[] ppVarDesc ) {
+ return COM.VtblCall(6, address, index, ppVarDesc);
+}
+public int ReleaseFuncDesc(int pFuncDesc ) {
+ return COM.VtblCall(20, address, pFuncDesc);
+}
+public int ReleaseTypeAttr(int pTypeAttr) {
+ return COM.VtblCall(19, address, pTypeAttr);
+}
+public int ReleaseVarDesc(int pVarDesc ) {
+ return COM.VtblCall(21, address, pVarDesc);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java
new file mode 100755
index 0000000000..18e2e8df43
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java
@@ -0,0 +1,26 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class IUnknown
+{
+ int address;
+public IUnknown(int address) {
+ this.address = address;
+}
+public int AddRef() {
+ return COM.VtblCall(1, address);
+}
+public int getAddress() {
+ return address;
+}
+public int QueryInterface(GUID riid, int ppvObject[]) {
+ return COM.VtblCall(0, address, riid, ppvObject);
+}
+public int Release() {
+ return COM.VtblCall(2, address);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java
new file mode 100755
index 0000000000..78c2f621b3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.internal.win32.*;
+
+public class IViewObject2 extends IUnknown
+{
+public IViewObject2(int address) {
+ super(address);
+}
+public int GetExtent(int dwAspect, int lindex, DVTARGETDEVICE ptd, SIZE lpsizel) {
+ return COM.VtblCall(9, address, dwAspect, lindex, ptd, lpsizel);
+}
+public int SetAdvise(int dwAspects, int dwAdvf, int pIAdviseSink) {
+ return COM.VtblCall(7, address, dwAspects, dwAdvf, pIAdviseSink);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java
new file mode 100755
index 0000000000..a427edd1b1
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java
@@ -0,0 +1,15 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class LICINFO
+{
+ public int cbLicInfo;
+ public int fRuntimeKeyAvail;
+ public int fLicVerified;
+
+ public static final int sizeof = 12;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java
new file mode 100755
index 0000000000..d51a8882e9
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java
@@ -0,0 +1,13 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class OLECMD {
+ public int cmdID;
+ public int cmdf;
+
+ public static final int sizeof = 8;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java
new file mode 100755
index 0000000000..bfac57d0e2
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java
@@ -0,0 +1,17 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class OLECMDTEXT {
+ public int cmdtextf;
+ public int cwActual;
+ public int cwBuf;
+ public short rgwz;
+
+ // Note: this is a variable sized struct. The last field rgwz can vary in size.
+ // Currently we do not use this field and do not support accessing anything more
+ // than the first char in the field.
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java
new file mode 100755
index 0000000000..cc0bf1c086
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java
@@ -0,0 +1,19 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class OLEINPLACEFRAMEINFO
+{
+
+ public int cb;
+ public int fMDIApp;
+ public int hwndFrame;
+ public int haccel;
+ public int cAccelEntries;
+
+ public static final int sizeof = 20;
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java
new file mode 100755
index 0000000000..76a3a7de8e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java
@@ -0,0 +1,39 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public class STATSTG {
+ public int pwcsName;
+ public int type;
+ public long cbSize;
+ //FILETIME mtime;
+ public int mtime_dwLowDateTime;
+ public int mtime_dwHighDateTime;
+ //FILETIME ctime;
+ public int ctime_dwLowDateTime;
+ public int ctime_dwHighDateTime;
+ //FILETIME atime;
+ public int atime_dwLowDateTime;
+ public int atime_dwHighDateTime;
+ public int grfMode;
+ public int grfLocksSupported;
+ //GUID clsid;
+ public int clsid_data1;
+ public short clsid_data2;
+ public short clsid_data3;
+ public byte clsid_b0;
+ public byte clsid_b1;
+ public byte clsid_b2;
+ public byte clsid_b3;
+ public byte clsid_b4;
+ public byte clsid_b5;
+ public byte clsid_b6;
+ public byte clsid_b7;
+ public int grfStateBits;
+ public int reserved;
+
+ public static final int sizeof = 72;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java
new file mode 100755
index 0000000000..cf9ecde696
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java
@@ -0,0 +1,15 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class STGMEDIUM
+{
+ public int tymed;
+ public int unionField;
+ public int pUnkForRelease;
+
+ public static final int sizeof = 12;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java
new file mode 100755
index 0000000000..4055e2fbeb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java
@@ -0,0 +1,50 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+public final class TYPEATTR
+{
+ //public GUID guid
+ public int guid_data1;
+ public short guid_data2;
+ public short guid_data3;
+ public byte guid_b0;
+ public byte guid_b1;
+ public byte guid_b2;
+ public byte guid_b3;
+ public byte guid_b4;
+ public byte guid_b5;
+ public byte guid_b6;
+ public byte guid_b7;
+
+ public int lcid;
+ public int dwReserved;
+ public int memidConstructor;
+ public int memidDestructor;
+ public int lpstrSchema;
+ public int cbSizeInstance;
+ public int typekind;
+ public short cFuncs;
+ public short cVars;
+ public short cImplTypes;
+ public short cbSizeVft;
+ public short cbAlignment;
+ public short wTypeFlags;
+ public short wMajorVerNum;
+ public short wMinorVerNum;
+
+ // public TYPEDESC tdescAlias
+ public int tdescAlias_unionField;
+ public short tdescAlias_vt;
+ // this filler field is required for proper byte alignment
+ public short filler;
+
+ // public IDLDESC idldesctype
+ public int idldescType_dwReserved;
+ public short idldescType_wIDLFlags;
+
+ public static final int sizeof = 74;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java
new file mode 100755
index 0000000000..9d33d3f54a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java
@@ -0,0 +1,26 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class VARDESC1 {
+ public int memid;
+ public int lpstrSchema;
+ public int unionField;
+ //ELEMDESC elemdescVar
+ //TYPEDESC elemdescVar.tdesc
+ public int elemdescVar_tdesc_union;
+ public short elemdescVar_tdesc_vt;
+ public short elemdescVar_tdesc_filler;
+ //PARAMDESC elemdescFunc.paramdesc
+ public int elemdescVar_paramdesc_pparamdescex;
+ public short elemdescVar_paramdesc_wParamFlags;
+ public short elemdescVar_paramdesc_filler;
+ public short wVarFlags;
+ public short filler;
+ public int varkind;
+
+ public static final int sizeof = 36;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java
new file mode 100755
index 0000000000..7237ffce2d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java
@@ -0,0 +1,26 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class VARDESC2 {
+ public int memid;
+ public int lpstrSchema;
+ public int unionField;
+ //ELEMDESC elemdescVar
+ //TYPEDESC elemdescVar.tdesc
+ public int elemdescVar_tdesc_union;
+ public short elemdescVar_tdesc_vt;
+ public short elemdescVar_tdesc_filler;
+ //IDLDESC elemdescFunc.idldesc
+ public int elemdescFunc_idldesc_dwReserved;
+ public short elemdescFunc_idldesc_wIDLFlags;
+ public short elemdescFunc_idldesc_filler;
+ public short wVarFlags;
+ public short filler;
+ public int varkind;
+
+ public static final int sizeof = 36;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/package.html b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/package.html
new file mode 100755
index 0000000000..2f36647b51
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/package.html
@@ -0,0 +1,13 @@
+ <html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="IBM">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Brief overview will be provided here.
+<h2>
+Package Specification</h2>
+Detailed overview will be provided here.
+</body>
+</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OLE.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OLE.java
new file mode 100755
index 0000000000..2ad984837b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OLE.java
@@ -0,0 +1,420 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.*;
+import java.io.File;
+import org.eclipse.swt.internal.ole.win32.COM;
+import org.eclipse.swt.internal.Converter;
+import org.eclipse.swt.internal.win32.OS;
+
+
+/**
+ *
+ * OLE contains all the constants used to create an ActiveX Control or an OLE Document.
+ *
+ * <p>Definitions for these constants can be found in MSDN.
+ *
+ */
+public class OLE extends SWT {
+
+ public static final int S_FALSE = 1; // Used for functions that semantically return a Boolean FALSE result to indicate that the function succeeded.
+ public static final int S_OK = 0; // Function succeeded.
+
+ // Verbs that can be invoked on this client
+ public static final int OLEIVERB_DISCARDUNDOSTATE = -6; // close the OLE object and discard the undo state
+ public static final int OLEIVERB_HIDE = -3; // hide the OLE object
+ public static final int OLEIVERB_INPLACEACTIVATE = -5; // open the OLE for editing in-place
+ public static final int OLEIVERB_OPEN = -2; // open the OLE object for editing in a separate window
+ public static final int OLEIVERB_PRIMARY = 0; // opens the OLE object for editing
+ public static final int OLEIVERB_PROPERTIES = -7; // request the OLE object properties dialog
+ public static final int OLEIVERB_SHOW = -1; // show the OLE object
+ public static final int OLEIVERB_UIACTIVATE = -4; // activate the UI for the OLE object
+
+ public static final int PROPERTY_CHANGING = 0;
+ public static final int PROPERTY_CHANGED = 1;
+
+ /**
+ * Error code for OleError - No specific error information available
+ */
+ public static final int HRESULT_UNSPECIFIED = 0;
+ /**
+ * Error code for OleError - Failed to create file
+ */
+ public static final int ERROR_CANNOT_CREATE_FILE = 1000;
+ /**
+ * Error code for OleError - Failed to create Ole Client
+ */
+ public static final int ERROR_CANNOT_CREATE_OBJECT = 1001;
+ /**
+ * Error code for OleError - File does not exist, is not accessible to user or does not have the correct format
+ */
+ public static final int ERROR_CANNOT_OPEN_FILE = 1002;
+ /**
+ * Error code for OleError - Failed to find requested interface on OLE Object
+ */
+ public static final int ERROR_INTERFACE_NOT_FOUND = 1003;
+ /**
+ * Error code for OleError - Class ID not found in registry
+ */
+ public static final int ERROR_INVALID_CLASSID = 1004;
+ /**
+ * Error code for OleError - Failed to get the class factory for the specified classID
+ */
+ public static final int ERROR_CANNOT_ACCESS_CLASSFACTORY = 1005;
+ /**
+ * Error code for OleError - Failed to create Licensed instance
+ */
+ public static final int ERROR_CANNOT_CREATE_LICENSED_OBJECT = 1006;
+ /**
+ * Error code for OleError - Out of Memory
+ */
+ public static final int ERROR_OUT_OF_MEMORY = 1007;
+ /**
+ * Error code for OleError - Failed to change Variant type
+ */
+ public static final int ERROR_CANNOT_CHANGE_VARIANT_TYPE = 1010;
+ /**
+ * Error code for OleError - Invalid address received for Ole Interface
+ */
+ public static final int ERROR_INVALID_INTERFACE_ADDRESS = 1011;
+ /**
+ * Error code for OleError - Unable to find Application
+ */
+ public static final int ERROR_APPLICATION_NOT_FOUND = 1013;
+ /**
+ * Error code for OleError - Action can not be performed
+ */
+ public static final int ERROR_ACTION_NOT_PERFORMED = 1014;
+
+ public static final int OLECMDF_SUPPORTED = 1;
+ public static final int OLECMDF_ENABLED = 2;
+ public static final int OLECMDF_LATCHED = 4;
+ public static final int OLECMDF_NINCHED = 8;
+
+ public static final int OLECMDTEXTF_NONE = 0;
+ public static final int OLECMDTEXTF_NAME = 1;
+ public static final int OLECMDTEXTF_STATUS = 2;
+
+ public static final int OLECMDEXECOPT_DODEFAULT = 0;
+ public static final int OLECMDEXECOPT_PROMPTUSER = 1;
+ public static final int OLECMDEXECOPT_DONTPROMPTUSER = 2;
+ public static final int OLECMDEXECOPT_SHOWHELP = 3;
+
+ public static final int OLECMDID_OPEN = 1;
+ public static final int OLECMDID_NEW = 2;
+ public static final int OLECMDID_SAVE = 3;
+ public static final int OLECMDID_SAVEAS = 4;
+ public static final int OLECMDID_SAVECOPYAS = 5;
+ public static final int OLECMDID_PRINT = 6;
+ public static final int OLECMDID_PRINTPREVIEW = 7;
+ public static final int OLECMDID_PAGESETUP = 8;
+ public static final int OLECMDID_SPELL = 9;
+ public static final int OLECMDID_PROPERTIES = 10;
+ public static final int OLECMDID_CUT = 11;
+ public static final int OLECMDID_COPY = 12;
+ public static final int OLECMDID_PASTE = 13;
+ public static final int OLECMDID_PASTESPECIAL = 14;
+ public static final int OLECMDID_UNDO = 15;
+ public static final int OLECMDID_REDO = 16;
+ public static final int OLECMDID_SELECTALL = 17;
+ public static final int OLECMDID_CLEARSELECTION = 18;
+ public static final int OLECMDID_ZOOM = 19;
+ public static final int OLECMDID_GETZOOMRANGE = 20;
+ public static final int OLECMDID_UPDATECOMMANDS = 21;
+ public static final int OLECMDID_REFRESH = 22;
+ public static final int OLECMDID_STOP = 23;
+ public static final int OLECMDID_HIDETOOLBARS = 24;
+ public static final int OLECMDID_SETPROGRESSMAX = 25;
+ public static final int OLECMDID_SETPROGRESSPOS = 26;
+ public static final int OLECMDID_SETPROGRESSTEXT = 27;
+ public static final int OLECMDID_SETTITLE = 28;
+ public static final int OLECMDID_SETDOWNLOADSTATE = 29;
+ public static final int OLECMDID_STOPDOWNLOAD = 30;
+
+ /* Ole Property Description flags */
+ public static int VARFLAG_FREADONLY = 0x1;
+ public static int VARFLAG_FSOURCE = 0x2;
+ public static int VARFLAG_FBINDABLE = 0x4;
+ public static int VARFLAG_FREQUESTEDIT = 0x8;
+ public static int VARFLAG_FDISPLAYBIND = 0x10;
+ public static int VARFLAG_FDEFAULTBIND = 0x20;
+ public static int VARFLAG_FHIDDEN = 0x40;
+ public static int VARFLAG_FRESTRICTED = 0x80;
+ public static int VARFLAG_FDEFAULTCOLLELEM = 0x100;
+ public static int VARFLAG_FUIDEFAULT = 0x200;
+ public static int VARFLAG_FNONBROWSABLE = 0x400;
+ public static int VARFLAG_FREPLACEABLE = 0x800;
+ public static int VARFLAG_FIMMEDIATEBIND = 0x1000;
+
+ /* Ole Property Description kind */
+ public static int VAR_PERINSTANCE = 0;
+ public static int VAR_STATIC = 1;
+ public static int VAR_CONST = 2;
+ public static int VAR_DISPATCH = 3;
+
+ /* Ole Parameter Description flags */
+ public static short IDLFLAG_NONE = 0;
+ public static short IDLFLAG_FIN = 1;
+ public static short IDLFLAG_FOUT = 2;
+ public static short IDLFLAG_FLCID = 4;
+ public static short IDLFLAG_FRETVAL = 8;
+
+ /* Ole Description types */
+ public static final short VT_BOOL = 11; // Boolean; True=-1, False=0.
+ public static final short VT_BSTR = 8; // Binary String.
+ public static final short VT_BYREF = 16384; // By reference - must be combined with one of the othre VT values
+ public static final short VT_CY = 6; // Currency.
+ public static final short VT_DATE = 7; // Date.
+ public static final short VT_DISPATCH = 9; // IDispatch
+ public static final short VT_EMPTY = 0; // Not specified.
+ public static final short VT_ERROR = 10; // Scodes.
+ public static final short VT_I2 = 2; // 2-byte signed int.
+ public static final short VT_I4 = 3; // 4-byte signed int.
+ public static final short VT_NULL = 1; // Null.
+ public static final short VT_R4 = 4; // 4-byte real.
+ public static final short VT_R8 = 5; // 8-byte real.
+ public static final short VT_UI1 = 17; // Unsigned char.
+ public static final short VT_UI4 = 19; // Unsigned int.
+ public static final short VT_UNKNOWN = 13; // IUnknown FAR*.
+ public static final short VT_VARIANT = 12; // VARIANT FAR*.
+ public static final short VT_PTR = 26;
+ public static final short VT_USERDEFINED = 29;
+ public static final short VT_HRESULT = 25;
+ public static final short VT_DECIMAL = 14;
+ public static final short VT_I1 = 16;
+ public static final short VT_UI2 = 18;
+ public static final short VT_I8 = 20;
+ public static final short VT_UI8 = 21;
+ public static final short VT_INT = 22;
+ public static final short VT_UINT = 23;
+ public static final short VT_VOID = 24;
+ public static final short VT_SAFEARRAY = 27;
+ public static final short VT_CARRAY = 28;
+ public static final short VT_LPSTR = 30;
+ public static final short VT_LPWSTR = 31;
+ public static final short VT_RECORD = 36;
+ public static final short VT_FILETIME = 64;
+ public static final short VT_BLOB = 65;
+ public static final short VT_STREAM = 66;
+ public static final short VT_STORAGE = 67;
+ public static final short VT_STREAMED_OBJECT = 68;
+ public static final short VT_STORED_OBJECT = 69;
+ public static final short VT_BLOB_OBJECT = 70;
+ public static final short VT_CF = 71;
+ public static final short VT_CLSID = 72;
+ public static final short VT_VERSIONED_STREAM = 73;
+ public static final short VT_BSTR_BLOB = 0xfff;
+ public static final short VT_VECTOR = 0x1000;
+ public static final short VT_ARRAY = 0x2000;
+
+ /* Ole Function Description Invoke Kind values */
+ public static final int INVOKE_FUNC = 1;
+ public static final int INVOKE_PROPERTYGET = 2;
+ public static final int INVOKE_PROPERTYPUT = 4;
+ public static final int INVOKE_PROPERTYPUTREF = 8;
+
+ /* Ole Function Description function kind */
+ public static final int FUNC_VIRTUAL = 0;
+ public static final int FUNC_PUREVIRTUAL = 1;
+ public static final int FUNC_NONVIRTUAL = 2;
+ public static final int FUNC_STATIC = 3;
+ public static final int FUNC_DISPATCH = 4;
+
+ /* Ole Function Description function flags */
+ public static final short FUNCFLAG_FRESTRICTED = 1;
+ public static final short FUNCFLAG_FSOURCE = 0x2;
+ public static final short FUNCFLAG_FBINDABLE = 0x4;
+ public static final short FUNCFLAG_FREQUESTEDIT = 0x8;
+ public static final short FUNCFLAG_FDISPLAYBIND = 0x10;
+ public static final short FUNCFLAG_FDEFAULTBIND = 0x20;
+ public static final short FUNCFLAG_FHIDDEN = 0x40;
+ public static final short FUNCFLAG_FUSESGETLASTERROR = 0x80;
+ public static final short FUNCFLAG_FDEFAULTCOLLELEM = 0x100;
+ public static final short FUNCFLAG_FUIDEFAULT = 0x200;
+ public static final short FUNCFLAG_FNONBROWSABLE = 0x400;
+ public static final short FUNCFLAG_FREPLACEABLE = 0x800;
+ public static final short FUNCFLAG_FIMMEDIATEBIND = 0x1000;
+
+ /* Ole Function Description calling convention */
+ public static final int CC_FASTCALL = 0;
+ public static final int CC_CDECL = 1;
+ public static final int CC_MSCPASCAL = 2;
+ public static final int CC_PASCAL = 2;
+ public static final int CC_MACPASCAL = 3;
+ public static final int CC_STDCALL = 4;
+ public static final int CC_FPFASTCALL = 5;
+ public static final int CC_SYSCALL = 6;
+ public static final int CC_MPWCDECL = 7;
+ public static final int CC_MPWPASCAL = 8;
+ public static final int CC_MAX = 9;
+
+ static final String ERROR_NOT_IMPLEMENTED_MSG = "Required functionality not currently supported.";
+ static final String ERROR_CANNOT_CREATE_FILE_MSG = "Failed to create file.";
+ static final String ERROR_CANNOT_CREATE_OBJECT_MSG = "Failed to create Ole Client.";
+ static final String ERROR_CANNOT_OPEN_FILE_MSG = "File does not exist, is not accessible to user or does not have the correct format.";
+ static final String ERROR_INTERFACE_NOT_FOUND_MSG = "Failed to find requested interface on OLE Object.";
+ static final String ERROR_INVALID_CLASSID_MSG = "Class ID not found in registry";
+ static final String ERROR_CANNOT_ACCESS_CLASSFACTORY_MSG = "Failed to get the class factory for the specified classID";
+ static final String ERROR_CANNOT_CREATE_LICENSED_OBJECT_MSG = "Failed to create Licensed instance";
+ static final String ERROR_OUT_OF_MEMORY_MSG = "Out of Memory";
+ static final String ERROR_CANNOT_CHANGE_VARIANT_TYPE_MSG = "Failed to change Variant type";
+ static final String ERROR_INVALID_INTERFACE_ADDRESS_MSG = "Invalid address received for Ole Interface.";
+ static final String ERROR_APPLICATION_NOT_FOUND_MSG = "Unable to find Application.";
+ static final String ERROR_ACTION_NOT_PERFORMED_MSG = "Action can not be performed.";
+
+
+public static void error (int code) {
+ error (code, 0);
+}
+public static void error (int code, int hresult) {
+
+ switch (code) {
+ /* Illegal Arguments (non-fatal) */
+ case ERROR_INVALID_INTERFACE_ADDRESS :{
+ throw new IllegalArgumentException (ERROR_INVALID_INTERFACE_ADDRESS_MSG);
+ }
+
+ /* SWT Errors (non-fatal) */
+ case ERROR_CANNOT_CREATE_FILE : {
+ String msg = ERROR_CANNOT_CREATE_FILE_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+ case ERROR_CANNOT_CREATE_OBJECT : {
+ String msg = ERROR_CANNOT_CREATE_OBJECT_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+ case ERROR_CANNOT_OPEN_FILE : {
+ String msg = ERROR_CANNOT_OPEN_FILE_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+ case ERROR_INTERFACE_NOT_FOUND : {
+ String msg = ERROR_INTERFACE_NOT_FOUND_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+ case ERROR_INVALID_CLASSID : {
+ String msg = ERROR_INVALID_CLASSID_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+ case ERROR_CANNOT_ACCESS_CLASSFACTORY : {
+ String msg = ERROR_CANNOT_ACCESS_CLASSFACTORY_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+ case ERROR_CANNOT_CREATE_LICENSED_OBJECT : {
+ String msg = ERROR_CANNOT_CREATE_LICENSED_OBJECT_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+ case ERROR_CANNOT_CHANGE_VARIANT_TYPE : {
+ String msg = ERROR_CANNOT_CHANGE_VARIANT_TYPE_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+ case ERROR_APPLICATION_NOT_FOUND : {
+ String msg = ERROR_APPLICATION_NOT_FOUND_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+ case ERROR_ACTION_NOT_PERFORMED : {
+ String msg = ERROR_ACTION_NOT_PERFORMED_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTException (code, msg);
+ }
+
+ /* OS Failure/Limit (fatal, may occur only on some platforms) */
+ case ERROR_OUT_OF_MEMORY : {
+ String msg = ERROR_ACTION_NOT_PERFORMED_MSG;
+ if (hresult != 0) msg += " result = "+hresult;
+ throw new SWTError (code, msg);
+ }
+ }
+
+ /* Unknown/Undefined Error */
+ SWT.error(code);
+}
+
+/*
+ * Finds the OLE program id that is associated with an extension.
+ * The extension may or may not begin with a '.'. On platforms
+ * that do not support OLE, an empty string is returned.
+ *
+ * @param extension the program extension
+ * @return a string that is the OLE program id or an empty string
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_NULL_ARGUMENT when extension is null</li>
+ * </ul>
+ */
+public static String findProgramID (String extension) {
+ if (extension == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (extension.length () == 0) return "";
+
+ if (extension.charAt (0) != '.') extension = "." + extension;
+
+ byte[] extensionKey = Converter.wcsToMbcs(0, extension, true);
+ String result = getKeyValue(extensionKey);
+ if (result != null) {
+ // look for "<programID>\NotInsertable"
+ byte[] notInsertableKey = Converter.wcsToMbcs(0, result+"\\NotInsertable", true);
+ if (getKeyExists(notInsertableKey)) return "";
+ // look for "<programID>\Insertable"
+ byte[] insertableKey = Converter.wcsToMbcs(0, result+"\\Insertable", true);
+ if (getKeyExists(insertableKey)) return result;
+ // look for "<programID>\protocol\StdFileEditing\server"
+ byte[] serverKey = Converter.wcsToMbcs(0, result+"\\protocol\\StdFileEditing\\server", true);
+ if (getKeyExists(serverKey)) return result;
+ }
+
+ return "";
+}
+private static String getKeyValue (byte [] key) {
+ int [] phkResult = new int [1];
+ if (OS.RegOpenKeyEx (OS.HKEY_CLASSES_ROOT, key, 0, OS.KEY_READ, phkResult) != 0) {
+ return null;
+ }
+ String result = null;
+ int [] lpcbData = new int [1];
+ if (OS.RegQueryValueEx (phkResult [0], null, 0, null, null, lpcbData) == 0) {
+ byte [] lpData = new byte [lpcbData [0]];
+ if (OS.RegQueryValueEx (phkResult [0], null, 0, null, lpData, lpcbData) == 0) {
+ char[] charArray = Converter.mbcsToWcs (0, lpData);
+ result = new String(charArray, 0, charArray.length - 1);
+ }
+ }
+ if (phkResult [0] != 0) OS.RegCloseKey (phkResult [0]);
+ return result;
+}
+private static boolean getKeyExists (byte [] key) {
+ int [] phkResult = new int [1];
+ if (OS.RegOpenKeyEx (OS.HKEY_CLASSES_ROOT, key, 0, OS.KEY_READ, phkResult) != 0) {
+ return false;
+ }
+ if (phkResult [0] != 0) OS.RegCloseKey (phkResult [0]);
+ return true;
+}
+/**
+ * Returns true if the specified file has an OLE Storage format.
+ *
+ * Note all empty files (regardless of extension) will return false.
+ *
+ * @param file the file to be checked
+ *
+ * @return true if this file has an OLE Storage format
+ */
+public static boolean isOleFile(File file) {
+ if (file == null || !file.exists() || file.isDirectory())
+ return false;
+
+ return (COM.StgIsStorageFile((file.getAbsolutePath()+"\0").toCharArray()) == COM.S_OK);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java
new file mode 100755
index 0000000000..1ac00551fe
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java
@@ -0,0 +1,588 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.ole.win32.*;
+import org.eclipse.swt.internal.win32.*;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+/**
+ * OleAutomation provides a generic mechanism for accessing functionality that is
+ * specific to a particular ActiveX Control or OLE Document.
+ *
+ * <p>The OLE Document or ActiveX Control must support the IDispatch interface in order to provide
+ * OleAutomation support. The additional functionality provided by the OLE Object is specified in
+ * its IDL file. The additional methods can either be to get property values (<code>getProperty</code>),
+ * to set property values (<code>setProperty</code>) or to invoke a method (<code>invoke</code> or
+ * <code>invokeNoReply</code>). Arguments are passed around in the form of <code>Variant</code>
+ * objects.
+ *
+ * <p>Here is a sample IDL fragment:
+ *
+ * <pre>
+ * interface IMyControl : IDispatch
+ * {
+ * [propget, id(0)] HRESULT maxFileCount([retval, out] int *c);
+ * [propput, id(0)] HRESULT maxFileCount([in] int c);
+ * [id(1)] HRESULT AddFile([in] BSTR fileName);
+ * };
+ * </pre>
+ *
+ * <p>An example of how to interact with this extended functionality is shown below:
+ *
+ * <code><pre>
+ * OleAutomation automation = new OleAutomation(myControlSite);
+ *
+ * // Look up the ID of the maxFileCount parameter
+ * int[] rgdispid = automation.getIDsOfNames(new String[]{"maxFileCount"});
+ * int maxFileCountID = rgdispid[0];
+ *
+ * // Set the property maxFileCount to 100:
+ * if (automation.setProperty(maxFileCountID, new Variant(100))) {
+ * System.out.println("Max File Count was successfully set.");
+ * }
+ *
+ * // Get the new value of the maxFileCount parameter:
+ * Variant pVarResult = automation.getProperty(maxFileCountID);
+ * if (pVarResult != null) {
+ * System.out.println("Max File Count is "+pVarResult.getInt());
+ * }
+ *
+ * // Invoke the AddFile method
+ * // Look up the IDs of the AddFile method and its parameter
+ * rgdispid = automation.getIDsOfNames(new String[]{"AddFile", "fileName"});
+ * int dispIdMember = rgdispid[0];
+ * int[] rgdispidNamedArgs = new int[] {rgdispid[1]};
+ *
+ * // Convert arguments to Variant objects
+ * Variant[] rgvarg = new Variant[1];
+ * String fileName = "C:\\testfile";
+ * rgvarg[0] = new Variant(fileName);
+ *
+ * // Call the method
+ * Variant pVarResult = automation.invoke(dispIdMember, rgvarg, rgdispidNamedArgs);
+ *
+ * // Check the return value
+ * if (pVarResult == null || pVarResult.getInt() != OLE.S_OK){
+ * System.out.println("Failed to add file "+fileName);
+ * }
+ *
+ * automation.dispose();
+ *
+ * </pre></code>
+ */
+public final class OleAutomation {
+ private IDispatch objIDispatch;
+ private String exceptionDescription;
+ private ITypeInfo objITypeInfo;
+
+OleAutomation(int address) {
+ if (address == 0) OLE.error(OLE.ERROR_INVALID_INTERFACE_ADDRESS);
+ objIDispatch = new IDispatch(address);
+ objIDispatch.AddRef();
+}
+/**
+ * Creates an OleAutomation object for the specified client.
+ *
+ * @param clientSite the site for the OLE Document or ActiveX Control whose additional functionality
+ * you need to access
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_INVALID_INTERFACE_ADDRESS when called with an invalid client site
+ * </ul>
+ */
+ public OleAutomation(OleClientSite clientSite) {
+ if (clientSite == null) OLE.error(OLE.ERROR_INVALID_INTERFACE_ADDRESS);
+ objIDispatch = clientSite.getAutomationObject();
+
+ int[] ppv = new int[1];
+ int result = objIDispatch.GetTypeInfo(0, COM.LOCALE_USER_DEFAULT, ppv);
+ if (result == OLE.S_OK) {
+ objITypeInfo = new ITypeInfo(ppv[0]);
+ objITypeInfo.AddRef();
+ }
+ }
+/**
+ * Disposes the automation object.
+ * <p>
+ * This method releases the IDispatch interface on the OLE Document or ActiveX Control.
+ * Do not use the OleAutomation object after it has been disposed.
+ */
+public void dispose() {
+
+ if (objIDispatch != null){
+ objIDispatch.Release();
+ }
+ objIDispatch = null;
+
+ if (objITypeInfo != null){
+ objITypeInfo.Release();
+ }
+ objITypeInfo = null;
+
+}
+int getAddress() {
+ return objIDispatch.getAddress();
+}
+public String getHelpFile(int dispId) {
+ if (objITypeInfo == null) return null;
+ String[] file = new String[1];
+ int rc = objITypeInfo.GetDocumentation(dispId, null, null, null, file );
+ if (rc == OLE.S_OK) return file[0];
+ return null;
+}
+public String getDocumentation(int dispId) {
+ if (objITypeInfo == null) return null;
+ String[] doc = new String[1];
+ int rc = objITypeInfo.GetDocumentation(dispId, null, doc, null, null );
+ if (rc == OLE.S_OK) return doc[0];
+ return null;
+}
+public OlePropertyDescription getPropertyDescription(int index) {
+ if (objITypeInfo == null) return null;
+ int[] ppVarDesc = new int[1];
+ int rc = objITypeInfo.GetVarDesc(index, ppVarDesc);
+ if (rc != OLE.S_OK) return null;
+ VARDESC1 vardesc = new VARDESC1();
+ COM.MoveMemory(vardesc, ppVarDesc[0], VARDESC1.sizeof);
+
+ OlePropertyDescription data = new OlePropertyDescription();
+ data.id = vardesc.memid;
+ data.name = getName(vardesc.memid);
+ data.type = vardesc.elemdescVar_tdesc_vt;
+ if (data.type == OLE.VT_PTR) {
+ short[] vt = new short[1];
+ COM.MoveMemory(vt, vardesc.elemdescVar_tdesc_union + 4, 2);
+ data.type = vt[0];
+ }
+ data.flags = vardesc.wVarFlags;
+ data.kind = vardesc.varkind;
+ data.description = getDocumentation(vardesc.memid);
+ data.helpFile = getHelpFile(vardesc.memid);
+
+ objITypeInfo.ReleaseVarDesc(ppVarDesc[0]);
+ return data;
+}
+public OleFunctionDescription getFunctionDescription(int index) {
+ if (objITypeInfo == null) return null;
+ int[] ppFuncDesc = new int[1];
+ int rc = objITypeInfo.GetFuncDesc(index, ppFuncDesc);
+ if (rc != OLE.S_OK) return null;
+ FUNCDESC1 funcdesc = new FUNCDESC1();
+ COM.MoveMemory(funcdesc, ppFuncDesc[0], FUNCDESC1.sizeof);
+
+ OleFunctionDescription data = new OleFunctionDescription();
+
+ data.id = funcdesc.memid;
+ data.optionalArgCount = funcdesc.cParamsOpt;
+ data.invokeKind = funcdesc.invkind;
+ data.funcKind = funcdesc.funckind;
+ data.flags = funcdesc.wFuncFlags;
+ data.callingConvention = funcdesc.callconv;
+ data.documentation = getDocumentation(funcdesc.memid);
+ data.helpFile = getHelpFile(funcdesc.memid);
+
+ String[] names = getNames(funcdesc.memid, funcdesc.cParams + 1);
+ data.name = names[0];
+ data.args = new OleParameterDescription[funcdesc.cParams];
+ for (int i = 0; i < data.args.length; i++) {
+ data.args[i] = new OleParameterDescription();
+ data.args[i].name = names[i + 1];
+ short[] vt = new short[1];
+ COM.MoveMemory(vt, funcdesc.lprgelemdescParam + i * 16 + 4, 2);
+ if (vt[0] == OLE.VT_PTR) {
+ int[] pTypedesc = new int[1];
+ COM.MoveMemory(pTypedesc, funcdesc.lprgelemdescParam + i * 16, 4);
+ short[] vt2 = new short[1];
+ COM.MoveMemory(vt2, pTypedesc[0] + 4, 2);
+ vt[0] = (short)(vt2[0] | COM.VT_BYREF);
+ }
+ data.args[i].type = vt[0];
+ short[] wParamFlags = new short[1];
+ COM.MoveMemory(wParamFlags, funcdesc.lprgelemdescParam + i * 16 + 12, 2);
+ data.args[i].flags = wParamFlags[0];
+ }
+
+ data.returnType = funcdesc.elemdescFunc_tdesc_vt;
+ if (data.returnType == OLE.VT_PTR) {
+ short[] vt = new short[1];
+ COM.MoveMemory(vt, funcdesc.elemdescFunc_tdesc_union + 4, 2);
+ data.returnType = vt[0];
+ }
+
+ objITypeInfo.ReleaseFuncDesc(ppFuncDesc[0]);
+ return data;
+}
+public TYPEATTR getTypeInfoAttributes() {
+ if (objITypeInfo == null) return null;
+ int[] ppTypeAttr = new int[1];
+ int rc = objITypeInfo.GetTypeAttr(ppTypeAttr);
+ if (rc != OLE.S_OK) return null;
+ TYPEATTR typeattr = new TYPEATTR();
+ COM.MoveMemory(typeattr, ppTypeAttr[0], TYPEATTR.sizeof);
+ objITypeInfo.ReleaseTypeAttr(ppTypeAttr[0]);
+ return typeattr;
+}
+public String getName(int dispId) {
+ if (objITypeInfo == null) return null;
+ String[] name = new String[1];
+ int rc = objITypeInfo.GetDocumentation(dispId, name, null, null, null );
+ if (rc == OLE.S_OK) return name[0];
+ return null;
+}
+public String[] getNames(int dispId, int maxSize) {
+ if (objITypeInfo == null) return new String[0];
+ String[] names = new String[maxSize];
+ int[] count = new int[1];
+ int rc = objITypeInfo.GetNames(dispId, names, maxSize, count);
+ if (rc == OLE.S_OK) {
+ String[] newNames = new String[count[0]];
+ System.arraycopy(names, 0, newNames, 0, count[0]);
+ return newNames;
+ }
+ return new String[0];
+}
+/**
+ * Returns the positive integer values (IDs) that are associated with the specified names by the
+ * IDispatch implementor. If you are trying to get the names of the parameters in a method, the first
+ * String in the names array must be the name of the method followed by the names of the parameters.
+ *
+ * @param names an array of names for which you require the identifiers
+ *
+ * @return positive integer values that are associated with the specified names in the same
+ * order as the names where provided; or null if the names are unknown
+ */
+public int[] getIDsOfNames(String[] names) {
+
+ int[] rgdispid = new int[names.length];
+ int result = objIDispatch.GetIDsOfNames(new GUID(), names, names.length, COM.LOCALE_USER_DEFAULT, rgdispid);
+ if (result != COM.S_OK) return null;
+
+ return rgdispid;
+}
+/**
+ * Returns a description of the last error encountered.
+ *
+ * @return a description of the last error encountered
+ */
+public String getLastError() {
+
+ return exceptionDescription;
+
+}
+/**
+ * Returns the value of the property specified by the dispIdMember.
+ *
+ * @param dispIdMember the ID of the property as specified by the IDL of the ActiveX Control; the
+ * value for the ID can be obtained using OleAutomation.getIDsOfNames
+ *
+ * @return the value of the property specified by the dispIdMember
+ */
+public Variant getProperty(int dispIdMember) {
+ // get the IDispatch interface for the control
+ if (objIDispatch == null) return null;
+
+ DISPPARAMS pDispParams = new DISPPARAMS();
+ EXCEPINFO excepInfo = new EXCEPINFO();
+ int[] pArgErr = new int[1];
+ int pVarResultAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
+ int result = objIDispatch.Invoke(dispIdMember, new GUID(), COM.LOCALE_USER_DEFAULT, COM.DISPATCH_PROPERTYGET, pDispParams, pVarResultAddress, excepInfo, pArgErr);
+
+ // save error string and cleanup EXCEPINFO
+ manageExcepinfo(result, excepInfo);
+
+ Variant pVarResult = null;
+ if (result == COM.S_OK) {
+ pVarResult = new Variant();
+ pVarResult.setData(pVarResultAddress);
+ }
+
+ COM.VariantClear(pVarResultAddress);
+ OS.GlobalFree(pVarResultAddress);
+
+ return pVarResult;
+
+}
+/**
+ * Invokes a method on the OLE Object; the method has no parameters.
+ *
+ * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
+ * value for the ID can be obtained using OleAutomation.getIDsOfNames
+ *
+ * @return the result of the method or null if the method failed to give result information
+ */
+public Variant invoke(int dispIdMember) {
+
+ Variant pVarResult = new Variant();
+ int result = invoke(dispIdMember, null, null, pVarResult);
+
+ if (result == COM.S_OK) return pVarResult;
+
+ return null;
+}
+/**
+ * Invokes a method on the OLE Object; the method has no optional parameters.
+ *
+ * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
+ * value for the ID can be obtained using OleAutomation.getIDsOfNames
+ *
+ * @param rgvarg an array of arguments for the method. All arguments are considered to be
+ * read only unless the Variant is a By Reference Variant type.
+ *
+ * @return the result of the method or null if the method failed to give result information
+ */
+public Variant invoke(int dispIdMember, Variant[] rgvarg) {
+
+ Variant pVarResult = new Variant();
+ int result = invoke(dispIdMember, rgvarg, null, pVarResult);
+
+ if (result == COM.S_OK) return pVarResult;
+
+ return null;
+}
+/**
+ * Invokes a method on the OLE Object; the method has optional parameters. It is not
+ * neccessary to specify all the optional parameters, only include the parameters for which
+ * you are providing values.
+ *
+ * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
+ * value for the ID can be obtained using OleAutomation.getIDsOfNames
+ *
+ * @param rgvarg an array of arguments for the method. All arguments are considered to be
+ * read only unless the Variant is a By Reference Variant type.
+ *
+ * @param rgdispidNamedArgs an array of identifiers for the arguments specified in rgvarg; the
+ * parameter IDs must be in the same order as their corresponding values;
+ * all arguments must have an identifier - identifiers can be obtained using
+ * OleAutomation.getIDsOfNames
+ *
+ * @return the result of the method or null if the method failed to give result information
+ */
+public Variant invoke(int dispIdMember, Variant[] rgvarg, int[] rgdispidNamedArgs) {
+
+ Variant pVarResult = new Variant();
+ int result = invoke(dispIdMember, rgvarg, rgdispidNamedArgs, pVarResult);
+
+ if (result == COM.S_OK) return pVarResult;
+
+ return null;
+}
+private int invoke(int dispIdMember, Variant[] rgvarg, int[] rgdispidNamedArgs, Variant pVarResult) {
+
+ // get the IDispatch interface for the control
+ if (objIDispatch == null) return COM.E_FAIL;
+
+ // create a DISPPARAMS structure for the input parameters
+ DISPPARAMS pDispParams = new DISPPARAMS();
+ // store arguments in rgvarg
+ if (rgvarg != null && rgvarg.length > 0) {
+ pDispParams.cArgs = rgvarg.length;
+ pDispParams.rgvarg = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, Variant.sizeof * rgvarg.length);
+ int offset = 0;
+ for (int i = rgvarg.length - 1; i >= 0 ; i--) {
+ rgvarg[i].getData(pDispParams.rgvarg + offset);
+ offset += Variant.sizeof;
+ }
+ }
+
+ // if arguments have ids, store the ids in rgdispidNamedArgs
+ if (rgdispidNamedArgs != null && rgdispidNamedArgs.length > 0) {
+ pDispParams.cNamedArgs = rgdispidNamedArgs.length;
+ pDispParams.rgdispidNamedArgs = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4 * rgdispidNamedArgs.length);
+ int offset = 0;
+ for (int i = rgdispidNamedArgs.length; i > 0; i--) {
+ COM.MoveMemory(pDispParams.rgdispidNamedArgs + offset, new int[] {rgdispidNamedArgs[i-1]}, 4);
+ offset += 4;
+ }
+ }
+
+ // invoke the method
+ EXCEPINFO excepInfo = new EXCEPINFO();
+ int[] pArgErr = new int[1];
+ int pVarResultAddress = 0;
+ if (pVarResult != null) pVarResultAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
+ int result = objIDispatch.Invoke(dispIdMember, new GUID(), COM.LOCALE_USER_DEFAULT, COM.DISPATCH_METHOD, pDispParams, pVarResultAddress, excepInfo, pArgErr);
+
+ if (pVarResultAddress != 0){
+ pVarResult.setData(pVarResultAddress);
+ COM.VariantClear(pVarResultAddress);
+ OS.GlobalFree(pVarResultAddress);
+ }
+
+ // free the Dispparams resources
+ if (pDispParams.rgdispidNamedArgs != 0){
+ OS.GlobalFree(pDispParams.rgdispidNamedArgs);
+ }
+ if (pDispParams.rgvarg != 0) {
+ int offset = 0;
+ for (int i = 0, length = rgvarg.length; i < length; i++){
+ COM.VariantClear(pDispParams.rgvarg + offset);
+ offset += Variant.sizeof;
+ }
+ OS.GlobalFree(pDispParams.rgvarg);
+ }
+
+ // save error string and cleanup EXCEPINFO
+ manageExcepinfo(result, excepInfo);
+
+ return result;
+}
+/**
+ * Invokes a method on the OLE Object; the method has no parameters. In the early days of OLE,
+ * the IDispatch interface was not well defined and some applications (mainly Word) did not support
+ * a return value. For these applications, call this method instead of calling
+ * <code>public void invoke(int dispIdMember)</code>.
+ *
+ * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
+ * value for the ID can be obtained using OleAutomation.getIDsOfNames
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_ACTION_NOT_PERFORMED when method invocation fails
+ * </ul>
+ */
+public void invokeNoReply(int dispIdMember) {
+ int result = invoke(dispIdMember, null, null, null);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_ACTION_NOT_PERFORMED, result);
+}
+/**
+ * Invokes a method on the OLE Object; the method has no optional parameters. In the early days of OLE,
+ * the IDispatch interface was not well defined and some applications (mainly Word) did not support
+ * a return value. For these applications, call this method instead of calling
+ * <code>public void invoke(int dispIdMember, Variant[] rgvarg)</code>.
+ *
+ * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
+ * value for the ID can be obtained using OleAutomation.getIDsOfNames
+ *
+ * @param rgvarg an array of arguments for the method. All arguments are considered to be
+ * read only unless the Variant is a By Reference Variant type.
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_ACTION_NOT_PERFORMED when method invocation fails
+ * </ul>
+ */
+public void invokeNoReply(int dispIdMember, Variant[] rgvarg) {
+ int result = invoke(dispIdMember, rgvarg, null, null);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_ACTION_NOT_PERFORMED, result);
+}
+/**
+ * Invokes a method on the OLE Object; the method has optional parameters. It is not
+ * neccessary to specify all the optional parameters, only include the parameters for which
+ * you are providing values. In the early days of OLE, the IDispatch interface was not well
+ * defined and some applications (mainly Word) did not support a return value. For these
+ * applications, call this method instead of calling
+ * <code>public void invoke(int dispIdMember, Variant[] rgvarg, int[] rgdispidNamedArgs)</code>.
+ *
+ * @param dispIdMember the ID of the method as specified by the IDL of the ActiveX Control; the
+ * value for the ID can be obtained using OleAutomation.getIDsOfNames
+ *
+ * @param rgvarg an array of arguments for the method. All arguments are considered to be
+ * read only unless the Variant is a By Reference Variant type.
+ *
+ * @param rgdispidNamedArgs an array of identifiers for the arguments specified in rgvarg; the
+ * parameter IDs must be in the same order as their corresponding values;
+ * all arguments must have an identifier - identifiers can be obtained using
+ * OleAutomation.getIDsOfNames
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_ACTION_NOT_PERFORMED when method invocation fails
+ * </ul>
+ */
+public void invokeNoReply(int dispIdMember, Variant[] rgvarg, int[] rgdispidNamedArgs) {
+ int result = invoke(dispIdMember, rgvarg, rgdispidNamedArgs, null);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_ACTION_NOT_PERFORMED, result);
+}
+private void manageExcepinfo(int hResult, EXCEPINFO excepInfo) {
+
+ if (hResult == COM.S_OK){
+ exceptionDescription = new String("No Error");
+ return;
+ }
+
+ // extract exception info
+ if (hResult == COM.DISP_E_EXCEPTION) {
+ if (excepInfo.bstrDescription != 0){
+ int size = COM.SysStringByteLen(excepInfo.bstrDescription);
+ char[] buffer = new char[(size + 1) /2];
+ COM.MoveMemory(buffer, excepInfo.bstrDescription, size);
+ exceptionDescription = new String(buffer);
+ } else {
+ exceptionDescription = new String("OLE Automation Error Exception ");
+ if (excepInfo.wCode != 0){
+ exceptionDescription += "code = "+excepInfo.wCode;
+ } else if (excepInfo.scode != 0){
+ exceptionDescription += "code = "+excepInfo.scode;
+ }
+ }
+ } else {
+ exceptionDescription = new String("OLE Automation Error HResult : "+hResult);
+ }
+
+ // cleanup EXCEPINFO struct
+ if (excepInfo.bstrDescription != 0)
+ COM.SysFreeString(excepInfo.bstrDescription);
+ if (excepInfo.bstrHelpFile != 0)
+ COM.SysFreeString(excepInfo.bstrHelpFile);
+ if (excepInfo.bstrSource != 0)
+ COM.SysFreeString(excepInfo.bstrSource);
+}
+/**
+ * Sets the property specified by the dispIdMember to a new value.
+ *
+ * @param dispIdMember the ID of the property as specified by the IDL of the ActiveX Control; the
+ * value for the ID can be obtained using OleAutomation.getIDsOfNames
+ * @param rgvarg the new value of the property
+ *
+ * @return true if the operation was successful
+ */
+public boolean setProperty(int dispIdMember, Variant rgvarg) {
+
+ // get the IDispatch interface for the control
+ if (objIDispatch == null) return false;
+
+ // create Dispparams structure with input parameters
+ DISPPARAMS pDispParams = new DISPPARAMS();
+ pDispParams.cArgs = 1;
+ pDispParams.rgvarg = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, Variant.sizeof);
+ rgvarg.getData(pDispParams.rgvarg);
+
+ // add in information for named args
+ pDispParams.cNamedArgs = 1;
+ pDispParams.rgdispidNamedArgs = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, 4);
+ COM.MoveMemory(pDispParams.rgdispidNamedArgs, new int[] {COM.DISPID_PROPERTYPUT}, 4);
+
+ int pVarResultAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
+ EXCEPINFO excepInfo = new EXCEPINFO();
+ int[] pArgErr = new int[1];
+ int dwFlags = COM.DISPATCH_PROPERTYPUT;
+ if ((rgvarg.getType() & COM.VT_BYREF) == COM.VT_BYREF)
+ dwFlags = COM.DISPATCH_PROPERTYPUTREF;
+ int rc = objIDispatch.Invoke(dispIdMember, new GUID(), COM.LOCALE_USER_DEFAULT, dwFlags, pDispParams, pVarResultAddress, excepInfo, pArgErr);
+
+ // free the result
+ COM.VariantClear(pVarResultAddress);
+ OS.GlobalFree(pVarResultAddress);
+
+ // free the Dispparams resources
+ OS.GlobalFree(pDispParams.rgdispidNamedArgs);
+ COM.VariantClear(pDispParams.rgvarg);
+ OS.GlobalFree(pDispParams.rgvarg);
+
+ // save error string and cleanup EXCEPINFO
+ manageExcepinfo(rc, excepInfo);
+
+ return (rc == COM.S_OK);
+
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
new file mode 100755
index 0000000000..bf6dc38b03
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
@@ -0,0 +1,1306 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.ole.win32.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.win32.*;
+/**
+ * OleClientSite provides a site to manage an embedded OLE Document within a container.
+ *
+ * <p>The OleClientSite provides the following capabilities:
+ * <ul>
+ * <li>creates the in-place editor for a blank document or opening an existing OLE Document
+ * <li>lays the editor out
+ * <li>provides a mechanism for activating and deactivating the Document
+ * <li>provides a mechanism for saving changes made to the document
+ * </ul>
+ *
+ * <p>This object implements the OLE Interfaces IUnknown, IOleClientSite, IAdviseSink,
+ * IOleInPlaceSite
+ *
+ * <dl>
+ * <dt><b>Styles</b> <dd>BORDER
+ * <dt><b>Events</b> <dd>Dispose, Move, Resize
+ * </dl>
+ *
+ */
+public class OleClientSite extends Composite {
+
+ // Interfaces for this Ole Client Container
+ private COMObject iUnknown;
+ private COMObject iOleClientSite;
+ private COMObject iAdviseSink;
+ private COMObject iOleInPlaceSite;
+
+ protected GUID appClsid;
+ private GUID objClsid;
+ private int refCount;
+
+ // References to the associated Frame.
+ protected OleFrame frame;
+
+ // Access to the embedded/linked Ole Object
+ protected IUnknown objIUnknown;
+ protected IOleObject objIOleObject;
+ protected IViewObject2 objIViewObject2;
+ protected IOleInPlaceObject objIOleInPlaceObject;
+ protected IOleCommandTarget objIOleCommandTarget;
+
+ // Related storage information
+ protected IStorage tempStorage; // IStorage interface of the receiver
+
+ // Internal state and style information
+ private boolean active; // Track whether the object is in place active
+ private int aspect; // the display aspect of the embedded object, e.g., DvaspectContent or DvaspectIcon
+ private int type; // Indicates the type of client that can be supported inside this container
+ private boolean isStatic; // Indicates item's display is static, i.e., a bitmap, metafile, etc.
+
+ private RECT borderWidths = new RECT();
+ private RECT indent = new RECT();
+ private boolean inUpdate = false;
+ private boolean inInit = true;
+
+ private static final String WORDPROGID = "Word.Document";
+
+ private Listener listener;
+
+protected OleClientSite(Composite parent, int style) {
+ // this constructor should never be used by itself because it does
+ // not create an Ole Object
+
+ super(parent, style);
+
+ createCOMInterfaces();
+
+ // install the Ole Frame for this Client Site
+ while (true) {
+ if (parent instanceof OleFrame){
+ frame = (OleFrame)parent;
+ break;
+ }
+ parent = parent.getParent();
+ if (parent == null) break;
+ }
+ if (frame == null) OLE.error(SWT.ERROR_INVALID_ARGUMENT);
+ frame.AddRef();
+
+ active = false;
+ aspect = COM.DVASPECT_CONTENT;
+ type = COM.OLEEMBEDDED;
+ isStatic = false;
+
+ listener = new Listener() {
+ public void handleEvent(Event e) {
+ switch (e.type) {
+ case SWT.Resize :
+ case SWT.Move :
+ onResize(e);
+ break;
+ case SWT.Dispose :
+ onDispose(e);
+ break;
+ case SWT.FocusIn:
+ onFocusIn();
+ break;
+ case SWT.Paint:
+ onPaint(e);
+ break;
+ default :
+ OLE.error(SWT.ERROR_NOT_IMPLEMENTED);
+ }
+ }
+ };
+ this.addListener(SWT.Dispose, listener);
+ this.addListener(SWT.FocusIn, listener);
+ this.addListener(SWT.Paint, listener);
+ frame.addListener(SWT.Resize, listener);
+}
+/**
+ * Create an OleClientSite child widget using the OLE Document type associated with the
+ * specified file. The OLE Document type is determined either through header information in the file
+ * or through a Registry entry for the file extension. Use style bits to select a particular look
+ * or set of properties.
+ *
+ * @param parent a composite widget; must be an OleFrame
+ * @param style the bitwise OR'ing of widget styles
+ * @param file the file that is to be opened in this OLE Document
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
+ * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null</ul>
+ * @exception SWTError
+ * <ul><li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
+ * <li>ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
+ * <li>ERROR_CANNOT_OPEN_FILE when failed to open file
+ * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
+ *
+ */
+public OleClientSite(Composite parent, int style, File file) {
+ this(parent, style);
+ try {
+
+ if (file == null || file.isDirectory() || !file.exists())
+ OLE.error(OLE.ERROR_INVALID_ARGUMENT);
+
+ // Is there an associated CLSID?
+ appClsid = new GUID();
+ char[] fileName = (file.getAbsolutePath()+"\0").toCharArray();
+ int result = COM.GetClassFile(fileName, appClsid);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
+
+ // Open a temporary storage object
+ tempStorage = createTempStorage();
+
+ // Create ole object with storage object
+ int[] address = new int[1];
+ result = COM.OleCreateFromFile(appClsid, fileName, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
+
+ objIUnknown = new IUnknown(address[0]);
+
+ // Init sinks
+ addObjectReferences();
+
+ COM.OleRun(objIUnknown.getAddress());
+ } catch (SWTException e) {
+ disposeCOMInterfaces();
+ frame.Release();
+ throw e;
+ }
+}
+/**
+ * Create an OleClientSite child widget to edit a blank document using the specified OLE Document
+ * application. Use style bits to select a particular look or set of properties.
+ *
+ * @param parent a composite widget; must be an OleFrame
+ * @param style the bitwise OR'ing of widget styles
+ * @param progID the unique program identifier of am OLE Document application;
+ * the value of the ProgID key or the value of the VersionIndependentProgID key specified
+ * in the registry for the desired OLE Document (for example, the VersionIndependentProgID
+ * for Word is Word.Document)
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
+ * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
+ * <li>ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
+ * <li>ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
+ * <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
+ * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
+ *
+ */
+public OleClientSite(Composite parent, int style, String progId) {
+ this(parent, style);
+ try {
+ appClsid = getClassID(progId);
+ if (appClsid == null)
+ OLE.error(OLE.ERROR_INVALID_CLASSID);
+
+ // Open a temporary storage object
+ tempStorage = createTempStorage();
+
+ // Create ole object with storage object
+ int[] address = new int[1];
+ int result = COM.OleCreate(appClsid, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
+
+ objIUnknown = new IUnknown(address[0]);
+
+ // Init sinks
+ addObjectReferences();
+
+ COM.OleRun(objIUnknown.getAddress());
+
+ } catch (SWTException e) {
+ disposeCOMInterfaces();
+ frame.Release();
+ throw e;
+ }
+}
+/**
+ * @private
+ *
+ * Create an OleClientSite child widget to edit the specified file using the specified OLE Document
+ * application. Use style bits to select a particular look or set of properties.
+ *
+ * @param parent a composite widget; must be an OleFrame
+ * @param style the bitwise OR'ing of widget styles
+ * @param progID the unique program identifier of am OLE Document application;
+ * the value of the ProgID key or the value of the VersionIndependentProgID key specified
+ * in the registry for the desired OLE Document (for example, the VersionIndependentProgID
+ * for Word is Word.Document)
+ * @param file the file that is to be opened in this OLE Document
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
+ * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
+ * <li>ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
+ * <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
+ * <li>ERROR_CANNOT_OPEN_FILE when failed to open file
+ * <li>ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
+ * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
+ *
+ */
+public OleClientSite(Composite parent, int style, String progId, File file) {
+ this(parent, style);
+
+ try {
+
+ if (file == null || file.isDirectory() || !file.exists())
+ OLE.error(OLE.ERROR_INVALID_ARGUMENT);
+
+ appClsid = getClassID(progId);
+
+ // Are we opening this file with the preferred OLE object?
+ char[] fileName = (file.getAbsolutePath()+"\0").toCharArray();
+ GUID fileClsid = new GUID();
+ COM.GetClassFile(fileName, fileClsid);
+
+ if (COM.IsEqualGUID(appClsid, fileClsid)){
+ // use default mechanism
+ // Open a temporary storage object
+ tempStorage = createTempStorage();
+
+ // Create ole object with storage object
+ int[] address = new int[1];
+ int result = COM.OleCreateFromFile(appClsid, fileName, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
+
+ objIUnknown = new IUnknown(address[0]);
+ } else {
+ // use a conversion mechanism
+
+ // Word does not follow the standard and does not use "CONTENTS" as the name of
+ // its primary stream
+ String contentStream = "CONTENTS";
+ GUID wordGUID = getClassID(WORDPROGID);
+ if (COM.IsEqualGUID(appClsid, wordGUID)) contentStream = "WordDocument";
+
+ // Copy over the contents of the file into a new temporary storage object
+ OleFile oleFile = new OleFile(file, contentStream, OleFile.READ);
+ IStorage storage = oleFile.getRootStorage();
+ storage.AddRef();
+ // Open a temporary storage object
+ tempStorage = createTempStorage();
+ // Copy over contents of file
+ int result = storage.CopyTo(0, null, null, tempStorage.getAddress());
+ storage.Release();
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
+ oleFile.dispose();
+
+ // create ole client
+ int[] ppv = new int[1];
+ result = COM.CoCreateInstance(appClsid, 0, COM.CLSCTX_INPROC_HANDLER | COM.CLSCTX_INPROC_SERVER, COM.IIDIUnknown, ppv);
+ if (result != COM.S_OK){
+ tempStorage.Release();
+ OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
+ }
+ objIUnknown = new IUnknown(ppv[0]);
+
+ // get the persistant storage of the ole client
+ ppv = new int[1];
+ result = objIUnknown.QueryInterface(COM.IIDIPersistStorage, ppv);
+ if (result != COM.S_OK){
+ tempStorage.Release();
+ objIUnknown.Release();
+ OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
+ }
+ IPersistStorage iPersistStorage = new IPersistStorage(ppv[0]);
+
+ // load the contents of the file into the ole client site
+ result = iPersistStorage.Load(tempStorage.getAddress());
+ iPersistStorage.Release();
+ if (result != COM.S_OK){
+ tempStorage.Release();
+ tempStorage = null;
+ objIUnknown.Release();
+ objIUnknown = null;
+ OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
+ }
+ }
+
+ // Init sinks
+ addObjectReferences();
+
+ COM.OleRun(objIUnknown.getAddress());
+ } catch (SWTException e) {
+ disposeCOMInterfaces();
+ frame.Release();
+ throw e;
+ }
+}
+private void activateInPlaceClient() {
+ if (objIOleInPlaceObject == null) return;
+
+ // bring client window to foreground
+ int[] phwnd = new int[1];
+ if (objIOleInPlaceObject.GetWindow(phwnd) == COM.S_OK) {
+ OS.SetWindowPos(phwnd[0], OS.HWND_TOP, 0, 0, 0, 0, OS.SWP_NOSIZE | OS.SWP_NOMOVE);
+ }
+
+ frame.setCurrentDocument(this);
+
+ setFocus();
+}
+protected void addObjectReferences() {
+
+ //
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIPersist, ppvObject) == COM.S_OK) {
+ IPersist objIPersist = new IPersist(ppvObject[0]);
+ GUID tempid = new GUID();
+ if (objIPersist.GetClassID(tempid) == COM.S_OK)
+ objClsid = tempid;
+ objIPersist.Release();
+ }
+
+ //
+ ppvObject = new int[1];
+ int result = objIUnknown.QueryInterface(COM.IIDIViewObject2, ppvObject);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_INTERFACE_NOT_FOUND, result);
+ objIViewObject2 = new IViewObject2(ppvObject[0]);
+ objIViewObject2.SetAdvise(aspect, 0, iAdviseSink.getAddress());
+
+ //
+ ppvObject = new int[1];
+ result = objIUnknown.QueryInterface(COM.IIDIOleObject, ppvObject);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_INTERFACE_NOT_FOUND, result);
+ objIOleObject = new IOleObject(ppvObject[0]);
+ objIOleObject.SetClientSite(iOleClientSite.getAddress());
+ int[] pdwConnection = new int[1];
+ objIOleObject.Advise(iAdviseSink.getAddress(), pdwConnection);
+ objIOleObject.SetHostNames("main", "main");
+
+ // Notify the control object that it is embedded in an OLE container
+ COM.OleSetContainedObject(objIUnknown.getAddress(), true);
+
+ // Is OLE object linked or embedded?
+ ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIOleLink, ppvObject) == COM.S_OK) {
+ IOleLink objIOleLink = new IOleLink(ppvObject[0]);
+ int[] ppmk = new int[1];
+ if (objIOleLink.GetSourceMoniker(ppmk) == COM.S_OK) {
+ IMoniker objIMoniker = new IMoniker(ppmk[0]);
+ objIMoniker.Release();
+ type = COM.OLELINKED;
+ objIOleLink.BindIfRunning();
+ } else {
+ isStatic = true;
+ }
+ objIOleLink.Release();
+ }
+}
+protected int AddRef() {
+ refCount++;
+ return refCount;
+}
+private int CanInPlaceActivate() {
+ if (aspect == COM.DVASPECT_CONTENT && type == COM.OLEEMBEDDED)
+ return COM.S_OK;
+
+ return COM.S_FALSE;
+}
+private int ContextSensitiveHelp(int fEnterMode) {
+ return COM.S_OK;
+}
+protected void createCOMInterfaces() {
+
+ iUnknown = new COMObject(new int[]{2, 0, 0}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ };
+
+ iOleClientSite = new COMObject(new int[]{2, 0, 0, 0, 3, 1, 0, 1, 0}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ public int method3(int[] args) {return SaveObject();}
+ // method4 GetMoniker - not implemented
+ public int method5(int[] args) {return GetContainer(args[0]);}
+ public int method6(int[] args) {return ShowObject();}
+ public int method7(int[] args) {return OnShowWindow(args[0]);}
+ // method8 RequestNewObjectLayout - not implemented
+ };
+
+ iAdviseSink = new COMObject(new int[]{2, 0, 0, 2, 2, 1, 0, 0}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ public int method3(int[] args) {return OnDataChange(args[0], args[1]);}
+ public int method4(int[] args) {return OnViewChange(args[0], args[1]);}
+ //method5 OnRename - not implemented
+ public int method6(int[] args) {OnSave();return 0;}
+ public int method7(int[] args) {return OnClose();}
+ };
+
+ iOleInPlaceSite = new COMObject(new int[]{2, 0, 0, 1, 1, 0, 0, 0, 5, 1, 1, 0, 0, 0, 1}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ public int method3(int[] args) {return GetWindow(args[0]);}
+ public int method4(int[] args) {return ContextSensitiveHelp(args[0]);}
+ public int method5(int[] args) {return CanInPlaceActivate();}
+ public int method6(int[] args) {return OnInPlaceActivate();}
+ public int method7(int[] args) {return OnUIActivate();}
+ public int method8(int[] args) {return GetWindowContext(args[0], args[1], args[2], args[3], args[4]);}
+ public int method9(int[] args) {return Scroll(args[0]);}
+ public int method10(int[] args) {return OnUIDeactivate(args[0]);}
+ public int method11(int[] args) {return OnInPlaceDeactivate();}
+ // method12 DiscardUndoState - not implemented
+ // method13 DeactivateAndUndoChange - not implemented
+ public int method14(int[] args) {return OnPosRectChange(args[0]);}
+ };
+}
+protected IStorage createTempStorage() {
+ int[] tempStorage = new int[1];
+ int grfMode = COM.STGM_READWRITE | COM.STGM_SHARE_EXCLUSIVE | COM.STGM_DELETEONRELEASE;
+ int result = COM.StgCreateDocfile(null, grfMode, 0, tempStorage);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CREATE_FILE, result);
+ return new IStorage(tempStorage[0]);
+}
+/**
+ * Deactivates an active in-place object and discards the object's undo state.
+ */
+public void deactivateInPlaceClient() {
+ if (active && objIOleInPlaceObject != null) {
+ objIOleInPlaceObject.InPlaceDeactivate();
+ }
+}
+private void deleteTempStorage() {
+ //Destroy this item's contents in the temp root IStorage.
+ if (tempStorage != null){
+ tempStorage.Release();
+ }
+
+ tempStorage = null;
+}
+protected void disposeCOMInterfaces() {
+
+ if (iUnknown != null)
+ iUnknown.dispose();
+ iUnknown = null;
+
+ if (iOleClientSite != null)
+ iOleClientSite.dispose();
+ iOleClientSite = null;
+
+ if (iAdviseSink != null)
+ iAdviseSink.dispose();
+ iAdviseSink = null;
+
+ if (iOleInPlaceSite != null)
+ iOleInPlaceSite.dispose();
+ iOleInPlaceSite = null;
+}
+/**
+ * Requests that the OLE Document or ActiveX Control perform an action; actions are almost always
+ * changes to the activation state.
+ *
+ * @param verb the operation that is requested. This is one of the OLE.OLEIVERB_ values
+ *
+ * @return an HRESULT value indicating the success of the operation request; OLE.S_OK indicates
+ * success
+ */
+public int doVerb(int verb) {
+ if (objIOleObject == null || isStatic)
+ return COM.E_FAIL;
+ boolean wasActive = active;
+
+ int oleobject = objIOleObject.getAddress();
+ COM.OleRun(oleobject);
+
+ // See PR: 1FV9RZW
+ int result = objIOleObject.DoVerb(verb, null, iOleClientSite.getAddress(), 0, handle, null);
+
+ if (active) setObjectRects();
+
+ // synch up with state of object
+ if (wasActive != active){
+ if (active) {
+ activateInPlaceClient();
+ } else {
+ deactivateInPlaceClient();
+ }
+ }
+
+ if (active && inInit) {
+ updateStorage();
+ inInit = false;
+ }
+ return result;
+}
+/**
+ * Asks the OLE Document or ActiveX Control to execute a command from a standard
+ * list of commands. The OLE Document or ActiveX Control must support the IOleCommandTarget
+ * interface. The OLE Document or ActiveX Control does not have to support all the commands
+ * in the standard list. To check if a command is supported, you can call queryStatus with
+ * the cmdID.
+ *
+ * @param cmdID the ID of a command; these are the OLE.OLECMDID_ values - a small set of common
+ * commands
+ * @param options the optional flags; these are the OLE.OLECMDEXECOPT_ values
+ * @param in the argument for the command
+ * @param out the return value of the command
+ *
+ * @return an HRESULT value; OLE.S_OK is returned if successful
+ *
+ */
+public int exec(int cmdID, int options, Variant in, Variant out) {
+
+ if (objIOleCommandTarget == null) {
+ int[] address = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIOleCommandTarget, address) != COM.S_OK)
+ return OLE.ERROR_INTERFACE_NOT_FOUND;
+ objIOleCommandTarget = new IOleCommandTarget(address[0]);
+ }
+
+ int inAddress = 0;
+ if (in != null){
+ inAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
+ in.getData(inAddress);
+ }
+ int outAddress = 0;
+ if (out != null){
+ outAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
+ out.getData(outAddress);
+ }
+
+ int result = objIOleCommandTarget.Exec(null, cmdID, options, inAddress, outAddress);
+
+ if (inAddress != 0){
+ COM.VariantClear(inAddress);
+ OS.GlobalFree(inAddress);
+ }
+ if (outAddress != 0) {
+ out.setData(outAddress);
+ COM.VariantClear(outAddress);
+ OS.GlobalFree(outAddress);
+ }
+
+ return result;
+}
+IDispatch getAutomationObject() {
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIDispatch, ppvObject) != COM.S_OK)
+ return null;
+ return new IDispatch(ppvObject[0]);
+}
+protected GUID getClassID(String clientName) {
+ // create a GUID struct to hold the result
+ GUID guid = new GUID();
+
+ // create a null terminated array of char
+ char[] buffer = null;
+ if (clientName != null) {
+ int count = clientName.length();
+ buffer = new char[count + 1];
+ clientName.getChars(0, count, buffer, 0);
+ }
+ if (COM.CLSIDFromProgID(buffer, guid) != COM.S_OK){
+ int result = COM.CLSIDFromString(buffer, guid);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_INVALID_CLASSID, result);
+ }
+ return guid;
+}
+private int GetContainer(int ppContainer) {
+
+ /* Simple containers that do not support links to their embedded
+ objects probably do not need to implement this method. Instead,
+ they can return E_NOINTERFACE and set ppContainer to NULL.*/
+
+ if (ppContainer != 0)
+ COM.MoveMemory(ppContainer, new int[]{0}, 4);
+ return COM.E_NOINTERFACE;
+}
+private SIZE getExtent() {
+ SIZE sizel = new SIZE();
+ // get the current size of the embedded OLENatives object
+ if (objIOleObject != null) {
+ if ( objIViewObject2 != null && !COM.OleIsRunning(objIOleObject.getAddress())) {
+ objIViewObject2.GetExtent(aspect, -1, null, sizel);
+ } else {
+ objIOleObject.GetExtent(aspect, sizel);
+ }
+ }
+ return xFormHimetricToPixels(sizel);
+}
+public Rectangle getIndent() {
+ return new Rectangle(indent.left, indent.right, indent.top, indent.bottom);
+}
+/**
+ * Returns the program ID of the OLE Document or ActiveX Control.
+ *
+ * @return the program ID of the OLE Document or ActiveX Control
+ */
+public String getProgramID(){
+ if (appClsid != null){
+ int[] lplpszProgID = new int[1];
+ if (COM.ProgIDFromCLSID(appClsid, lplpszProgID) == COM.S_OK) {
+ int ptr = OS.GlobalLock(lplpszProgID[0]);
+ int length = OS.GlobalSize(ptr);
+ char[] buffer = new char[length];
+ COM.MoveMemory(buffer, lplpszProgID[0], length);
+ OS.GlobalUnlock(ptr);
+ OS.GlobalFree(lplpszProgID[0]);
+
+ String result = new String(buffer);
+ // remove null terminator
+ int index = result.indexOf("\0");
+ return result.substring(0, index);
+ }
+ }
+ return null;
+}
+protected int GetWindow(int phwnd) {
+
+ if (phwnd == 0)
+ return COM.E_INVALIDARG;
+ if (frame == null) {
+ COM.MoveMemory(phwnd, new int[] {0}, 4);
+ return COM.E_NOTIMPL;
+ }
+
+ // Copy the Window's handle into the memory passed in
+ COM.MoveMemory(phwnd, new int[] {frame.handle}, 4);
+ return COM.S_OK;
+}
+private int GetWindowContext(int ppFrame, int ppDoc, int lprcPosRect, int lprcClipRect, int lpFrameInfo) {
+
+ if (frame == null || ppFrame == 0)
+ return COM.E_NOTIMPL;
+
+ // fill in frame handle
+ int iOleInPlaceFrame = frame.getIOleInPlaceFrame();
+ COM.MoveMemory(ppFrame, new int[] {iOleInPlaceFrame}, 4);
+ frame.AddRef();
+
+ // null out document handle
+ if (ppDoc != 0) {
+ COM.MoveMemory(ppDoc, new int[] {0}, 4);
+ }
+
+ // fill in position and clipping info
+ Rectangle clientArea = this.getClientArea();
+ Point clientLocation = this.getLocation();
+ setExtent(clientArea.width - indent.left - indent.right, clientArea.height - indent.top - indent.bottom);
+
+ RECT posRect = new RECT();
+ posRect.left = clientLocation.x + indent.left;
+ posRect.top = clientLocation.y + indent.top;
+ posRect.right = clientLocation.x + clientArea.width - indent.right;
+ posRect.bottom = clientLocation.y + clientArea.height - indent.bottom;
+
+ RECT clipRect = new RECT();
+ Rectangle frameArea = frame.getClientArea();
+ clipRect.left = frameArea.x;
+ clipRect.top = frameArea.y;
+ clipRect.right = frameArea.x + frameArea.width;
+ clipRect.bottom = frameArea.y + frameArea.height;
+
+ if (lprcPosRect != 0) {
+ OS.MoveMemory(lprcPosRect, posRect, RECT.sizeof);
+ }
+ if (lprcClipRect != 0) {
+ OS.MoveMemory(lprcClipRect, clipRect, RECT.sizeof);
+ }
+
+ // get frame info
+ OLEINPLACEFRAMEINFO frameInfo = new OLEINPLACEFRAMEINFO();
+ frameInfo.cb = OLEINPLACEFRAMEINFO.sizeof;
+ frameInfo.fMDIApp = 0;
+ frameInfo.hwndFrame = frame.handle;
+ //frameInfo.cAccelEntries = ??;
+ //frameInfo.hAccel = ??;
+ COM.MoveMemory(lpFrameInfo, frameInfo, OLEINPLACEFRAMEINFO.sizeof);
+
+ return COM.S_OK;
+}
+public boolean isDirty() {
+ // Get access to the persistant storage mechanism
+ int[] address = new int[1];
+ if (objIOleObject.QueryInterface(COM.IIDIPersistFile, address) != COM.S_OK)
+ return false;
+ IPersistStorage permStorage = new IPersistStorage(address[0]);
+ // Are the contents of the permanent storage different from the file?
+ int result = permStorage.IsDirty();
+ permStorage.Release();
+ return (result == COM.S_OK);
+}
+public boolean isFocusControl () {
+ Control focus = getDisplay().getFocusControl();
+ if (focus == frame) {
+ return frame.getCurrentDocument() == this;
+ }
+ return false;
+}
+private int OnClose() {
+ return COM.S_OK;
+}
+private int OnDataChange(int pFormatetc, int pStgmed) {
+ return COM.S_OK;
+}
+private void onDispose(Event e) {
+
+ doVerb(OLE.OLEIVERB_DISCARDUNDOSTATE);
+
+ releaseObjectInterfaces(); // Note, must release object interfaces before releasing frame
+ deleteTempStorage();
+
+ // remove listeners
+ removeListener(SWT.Resize, listener);
+ removeListener(SWT.Move, listener);
+ removeListener(SWT.Dispose, listener);
+ frame.removeListener(SWT.Resize, listener);
+ frame.Release();
+ frame = null;
+}
+private void onFocusIn() {
+ setInplaceFocus();
+}
+private int OnInPlaceActivate() {
+ active = true;
+ if (objIOleObject == null)
+ return COM.S_OK;
+ int[] ppvObject = new int[1];
+ if (objIOleObject.QueryInterface(COM.IIDIOleInPlaceObject, ppvObject) == COM.S_OK) {
+ objIOleInPlaceObject = new IOleInPlaceObject(ppvObject[0]);
+ }
+ return COM.S_OK;
+}
+private int OnInPlaceDeactivate() {
+
+ if (objIOleInPlaceObject != null)
+ objIOleInPlaceObject.Release();
+ objIOleInPlaceObject = null;
+ active = false;
+ return COM.S_OK;
+}
+private int OnPosRectChange(int lprcPosRect) {
+
+ setObjectRects();
+
+ return COM.S_OK;
+}
+private void onPaint(Event e) {
+ if (!active && objIUnknown != null) {
+ SIZE size = getExtent();
+ RECT rect = new RECT();
+ rect.left = 0; rect.top = 0;
+ rect.right = size.cx; rect.bottom = size.cy;
+ int pArea = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, RECT.sizeof);
+ OS.MoveMemory(pArea, rect, RECT.sizeof);
+ COM.OleDraw(objIUnknown.getAddress(), aspect, e.gc.handle, pArea);
+ OS.GlobalFree(pArea);
+ }
+}
+private void onResize(Event e) {
+ Rectangle area = frame.getClientArea();
+ setBounds(borderWidths.left,
+ borderWidths.top,
+ area.width - borderWidths.left - borderWidths.right,
+ area.height - borderWidths.top - borderWidths.bottom);
+
+ setObjectRects();
+}
+private void OnSave() {
+}
+private int OnShowWindow(int fShow) {
+ boolean wasActive = active;
+ active = (fShow != 0);
+ if (wasActive != active){
+ if (active) {
+ activateInPlaceClient();
+ } else {
+ deactivateInPlaceClient();
+ }
+ }
+ return COM.S_OK;
+}
+private int OnUIActivate() {
+ return COM.S_OK;
+}
+private int OnUIDeactivate(int fUndoable) {
+
+ // currently, we are ignoring the fUndoable flag
+ if (frame == null || frame.isDisposed()) return COM.S_OK;
+
+ frame.SetActiveObject(0,0);
+
+ Menu menubar = frame.getMenubar();
+ if (menubar == null || menubar.isDisposed())
+ return COM.S_OK;
+
+ int shellHandle = menubar.getShell().handle;
+ OS.SetMenu(shellHandle, menubar.handle);
+ return COM.OleSetMenuDescriptor(0, shellHandle, 0, 0, 0);
+}
+private int OnViewChange(int dwAspect, int lindex) {
+ setObjectRects();
+ return COM.S_OK;
+}
+private IStorage openStorage(IStorage storage, String name) {
+ int mode = COM.STGM_TRANSACTED | COM.STGM_READWRITE | COM.STGM_SHARE_EXCLUSIVE;
+ int[] ppStg = new int[1];
+ if (storage.OpenStorage(name, 0, mode, null, 0, ppStg) != COM.S_OK) {
+ // IStorage does not exist, so create one
+ mode = mode | COM.STGM_CREATE;
+ if (storage.CreateStorage(name, mode, 0, 0, ppStg) != COM.S_OK)
+ return null;
+ }
+ return new IStorage(ppStg[0]);
+}
+protected int QueryInterface(int riid, int ppvObject) {
+
+ if (riid == 0 || ppvObject == 0)
+ return COM.E_NOINTERFACE;
+ GUID guid = new GUID();
+ COM.MoveMemory(guid, riid, GUID.sizeof);
+
+ if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
+ COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
+ AddRef();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID(guid, COM.IIDIAdviseSink)) {
+ COM.MoveMemory(ppvObject, new int[] {iAdviseSink.getAddress()}, 4);
+ AddRef();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID(guid, COM.IIDIOleClientSite)) {
+ COM.MoveMemory(ppvObject, new int[] {iOleClientSite.getAddress()}, 4);
+ AddRef();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID(guid, COM.IIDIOleInPlaceSite)) {
+ COM.MoveMemory(ppvObject, new int[] {iOleInPlaceSite.getAddress()}, 4);
+ AddRef();
+ return COM.S_OK;
+ }
+ COM.MoveMemory(ppvObject, new int[] {0}, 4);
+ return COM.E_NOINTERFACE;
+}
+/**
+ * Returns the status of the specified command. The status is any bitwise OR'd combination of
+ * SWTOLE.OLECMDF_SUPPORTED, SWTOLE.OLECMDF_ENABLED, SWTOLE.OLECMDF_LATCHED, SWTOLE.OLECMDF_NINCHED.
+ * You can query the status of a command before invoking it with OleClientSite.exec. The
+ * OLE Document or ActiveX Control must support the IOleCommandTarget to make use of this method.
+ *
+ * @param cmd the ID of a command; these are the OLE.OLECMDID_ values - a small set of common
+ * commands
+ *
+ * @return the status of the specified command or 0 if unable to query the OLE Object; these are the
+ * OLE.OLECMDF_ values
+ */
+public int queryStatus(int cmd) {
+
+ if (objIOleCommandTarget == null) {
+ int[] address = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIOleCommandTarget, address) != COM.S_OK)
+ return 0;
+ objIOleCommandTarget = new IOleCommandTarget(address[0]);
+ }
+
+ OLECMD olecmd = new OLECMD();
+ olecmd.cmdID = cmd;
+
+ int result = objIOleCommandTarget.QueryStatus(null, 1, olecmd, null);
+
+ if (result != COM.S_OK) return 0;
+
+ return olecmd.cmdf;
+}
+protected int Release() {
+ refCount--;
+
+ if (refCount == 0) {
+ disposeCOMInterfaces();
+ }
+ return refCount;
+}
+protected void releaseObjectInterfaces() {
+
+ if (objIOleInPlaceObject!= null)
+ objIOleInPlaceObject.Release();
+ objIOleInPlaceObject = null;
+
+ if (objIOleObject != null) {
+ objIOleObject.Close(COM.OLECLOSE_NOSAVE);
+ objIOleObject.Release();
+ }
+ objIOleObject = null;
+
+ if (objIViewObject2 != null) {
+ objIViewObject2.SetAdvise(aspect, 0, 0);
+ objIViewObject2.Release();
+ }
+ objIViewObject2 = null;
+
+ if (objIOleCommandTarget != null)
+ objIOleCommandTarget.Release();
+ objIOleCommandTarget = null;
+
+ if (objIUnknown != null){
+ objIUnknown.Release();
+ }
+ objIUnknown = null;
+
+ COM.CoFreeUnusedLibraries();
+}
+public boolean save(File file, boolean includeOleInfo) {
+ if (includeOleInfo)
+ return saveToStorageFile(file);
+ return saveToTraditionalFile(file);
+}
+private boolean saveFromContents(int address, File file) {
+
+ boolean success = false;
+
+ IStream tempContents = new IStream(address);
+ tempContents.AddRef();
+
+ try {
+ FileOutputStream writer = new FileOutputStream(file);
+
+ int increment = 1024 * 4;
+ int pv = COM.CoTaskMemAlloc(increment);
+ int[] pcbWritten = new int[1];
+ while (tempContents.Read(pv, increment, pcbWritten) == COM.S_OK && pcbWritten[0] > 0) {
+ byte[] buffer = new byte[ pcbWritten[0]];
+ OS.MoveMemory(buffer, pv, pcbWritten[0]);
+ writer.write(buffer); // Note: if file does not exist, this will create the file the
+ // first time it is called
+ success = true;
+ }
+ COM.CoTaskMemFree(pv);
+
+ writer.close();
+
+ } catch (IOException err) {
+ }
+
+ tempContents.Release();
+
+ return success;
+}
+private boolean saveFromOle10Native(int address, File file) {
+
+ boolean success = false;
+
+ IStream tempContents = new IStream(address);
+ tempContents.AddRef();
+
+ // The "\1Ole10Native" stream contains a DWORD header whose value is the length
+ // of the native data that follows.
+ int pv = COM.CoTaskMemAlloc(4);
+ int[] size = new int[1];
+ int rc = tempContents.Read(pv, 4, null);
+ OS.MoveMemory(size, pv, 4);
+ COM.CoTaskMemFree(pv);
+ if (rc == COM.S_OK && size[0] > 0) {
+
+ // Read the data
+ byte[] buffer = new byte[size[0]];
+ pv = COM.CoTaskMemAlloc(size[0]);
+ rc = tempContents.Read(pv, size[0], null);
+ OS.MoveMemory(buffer, pv, size[0]);
+ COM.CoTaskMemFree(pv);
+
+ // open the file and write data into it
+ try {
+ FileOutputStream writer = new FileOutputStream(file);
+ writer.write(buffer); // Note: if file does not exist, this will create the file
+ writer.close();
+
+ success = true;
+ } catch (IOException err) {
+ }
+ }
+ tempContents.Release();
+
+ return success;
+}
+private int SaveObject() {
+
+ updateStorage();
+
+ return COM.S_OK;
+}
+/**
+ * Saves the document to the specified file and includes OLE spcific inforrmation. This method
+ * must <b>only</b> be used for files that have an OLE Storage format. For example, a word file
+ * edited with Word.Document should be saved using this method because there is formating information
+ * that should be stored in the OLE specific Storage format.
+ *
+ * @param file the file to which the changes are to be saved
+ *
+ * @return true if the save was successful
+ */
+private boolean saveToStorageFile(File file) {
+ // Note: if the file already exists, some applications will not overwrite the file
+ // In these cases, you should delete the file first (probably save the contents of the file in case the
+ // save fails)
+ if (file == null || file.isDirectory())
+ return false;
+
+ if (!updateStorage())
+ return false;
+
+ // get access to the persistant storage mechanism
+ int[] address = new int[1];
+ if (objIOleObject.QueryInterface(COM.IIDIPersistStorage, address) != COM.S_OK)
+ return false;
+ IPersistStorage permStorage = new IPersistStorage(address[0]);
+
+ // The file will be saved using the formating of the current application - this
+ // may not be the format of the application that was originally used to create the file
+ // e.g. if an Excel file is opened in Word, the Word application will save the file in the
+ // Word format
+
+ boolean success = false;
+ OleFile oleFile = new OleFile(file, null, OleFile.WRITE);
+ IStorage storage = oleFile.getRootStorage();
+ storage.AddRef();
+ if (COM.OleSave(permStorage.getAddress(), storage.getAddress(), false) == COM.S_OK) {
+ if (storage.Commit(COM.STGC_DEFAULT) == COM.S_OK)
+ success = true;
+ }
+ storage.Release();
+ oleFile.dispose();
+ permStorage.Release();
+
+ return success;
+}
+/**
+ * Saves the document to the specified file. This method must be used for
+ * files that do not have an OLE Storage format. For example, a bitmap file edited with MSPaint
+ * should be saved using this method because bitmap is a standard format that does not include any
+ * OLE specific data.
+ *
+ * @param file the file to which the changes are to be saved
+ *
+ * @return true if the save was successful
+ */
+private boolean saveToTraditionalFile(File file) {
+ // Note: if the file already exists, some applications will not overwrite the file
+ // In these cases, you should delete the file first (probably save the contents of the file in case the
+ // save fails)
+ if (file == null || file.isDirectory())
+ return false;
+ if (!updateStorage())
+ return false;
+
+ int[] address = new int[1];
+ // Look for a CONTENTS stream
+ if (tempStorage.OpenStream("CONTENTS", 0, COM.STGM_DIRECT | COM.STGM_READ | COM.STGM_SHARE_EXCLUSIVE, 0, address) == COM.S_OK)
+ return saveFromContents(address[0], file);
+
+ // Look for Ole 1.0 object stream
+ if (tempStorage.OpenStream("\1Ole10Native", 0, COM.STGM_DIRECT | COM.STGM_READ | COM.STGM_SHARE_EXCLUSIVE, 0, address) == COM.S_OK)
+ return saveFromOle10Native(address[0], file);
+
+ return false;
+}
+private int Scroll(int scrollExtant) {
+ return COM.S_OK;
+}
+void setBorderSpace(RECT newBorderwidth) {
+ borderWidths = newBorderwidth;
+
+ // readjust size and location of client site
+ Rectangle area = frame.getClientArea();
+ setBounds(borderWidths.left, borderWidths.top,
+ area.width - borderWidths.left - borderWidths.right,
+ area.height - borderWidths.top - borderWidths.bottom);
+
+ setObjectRects();
+}
+private void setExtent(int width, int height){
+ // Resize the width and height of the embedded/linked OLENatives object
+ // to the specified values.
+
+ if (objIOleObject == null || isStatic) return;
+
+ if (inUpdate) return;
+
+ SIZE currentExtent = getExtent();
+ if (width == currentExtent.cx && height == currentExtent.cy) return;
+
+ SIZE newExtent = new SIZE();
+ newExtent.cx = width; newExtent.cy = height;
+ newExtent = xFormPixelsToHimetric(newExtent);
+
+ // Get the server running first, then do a SetExtent, then show it
+ boolean alreadyRunning = COM.OleIsRunning(objIOleObject.getAddress());
+ if (!alreadyRunning)
+ COM.OleRun(objIOleObject.getAddress());
+
+ if (objIOleObject.SetExtent(aspect, newExtent) == COM.S_OK){
+ inUpdate = true;
+ objIOleObject.Update();
+ inUpdate = false;
+ if (!alreadyRunning)
+ // Close server if it wasn't already running upon entering this method.
+ objIOleObject.Close(COM.OLECLOSE_SAVEIFDIRTY);
+ }
+
+}
+public void setIndent(Rectangle newIndent) {
+ indent = new RECT();
+ indent.left = newIndent.x;
+ indent.right = newIndent.width;
+ indent.top = newIndent.y;
+ indent.bottom = newIndent.height;
+}
+private boolean setInplaceFocus() {
+ if (objIOleInPlaceObject == null) return false;
+ int[] phwnd = new int[1];
+ objIOleInPlaceObject.GetWindow(phwnd);
+ if (phwnd[0] == 0) return false;
+ return (OS.SetFocus(phwnd[0]) != 0);
+}
+public boolean forceFocus () {
+ if (!setInplaceFocus()) {
+ return super.forceFocus();
+ }
+ return true;
+}
+private void setObjectRects() {
+
+ if (objIOleInPlaceObject == null) return;
+
+ // size the object to fill the available space
+ // leave a border
+ Rectangle clientArea = this.getClientArea();
+ Point clientLocation = this.getLocation();
+ setExtent(clientArea.width - indent.left - indent.right, clientArea.height - indent.top - indent.bottom);
+
+ RECT posRect = new RECT();
+ posRect.left = clientLocation.x + indent.left;
+ posRect.top = clientLocation.y + indent.top;
+ posRect.right = clientLocation.x + clientArea.width - indent.right;
+ posRect.bottom = clientLocation.y + clientArea.height - indent.bottom;
+
+ RECT clipRect = new RECT();
+ Rectangle frameArea = frame.getClientArea();
+ clipRect.left = frameArea.x;
+ clipRect.top = frameArea.y;
+ clipRect.right = frameArea.x + frameArea.width;
+ clipRect.bottom = frameArea.y + frameArea.height;
+
+ objIOleInPlaceObject.SetObjectRects(posRect, clipRect);
+
+}
+
+private int ShowObject() {
+ /* Tells the container to position the object so it is visible to
+ * the user. This method ensures that the container itself is
+ * visible and not minimized.
+ */
+ return COM.S_OK;
+}
+/**
+ * Displays a dialog with the property information for this OLE Object. The OLE Document or
+ * ActiveX Control must support the ISpecifyPropertyPages interface.
+ *
+ * @param title the name that will appear in the titlebar of the dialog
+ */
+public void showProperties(String title) {
+
+ // Get the Property Page information from the OLE Object
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDISpecifyPropertyPages, ppvObject) != COM.S_OK) return;
+ ISpecifyPropertyPages objISPP = new ISpecifyPropertyPages(ppvObject[0]);
+ CAUUID caGUID = new CAUUID();
+ int result = objISPP.GetPages(caGUID);
+ objISPP.Release();
+ if (result != COM.S_OK) return;
+
+ // create a frame in which to display the pages
+ char[] chTitle = null;
+ if (title != null) {
+ chTitle = new char[title.length()];
+ title.getChars(0, title.length(), chTitle, 0);
+ }
+ result = COM.OleCreatePropertyFrame(frame.handle, 10, 10, chTitle, 1, new int[] {objIUnknown.getAddress()}, caGUID.cElems, caGUID.pElems, COM.LOCALE_USER_DEFAULT, 0, 0);
+
+ // free the property page information
+ COM.CoTaskMemFree(caGUID.pElems);
+}
+private boolean updateStorage() {
+
+ if (tempStorage == null) return false;
+
+ int[] ppv = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIPersistStorage, ppv) != COM.S_OK) return false;
+ IPersistStorage iPersistStorage = new IPersistStorage(ppv[0]);
+
+ int result = COM.OleSave(iPersistStorage.getAddress(), tempStorage.getAddress(), true);
+
+ if (result != COM.S_OK){
+ // OleSave will fail for static objects, so do what OleSave does.
+ COM.WriteClassStg(tempStorage.getAddress(), objClsid);
+ result = iPersistStorage.Save(tempStorage.getAddress(), true);
+ }
+
+ tempStorage.Commit(COM.STGC_DEFAULT);
+ result = iPersistStorage.SaveCompleted(0);
+ iPersistStorage.Release();
+
+ return true;
+}
+private SIZE xFormHimetricToPixels(SIZE aSize) {
+ // Return a new Size which is the pixel transformation of a
+ // size in HIMETRIC units.
+
+ int hDC = OS.GetDC(0);
+ int xppi = OS.GetDeviceCaps(hDC, 88); // logical pixels/inch in x
+ int yppi = OS.GetDeviceCaps(hDC, 90); // logical pixels/inch in y
+ OS.ReleaseDC(0, hDC);
+ double tcx = Math.round( ((float)aSize.cx * (float)xppi) / 2540.0 ); // 2540 HIMETRIC units per inch
+ int cx = (int)tcx;
+ double tcy = Math.round( ((float)aSize.cy * (float)yppi) / 2540.0 );
+ int cy = (int)tcy;
+ SIZE size = new SIZE();
+ size.cx = cx;
+ size.cy = cy;
+ return size;
+}
+private SIZE xFormPixelsToHimetric(SIZE aSize) {
+ // Return a new size which is the HIMETRIC transformation of a
+ // size in pixel units.
+
+ int hDC = OS.GetDC(0);
+ int xppi = OS.GetDeviceCaps(hDC, 88); // logical pixels/inch in x
+ int yppi = OS.GetDeviceCaps(hDC, 90); // logical pixels/inch in y
+ OS.ReleaseDC(0, hDC);
+ double tcx = Math.round( ((float)aSize.cx * 2540.0) / (float)xppi ); // 2540 HIMETRIC units per inch
+ int cx = (int)tcx;
+ double tcy = Math.round( ((float)aSize.cy * 2540.0) / (float)yppi );
+ int cy = (int)tcy;
+ SIZE size = new SIZE();
+ size.cx = cx;
+ size.cy = cy;
+ return size;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
new file mode 100755
index 0000000000..42ed034b2f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
@@ -0,0 +1,521 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import java.io.*;
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.ole.win32.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.win32.*;
+
+/**
+ * OleControlSite provides a site to manage an embedded ActiveX Control within a container.
+ *
+ * <p>In addition to the behaviour provided by OleClientSite, this object provides the following:
+ * <ul>
+ * <li>events from the ActiveX control
+ * <li>notification of property changes from the ActiveX control
+ * <li>simplified access to well known properties of the ActiveX Control (e.g. font, background color)
+ * <li>expose ambient properties of the container to the ActiveX Control
+ * </ul>
+ *
+ * <p>This object implements the OLE Interfaces IOleControlSite, IDispatch, and IPropertyNotifySink.
+ *
+ * <dl>
+ * <dt><b>Styles</b> <dd>BORDER
+ * <dt><b>Events</b> <dd>Dispose, Move, Resize
+ * </dl>
+ *
+ */
+public class OleControlSite extends OleClientSite
+{
+ // interfaces for this container
+ private COMObject iOleControlSite;
+ private COMObject iDispatch;
+
+ // supporting Property Change attributes
+ private OlePropertyChangeSink olePropertyChangeSink;
+
+ // supporting Event Sink attributes
+ private OleEventSink oleEventSink;
+
+ // supporting information for the Control COM object
+ private CONTROLINFO currentControlInfo;
+ private String licenseInfo;
+
+/**
+ * Create an OleControlSite child widget using style bits
+ * to select a particular look or set of properties.
+ *
+ * @param parent a composite widget; must be an OleFrame
+ * @param style the bitwise OR'ing of widget styles
+ * @param progID the unique program identifier which has been registered for this ActiveX Control;
+ * the value of the ProgID key or the value of the VersionIndependentProgID key specified
+ * in the registry for this Control (for example, the VersionIndependentProgID for
+ * Internet Explorer is Shell.Explorer)
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
+ * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
+ * <li>ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
+ * <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
+ * <li>ERROR_CANNOT_ACCESS_CLASSFACTORY when Class Factory could not be found
+ * <li>ERROR_CANNOT_CREATE_LICENSED_OBJECT when failed to create a licensed OLE Object
+ * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
+ *
+ */
+public OleControlSite(Composite parent, int style, String progId) {
+ super(parent, style);
+
+ createCOMInterfaces();
+
+ // check for licensing
+ appClsid = getClassID(progId);
+ if (appClsid == null) OLE.error(OLE.ERROR_INVALID_CLASSID);
+
+ int licinfo = getLicenseInfo(appClsid);
+ if (licinfo == 0) {
+
+ // Open a storage object
+ tempStorage = createTempStorage();
+
+ // Create ole object with storage object
+ int[] address = new int[1];
+ int result = COM.OleCreate(appClsid, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
+
+ objIUnknown = new IUnknown(address[0]);
+
+ } else {
+ // Prepare the ClassFactory
+ int[] ppvObject = new int[1];
+ try {
+ int result = COM.CoGetClassObject(appClsid, COM.CLSCTX_INPROC_HANDLER | COM.CLSCTX_INPROC_SERVER, 0, COM.IIDIClassFactory2, ppvObject);
+ if (result != COM.S_OK) {
+ OLE.error(OLE.ERROR_CANNOT_ACCESS_CLASSFACTORY, result);
+ }
+ IClassFactory2 classFactory = new IClassFactory2(ppvObject[0]);
+ // Create Com Object
+ ppvObject = new int[1];
+ result = classFactory.CreateInstanceLic(0, 0, COM.IIDIUnknown, licinfo, ppvObject);
+ classFactory.Release();
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CREATE_LICENSED_OBJECT, result);
+ } finally {
+ COM.SysFreeString(licinfo);
+ }
+
+ objIUnknown = new IUnknown(ppvObject[0]);
+
+ // Prepare a storage medium
+ ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIPersistStorage, ppvObject) == COM.S_OK) {
+ IPersistStorage persist = new IPersistStorage(ppvObject[0]);
+ tempStorage = createTempStorage();
+ persist.InitNew(tempStorage.getAddress());
+ persist.Release();
+ }
+ }
+
+ // Init sinks
+ try {
+ addObjectReferences();
+ } catch (SWTError e) {
+ disposeCOMInterfaces();
+ frame.Release();
+ throw e;
+ }
+
+ COM.OleRun(objIUnknown.getAddress());
+}
+/**
+ * Adds the listener to receive events.
+ *
+ * @param eventID the id of the event
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void addEventListener(int eventID, OleListener listener) {
+ if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
+ oleEventSink.addListener(eventID, listener);
+}
+protected void addObjectReferences() {
+
+ super.addObjectReferences();
+
+ // Get event notification from control
+ connectEventSink();
+ // Get property change notification from control
+ connectPropertyChangeSink();
+
+ // Get access to the Control object
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIOleControl, ppvObject) == COM.S_OK) {
+ IOleControl objIOleControl = new IOleControl(ppvObject[0]);
+ // ask the control for its info in case users
+ // need to act on it
+ currentControlInfo = new CONTROLINFO();
+ objIOleControl.GetControlInfo(currentControlInfo);
+ objIOleControl.Release();
+ }
+}
+/**
+ * Adds the listener to receive events.
+ *
+ * @param propertyID the identifier of the property
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void addPropertyListener(int propertyID, OleListener listener) {
+ if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
+ olePropertyChangeSink.addListener(propertyID, listener);
+}
+private void connectEventSink() {
+ oleEventSink = new OleEventSink(this);
+ oleEventSink.AddRef();
+ oleEventSink.connect(objIUnknown);
+}
+private void connectPropertyChangeSink() {
+ olePropertyChangeSink = new OlePropertyChangeSink(this);
+ olePropertyChangeSink.AddRef();
+ olePropertyChangeSink.connect(objIUnknown);
+}
+protected void createCOMInterfaces () {
+ super.createCOMInterfaces();
+
+ // register each of the interfaces that this object implements
+ iOleControlSite = new COMObject(new int[]{2, 0, 0, 0, 1, 1, 3, 2, 1, 0}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ public int method3(int[] args) {return OnControlInfoChanged();}
+ // method4 LockInPlaceActive - not implemented
+ // method5 GetExtendedControl - not implemented
+ // method6 TransformCoords - not implemented
+ // method7 Translate Accelerator - not implemented
+ public int method8(int[] args) {return OnFocus(args[0]);}
+ // method9 ShowPropertyFrame - not implemented
+ };
+
+ iDispatch = new COMObject(new int[]{2, 0, 0, 1, 3, 4, 8}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ // method3 GetTypeInfoCount - not implemented
+ // method4 GetTypeInfo - not implemented
+ // method5 GetIDsOfNames - not implemented
+ public int method6(int[] args) {return Invoke(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);}
+ };
+}
+private void disconnectEventSink() {
+
+ if (oleEventSink != null) {
+ oleEventSink.disconnect(objIUnknown);
+ oleEventSink.Release();
+ }
+ oleEventSink = null;
+}
+private void disconnectPropertyChangeSink() {
+
+ if (olePropertyChangeSink != null) {
+ olePropertyChangeSink.disconnect(objIUnknown);
+ olePropertyChangeSink.Release();
+ }
+ olePropertyChangeSink = null;
+}
+protected void disposeCOMInterfaces() {
+ super.disposeCOMInterfaces();
+
+ if (iOleControlSite != null)
+ iOleControlSite.dispose();
+ iOleControlSite = null;
+
+ if (iDispatch != null)
+ iDispatch.dispose();
+ iDispatch = null;
+}
+public Color getBackground () {
+
+ if (objIUnknown != null) {
+ // !! We are getting the OLE_COLOR - should we change this to the COLORREF value?
+ OleAutomation oleObject= new OleAutomation(this);
+ Variant varBackColor = oleObject.getProperty(COM.DISPID_BACKCOLOR);
+ oleObject.dispose();
+
+ if (varBackColor != null){
+ int[] colorRef = new int[1];
+ if (COM.OleTranslateColor(varBackColor.getInt(), getDisplay().hPalette, colorRef) == COM.S_OK)
+ return Color.win32_new(getDisplay(), colorRef[0]);
+ }
+ }
+
+ return super.getBackground();
+}
+public Font getFont () {
+
+ if (objIUnknown != null) {
+ OleAutomation oleObject= new OleAutomation(this);
+ Variant varDispFont = oleObject.getProperty(COM.DISPID_FONT);
+ oleObject.dispose();
+
+ if (varDispFont != null){
+ OleAutomation iDispFont = varDispFont.getAutomation();
+ Variant lfFaceName = iDispFont.getProperty(COM.DISPID_FONT_NAME);
+ Variant lfHeight = iDispFont.getProperty(COM.DISPID_FONT_SIZE);
+ Variant lfItalic = iDispFont.getProperty(COM.DISPID_FONT_ITALIC);
+ //Variant lfCharSet = iDispFont.getProperty(COM.DISPID_FONT_CHARSET);
+ Variant lfBold = iDispFont.getProperty(COM.DISPID_FONT_BOLD);
+ iDispFont.dispose();
+
+ if (lfFaceName != null &&
+ lfHeight != null &&
+ lfItalic != null &&
+ lfBold != null){
+ int style = 3 * lfBold.getInt() + 2 * lfItalic.getInt();
+ Font font = new Font(getShell().getDisplay(), lfFaceName.getString(), lfHeight.getInt(), style);
+ return font;
+ }
+ }
+ }
+
+ return super.getFont();
+}
+public Color getForeground () {
+
+ if (objIUnknown != null) {
+ // !! We are getting the OLE_COLOR - should we change this to the COLORREF value?
+ OleAutomation oleObject= new OleAutomation(this);
+ Variant varForeColor = oleObject.getProperty(COM.DISPID_FORECOLOR);
+ oleObject.dispose();
+
+ if (varForeColor != null){
+ int[] colorRef = new int[1];
+ if (COM.OleTranslateColor(varForeColor.getInt(), getDisplay().hPalette, colorRef) == COM.S_OK)
+ return Color.win32_new(getDisplay(), colorRef[0]);
+ }
+ }
+
+ return super.getForeground();
+}
+protected int getLicenseInfo(GUID clsid) {
+ int[] ppvObject = new int[1];
+
+ if (COM.CoGetClassObject(clsid, COM.CLSCTX_INPROC_HANDLER | COM.CLSCTX_INPROC_SERVER, 0, COM.IIDIClassFactory2, ppvObject) != COM.S_OK) {
+ return 0;
+ }
+ IClassFactory2 classFactory = new IClassFactory2(ppvObject[0]);
+ LICINFO licinfo = new LICINFO();
+ if (classFactory.GetLicInfo(licinfo) != COM.S_OK) {
+ classFactory.Release();
+ return 0;
+ }
+ int[] pBstrKey = new int[1];
+ if (licinfo != null && licinfo.fRuntimeKeyAvail != 0) {
+ if (classFactory.RequestLicKey(0, pBstrKey) == COM.S_OK) {
+ classFactory.Release();
+ return pBstrKey[0];
+ }
+ }
+ classFactory.Release();
+ return 0;
+}
+protected int GetWindow(int phwnd) {
+
+ if (phwnd == 0)
+ return COM.E_INVALIDARG;
+ if (frame == null) {
+ COM.MoveMemory(phwnd, new int[] {0}, 4);
+ return COM.E_NOTIMPL;
+ }
+
+ // Copy the Window's handle into the memory passed in
+ COM.MoveMemory(phwnd, new int[] {handle}, 4);
+ return COM.S_OK;
+}
+private int Invoke(int dispIdMember, int riid, int lcid, int dwFlags, int pDispParams, int pVarResult, int pExcepInfo, int pArgErr) {
+ if (pVarResult == 0 || dwFlags != COM.DISPATCH_PROPERTYGET) {
+ if (pExcepInfo != 0) COM.MoveMemory(pExcepInfo, new int[] {0}, 4);
+ if (pArgErr != 0) COM.MoveMemory(pArgErr, new int[] {0}, 4);
+ return COM.DISP_E_MEMBERNOTFOUND;
+ }
+ switch (dispIdMember) {
+ case COM.DISPID_AMBIENT_USERMODE :
+ Variant usermode = new Variant(true);
+ if (pVarResult != 0) usermode.getData(pVarResult);
+ return COM.S_OK;
+
+ case COM.DISPID_AMBIENT_UIDEAD :
+ Variant uidead = new Variant(false);
+ if (pVarResult != 0) uidead.getData(pVarResult);
+ return COM.S_OK;
+
+ // indicate a false result
+ case COM.DISPID_AMBIENT_SUPPORTSMNEMONICS :
+ case COM.DISPID_AMBIENT_SHOWGRABHANDLES :
+ case COM.DISPID_AMBIENT_SHOWHATCHING :
+ if (pVarResult != 0) COM.MoveMemory(pVarResult, new int[] {0}, 4);
+ if (pExcepInfo != 0) COM.MoveMemory(pExcepInfo, new int[] {0}, 4);
+ if (pArgErr != 0) COM.MoveMemory(pArgErr, new int[] {0}, 4);
+ return COM.S_FALSE;
+
+ // not implemented
+ case COM.DISPID_AMBIENT_OFFLINEIFNOTCONNECTED :
+ case COM.DISPID_AMBIENT_BACKCOLOR :
+ case COM.DISPID_AMBIENT_FORECOLOR :
+ case COM.DISPID_AMBIENT_FONT :
+ case COM.DISPID_AMBIENT_LOCALEID :
+ case COM.DISPID_AMBIENT_SILENT :
+ case COM.DISPID_AMBIENT_MESSAGEREFLECT :
+ if (pVarResult != 0) COM.MoveMemory(pVarResult, new int[] {0}, 4);
+ if (pExcepInfo != 0) COM.MoveMemory(pExcepInfo, new int[] {0}, 4);
+ if (pArgErr != 0) COM.MoveMemory(pArgErr, new int[] {0}, 4);
+ return COM.E_NOTIMPL;
+
+ default :
+ if (pVarResult != 0) COM.MoveMemory(pVarResult, new int[] {0}, 4);
+ if (pExcepInfo != 0) COM.MoveMemory(pExcepInfo, new int[] {0}, 4);
+ if (pArgErr != 0) COM.MoveMemory(pArgErr, new int[] {0}, 4);
+ return COM.DISP_E_MEMBERNOTFOUND;
+ }
+}
+public boolean isFocusControl () {
+ return getDisplay().getFocusControl() == this;
+}
+private int OnControlInfoChanged() {
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIOleControl, ppvObject) == COM.S_OK) {
+ IOleControl objIOleControl = new IOleControl(ppvObject[0]);
+ // ask the control for its info in case users
+ // need to act on it
+ currentControlInfo = new CONTROLINFO();
+ objIOleControl.GetControlInfo(currentControlInfo);
+ objIOleControl.Release();
+ }
+ return COM.S_OK;
+}
+private int OnFocus(int fGotFocus) {
+ //if (frame == null) return COM.S_OK;
+
+ //if (fGotFocus != 0) {
+ // frame.setCurrentDocument(this);
+ //} else {
+ // frame.setCurrentDocument(null);
+ //}
+ return COM.S_OK;
+ //return COM.E_NOTIMPL;
+}
+protected int OnUIDeactivate(int fUndoable) {
+ // controls don't need to do anything for
+ // border space or menubars
+ return COM.S_OK;
+}
+protected int QueryInterface(int riid, int ppvObject) {
+ int result = super.QueryInterface(riid, ppvObject);
+ if (result == COM.S_OK)
+ return result;
+ if (riid == 0 || ppvObject == 0)
+ return COM.E_INVALIDARG;
+ GUID guid = new GUID();
+ COM.MoveMemory(guid, riid, GUID.sizeof);
+ if (COM.IsEqualGUID(guid, COM.IIDIOleControlSite)) {
+ COM.MoveMemory(ppvObject, new int[] {iOleControlSite.getAddress()}, 4);
+ AddRef();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID(guid, COM.IIDIDispatch)) {
+ COM.MoveMemory(ppvObject, new int[] {iDispatch.getAddress()}, 4);
+ AddRef();
+ return COM.S_OK;
+ }
+ COM.MoveMemory(ppvObject, new int[] {0}, 4);
+ return COM.E_NOINTERFACE;
+}
+protected void releaseObjectInterfaces() {
+
+ disconnectEventSink();
+
+ disconnectPropertyChangeSink();
+
+ super.releaseObjectInterfaces();
+}
+/**
+ * Removes the listener.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void removeEventListener(int eventID, OleListener listener) {
+ if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
+ oleEventSink.removeListener(eventID, listener);
+}
+/**
+ * Removes the listener.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void removePropertyListener(int propertyID, OleListener listener) {
+ if (listener == null) throw new SWTError (SWT.ERROR_NULL_ARGUMENT);
+ olePropertyChangeSink.removeListener(propertyID, listener);
+}
+public void setBackground (Color color) {
+
+ super.setBackground(color);
+
+ //set the background of the ActiveX Control
+ if (objIUnknown != null) {
+ OleAutomation oleObject= new OleAutomation(this);
+ oleObject.setProperty(COM.DISPID_BACKCOLOR, new Variant(color.handle));
+ oleObject.dispose();
+ }
+}
+public void setFont (Font font) {
+
+ super.setFont(font);
+
+ //set the font of the ActiveX Control
+ if (objIUnknown != null) {
+
+ OleAutomation oleObject= new OleAutomation(this);
+ Variant varDispFont = oleObject.getProperty(COM.DISPID_FONT);
+ oleObject.dispose();
+
+ if (varDispFont != null){
+ OleAutomation iDispFont = varDispFont.getAutomation();
+ FontData[] fdata = font.getFontData();
+ iDispFont.setProperty(COM.DISPID_FONT_NAME, new Variant(fdata[0].getName()));
+ iDispFont.setProperty(COM.DISPID_FONT_SIZE, new Variant(fdata[0].getHeight()));
+ iDispFont.setProperty(COM.DISPID_FONT_ITALIC, new Variant(fdata[0].getStyle() & SWT.ITALIC));
+ //iDispFont.setProperty(COM.DISPID_FONT_CHARSET, new Variant(fdata[0].getCharset));
+ iDispFont.setProperty(COM.DISPID_FONT_BOLD, new Variant((fdata[0].getStyle() & SWT.BOLD)));
+ iDispFont.dispose();
+ }
+ }
+
+ return;
+}
+public void setForeground (Color color) {
+
+ super.setForeground(color);
+
+ //set the foreground of the ActiveX Control
+ if (objIUnknown != null) {
+ OleAutomation oleObject= new OleAutomation(this);
+ oleObject.setProperty(COM.DISPID_FORECOLOR, new Variant(color.handle));
+ oleObject.dispose();
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEvent.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEvent.java
new file mode 100755
index 0000000000..b38fc1eda2
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEvent.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.ole.win32;
+
+import org.eclipse.swt.widgets.Widget;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class OleEvent {
+ public int type;
+ public Widget widget;
+ public int detail;
+ public boolean doit = true;
+ public Variant[] arguments;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java
new file mode 100755
index 0000000000..0668e40c92
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java
@@ -0,0 +1,269 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.ole.win32.*;
+import org.eclipse.swt.internal.win32.*;
+
+final class OleEventSink
+{
+ private OleControlSite controlSite;
+
+ private COMObject iUnknown;
+ private COMObject iDispatch;
+ private int refCount;
+
+ private int eventCookie;
+ private GUID eventSinkDispInterface;
+
+ private OleEventTable eventTable;
+
+OleEventSink(OleControlSite controlSite) {
+
+ this.controlSite = controlSite;
+
+ createCOMInterfaces();
+}
+void addListener(int eventID, OleListener listener) {
+ if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) eventTable = new OleEventTable ();
+ eventTable.hook(eventID, listener);
+}
+int AddRef() {
+ refCount++;
+ return refCount;
+}
+void connect(IUnknown objIUnknown) {
+
+ // What is the custom Event Sink interface?
+ eventSinkDispInterface = getEventSinkDispInterface(objIUnknown);
+
+ // It is possible that the Control does not have an Event sink.
+ // In this case, just carry on.
+ if (eventSinkDispInterface == null) return;
+
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIConnectionPointContainer, ppvObject) == COM.S_OK) {
+ IConnectionPointContainer cpc = new IConnectionPointContainer(ppvObject[0]);
+ int[] ppCP = new int[1];
+ if (cpc.FindConnectionPoint(eventSinkDispInterface, ppCP) == COM.S_OK) {
+ IConnectionPoint cp = new IConnectionPoint(ppCP[0]);
+ int[] pCookie = new int[1];
+ if (cp.Advise(iUnknown.getAddress(), pCookie) == COM.S_OK)
+ eventCookie = pCookie[0];
+ cp.Release();
+ }
+ cpc.Release();
+ }
+}
+private void createCOMInterfaces() {
+ // register each of the interfaces that this object implements
+ iUnknown = new COMObject(new int[]{2, 0, 0}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ };
+ iDispatch = new COMObject(new int[]{2, 0, 0, 1, 3, 4, 8}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ // method3 GetTypeInfoCount - not implemented
+ // method4 GetTypeInfo - not implemented
+ // method5 GetIDsOfNames - not implemented
+ public int method6(int[] args) {return Invoke(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);}
+ };
+}
+void disconnect(IUnknown objIUnknown) {
+
+ // disconnect event sink
+ if (eventCookie != 0 && objIUnknown != null) {
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIConnectionPointContainer, ppvObject) == COM.S_OK) {
+ IConnectionPointContainer cpc = new IConnectionPointContainer(ppvObject[0]);
+ if (cpc.FindConnectionPoint(eventSinkDispInterface, ppvObject) == COM.S_OK) {
+ IConnectionPoint cp = new IConnectionPoint(ppvObject[0]);
+ if (cp.Unadvise(eventCookie) == COM.S_OK) {
+ eventCookie = 0;
+ }
+ cp.Release();
+ }
+ cpc.Release();
+ }
+ }
+}
+private void disposeCOMInterfaces() {
+
+ if (iUnknown != null);
+ iUnknown.dispose();
+ iUnknown = null;
+
+ if (iDispatch != null)
+ iDispatch.dispose();
+ iDispatch = null;
+
+}
+private GUID getEventSinkDispInterface(IUnknown objIUnknown) {
+
+ // get Event Sink I/F from IProvideClassInfo2
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIProvideClassInfo2, ppvObject) == COM.S_OK) {
+ IProvideClassInfo2 pci2 = new IProvideClassInfo2(ppvObject[0]);
+ GUID eventsinkdisp = new GUID();
+ int result = pci2.GetGUID(COM.GUIDKIND_DEFAULT_SOURCE_DISP_IID, eventsinkdisp);
+ pci2.Release();
+ if (result == COM.S_OK) {
+ eventSinkDispInterface = eventsinkdisp;
+ return eventSinkDispInterface;
+ }
+
+ }
+
+ // get Event Sink I/F from IProvideClassInfo
+ if (objIUnknown.QueryInterface(COM.IIDIProvideClassInfo, ppvObject) == COM.S_OK) {
+ int[] ppTI = new int[1];
+ int[] ppEI = new int[1];
+ TYPEATTR typeAttribute = null;
+ IProvideClassInfo pci = new IProvideClassInfo(ppvObject[0]);
+ int result = pci.GetClassInfo(ppTI);
+ pci.Release();
+ if (result != COM.S_OK) return null;
+
+ if (ppTI != null && ppTI.length == 1) {
+ ITypeInfo classInfo = new ITypeInfo(ppTI[0]);
+ int[] ppTypeAttr = new int[1];
+ result = classInfo.GetTypeAttr(ppTypeAttr);
+ if (result != COM.S_OK) {
+ classInfo.Release();
+ return null;
+ }
+ typeAttribute = new TYPEATTR();
+ COM.MoveMemory(typeAttribute, ppTypeAttr[0], TYPEATTR.sizeof);
+ classInfo.ReleaseTypeAttr(ppTypeAttr[0]);
+ int implMask = COM.IMPLTYPEFLAG_FDEFAULT | COM.IMPLTYPEFLAG_FSOURCE | COM.IMPLTYPEFLAG_FRESTRICTED;
+ int implBits = COM.IMPLTYPEFLAG_FDEFAULT | COM.IMPLTYPEFLAG_FSOURCE;
+ for (int i = 0; i < typeAttribute.cImplTypes; i++) {
+ int[] pImplTypeFlags = new int[1];
+ if (classInfo.GetImplTypeFlags(i, pImplTypeFlags) == COM.S_OK) {
+ if ((pImplTypeFlags[0] & implMask) == implBits) {
+ int[] pRefType = new int[1];
+ if (classInfo.GetRefTypeOfImplType(i, pRefType) == COM.S_OK) {
+ classInfo.GetRefTypeInfo(pRefType[0], ppEI);
+ }
+ }
+ }
+ }
+ classInfo.Release();
+
+ //
+ if (ppEI != null && ppEI.length == 1) {
+ ppTypeAttr = new int[1];
+ ITypeInfo eventInfo = new ITypeInfo(ppEI[0]);
+ if (eventInfo.GetTypeAttr(ppTypeAttr) == COM.S_OK) {
+ typeAttribute = new TYPEATTR();
+ COM.MoveMemory(typeAttribute, ppTypeAttr[0], TYPEATTR.sizeof);
+ eventInfo.ReleaseTypeAttr(ppTypeAttr[0]);
+ if (ppTypeAttr != null && ppTypeAttr[0] != 0) {
+ eventSinkDispInterface = new GUID();
+ eventSinkDispInterface.data1 = typeAttribute.guid_data1;
+ eventSinkDispInterface.data2 = typeAttribute.guid_data2;
+ eventSinkDispInterface.data3 = typeAttribute.guid_data3;
+ eventSinkDispInterface.b0 = typeAttribute.guid_b0;
+ eventSinkDispInterface.b1 = typeAttribute.guid_b1;
+ eventSinkDispInterface.b2 = typeAttribute.guid_b2;
+ eventSinkDispInterface.b3 = typeAttribute.guid_b3;
+ eventSinkDispInterface.b4 = typeAttribute.guid_b4;
+ eventSinkDispInterface.b5 = typeAttribute.guid_b5;
+ eventSinkDispInterface.b6 = typeAttribute.guid_b6;
+ eventSinkDispInterface.b7 = typeAttribute.guid_b7;
+ }
+ }
+ eventInfo.Release();
+ }
+ }
+ }
+ return eventSinkDispInterface;
+}
+private int Invoke(int dispIdMember, int riid, int lcid, int dwFlags, int pDispParams, int pVarResult, int pExcepInfo, int pArgErr)
+{
+ if (eventTable == null || !eventTable.hooks(dispIdMember)) return COM.S_OK;
+
+ // Construct an array of the parameters that are passed in
+ // Note: parameters are passed in reverse order - here we will correct the order
+ Variant[] eventInfo = null;
+ if (pDispParams != 0) {
+ DISPPARAMS dispParams = new DISPPARAMS();
+ COM.MoveMemory(dispParams, pDispParams, DISPPARAMS.sizeof);
+ eventInfo = new Variant[dispParams.cArgs];
+ int size = Variant.sizeof;
+ int offset = (dispParams.cArgs - 1) * size;
+
+ for (int j = 0; j < dispParams.cArgs; j++){
+ eventInfo[j] = new Variant();
+ eventInfo[j].setData(dispParams.rgvarg + offset);
+ offset = offset - size;
+ }
+ }
+
+ OleEvent event = new OleEvent();
+ event.arguments = eventInfo;
+ notifyListener(dispIdMember,event);
+
+ return COM.S_OK;
+}
+/**
+* Notify listeners of an event.
+* <p>
+* This method notifies all listeners that an event
+* has occurred.
+*
+* @param eventType the desired SWT event
+* @param event the event data
+*
+* @exception SWTError <ul>
+* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+* <li>ERROR_NULL_ARGUMENT when handler is null</li>
+* </ul>
+*/
+private void notifyListener (int eventType, OleEvent event) {
+ if (event == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ event.type = eventType;
+ event.widget = controlSite;
+ eventTable.sendEvent (event);
+}
+private int QueryInterface(int riid, int ppvObject) {
+
+ if (riid == 0 || ppvObject == 0)
+ return COM.E_INVALIDARG;
+ GUID guid = new GUID();
+ COM.MoveMemory(guid, riid, GUID.sizeof);
+
+ if ( COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIDispatch) ||
+ COM.IsEqualGUID(guid, eventSinkDispInterface)) {
+ COM.MoveMemory(ppvObject, new int[] {iDispatch.getAddress()}, 4);
+ AddRef();
+ return OLE.S_OK;
+ }
+
+ COM.MoveMemory(ppvObject, new int[] {0}, 4);
+ return COM.E_NOINTERFACE;
+}
+int Release() {
+ refCount--;
+ if (refCount == 0) {
+ disposeCOMInterfaces();
+ }
+
+ return refCount;
+}
+void removeListener(int eventID, OleListener listener) {
+ if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (eventID, listener);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java
new file mode 100755
index 0000000000..6318e9d1b0
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java
@@ -0,0 +1,68 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+/* Imports */
+import java.util.EventListener;
+
+/**
+* The OleEventTable class implements a simple
+* look up mechanism that maps an event type
+* to a listener. Muliple listeners for the
+* same event type are supported.
+*
+*/
+
+/* Class Definition */
+class OleEventTable {
+ int [] types;
+ OleListener [] handlers;
+void hook (int eventType, OleListener handler) {
+ if (types == null) types = new int [4];
+ if (handlers == null) handlers = new OleListener [4];
+ for (int i=0; i<types.length; i++) {
+ if (types [i] == 0) {
+ types [i] = eventType;
+ handlers [i] = handler;
+ return;
+ }
+ }
+ int size = types.length;
+ int [] newTypes = new int [size + 4];
+ OleListener [] newHandlers = new OleListener [size + 4];
+ System.arraycopy (types, 0, newTypes, 0, size);
+ System.arraycopy (handlers, 0, newHandlers, 0, size);
+ types = newTypes; handlers = newHandlers;
+ types [size] = eventType; handlers [size] = handler;
+}
+boolean hooks (int eventType) {
+ if (handlers == null) return false;
+ for (int i=0; i<types.length; i++) {
+ if (types [i] == eventType) return true;
+ }
+ return false;
+}
+void sendEvent (OleEvent event) {
+ if (handlers == null) return;
+ for (int i=0; i<types.length; i++) {
+ if (types [i] == event.type) {
+ OleListener listener = handlers [i];
+ if (listener != null) listener.handleEvent (event);
+ }
+ }
+}
+void unhook (int eventType, OleListener handler) {
+ if (handlers == null) return;
+ for (int i=0; i<types.length; i++) {
+ if ((types [i] == eventType) && (handlers [i] == handler)) {
+ types [i] = 0;
+ handlers [i] = null;
+ return;
+ }
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFile.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFile.java
new file mode 100755
index 0000000000..8564bcea56
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFile.java
@@ -0,0 +1,128 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import java.io.*;
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.win32.*;
+import org.eclipse.swt.internal.ole.win32.*;
+
+final class OleFile {
+ IStorage rootStorage;
+ File file;
+ String streamName;
+
+ static int READ = 0;
+ static int WRITE = 1;
+OleFile(File file, String streamName, int mode) {
+ if (file == null || file.isDirectory())
+ OLE.error(OLE.ERROR_INVALID_ARGUMENT);
+
+ this.file = file;
+ this.streamName = streamName;
+
+ if (mode == READ)
+ openForRead();
+ if (mode == WRITE)
+ openForWrite();
+}
+void dispose() {
+
+ rootStorage.Release();
+ rootStorage = null;
+ file = null;
+ streamName = null;
+}
+IStorage getRootStorage() {
+ return rootStorage;
+}
+private void openForRead() {
+
+ if (!file.exists()) return;
+
+ char[] path = (file.getAbsolutePath()+"\0").toCharArray();
+ if (COM.StgIsStorageFile(path) == COM.S_OK) {
+ readStorageFile(path);
+ } else {
+ readTraditionalFile(path);
+ }
+
+}
+private void openForWrite() {
+ char[] filePath = (file.getAbsolutePath()+"\0").toCharArray();
+ int[] address = new int[1];
+ int mode = COM.STGM_TRANSACTED | COM.STGM_READWRITE | COM.STGM_SHARE_EXCLUSIVE | COM.STGM_CREATE;
+
+ int result = COM.StgCreateDocfile(filePath, mode, 0, address);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CREATE_FILE, result);
+
+ IStorage storage = new IStorage(address[0]);
+
+ rootStorage = storage;
+}
+private void readStorageFile(char[] path) {
+
+ int mode = COM.STGM_READ | COM.STGM_TRANSACTED | COM.STGM_SHARE_EXCLUSIVE;
+ int[] address = new int[1];
+
+ int result = COM.StgOpenStorage(path, 0, mode, 0, 0, address);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
+
+ rootStorage = new IStorage(address[0]);
+ rootStorage.AddRef();
+}
+private void readTraditionalFile(char[] path) {
+
+ if (streamName == null) OLE.error(OLE.ERROR_NULL_ARGUMENT);
+
+ int mode = COM.STGM_DIRECT | COM.STGM_SHARE_EXCLUSIVE | COM.STGM_READWRITE | COM.STGM_CREATE;
+
+ // Create a temporary storage object
+ int[] address = new int[1];
+ int result = COM.StgCreateDocfile(null, mode | COM.STGM_DELETEONRELEASE, 0, address);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
+ rootStorage = new IStorage(address[0]);
+ rootStorage.AddRef();
+
+ // Create a stream on the storage object with the name specified in streamName
+ address = new int[1];
+ result = rootStorage.CreateStream(streamName, mode, 0, 0, address);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
+
+ // Copy over data in file to named stream
+ IStream stream = new IStream(address[0]);
+ stream.AddRef();
+ try {
+
+ FileInputStream fileInput = new FileInputStream(file);
+
+ int increment = 1024*4;
+ byte[] buffer = new byte[increment];
+ int count = 0;
+
+ while((count = fileInput.read(buffer)) > 0){
+ int pv = COM.CoTaskMemAlloc(count);
+ OS.MoveMemory(pv, buffer, count);
+ result = stream.Write(pv, count, null) ;
+ COM.CoTaskMemFree(pv);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
+ }
+ stream.Commit(COM.STGC_DEFAULT);
+
+ fileInput.close();
+ } catch (IOException err) {
+ OLE.error(OLE.ERROR_CANNOT_OPEN_FILE);
+ }
+
+ stream.Release();
+
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
new file mode 100755
index 0000000000..d36adaa5e2
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
@@ -0,0 +1,626 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.ole.win32.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.win32.*;
+import java.util.Enumeration;
+import java.util.Vector;
+
+/**
+ *
+ * OleFrame is an OLE Container's top level frame.
+ *
+ * <p>This object implements the OLE Interfaces IUnknown and IOleInPlaceFrame
+ *
+ * <p>OleFrame allows the container to do the following: <ul>
+ * <li>position and size the ActiveX Control or OLE Document within the application
+ * <li>insert menu items from the application into the OLE Document's menu
+ * <li>activate and deactivate the OLE Document's menus
+ * <li>position the OLE Document's menu in the application
+ * <li>translate accelerator keystrokes intended for the container's frame</ul>
+ *
+ * <dl>
+ * <dt><b>Styles</b> <dd>BORDER
+ * <dt><b>Events</b> <dd>Dispose, Move, Resize
+ * </dl>
+ *
+ */
+final public class OleFrame extends Composite
+{
+ // Interfaces for this Ole Client Container
+ private COMObject iUnknown;
+ private COMObject iOleInPlaceFrame;
+
+ // Access to the embedded/linked Ole Object
+ private IOleInPlaceActiveObject objIOleInPlaceActiveObject;
+
+ private OleClientSite currentdoc;
+
+ private int refCount = 0;
+
+ private MenuItem[] fileMenuItems;
+ private MenuItem[] containerMenuItems;
+ private MenuItem[] windowMenuItems;
+ private Menu menubar;
+
+ private InternalListener listener;
+ private class InternalListener implements Listener {
+ public void handleEvent(Event e) {
+ switch (e.type) {
+ case SWT.Dispose :
+ onDispose(e);
+ break;
+ case SWT.Resize :
+ case SWT.Move :
+ onResize(e);
+ break;
+ default :
+ OLE.error(SWT.ERROR_NOT_IMPLEMENTED);
+ }
+ }
+ }
+
+ private static String CHECK_FOCUS = "OLE_CHECK_FOCUS";
+
+/**
+ * Create an OleFrame child widget using style bits
+ * to select a particular look or set of properties.
+ *
+ * @param parent a composite widget (cannot be null)
+ * @param style the bitwise OR'ing of widget styles
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
+ * <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
+ * <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
+ *
+ */
+public OleFrame(Composite parent, int style) {
+ // set up widget attributes
+ super(parent, style | SWT.CLIP_CHILDREN | SWT.CLIP_SIBLINGS);
+
+ createCOMInterfaces();
+
+ // setup cleanup proc
+ listener = new InternalListener();
+ addListener(SWT.Dispose, listener);
+
+ // inform inplaceactiveobject whenever frame resizes
+ addListener(SWT.Resize, listener);
+
+ // inform inplaceactiveobject whenever frame moves
+ addListener(SWT.Move, listener);
+
+ // By default, set the menubar to the current frame's menubar
+ menubar = getShell().getMenuBar();
+
+ // Maintain a reference to yourself so that when
+ // ClientSites close, they don't take the frame away
+ // with them.
+ this.AddRef();
+
+ // Check for focus change
+ checkFocus(getDisplay());
+}
+private static void checkFocus (final Display display) {
+ Object polling = display.getData(CHECK_FOCUS);
+ if (polling != null) return;
+ display.setData(CHECK_FOCUS, CHECK_FOCUS);
+ final int time = 50;
+ final Runnable[] timer = new Runnable[1];
+ final Control[] lastFocus = new Control[1];
+ timer[0] = new Runnable() {
+ public void run() {
+ Event event = new Event();
+ Control currentFocus = display.getFocusControl();
+ if (lastFocus[0] != currentFocus) {
+ if (lastFocus[0] instanceof OleFrame) {
+ if (!lastFocus [0].isDisposed()) {
+ OleFrame frame = (OleFrame) lastFocus[0];
+ OleClientSite client = frame.getCurrentDocument();
+ if (client != null) {
+ client.notifyListeners (SWT.FocusOut, event);
+ }
+ }
+ }
+ if (lastFocus [0] instanceof OleControlSite) {
+ if (!lastFocus[0].isDisposed()) {
+ lastFocus[0].notifyListeners (SWT.FocusOut, event);
+ }
+ }
+ if (currentFocus instanceof OleFrame) {
+ OleFrame frame = (OleFrame) currentFocus;
+ OleClientSite client = frame.getCurrentDocument();
+ if (client != null) {
+ client.notifyListeners (SWT.FocusIn, event);
+ }
+ }
+ if (currentFocus instanceof OleControlSite) {
+ currentFocus.notifyListeners(SWT.FocusIn, event);
+ }
+ }
+ lastFocus[0] = currentFocus;
+ display.timerExec(time, timer[0]);
+ }
+ };
+ display.timerExec(time, timer[0]);
+}
+/**
+ * Increment the count of references to this instance
+ *
+ * @return the current reference count
+ */
+int AddRef() {
+ refCount++;
+ return refCount;
+}
+private int ContextSensitiveHelp(int fEnterMode) {
+ return COM.S_OK;
+}
+private void createCOMInterfaces() {
+ // Create each of the interfaces that this object implements
+ iUnknown = new COMObject(new int[]{2, 0, 0}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ };
+
+ iOleInPlaceFrame = new COMObject(new int[]{2, 0, 0, 1, 1, 1, 1, 1, 2, 2, 3, 1, 1, 1, 2}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ public int method3(int[] args) {return GetWindow(args[0]);}
+ public int method4(int[] args) {return ContextSensitiveHelp(args[0]);}
+ public int method5(int[] args) {return GetBorder(args[0]);}
+ public int method6(int[] args) {return RequestBorderSpace(args[0]);}
+ public int method7(int[] args) {return SetBorderSpace(args[0]);}
+ public int method8(int[] args) {return SetActiveObject(args[0], args[1]);}
+ public int method9(int[] args) {return InsertMenus(args[0], args[1]);}
+ public int method10(int[] args) {return SetMenu(args[0], args[1], args[2]);}
+ public int method11(int[] args) {return RemoveMenus(args[0]);}
+ // method12 SetStatusText - not implemented
+ // method13 EnableModeless - not implemented
+ public int method14(int[] args) {return TranslateAccelerator(args[0], args[1]);}
+ };
+}
+private void disposeCOMInterfaces () {
+
+ if (iUnknown != null)
+ iUnknown.dispose();
+ iUnknown = null;
+
+ if (iOleInPlaceFrame != null)
+ iOleInPlaceFrame.dispose();
+ iOleInPlaceFrame = null;
+}
+private int GetBorder(int lprectBorder) {
+ /*
+ The IOleInPlaceUIWindow::GetBorder function, when called on a document or frame window
+ object, returns the outer rectangle (relative to the window) where the object can put
+ toolbars or similar controls.
+ */
+ if (lprectBorder == 0) return COM.E_INVALIDARG;
+ RECT rectBorder = new RECT();
+ // Coordinates must be relative to the window
+ OS.GetClientRect(handle, rectBorder);
+ OS.MoveMemory(lprectBorder, rectBorder, RECT.sizeof);
+ return COM.S_OK;
+}
+/**
+ *
+ * Returns the application menu items that will appear in the Container location when an OLE Document
+ * is in-place activated.
+ *
+ * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
+ * is given the opportunity to merge some of its menus into the menubar. The application
+ * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
+ * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
+ * menu locations. Note that an application can insert more than one menu into a single location.
+ *
+ * @return the application menu items that will appear in the Container location when an OLE Document
+ * is in-place activated.
+ *
+ */
+public MenuItem[] getContainerMenus(){
+ return containerMenuItems;
+}
+/**
+ *
+ * Returns the application menu items that will appear in the File location when an OLE Document
+ * is in-place activated.
+ *
+ * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
+ * is given the opportunity to merge some of its menus into the menubar. The application
+ * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
+ * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
+ * menu locations. Note that an application can insert more than one menu into a single location.
+ *
+ * @return the application menu items that will appear in the File location when an OLE Document
+ * is in-place activated.
+ *
+ */
+public MenuItem[] getFileMenus(){
+ return fileMenuItems;
+}
+int getIOleInPlaceFrame() {
+ return iOleInPlaceFrame.getAddress();
+}
+Menu getMenubar(){
+ return menubar;
+}
+private int getMenuItemID(int hMenu, int index) {
+ int id = 0;
+ MENUITEMINFO lpmii = new MENUITEMINFO();
+ lpmii.cbSize = MENUITEMINFO.sizeof;
+ lpmii.fMask = OS.MIIM_STATE | OS.MIIM_SUBMENU | OS.MIIM_ID;
+ OS.GetMenuItemInfo(hMenu, index, true, lpmii);
+ if ((lpmii.fState & OS.MF_POPUP) == OS.MF_POPUP) {
+ id = lpmii.hSubMenu;
+ } else {
+ id = lpmii.wID;
+ }
+ return id;
+}
+private int GetWindow(int phwnd) {
+ if (phwnd != 0) {
+ COM.MoveMemory(phwnd, new int[] {handle}, 4);
+ }
+ return COM.S_OK;
+}
+/**
+ *
+ * Returns the application menu items that will appear in the Window location when an OLE Document
+ * is in-place activated.
+ *
+ * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
+ * is given the opportunity to merge some of its menus into the menubar. The application
+ * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
+ * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
+ * menu locations. Note that an application can insert more than one menu into a single location.
+ *
+ * @return the application menu items that will appear in the Window location when an OLE Document
+ * is in-place activated.
+ *
+ */
+public MenuItem[] getWindowMenus(){
+ return windowMenuItems;
+}
+private int InsertMenus(int hmenuShared, int lpMenuWidths) {
+ // locate menu bar
+ if (menubar == null || menubar.isDisposed()) {
+ COM.MoveMemory(lpMenuWidths, new int[] {0}, 4);
+ return COM.S_OK;
+ }
+ int hMenu = menubar.handle;
+
+ // Create a holder for menu information. This will be passed down to
+ // the OS and the OS will fill in the requested information for each menu.
+ MENUITEMINFO lpmii = new MENUITEMINFO();
+ int hHeap = OS.GetProcessHeap();
+ int maxTextLength = 128;
+ int pszText = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, maxTextLength);
+ lpmii.cbSize = MENUITEMINFO.sizeof;
+ lpmii.fMask = OS.MIIM_STATE | OS.MIIM_ID | OS.MIIM_TYPE | OS.MIIM_SUBMENU;
+ lpmii.dwTypeData = pszText;
+ lpmii.cch = maxTextLength;
+
+ // Loop over all "File-like" menus in the menubar and get information about the
+ // item from the OS.
+ int fileMenuCount = 0;
+ int newindex = 0;
+ if (this.fileMenuItems != null) {
+ for (int i = 0; i < this.fileMenuItems.length; i++) {
+ MenuItem item = this.fileMenuItems[i];
+ if (item != null) {
+ int index = item.getParent().indexOf(item);
+ lpmii.cch = maxTextLength; // lpmii.cch gets updated by GetMenuItemInfo to indicate the
+ // exact nuber of characters in name. Reset it to our max size
+ // before each call.
+ if (OS.GetMenuItemInfo(hMenu, index, true, lpmii)) {
+ if (OS.InsertMenuItem(hmenuShared, newindex, true, lpmii)) {
+ // keep track of the number of items
+ fileMenuCount++;
+ newindex++;
+ }
+ }
+ }
+ }
+ }
+
+ // copy the menu item count information to the pointer
+ COM.MoveMemory(lpMenuWidths, new int[] {fileMenuCount}, 4);
+
+ // Loop over all "Container-like" menus in the menubar and get information about the
+ // item from the OS.
+ int containerMenuCount = 0;
+ if (this.containerMenuItems != null) {
+ for (int i = 0; i < this.containerMenuItems.length; i++) {
+ MenuItem item = this.containerMenuItems[i];
+ if (item != null) {
+ int index = item.getParent().indexOf(item);
+ lpmii.cch = maxTextLength; // lpmii.cch gets updated by GetMenuItemInfo to indicate the
+ // exact nuber of characters in name. Reset it to a large number
+ // before each call.
+ if (OS.GetMenuItemInfo(hMenu, index, true, lpmii)) {
+ if (OS.InsertMenuItem(hmenuShared, newindex, true, lpmii)) {
+ // keep track of the number of items
+ containerMenuCount++;
+ newindex++;
+ }
+ }
+ }
+ }
+ }
+
+ // copy the menu item count information to the pointer
+ COM.MoveMemory(lpMenuWidths + 8, new int[] {containerMenuCount}, 4);
+
+ // Loop over all "Window-like" menus in the menubar and get information about the
+ // item from the OS.
+ int windowMenuCount = 0;
+ if (this.windowMenuItems != null) {
+ for (int i = 0; i < this.windowMenuItems.length; i++) {
+ MenuItem item = this.windowMenuItems[i];
+ if (item != null) {
+ int index = item.getParent().indexOf(item);
+ lpmii.cch = maxTextLength; // lpmii.cch gets updated by GetMenuItemInfo to indicate the
+ // exact nuber of characters in name. Reset it to a large number
+ // before each call.
+ if (OS.GetMenuItemInfo(hMenu, index, true, lpmii)) {
+ if (OS.InsertMenuItem(hmenuShared, newindex, true, lpmii)) {
+ // keep track of the number of items
+ windowMenuCount++;
+ newindex++;
+ }
+ }
+ }
+ }
+ }
+
+ // copy the menu item count information to the pointer
+ COM.MoveMemory(lpMenuWidths + 16, new int[] {windowMenuCount}, 4);
+
+ // free resources used in querying the OS
+ if (pszText != 0)
+ OS.HeapFree(hHeap, 0, pszText);
+ return COM.S_OK;
+}
+private void onDispose(Event e) {
+
+ releaseObjectInterfaces();
+ currentdoc = null;
+
+ this.Release();
+}
+private void onResize(Event e) {
+ if (objIOleInPlaceActiveObject != null) {
+ RECT lpRect = new RECT();
+ OS.GetClientRect(handle, lpRect);
+ objIOleInPlaceActiveObject.ResizeBorder(lpRect, iOleInPlaceFrame.getAddress(), true);
+ }
+}
+private int QueryInterface(int riid, int ppvObject) {
+// implements IUnknown, IOleInPlaceFrame, IOleContainer, IOleInPlaceUIWindow
+ if (riid == 0 || ppvObject == 0)
+ return COM.E_INVALIDARG;
+ GUID guid = new GUID();
+ COM.MoveMemory(guid, riid, GUID.sizeof);
+ if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIOleInPlaceFrame) ) {
+ COM.MoveMemory(ppvObject, new int[] {iOleInPlaceFrame.getAddress()}, 4);
+ AddRef();
+ return COM.S_OK;
+ }
+
+ COM.MoveMemory(ppvObject, new int[] {0}, 4);
+ return COM.E_NOINTERFACE;
+}
+/**
+ * Decrement the count of references to this instance
+ *
+ * @return the current reference count
+ */
+int Release() {
+ refCount--;
+ if (refCount == 0){
+ disposeCOMInterfaces();
+ COM.CoFreeUnusedLibraries();
+ }
+ return refCount;
+}
+private void releaseObjectInterfaces() {
+ if (objIOleInPlaceActiveObject != null) {
+ objIOleInPlaceActiveObject.Release();
+ }
+ objIOleInPlaceActiveObject = null;
+}
+private int RemoveMenus(int hmenuShared) {
+
+ if (menubar == null || menubar.isDisposed()) return COM.S_FALSE;
+
+ int hMenu = menubar.handle;
+
+ Vector ids = new Vector();
+ if (this.fileMenuItems != null) {
+ for (int i = 0; i < this.fileMenuItems.length; i++) {
+ MenuItem item = this.fileMenuItems[i];
+ if (item != null && !item.isDisposed()) {
+ int index = item.getParent().indexOf(item);
+ // get Id from original menubar
+ int id = getMenuItemID(hMenu, index);
+ ids.addElement(new Integer(id));
+ }
+ }
+ }
+ if (this.containerMenuItems != null) {
+ for (int i = 0; i < this.containerMenuItems.length; i++) {
+ MenuItem item = this.containerMenuItems[i];
+ if (item != null && !item.isDisposed()) {
+ int index = item.getParent().indexOf(item);
+ int id = getMenuItemID(hMenu, index);
+ ids.addElement(new Integer(id));
+ }
+ }
+ }
+ if (this.windowMenuItems != null) {
+ for (int i = 0; i < this.windowMenuItems.length; i++) {
+ MenuItem item = this.windowMenuItems[i];
+ if (item != null && !item.isDisposed()) {
+ int index = item.getParent().indexOf(item);
+ int id = getMenuItemID(hMenu, index);
+ ids.addElement(new Integer(id));
+ }
+ }
+ }
+ int index = OS.GetMenuItemCount(hmenuShared) - 1;
+ for (int i = index; i >= 0; i--) {
+ int id = getMenuItemID(hmenuShared, i);
+ if (ids.contains(new Integer(id))){
+ OS.RemoveMenu(hmenuShared, i, OS.MF_BYPOSITION);
+ }
+ }
+ return COM.S_OK;
+}
+private int RequestBorderSpace(int pborderwidths) {
+ return COM.S_OK;
+}
+int SetActiveObject(int pActiveObject, int pszObjName) {
+ if (objIOleInPlaceActiveObject != null) {
+ objIOleInPlaceActiveObject.Release();
+ objIOleInPlaceActiveObject = null;
+ }
+ if (pActiveObject != 0) {
+ objIOleInPlaceActiveObject = new IOleInPlaceActiveObject(pActiveObject);
+ objIOleInPlaceActiveObject.AddRef();
+ }
+
+ return COM.S_OK;
+}
+private int SetBorderSpace(int pborderwidths) {
+ // A Control/Document can :
+ // Use its own toolbars, requesting border space of a specific size, or,
+ // Use no toolbars, but force the container to remove its toolbars by passing a
+ // valid BORDERWIDTHS structure containing nothing but zeros in the pborderwidths parameter, or,
+ // Use no toolbars but allow the in-place container to leave its toolbars up by
+ // passing NULL as the pborderwidths parameter.
+
+ RECT borderwidth = new RECT();
+ if (pborderwidths == 0 || currentdoc == null ) return COM.S_OK;
+
+ COM.MoveMemory(borderwidth, pborderwidths, RECT.sizeof);
+ currentdoc.setBorderSpace(borderwidth);
+
+ return COM.S_OK;
+}
+/**
+ *
+ * Specify the menu items that should appear in the Container location when an OLE Document
+ * is in-place activated.
+ *
+ * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
+ * is given the opportunity to merge some of its menus into the menubar. The application
+ * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
+ * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
+ * menu locations. Note that an application can insert more than one menu into a single location.
+ *
+ * <p>This method must be called before in place activation of the OLE Document. After the Document
+ * is activated, the menu bar will not be modified until a subsequent activation.
+ *
+ * @param containerMenus an array of top level MenuItems to be inserted into the Container location of
+ * the menubar
+ */
+public void setContainerMenus(MenuItem[] containerMenus){
+ containerMenuItems = containerMenus;
+}
+OleClientSite getCurrentDocument() {
+ return currentdoc;
+}
+void setCurrentDocument(OleClientSite doc) {
+ currentdoc = doc;
+
+ if (currentdoc != null && objIOleInPlaceActiveObject != null) {
+ RECT lpRect = new RECT();
+ OS.GetClientRect(handle, lpRect);
+ objIOleInPlaceActiveObject.ResizeBorder(lpRect, iOleInPlaceFrame.getAddress(), true);
+ }
+}
+/**
+ *
+ * Specify the menu items that should appear in the File location when an OLE Document
+ * is in-place activated.
+ *
+ * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
+ * is given the opportunity to merge some of its menus into the menubar. The application
+ * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
+ * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
+ * menu locations. Note that an application can insert more than one menu into a single location.
+ *
+ * <p>This method must be called before in place activation of the OLE Document. After the Document
+ * is activated, the menu bar will not be modified until a subsequent activation.
+ *
+ * @param fileMenus an array of top level MenuItems to be inserted into the Flie location of
+ * the menubar
+ */
+public void setFileMenus(MenuItem[] fileMenus){
+ fileMenuItems = fileMenus;
+}
+public boolean forceFocus () {
+ if (currentdoc == null) return super.forceFocus();
+ return currentdoc.forceFocus();
+}
+private int SetMenu(int hmenuShared, int holemenu, int hwndActiveObject) {
+
+ int inPlaceActiveObject = 0;
+ if (objIOleInPlaceActiveObject != null)
+ inPlaceActiveObject = objIOleInPlaceActiveObject.getAddress();
+
+ if (menubar == null || menubar.isDisposed()){
+ return COM.OleSetMenuDescriptor(0, getShell().handle, hwndActiveObject, iOleInPlaceFrame.getAddress(), inPlaceActiveObject);
+ }
+
+ int handle = menubar.getShell().handle;
+
+ if (hmenuShared == 0 && holemenu == 0) {
+ // re-instate the original menu - this occurs on deactivation
+ hmenuShared = menubar.handle;
+ }
+ if (hmenuShared == 0) return COM.E_FAIL;
+
+ OS.SetMenu(handle, hmenuShared);
+ OS.DrawMenuBar(handle);
+
+ return COM.OleSetMenuDescriptor(holemenu, handle, hwndActiveObject, iOleInPlaceFrame.getAddress(), inPlaceActiveObject);
+}
+private void setMenubar(Menu bar){
+ menubar = bar;
+}
+/**
+ *
+ * Set the menu items that should appear in the Window location when an OLE Document
+ * is in-place activated.
+ *
+ * <p>When an OLE Document is in-place active, the Document provides its own menus but the application
+ * is given the opportunity to merge some of its menus into the menubar. The application
+ * is allowed to insert its menus in three locations: File (far left), Container(middle) and Window
+ * (far right just before Help). The OLE Document retains control of the Edit, Object and Help
+ * menu locations. Note that an application can insert more than one menu into a single location.
+ *
+ * <p>This method must be called before in place activation of the OLE Document. After the Document
+ * is activated, the menu bar will not be modified until a subsequent activation.
+ *
+ * @param windowMenus an array of top level MenuItems to be inserted into the Window location of
+ * the menubar
+ */
+public void setWindowMenus(MenuItem[] windowMenus){
+ windowMenuItems = windowMenus;
+}
+private int TranslateAccelerator(int lpmsg, int wID){
+ return COM.E_NOTIMPL;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFunctionDescription.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFunctionDescription.java
new file mode 100755
index 0000000000..6ea8d8b923
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFunctionDescription.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.ole.win32;
+
+import org.eclipse.swt.internal.ole.win32.COM;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class OleFunctionDescription {
+
+ public int id;
+ public String name;
+ public OleParameterDescription[] args;
+ public int optionalArgCount;
+ public short returnType;
+ public int invokeKind;
+ public int funcKind;
+ public short flags;
+ public int callingConvention;
+ public String documentation;
+ public String helpFile;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleListener.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleListener.java
new file mode 100755
index 0000000000..111bed3bc5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleListener.java
@@ -0,0 +1,17 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+/**
+ */
+public interface OleListener
+{
+/**
+ *
+ */
+public void handleEvent(OleEvent event);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleParameterDescription.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleParameterDescription.java
new file mode 100755
index 0000000000..797c891085
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleParameterDescription.java
@@ -0,0 +1,12 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class OleParameterDescription {
+ public String name;
+ public short flags;
+ public short type;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java
new file mode 100755
index 0000000000..4a4a84b75a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java
@@ -0,0 +1,179 @@
+package org.eclipse.swt.ole.win32;
+
+import org.eclipse.swt.internal.ole.win32.*;
+import org.eclipse.swt.*;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+final class OlePropertyChangeSink {
+
+ private OleControlSite controlSite;
+ //private IUnknown objIUnknown;
+
+ private COMObject iUnknown;
+ private COMObject iPropertyNotifySink;
+
+ private int refCount;
+
+ private int propertyCookie;
+
+ private OleEventTable eventTable;
+
+OlePropertyChangeSink(OleControlSite controlSite) {
+
+ this.controlSite = controlSite;
+
+ createCOMInterfaces();
+}
+void addListener(int propertyID, OleListener listener) {
+ if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) eventTable = new OleEventTable ();
+ eventTable.hook(propertyID, listener);
+}
+int AddRef() {
+ refCount++;
+ return refCount;
+}
+void connect(IUnknown objIUnknown) {
+
+ // Set up property change notification sink
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIConnectionPointContainer, ppvObject) == COM.S_OK) {
+ IConnectionPointContainer cpc = new IConnectionPointContainer(ppvObject[0]);
+ if (cpc.FindConnectionPoint(COM.IIDIPropertyNotifySink, ppvObject) == COM.S_OK) {
+ IConnectionPoint cp = new IConnectionPoint(ppvObject[0]);
+ int[] cookie = new int[1];
+ if (cp.Advise(iPropertyNotifySink.getAddress(), cookie) == COM.S_OK) {
+ propertyCookie = cookie[0];
+ }
+ cp.Release();
+ }
+ cpc.Release();
+ }
+}
+private void createCOMInterfaces() {
+ // register each of the interfaces that this object implements
+ iUnknown = new COMObject(new int[]{2, 0, 0}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ };
+
+ iPropertyNotifySink = new COMObject(new int[]{2, 0, 0, 1, 1}){
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ public int method3(int[] args) {return OnChanged(args[0]);}
+ public int method4(int[] args) {return OnRequestEdit(args[0]);}
+ };
+}
+void disconnect(IUnknown objIUnknown) {
+
+ // disconnect property notification sink
+ if (propertyCookie != 0 && objIUnknown != null) {
+ int[] ppvObject = new int[1];
+ if (objIUnknown.QueryInterface(COM.IIDIConnectionPointContainer, ppvObject) == COM.S_OK) {
+ IConnectionPointContainer cpc = new IConnectionPointContainer(ppvObject[0]);
+ if (cpc.FindConnectionPoint(COM.IIDIPropertyNotifySink, ppvObject) == COM.S_OK) {
+ IConnectionPoint cp = new IConnectionPoint(ppvObject[0]);
+ if (cp.Unadvise(propertyCookie) == COM.S_OK) {
+ propertyCookie = 0;
+ }
+ cp.Release();
+ }
+ cpc.Release();
+ }
+ }
+}
+private void disposeCOMInterfaces() {
+
+ if (iUnknown != null);
+ iUnknown.dispose();
+ iUnknown = null;
+
+ if (iPropertyNotifySink != null)
+ iPropertyNotifySink.dispose();
+ iPropertyNotifySink = null;
+
+}
+/**
+* Notify listeners of an event.
+* <p>
+* This method notifies all listeners that an event
+* has occurred.
+*
+* @param eventType the desired SWT event
+* @param event the event data
+*
+* @exception SWTError <ul>
+* <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+* <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+* <li>ERROR_NULL_ARGUMENT when handler is null</li>
+* </ul>
+*/
+private void notifyListener (int eventType, OleEvent event) {
+ if (event == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ event.type = eventType;
+ event.widget = controlSite;
+ eventTable.sendEvent (event);
+}
+private int OnChanged(int dispID) {
+
+ if (eventTable == null || !eventTable.hooks(dispID)) return COM.S_OK;
+
+ OleEvent event = new OleEvent();
+ event.detail = OLE.PROPERTY_CHANGED;
+ notifyListener(dispID,event);
+
+ return COM.S_OK;
+}
+private int OnRequestEdit(int dispID) {
+
+ if (eventTable == null || !eventTable.hooks(dispID)) return COM.S_OK;
+
+ OleEvent event = new OleEvent();
+ event.doit = true;
+ event.detail = OLE.PROPERTY_CHANGING;
+
+ notifyListener(dispID,event);
+
+ if (event.doit) return COM.S_OK;
+
+ return COM.S_FALSE;
+}
+private int QueryInterface(int riid, int ppvObject) {
+ if (riid == 0 || ppvObject == 0)
+ return COM.E_INVALIDARG;
+ GUID guid = new GUID();
+ COM.MoveMemory(guid, riid, GUID.sizeof);
+ if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
+ COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
+ AddRef();
+ return COM.S_OK;
+ }
+ if (COM.IsEqualGUID(guid, COM.IIDIPropertyNotifySink)) {
+ COM.MoveMemory(ppvObject, new int[] {iPropertyNotifySink.getAddress()}, 4);
+ AddRef();
+ return COM.S_OK;
+ }
+ COM.MoveMemory(ppvObject, new int[] {0}, 4);
+ return COM.E_NOINTERFACE;
+}
+int Release() {
+ refCount--;
+ if (refCount == 0) {
+ disposeCOMInterfaces();
+ }
+
+ return refCount;
+}
+void removeListener(int propertyID, OleListener listener) {
+ if (listener == null) OLE.error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (propertyID, listener);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyDescription.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyDescription.java
new file mode 100755
index 0000000000..e07b151c78
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyDescription.java
@@ -0,0 +1,16 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class OlePropertyDescription {
+ public int id;
+ public String name;
+ public int type;
+ public int flags;
+ public int kind;
+ public String description;
+ public String helpFile;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/Variant.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/Variant.java
new file mode 100755
index 0000000000..e9a39b00c5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/Variant.java
@@ -0,0 +1,524 @@
+package org.eclipse.swt.ole.win32;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.ole.win32.*;
+import org.eclipse.swt.internal.win32.*;
+/**
+ *
+ * A Variant is a generic OLE mechanism for passing data of different types via a common interface.
+ *
+ * <p>It is used within the OleAutomation object for getting a property, setting a property or invoking
+ * a method on an OLE Control or OLE Document.
+ *
+ */
+public final class Variant
+{
+ // A variant always takes up 16 bytes, no matter what you
+ // store in it. Objects, strings, and arrays are not physically
+ // stored in the Variant; in these cases, four bytes of the
+ // Variant are used to hold either an object reference, or a
+ // pointer to the string or array. The actual data are stored elsewhere.
+ public static final int sizeof = 16;
+
+ private short type; // OLE.VT_* type
+
+ private boolean booleanData;
+ private float floatData;
+ private int intData;
+ private short shortData;
+ private String stringData;
+ private int byRefPtr;
+ private OleAutomation dispatchData;
+ private IUnknown unknownData;
+Variant(){
+ type = COM.VT_EMPTY;
+}
+/**
+ * Create a Variant object which represents a Java float as a VT_R4.
+ *
+ * @param val the Java float value that this Variant represents
+ *
+ */
+public Variant(float val) {
+ type = COM.VT_R4;
+ floatData = val;
+
+}
+/**
+ * Create a Variant object which represents a Java int as a VT_I4.
+ *
+ * @param val the Java int value that this Variant represents
+ *
+ */
+ public Variant(int val) {
+
+ type = COM.VT_I4;
+ intData = val;
+}
+/**
+ * Create a Variant object which contains a reference to the data being transferred.
+ *
+ * <p>When creating a VT_BYREF Variant, you must give the full Variant type including VT_BYREF
+ * (such as <code>short byRefType = OLE.VT_BSTR | OLE.VT_BYREF</code>).
+ *
+ * @param ptr a pointer to the data being transferred.
+ * @param byRefType the type of the data being transferred such as OLE.VT_BSTR | OLE.VT_BYREF
+ *
+ */
+public Variant(int ptr, short byRefType) {
+ type = byRefType;
+ byRefPtr = ptr;
+}
+/**
+ * Create a Variant object which represents an IDispatch interface as a VT_Dispatch.
+ *
+ * @param automation the OleAutomation object that this Variant represents
+ *
+ */
+public Variant(OleAutomation automation) {
+ type = COM.VT_DISPATCH;
+ dispatchData = automation;
+}
+/**
+ * Create a Variant object which represents an IUnknown interface as a VT_UNKNOWN.
+ *
+ * <p>The caller is expected to have appropriately invoked unknown.AddRef() before creating
+ * this Variant.
+ *
+ * @param unknown the IUnknown object that this Variant represents
+ *
+ */
+public Variant(IUnknown unknown) {
+ type = COM.VT_UNKNOWN;
+ unknownData = unknown;
+}
+/**
+ * Create a Variant object which represents a Java String as a VT_BSTR.
+ *
+ * @param string the Java String value that this Variant represents
+ *
+ */
+public Variant(String string) {
+ type = COM.VT_BSTR;
+ stringData = string;
+}
+/**
+ * Create a Variant object which represents a Java short as a VT_I2.
+ *
+ * @param val the Java short value that this Variant represents
+ *
+ */
+public Variant(short val) {
+ type = COM.VT_I2;
+ shortData = val;
+}
+/**
+ * Create a Variant object which represents a Java boolean as a VT_BOOL.
+ *
+ * @param val the Java boolean value that this Variant represents
+ *
+ */
+public Variant(boolean val) {
+
+ type = COM.VT_BOOL;
+ booleanData = val;
+}
+/**
+ * Returns the OleAutomation object represented by this Variant.
+ *
+ * <p>If this Variant does not contain an OleAutomation object, an attempt is made to
+ * coerce the Variant type into an OleAutomation object. If this fails, an error is
+ * thrown.
+ *
+ * @return the OleAutomation object represented by this Variant
+ *
+ * @exception SWTError
+ * ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into an OleAutomation object
+ */
+public OleAutomation getAutomation() {
+ if (type == COM.VT_DISPATCH)
+ return dispatchData;
+
+ // try to coerce the value to the desired type
+ int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ try {
+ getData(oldPtr);
+ int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_DISPATCH);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
+ Variant autoVar = new Variant();
+ autoVar.setData(newPtr);
+ return autoVar.getAutomation();
+ } finally {
+ COM.VariantClear(oldPtr);
+ OS.GlobalFree(oldPtr);
+ COM.VariantClear(newPtr); // Note: This must absolutely be done AFTER the
+ // OleAutomation object is created as Variant Clear
+ // will result in a Release being performed on the
+ // Dispatch object
+ OS.GlobalFree(newPtr);
+ }
+}
+/**
+ * Returns the Java boolean represented by this Variant.
+ *
+ * <p>If this Variant does not contain a Java boolean, an attempt is made to
+ * coerce the Variant type into a Java boolean. If this fails, an error is thrown.
+ *
+ * @return the Java boolean represented by this Variant
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a boolean</ul>
+ *
+ */
+public boolean getBoolean() {
+ if (type == COM.VT_BOOL)
+ return booleanData;
+
+ // try to coerce the value to the desired type
+ int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ try {
+ getData(oldPtr);
+ int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_BOOL);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
+ Variant boolVar = new Variant();
+ boolVar.setData(newPtr);
+ return boolVar.getBoolean();
+ } finally {
+ COM.VariantClear(oldPtr);
+ OS.GlobalFree(oldPtr);
+ COM.VariantClear(newPtr);
+ OS.GlobalFree(newPtr);
+ }
+}
+/**
+ * Returns a pointer to the referenced data represented by this Variant.
+ *
+ * <p>If this Variant does not contain a reference to data, zero is returned.
+ *
+ * @return a pointer to the referenced data represented by this Variant or 0
+ *
+ */
+public int getByRef() {
+ if ((type & COM.VT_BYREF)== COM.VT_BYREF)
+ return byRefPtr;
+
+ return 0;
+}
+void getData(int pData){
+ if (pData == 0) OLE.error(OLE.ERROR_OUT_OF_MEMORY);
+
+ COM.VariantInit(pData);
+
+ if ((type & COM.VT_BYREF) == COM.VT_BYREF) {
+ COM.MoveMemory(pData, new short[] {type}, 2);
+ COM.MoveMemory(pData + 8, new int[]{byRefPtr}, 4);
+ return;
+ }
+
+ switch (type) {
+ case COM.VT_EMPTY :
+ break;
+ case COM.VT_BOOL :
+ COM.MoveMemory(pData, new short[] {type}, 2);
+ COM.MoveMemory(pData + 8, new short[]{(short)((booleanData) ? 1 : 0)}, 2);
+ break;
+ case COM.VT_R4 :
+ COM.MoveMemory(pData, new short[] {type}, 2);
+ COM.MoveMemory(pData + 8, new float[]{floatData}, 4);
+ break;
+ case COM.VT_I4 :
+ COM.MoveMemory(pData, new short[] {type}, 2);
+ COM.MoveMemory(pData + 8, new int[]{intData}, 4);
+ break;
+ case COM.VT_DISPATCH :
+ IDispatch dispatch = new IDispatch(dispatchData.getAddress());
+ dispatch.AddRef();
+ COM.MoveMemory(pData, new short[] {type}, 2);
+ COM.MoveMemory(pData + 8, new int[]{dispatch.getAddress()}, 4);
+ break;
+ case COM.VT_UNKNOWN :
+ unknownData.AddRef();
+ COM.MoveMemory(pData, new short[] {type}, 2);
+ COM.MoveMemory(pData + 8, new int[]{unknownData.getAddress()}, 4);
+ break;
+ case COM.VT_I2 :
+ COM.MoveMemory(pData, new short[] {type}, 2);
+ COM.MoveMemory(pData + 8, new short[]{shortData}, 2);
+ break;
+ case COM.VT_BSTR :
+ COM.MoveMemory(pData, new short[] {type}, 2);
+ char[] data = (stringData+"\0").toCharArray();
+ int ptr = COM.SysAllocString(data);
+ COM.MoveMemory(pData + 8, new int[] {ptr}, 4);
+ break;
+
+ default :
+ OLE.error(SWT.ERROR_NOT_IMPLEMENTED);
+ }
+}
+/**
+ * Returns the Java float represented by this Variant.
+ *
+ * <p>If this Variant does not contain a Java float, an attempt is made to
+ * coerce the Variant type into a Java float. If this fails, an error is thrown.
+ *
+ * @return the Java float represented by this Variant
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a float</ul>
+ */
+public float getFloat() {
+ if (type == COM.VT_R4)
+ return floatData;
+
+ // try to coerce the value to the desired type
+ int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ try {
+ getData(oldPtr);
+ int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_R4);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
+ Variant floatVar = new Variant();
+ floatVar.setData(newPtr);
+ return floatVar.getFloat();
+ } finally {
+ COM.VariantClear(oldPtr);
+ OS.GlobalFree(oldPtr);
+ COM.VariantClear(newPtr);
+ OS.GlobalFree(newPtr);
+ }
+
+}
+/**
+ * Returns the Java int represented by this Variant.
+ *
+ * <p>If this Variant does not contain a Java int, an attempt is made to
+ * coerce the Variant type into a Java int. If this fails, an error is thrown.
+ *
+ * @return the Java int represented by this Variant
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a int</ul>
+ */
+public int getInt() {
+ if (type == COM.VT_I4)
+ return intData;
+
+ // try to coerce the value to the desired type
+ int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ try {
+ getData(oldPtr);
+ int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_I4);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
+ Variant intVar = new Variant();
+ intVar.setData(newPtr);
+ return intVar.getInt();
+ } finally {
+ COM.VariantClear(oldPtr);
+ OS.GlobalFree(oldPtr);
+ COM.VariantClear(newPtr);
+ OS.GlobalFree(newPtr);
+ }
+}
+/**
+ * Returns the Java short represented by this Variant.
+ *
+ * <p>If this Variant does not contain a Java short, an attempt is made to
+ * coerce the Variant type into a Java short. If this fails, an error is thrown.
+ *
+ * @return the Java short represented by this Variant
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a short</ul>
+ */
+public short getShort() {
+ if (type == COM.VT_I2)
+ return shortData;
+
+ // try to coerce the value to the desired type
+ int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ try {
+ getData(oldPtr);
+ int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_I2);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
+ Variant shortVar = new Variant();
+ shortVar.setData(newPtr);
+ return shortVar.getShort();
+ } finally {
+ COM.VariantClear(oldPtr);
+ OS.GlobalFree(oldPtr);
+ COM.VariantClear(newPtr);
+ OS.GlobalFree(newPtr);
+ }
+
+}
+/**
+ * Returns the Java String represented by this Variant.
+ *
+ * <p>If this Variant does not contain a Java String, an attempt is made to
+ * coerce the Variant type into a Java String. If this fails, an error is thrown.
+ *
+ * @return the Java String represented by this Variant
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a String</ul>
+ */
+public String getString() {
+ if (type == COM.VT_BSTR)
+ return stringData;
+
+ // try to coerce the value to the desired type
+ int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ try {
+ getData(oldPtr);
+ int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_BSTR);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
+
+ Variant stringVar = new Variant();
+ stringVar.setData(newPtr);
+ return stringVar.getString();
+
+ } finally {
+ COM.VariantClear(oldPtr);
+ OS.GlobalFree(oldPtr);
+ COM.VariantClear(newPtr);
+ OS.GlobalFree(newPtr);
+ }
+}
+short getType() {
+ return type;
+}
+/**
+ * Returns the IUnknown object represented by this Variant.
+ *
+ * <p>If this Variant does not contain an IUnknown object, an attempt is made to
+ * coerce the Variant type into an IUnknown object. If this fails, an error is
+ * thrown.
+ *
+ * @return the IUnknown object represented by this Variant
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into
+ * an IUnknown object</ul>
+ */
+public IUnknown getUnknown() {
+ if (type == COM.VT_UNKNOWN)
+ return unknownData;
+
+ // try to coerce the value to the desired type
+ int oldPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ int newPtr = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, sizeof);
+ try {
+ getData(oldPtr);
+ int result = COM.VariantChangeType(newPtr, oldPtr, (short) 0, COM.VT_UNKNOWN);
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, result);
+ Variant unknownVar = new Variant();
+ unknownVar.setData(newPtr);
+ return unknownVar.getUnknown();
+ } finally {
+ COM.VariantClear(oldPtr);
+ OS.GlobalFree(oldPtr);
+ COM.VariantClear(newPtr); // Note: This must absolutely be done AFTER the
+ // IUnknown object is created as Variant Clear
+ // will result in a Release being performed on the
+ // Dispatch object
+ OS.GlobalFree(newPtr);
+ }
+}
+void setData(int pData){
+ if (pData == 0) OLE.error(OLE.ERROR_INVALID_ARGUMENT);
+
+ short[] dataType = new short[1];
+ COM.MoveMemory(dataType, pData, 2);
+ type = dataType[0];
+
+ if ((type & COM.VT_BYREF) == COM.VT_BYREF) {
+ int[] newByRefPtr = new int[1];
+ OS.MoveMemory(newByRefPtr, pData + 8, 4);
+ byRefPtr = newByRefPtr[0];
+ return;
+ }
+
+ switch (type) {
+ case COM.VT_EMPTY :
+ break;
+ case COM.VT_BOOL :
+ short[] newBooleanData = new short[1];
+ COM.MoveMemory(newBooleanData, pData + 8, 2);
+ booleanData = (newBooleanData[0] != 0);
+ break;
+ case COM.VT_R4 :
+ float[] newFloatData = new float[1];
+ COM.MoveMemory(newFloatData, pData + 8, 4);
+ floatData = newFloatData[0];
+ break;
+ case COM.VT_I4 :
+ int[] newIntData = new int[1];
+ OS.MoveMemory(newIntData, pData + 8, 4);
+ intData = newIntData[0];
+ break;
+ case COM.VT_DISPATCH :
+ int[] newDispatchData = new int[1];
+ OS.MoveMemory(newDispatchData, pData + 8, 4);
+ dispatchData = new OleAutomation(newDispatchData[0]);
+ break;
+ case COM.VT_UNKNOWN :
+ int[] newUnknownData = new int[1];
+ OS.MoveMemory(newUnknownData, pData + 8, 4);
+ unknownData = new IUnknown(newUnknownData[0]);
+ unknownData.AddRef();
+ break;
+ case COM.VT_I2 :
+ short[] newShortData = new short[1];
+ COM.MoveMemory(newShortData, pData + 8, 2);
+ shortData = newShortData[0];
+ break;
+ case COM.VT_BSTR :
+ // get the address of the memory in which the string resides
+ int[] hMem = new int[1];
+ OS.MoveMemory(hMem, pData + 8, 4);
+
+ // Get the size of the string from the OS - the size is expressed in number
+ // of bytes - each unicode character is 2 bytes.
+ int size = COM.SysStringByteLen(hMem[0]);
+ if (size > 0){
+ // get the unicode character array from the global memory and create a String
+ char[] buffer = new char[(size + 1) /2]; // add one to avoid rounding errors
+ COM.MoveMemory(buffer, hMem[0], size);
+ stringData = new String(buffer);
+ }
+ break;
+
+ default :
+ // try coercing it into one of the known forms
+ int newPData = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
+ if (COM.VariantChangeType(newPData, pData, (short) 0, COM.VT_R4) == COM.S_OK) {
+ setData(newPData);
+ } else if (COM.VariantChangeType(newPData, pData, (short) 0, COM.VT_I4) == COM.S_OK) {
+ setData(newPData);
+ } else if (COM.VariantChangeType(newPData, pData, (short) 0, COM.VT_BSTR) == COM.S_OK) {
+ setData(newPData);
+ }
+ COM.VariantClear(newPData);
+ OS.GlobalFree(newPData);
+ break;
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/package.html b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/package.html
new file mode 100755
index 0000000000..2f36647b51
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/package.html
@@ -0,0 +1,13 @@
+ <html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="IBM">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Brief overview will be provided here.
+<h2>
+Package Specification</h2>
+Detailed overview will be provided here.
+</body>
+</html>