shdocvw: Store object passed in DOCHOST_DOCCANNAVIGATE command.
[wine.git] / dlls / shdocvw / shdocvw.h
blob164122260128c80665b98def7f2bbeb896078fa7
1 /*
2 * Header includes for shdocvw.dll
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2005-2006 Jacek Caban for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_SHDOCVW_H
23 #define __WINE_SHDOCVW_H
25 #define COBJMACROS
27 #include <stdarg.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winuser.h"
34 #include "ole2.h"
35 #include "olectl.h"
36 #include "shlobj.h"
37 #include "exdisp.h"
38 #include "mshtmhst.h"
39 #include "hlink.h"
41 #include "wine/unicode.h"
43 /**********************************************************************
44 * Shell Instance Objects
46 extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid,
47 REFIID riid, LPVOID *ppvClassObj);
49 /**********************************************************************
50 * WebBrowser declaration for SHDOCVW.DLL
53 typedef struct ConnectionPoint ConnectionPoint;
54 typedef struct DocHost DocHost;
56 typedef struct {
57 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
59 ConnectionPoint *wbe2;
60 ConnectionPoint *wbe;
61 ConnectionPoint *pns;
63 IUnknown *impl;
64 } ConnectionPointContainer;
66 struct _task_header_t;
68 typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
70 typedef struct _task_header_t {
71 task_proc_t proc;
72 } task_header_t;
74 struct DocHost {
75 const IOleClientSiteVtbl *lpOleClientSiteVtbl;
76 const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
77 const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
78 const IOleDocumentSiteVtbl *lpOleDocumentSiteVtbl;
79 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
80 const IDispatchVtbl *lpDispatchVtbl;
81 const IPropertyNotifySinkVtbl *lpIPropertyNotifySinkVtbl;
82 const IServiceProviderVtbl *lpServiceProviderVtbl;
84 /* Interfaces of InPlaceFrame object */
85 const IOleInPlaceFrameVtbl *lpOleInPlaceFrameVtbl;
87 IDispatch *disp;
89 IDispatch *client_disp;
90 IDocHostUIHandler *hostui;
91 IOleInPlaceFrame *frame;
93 IUnknown *document;
94 IOleDocumentView *view;
95 IUnknown *doc_navigate;
97 HWND hwnd;
98 HWND frame_hwnd;
100 LPOLESTR url;
102 VARIANT_BOOL silent;
103 VARIANT_BOOL offline;
104 VARIANT_BOOL busy;
106 READYSTATE ready_state;
107 DWORD prop_notif_cookie;
108 BOOL is_prop_notif;
110 ConnectionPointContainer cps;
113 struct WebBrowser {
114 /* Interfaces available via WebBrowser object */
116 const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
117 const IOleObjectVtbl *lpOleObjectVtbl;
118 const IOleInPlaceObjectVtbl *lpOleInPlaceObjectVtbl;
119 const IOleControlVtbl *lpOleControlVtbl;
120 const IPersistStorageVtbl *lpPersistStorageVtbl;
121 const IPersistMemoryVtbl *lpPersistMemoryVtbl;
122 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
123 const IProvideClassInfo2Vtbl *lpProvideClassInfoVtbl;
124 const IViewObject2Vtbl *lpViewObjectVtbl;
125 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
126 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
127 const IHlinkFrameVtbl *lpHlinkFrameVtbl;
128 const IServiceProviderVtbl *lpServiceProviderVtbl;
130 LONG ref;
132 INT version;
134 IOleClientSite *client;
135 IOleContainer *container;
136 IOleInPlaceSite *inplace;
138 /* window context */
140 HWND frame_hwnd;
141 IOleInPlaceUIWindow *uiwindow;
142 RECT pos_rect;
143 RECT clip_rect;
144 OLEINPLACEFRAMEINFO frameinfo;
145 SIZEL extent;
147 HWND shell_embedding_hwnd;
149 VARIANT_BOOL register_browser;
150 VARIANT_BOOL visible;
151 VARIANT_BOOL menu_bar;
152 VARIANT_BOOL address_bar;
153 VARIANT_BOOL status_bar;
154 VARIANT_BOOL tool_bar;
155 VARIANT_BOOL full_screen;
156 VARIANT_BOOL theater_mode;
158 DocHost doc_host;
161 struct InternetExplorer {
162 const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
164 LONG ref;
166 HWND frame_hwnd;
168 DocHost doc_host;
171 #define WEBBROWSER(x) ((IWebBrowser*) &(x)->lpWebBrowser2Vtbl)
172 #define WEBBROWSER2(x) ((IWebBrowser2*) &(x)->lpWebBrowser2Vtbl)
173 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
174 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectVtbl)
175 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
176 #define PERSTORAGE(x) ((IPersistStorage*) &(x)->lpPersistStorageVtbl)
177 #define PERMEMORY(x) ((IPersistMemory*) &(x)->lpPersistMemoryVtbl)
178 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
179 #define CLASSINFO(x) ((IProvideClassInfo2*) &(x)->lpProvideClassInfoVtbl)
180 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
181 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectVtbl);
182 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectVtbl);
183 #define ACTIVEOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
184 #define OLECMD(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
185 #define HLINKFRAME(x) ((IHlinkFrame*) &(x)->lpHlinkFrameVtbl)
187 #define CLIENTSITE(x) ((IOleClientSite*) &(x)->lpOleClientSiteVtbl)
188 #define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpOleInPlaceSiteVtbl)
189 #define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpDocHostUIHandlerVtbl)
190 #define DOCHOSTUI2(x) ((IDocHostUIHandler2*) &(x)->lpDocHostUIHandlerVtbl)
191 #define DOCSITE(x) ((IOleDocumentSite*) &(x)->lpOleDocumentSiteVtbl)
192 #define CLDISP(x) ((IDispatch*) &(x)->lpDispatchVtbl)
193 #define PROPNOTIF(x) ((IPropertyNotifySink*) &(x)->lpIPropertyNotifySinkVtbl)
194 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
196 #define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl)
198 void WebBrowser_OleObject_Init(WebBrowser*);
199 void WebBrowser_ViewObject_Init(WebBrowser*);
200 void WebBrowser_Persist_Init(WebBrowser*);
201 void WebBrowser_ClassInfo_Init(WebBrowser*);
202 void WebBrowser_HlinkFrame_Init(WebBrowser*);
204 void WebBrowser_OleObject_Destroy(WebBrowser*);
206 void DocHost_Init(DocHost*,IDispatch*);
207 void DocHost_ClientSite_Init(DocHost*);
208 void DocHost_Frame_Init(DocHost*);
209 void release_dochost_client(DocHost*);
211 void DocHost_Release(DocHost*);
212 void DocHost_ClientSite_Release(DocHost*);
214 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
215 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
217 HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**);
218 HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
220 void create_doc_view_hwnd(DocHost*);
221 void deactivate_document(DocHost*);
222 HRESULT dochost_object_available(DocHost*,IUnknown*);
223 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
224 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
225 HRESULT go_home(DocHost*);
227 #define WM_DOCHOSTTASK (WM_USER+0x300)
228 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
229 LRESULT process_dochost_task(DocHost*,LPARAM);
231 HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
232 void InternetExplorer_WebBrowser_Init(InternetExplorer*);
234 HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
236 HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**);
238 HRESULT TaskbarList_Create(IUnknown*,REFIID,void**);
240 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
242 /**********************************************************************
243 * Dll lifetime tracking declaration for shdocvw.dll
245 extern LONG SHDOCVW_refCount;
246 static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_refCount ); }
247 static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
249 extern HINSTANCE shdocvw_hinstance;
250 extern void register_iewindow_class(void);
251 extern void unregister_iewindow_class(void);
253 HRESULT register_class_object(BOOL);
254 HRESULT get_typeinfo(ITypeInfo**);
255 DWORD register_iexplore(BOOL);
257 const char *debugstr_variant(const VARIANT*);
259 /* memory allocation functions */
261 static inline void *heap_alloc(size_t len)
263 return HeapAlloc(GetProcessHeap(), 0, len);
266 static inline void *heap_alloc_zero(size_t len)
268 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
271 static inline void *heap_realloc(void *mem, size_t len)
273 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
276 static inline BOOL heap_free(void *mem)
278 return HeapFree(GetProcessHeap(), 0, mem);
281 static inline LPWSTR heap_strdupW(LPCWSTR str)
283 LPWSTR ret = NULL;
285 if(str) {
286 DWORD size;
288 size = (strlenW(str)+1)*sizeof(WCHAR);
289 ret = heap_alloc(size);
290 memcpy(ret, str, size);
293 return ret;
296 static inline LPWSTR co_strdupW(LPCWSTR str)
298 WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
299 if (ret)
300 lstrcpyW(ret, str);
301 return ret;
304 static inline LPWSTR co_strdupAtoW(LPCSTR str)
306 INT len;
307 WCHAR *ret;
308 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
309 ret = CoTaskMemAlloc(len*sizeof(WCHAR));
310 if (ret)
311 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
312 return ret;
315 static inline LPSTR co_strdupWtoA(LPCWSTR str)
317 INT len;
318 CHAR *ret;
319 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
320 ret = CoTaskMemAlloc(len);
321 if (ret)
322 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
323 return ret;
326 #endif /* __WINE_SHDOCVW_H */