include: Add event trace flags and guid to evntrace.h.
[wine.git] / dlls / ieframe / ieframe.h
blobf8c204c9529d521978d1286797149a68fb25bb46
1 /*
2 * Header includes for ieframe.dll
4 * Copyright 2011 Jacek Caban for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
30 #include "ole2.h"
31 #include "olectl.h"
32 #include "shlobj.h"
33 #include "mshtmhst.h"
34 #include "exdisp.h"
35 #include "hlink.h"
36 #include "htiface.h"
37 #include "shdeprecated.h"
38 #include "docobjectservice.h"
40 #include "wine/unicode.h"
41 #include "wine/list.h"
43 typedef struct ConnectionPoint ConnectionPoint;
44 typedef struct DocHost DocHost;
46 typedef struct {
47 IConnectionPointContainer IConnectionPointContainer_iface;
49 ConnectionPoint *wbe2;
50 ConnectionPoint *wbe;
51 ConnectionPoint *pns;
53 IUnknown *impl;
54 } ConnectionPointContainer;
56 typedef struct {
57 IHlinkFrame IHlinkFrame_iface;
58 ITargetFrame2 ITargetFrame2_iface;
59 ITargetFramePriv2 ITargetFramePriv2_iface;
60 IWebBrowserPriv2IE9 IWebBrowserPriv2IE9_iface;
62 IUnknown *outer;
63 DocHost *doc_host;
64 } HlinkFrame;
66 struct _task_header_t;
68 typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
69 typedef void (*task_destr_t)(struct _task_header_t*);
71 typedef struct _task_header_t {
72 struct list entry;
73 task_proc_t proc;
74 task_destr_t destr;
75 } task_header_t;
77 typedef struct {
78 IShellBrowser IShellBrowser_iface;
79 IBrowserService IBrowserService_iface;
80 IDocObjectService IDocObjectService_iface;
82 LONG ref;
84 DocHost *doc_host;
85 } ShellBrowser;
87 typedef struct {
88 IHTMLWindow2 IHTMLWindow2_iface;
89 DocHost *doc_host;
90 } IEHTMLWindow;
92 typedef struct {
93 INewWindowManager INewWindowManager_iface;
94 DocHost *doc_host;
95 } NewWindowManager;
97 typedef struct {
98 WCHAR *url;
99 IStream *stream;
100 } travellog_entry_t;
102 typedef struct _IDocHostContainerVtbl
104 ULONG (*addref)(DocHost*);
105 ULONG (*release)(DocHost*);
106 void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
107 HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
108 void (WINAPI* SetURL)(DocHost*,LPCWSTR);
109 HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*);
110 } IDocHostContainerVtbl;
112 struct DocHost {
113 IOleClientSite IOleClientSite_iface;
114 IOleInPlaceSiteEx IOleInPlaceSiteEx_iface;
115 IDocHostUIHandler2 IDocHostUIHandler2_iface;
116 IOleDocumentSite IOleDocumentSite_iface;
117 IOleControlSite IOleControlSite_iface;
118 IOleCommandTarget IOleCommandTarget_iface;
119 IDispatch IDispatch_iface;
120 IPropertyNotifySink IPropertyNotifySink_iface;
121 IServiceProvider IServiceProvider_iface;
123 /* Interfaces of InPlaceFrame object */
124 IOleInPlaceFrame IOleInPlaceFrame_iface;
126 IWebBrowser2 *wb;
128 IDispatch *client_disp;
129 IDocHostUIHandler *hostui;
130 IOleInPlaceFrame *frame;
132 IUnknown *document;
133 IOleDocumentView *view;
134 IUnknown *doc_navigate;
136 const IDocHostContainerVtbl *container_vtbl;
138 HWND hwnd;
139 HWND frame_hwnd;
141 struct list task_queue;
143 LPOLESTR url;
145 VARIANT_BOOL silent;
146 VARIANT_BOOL offline;
147 VARIANT_BOOL busy;
149 READYSTATE ready_state;
150 READYSTATE doc_state;
151 DWORD prop_notif_cookie;
152 BOOL is_prop_notif;
154 ShellBrowser *browser_service;
155 IShellUIHelper2 *shell_ui_helper;
157 struct {
158 travellog_entry_t *log;
159 unsigned size;
160 unsigned length;
161 unsigned position;
162 int loading_pos;
163 } travellog;
165 ConnectionPointContainer cps;
166 IEHTMLWindow html_window;
167 NewWindowManager nwm;
170 struct WebBrowser {
171 IWebBrowser2 IWebBrowser2_iface;
172 IOleObject IOleObject_iface;
173 IOleInPlaceObject IOleInPlaceObject_iface;
174 IOleControl IOleControl_iface;
175 IPersistStorage IPersistStorage_iface;
176 IPersistMemory IPersistMemory_iface;
177 IPersistStreamInit IPersistStreamInit_iface;
178 IProvideClassInfo2 IProvideClassInfo2_iface;
179 IViewObject2 IViewObject2_iface;
180 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
181 IOleCommandTarget IOleCommandTarget_iface;
182 IServiceProvider IServiceProvider_iface;
183 IDataObject IDataObject_iface;
184 HlinkFrame hlink_frame;
186 LONG ref;
188 INT version;
190 IOleClientSite *client;
191 IOleContainer *container;
192 IOleInPlaceSiteEx *inplace;
194 /* window context */
196 HWND frame_hwnd;
197 IOleInPlaceUIWindow *uiwindow;
198 RECT pos_rect;
199 RECT clip_rect;
200 OLEINPLACEFRAMEINFO frameinfo;
201 SIZEL extent;
203 HWND shell_embedding_hwnd;
205 VARIANT_BOOL register_browser;
206 VARIANT_BOOL visible;
207 VARIANT_BOOL menu_bar;
208 VARIANT_BOOL address_bar;
209 VARIANT_BOOL status_bar;
210 VARIANT_BOOL tool_bar;
211 VARIANT_BOOL full_screen;
212 VARIANT_BOOL theater_mode;
214 DocHost doc_host;
217 struct InternetExplorer {
218 DocHost doc_host;
219 IWebBrowser2 IWebBrowser2_iface;
220 IExternalConnection IExternalConnection_iface;
221 IServiceProvider IServiceProvider_iface;
222 HlinkFrame hlink_frame;
224 LONG ref;
225 LONG extern_ref;
227 HWND frame_hwnd;
228 HWND status_hwnd;
229 HMENU menu;
230 BOOL nohome;
232 struct list entry;
235 void WebBrowser_OleObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
236 void WebBrowser_ViewObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
237 void WebBrowser_Persist_Init(WebBrowser*) DECLSPEC_HIDDEN;
238 void WebBrowser_ClassInfo_Init(WebBrowser*) DECLSPEC_HIDDEN;
240 void WebBrowser_OleObject_Destroy(WebBrowser*) DECLSPEC_HIDDEN;
242 void DocHost_Init(DocHost*,IWebBrowser2*,const IDocHostContainerVtbl*) DECLSPEC_HIDDEN;
243 void DocHost_Release(DocHost*) DECLSPEC_HIDDEN;
244 void DocHost_ClientSite_Init(DocHost*) DECLSPEC_HIDDEN;
245 void DocHost_ClientSite_Release(DocHost*) DECLSPEC_HIDDEN;
246 void DocHost_Frame_Init(DocHost*) DECLSPEC_HIDDEN;
247 void release_dochost_client(DocHost*) DECLSPEC_HIDDEN;
249 void IEHTMLWindow_Init(DocHost*) DECLSPEC_HIDDEN;
250 void NewWindowManager_Init(DocHost*) DECLSPEC_HIDDEN;
252 void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*) DECLSPEC_HIDDEN;
253 BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**) DECLSPEC_HIDDEN;
255 HRESULT create_browser_service(DocHost*,ShellBrowser**) DECLSPEC_HIDDEN;
256 void detach_browser_service(ShellBrowser*) DECLSPEC_HIDDEN;
257 HRESULT create_shell_ui_helper(IShellUIHelper2**) DECLSPEC_HIDDEN;
259 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*) DECLSPEC_HIDDEN;
260 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
262 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*) DECLSPEC_HIDDEN;
263 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
264 HRESULT go_home(DocHost*) DECLSPEC_HIDDEN;
265 HRESULT go_back(DocHost*) DECLSPEC_HIDDEN;
266 HRESULT go_forward(DocHost*) DECLSPEC_HIDDEN;
267 HRESULT refresh_document(DocHost*,const VARIANT*) DECLSPEC_HIDDEN;
268 HRESULT get_location_url(DocHost*,BSTR*) DECLSPEC_HIDDEN;
269 HRESULT set_dochost_url(DocHost*,const WCHAR*) DECLSPEC_HIDDEN;
270 void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*) DECLSPEC_HIDDEN;
271 HRESULT dochost_object_available(DocHost*,IUnknown*) DECLSPEC_HIDDEN;
272 void set_doc_state(DocHost*,READYSTATE) DECLSPEC_HIDDEN;
273 void deactivate_document(DocHost*) DECLSPEC_HIDDEN;
274 void create_doc_view_hwnd(DocHost*) DECLSPEC_HIDDEN;
275 void on_commandstate_change(DocHost*,LONG,VARIANT_BOOL) DECLSPEC_HIDDEN;
277 #define WM_DOCHOSTTASK (WM_USER+0x300)
278 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,task_destr_t,BOOL) DECLSPEC_HIDDEN;
279 void abort_dochost_tasks(DocHost*,task_proc_t) DECLSPEC_HIDDEN;
280 LRESULT process_dochost_tasks(DocHost*) DECLSPEC_HIDDEN;
282 void InternetExplorer_WebBrowser_Init(InternetExplorer*) DECLSPEC_HIDDEN;
283 HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR) DECLSPEC_HIDDEN;
284 void released_obj(void) DECLSPEC_HIDDEN;
285 DWORD release_extern_ref(InternetExplorer*,BOOL) DECLSPEC_HIDDEN;
287 void register_iewindow_class(void) DECLSPEC_HIDDEN;
288 void unregister_iewindow_class(void) DECLSPEC_HIDDEN;
290 #define TID_LIST \
291 XCLSID(WebBrowser) \
292 XCLSID(WebBrowser_V1) \
293 XIID(IWebBrowser2)
295 typedef enum {
296 #define XIID(iface) iface ## _tid,
297 #define XCLSID(class) class ## _tid,
298 TID_LIST
299 #undef XIID
300 #undef XCLSID
301 LAST_tid
302 } tid_t;
304 HRESULT get_typeinfo(tid_t,ITypeInfo**) DECLSPEC_HIDDEN;
305 HRESULT register_class_object(BOOL) DECLSPEC_HIDDEN;
307 HRESULT WINAPI CUrlHistory_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
308 HRESULT WINAPI InternetExplorer_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
309 HRESULT WINAPI InternetShortcut_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
310 HRESULT WINAPI WebBrowser_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
311 HRESULT WINAPI WebBrowserV1_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
313 extern LONG module_ref DECLSPEC_HIDDEN;
314 extern HINSTANCE ieframe_instance DECLSPEC_HIDDEN;
316 static inline void lock_module(void) {
317 InterlockedIncrement(&module_ref);
320 static inline void unlock_module(void) {
321 InterlockedDecrement(&module_ref);
324 static inline void *heap_alloc(size_t len)
326 return HeapAlloc(GetProcessHeap(), 0, len);
329 static inline void *heap_alloc_zero(size_t len)
331 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
334 static inline void *heap_realloc(void *mem, size_t len)
336 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
339 static inline BOOL heap_free(void *mem)
341 return HeapFree(GetProcessHeap(), 0, mem);
344 static inline LPWSTR heap_strdupW(LPCWSTR str)
346 LPWSTR ret = NULL;
348 if(str) {
349 DWORD size;
351 size = (strlenW(str)+1)*sizeof(WCHAR);
352 ret = heap_alloc(size);
353 if(ret)
354 memcpy(ret, str, size);
357 return ret;
360 static inline LPWSTR co_strdupW(LPCWSTR str)
362 WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
363 if (ret)
364 lstrcpyW(ret, str);
365 return ret;
368 static inline LPWSTR co_strdupAtoW(LPCSTR str)
370 INT len;
371 WCHAR *ret;
372 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
373 ret = CoTaskMemAlloc(len*sizeof(WCHAR));
374 if (ret)
375 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
376 return ret;
379 static inline LPSTR co_strdupWtoA(LPCWSTR str)
381 INT len;
382 CHAR *ret;
383 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
384 ret = CoTaskMemAlloc(len);
385 if (ret)
386 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
387 return ret;