Release 1.3.7.
[wine/gsoc-2012-control.git] / dlls / shdocvw / shdocvw.h
blob61dc63fb0e0775dbf8205243f73fb0477c450bcd
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"
40 #include "htiframe.h"
42 #include "wine/unicode.h"
43 #include "resource.h"
46 #define WM_UPDATEADDRBAR (WM_APP+1)
48 /**********************************************************************
49 * Shell Instance Objects
51 extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid,
52 REFIID riid, LPVOID *ppvClassObj);
54 /**********************************************************************
55 * WebBrowser declaration for SHDOCVW.DLL
58 typedef struct ConnectionPoint ConnectionPoint;
59 typedef struct DocHost DocHost;
61 typedef struct {
62 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
64 ConnectionPoint *wbe2;
65 ConnectionPoint *wbe;
66 ConnectionPoint *pns;
68 IUnknown *impl;
69 } ConnectionPointContainer;
71 typedef struct {
72 const IHlinkFrameVtbl *lpIHlinkFrameVtbl;
73 const ITargetFrame2Vtbl *lpITargetFrame2Vtbl;
75 IUnknown *outer;
76 DocHost *doc_host;
77 } HlinkFrame;
79 struct _task_header_t;
81 typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
83 typedef struct _task_header_t {
84 task_proc_t proc;
85 } task_header_t;
87 typedef struct _IDocHostContainerVtbl
89 void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
90 HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
91 void (WINAPI* SetURL)(DocHost*,LPCWSTR);
92 HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*);
93 } IDocHostContainerVtbl;
95 struct DocHost {
96 const IOleClientSiteVtbl *lpOleClientSiteVtbl;
97 const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
98 const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
99 const IOleDocumentSiteVtbl *lpOleDocumentSiteVtbl;
100 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
101 const IDispatchVtbl *lpDispatchVtbl;
102 const IPropertyNotifySinkVtbl *lpIPropertyNotifySinkVtbl;
103 const IServiceProviderVtbl *lpServiceProviderVtbl;
105 /* Interfaces of InPlaceFrame object */
106 const IOleInPlaceFrameVtbl *lpOleInPlaceFrameVtbl;
108 IDispatch *disp;
110 IDispatch *client_disp;
111 IDocHostUIHandler *hostui;
112 IOleInPlaceFrame *frame;
114 IUnknown *document;
115 IOleDocumentView *view;
116 IUnknown *doc_navigate;
118 const IDocHostContainerVtbl *container_vtbl;
120 HWND hwnd;
121 HWND frame_hwnd;
123 LPOLESTR url;
125 VARIANT_BOOL silent;
126 VARIANT_BOOL offline;
127 VARIANT_BOOL busy;
129 READYSTATE ready_state;
130 READYSTATE doc_state;
131 DWORD prop_notif_cookie;
132 BOOL is_prop_notif;
134 ConnectionPointContainer cps;
137 struct WebBrowser {
138 /* Interfaces available via WebBrowser object */
140 const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
141 const IOleObjectVtbl *lpOleObjectVtbl;
142 const IOleInPlaceObjectVtbl *lpOleInPlaceObjectVtbl;
143 const IOleControlVtbl *lpOleControlVtbl;
144 const IPersistStorageVtbl *lpPersistStorageVtbl;
145 const IPersistMemoryVtbl *lpPersistMemoryVtbl;
146 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
147 const IProvideClassInfo2Vtbl *lpProvideClassInfoVtbl;
148 const IViewObject2Vtbl *lpViewObjectVtbl;
149 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
150 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
151 const IServiceProviderVtbl *lpServiceProviderVtbl;
152 const IDataObjectVtbl *lpDataObjectVtbl;
153 HlinkFrame hlink_frame;
155 LONG ref;
157 INT version;
159 IOleClientSite *client;
160 IOleContainer *container;
161 IOleInPlaceSite *inplace;
163 /* window context */
165 HWND frame_hwnd;
166 IOleInPlaceUIWindow *uiwindow;
167 RECT pos_rect;
168 RECT clip_rect;
169 OLEINPLACEFRAMEINFO frameinfo;
170 SIZEL extent;
172 HWND shell_embedding_hwnd;
174 VARIANT_BOOL register_browser;
175 VARIANT_BOOL visible;
176 VARIANT_BOOL menu_bar;
177 VARIANT_BOOL address_bar;
178 VARIANT_BOOL status_bar;
179 VARIANT_BOOL tool_bar;
180 VARIANT_BOOL full_screen;
181 VARIANT_BOOL theater_mode;
183 DocHost doc_host;
186 struct InternetExplorer {
187 const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
188 HlinkFrame hlink_frame;
190 LONG ref;
192 HWND frame_hwnd;
193 HWND status_hwnd;
194 HMENU menu;
196 DocHost doc_host;
199 #define WEBBROWSER(x) ((IWebBrowser*) &(x)->lpWebBrowser2Vtbl)
200 #define WEBBROWSER2(x) ((IWebBrowser2*) &(x)->lpWebBrowser2Vtbl)
201 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
202 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectVtbl)
203 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
204 #define PERSTORAGE(x) ((IPersistStorage*) &(x)->lpPersistStorageVtbl)
205 #define PERMEMORY(x) ((IPersistMemory*) &(x)->lpPersistMemoryVtbl)
206 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
207 #define CLASSINFO(x) ((IProvideClassInfo2*) &(x)->lpProvideClassInfoVtbl)
208 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
209 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectVtbl);
210 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectVtbl);
211 #define ACTIVEOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
212 #define OLECMD(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
213 #define DATAOBJECT(x) ((IDataObject*) &(x)->lpDataObjectVtbl)
215 #define CLIENTSITE(x) ((IOleClientSite*) &(x)->lpOleClientSiteVtbl)
216 #define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpOleInPlaceSiteVtbl)
217 #define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpDocHostUIHandlerVtbl)
218 #define DOCHOSTUI2(x) ((IDocHostUIHandler2*) &(x)->lpDocHostUIHandlerVtbl)
219 #define DOCSITE(x) ((IOleDocumentSite*) &(x)->lpOleDocumentSiteVtbl)
220 #define CLDISP(x) ((IDispatch*) &(x)->lpDispatchVtbl)
221 #define PROPNOTIF(x) ((IPropertyNotifySink*) &(x)->lpIPropertyNotifySinkVtbl)
222 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
224 #define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl)
226 #define HLINKFRAME(x) ((IHlinkFrame*) &(x)->lpIHlinkFrameVtbl)
227 #define TARGETFRAME2(x) ((ITargetFrame2*) &(x)->lpITargetFrame2Vtbl)
229 void WebBrowser_OleObject_Init(WebBrowser*);
230 void WebBrowser_ViewObject_Init(WebBrowser*);
231 void WebBrowser_DataObject_Init(WebBrowser*);
232 void WebBrowser_Persist_Init(WebBrowser*);
233 void WebBrowser_ClassInfo_Init(WebBrowser*);
235 void WebBrowser_OleObject_Destroy(WebBrowser*);
237 void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*);
238 void DocHost_ClientSite_Init(DocHost*);
239 void DocHost_Frame_Init(DocHost*);
240 void release_dochost_client(DocHost*);
242 void DocHost_Release(DocHost*);
243 void DocHost_ClientSite_Release(DocHost*);
245 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
246 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
248 void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*);
249 BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**);
251 HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**);
252 HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
254 void create_doc_view_hwnd(DocHost*);
255 void deactivate_document(DocHost*);
256 HRESULT dochost_object_available(DocHost*,IUnknown*);
257 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
258 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
259 HRESULT go_home(DocHost*);
260 void set_doc_state(DocHost*,READYSTATE);
262 #define WM_DOCHOSTTASK (WM_USER+0x300)
263 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
264 LRESULT process_dochost_task(DocHost*,LPARAM);
266 HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
267 void InternetExplorer_WebBrowser_Init(InternetExplorer*);
269 HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
271 HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**);
273 HRESULT TaskbarList_Create(IUnknown*,REFIID,void**);
275 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
276 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
278 /**********************************************************************
279 * Dll lifetime tracking declaration for shdocvw.dll
281 extern LONG SHDOCVW_refCount;
282 static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_refCount ); }
283 static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
285 extern HINSTANCE shdocvw_hinstance;
286 extern void register_iewindow_class(void);
287 extern void unregister_iewindow_class(void);
288 extern HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR);
290 HRESULT register_class_object(BOOL);
291 HRESULT get_typeinfo(ITypeInfo**);
292 DWORD register_iexplore(BOOL);
294 const char *debugstr_variant(const VARIANT*);
296 /* memory allocation functions */
298 static inline void *heap_alloc(size_t len)
300 return HeapAlloc(GetProcessHeap(), 0, len);
303 static inline void *heap_alloc_zero(size_t len)
305 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
308 static inline void *heap_realloc(void *mem, size_t len)
310 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
313 static inline BOOL heap_free(void *mem)
315 return HeapFree(GetProcessHeap(), 0, mem);
318 static inline LPWSTR heap_strdupW(LPCWSTR str)
320 LPWSTR ret = NULL;
322 if(str) {
323 DWORD size;
325 size = (strlenW(str)+1)*sizeof(WCHAR);
326 ret = heap_alloc(size);
327 memcpy(ret, str, size);
330 return ret;
333 static inline LPWSTR co_strdupW(LPCWSTR str)
335 WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
336 if (ret)
337 lstrcpyW(ret, str);
338 return ret;
341 static inline LPWSTR co_strdupAtoW(LPCSTR str)
343 INT len;
344 WCHAR *ret;
345 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
346 ret = CoTaskMemAlloc(len*sizeof(WCHAR));
347 if (ret)
348 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
349 return ret;
352 static inline LPSTR co_strdupWtoA(LPCWSTR str)
354 INT len;
355 CHAR *ret;
356 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
357 ret = CoTaskMemAlloc(len);
358 if (ret)
359 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
360 return ret;
363 #endif /* __WINE_SHDOCVW_H */