mciqtz32: Use BOOL type where appropriate.
[wine.git] / dlls / ieframe / ieframe.h
blobb7da8ffa8079e2203bf0cf1eac2e467f20afcbf6
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
24 #define NONAMELESSUNION
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
31 #include "ole2.h"
32 #include "olectl.h"
33 #include "shlobj.h"
34 #include "mshtmhst.h"
35 #include "exdisp.h"
36 #include "hlink.h"
37 #include "htiface.h"
38 #include "shdeprecated.h"
39 #include "docobjectservice.h"
41 #include "wine/unicode.h"
42 #include "wine/list.h"
44 typedef struct ConnectionPoint ConnectionPoint;
45 typedef struct DocHost DocHost;
47 typedef struct {
48 IConnectionPointContainer IConnectionPointContainer_iface;
50 ConnectionPoint *wbe2;
51 ConnectionPoint *wbe;
52 ConnectionPoint *pns;
54 IUnknown *impl;
55 } ConnectionPointContainer;
57 typedef struct {
58 IHlinkFrame IHlinkFrame_iface;
59 ITargetFrame2 ITargetFrame2_iface;
60 ITargetFramePriv2 ITargetFramePriv2_iface;
61 IWebBrowserPriv2IE8 IWebBrowserPriv2IE8_iface;
63 IUnknown *outer;
64 DocHost *doc_host;
65 } HlinkFrame;
67 struct _task_header_t;
69 typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
70 typedef void (*task_destr_t)(struct _task_header_t*);
72 typedef struct _task_header_t {
73 struct list entry;
74 task_proc_t proc;
75 task_destr_t destr;
76 } task_header_t;
78 typedef struct {
79 IShellBrowser IShellBrowser_iface;
80 IBrowserService IBrowserService_iface;
81 IDocObjectService IDocObjectService_iface;
83 LONG ref;
85 DocHost *doc_host;
86 } ShellBrowser;
88 typedef struct {
89 IHTMLWindow2 IHTMLWindow2_iface;
90 DocHost *doc_host;
91 } IEHTMLWindow;
93 typedef struct {
94 INewWindowManager INewWindowManager_iface;
95 DocHost *doc_host;
96 } NewWindowManager;
98 typedef struct {
99 WCHAR *url;
100 IStream *stream;
101 } travellog_entry_t;
103 typedef struct _IDocHostContainerVtbl
105 ULONG (*addref)(DocHost*);
106 ULONG (*release)(DocHost*);
107 void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
108 HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
109 void (WINAPI* SetURL)(DocHost*,LPCWSTR);
110 HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*);
111 } IDocHostContainerVtbl;
113 struct DocHost {
114 IOleClientSite IOleClientSite_iface;
115 IOleInPlaceSiteEx IOleInPlaceSiteEx_iface;
116 IDocHostUIHandler2 IDocHostUIHandler2_iface;
117 IOleDocumentSite IOleDocumentSite_iface;
118 IOleControlSite IOleControlSite_iface;
119 IOleCommandTarget IOleCommandTarget_iface;
120 IDispatch IDispatch_iface;
121 IPropertyNotifySink IPropertyNotifySink_iface;
122 IServiceProvider IServiceProvider_iface;
124 /* Interfaces of InPlaceFrame object */
125 IOleInPlaceFrame IOleInPlaceFrame_iface;
127 IWebBrowser2 *wb;
129 IDispatch *client_disp;
130 IDocHostUIHandler *hostui;
131 IOleInPlaceFrame *frame;
133 IUnknown *document;
134 IOleDocumentView *view;
135 IUnknown *doc_navigate;
137 const IDocHostContainerVtbl *container_vtbl;
139 HWND hwnd;
140 HWND frame_hwnd;
142 struct list task_queue;
144 LPOLESTR url;
146 VARIANT_BOOL silent;
147 VARIANT_BOOL offline;
148 VARIANT_BOOL busy;
150 READYSTATE ready_state;
151 READYSTATE doc_state;
152 DWORD prop_notif_cookie;
153 BOOL is_prop_notif;
155 ShellBrowser *browser_service;
156 IShellUIHelper2 *shell_ui_helper;
158 struct {
159 travellog_entry_t *log;
160 unsigned size;
161 unsigned length;
162 unsigned position;
163 int loading_pos;
164 } travellog;
166 ConnectionPointContainer cps;
167 IEHTMLWindow html_window;
168 NewWindowManager nwm;
171 struct WebBrowser {
172 IWebBrowser2 IWebBrowser2_iface;
173 IOleObject IOleObject_iface;
174 IOleInPlaceObject IOleInPlaceObject_iface;
175 IOleControl IOleControl_iface;
176 IPersistStorage IPersistStorage_iface;
177 IPersistMemory IPersistMemory_iface;
178 IPersistStreamInit IPersistStreamInit_iface;
179 IProvideClassInfo2 IProvideClassInfo2_iface;
180 IViewObject2 IViewObject2_iface;
181 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
182 IOleCommandTarget IOleCommandTarget_iface;
183 IServiceProvider IServiceProvider_iface;
184 IDataObject IDataObject_iface;
185 HlinkFrame hlink_frame;
187 LONG ref;
189 INT version;
191 IOleClientSite *client;
192 IOleContainer *container;
193 IOleInPlaceSiteEx *inplace;
195 /* window context */
197 HWND frame_hwnd;
198 IOleInPlaceUIWindow *uiwindow;
199 RECT pos_rect;
200 RECT clip_rect;
201 OLEINPLACEFRAMEINFO frameinfo;
202 SIZEL extent;
204 HWND shell_embedding_hwnd;
206 VARIANT_BOOL register_browser;
207 VARIANT_BOOL visible;
208 VARIANT_BOOL menu_bar;
209 VARIANT_BOOL address_bar;
210 VARIANT_BOOL status_bar;
211 VARIANT_BOOL tool_bar;
212 VARIANT_BOOL full_screen;
213 VARIANT_BOOL theater_mode;
215 DocHost doc_host;
218 struct InternetExplorer {
219 DocHost doc_host;
220 IWebBrowser2 IWebBrowser2_iface;
221 IExternalConnection IExternalConnection_iface;
222 IServiceProvider IServiceProvider_iface;
223 HlinkFrame hlink_frame;
225 LONG ref;
226 LONG extern_ref;
228 HWND frame_hwnd;
229 HWND status_hwnd;
230 HMENU menu;
231 BOOL nohome;
233 struct list entry;
236 void WebBrowser_OleObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
237 void WebBrowser_ViewObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
238 void WebBrowser_Persist_Init(WebBrowser*) DECLSPEC_HIDDEN;
239 void WebBrowser_ClassInfo_Init(WebBrowser*) DECLSPEC_HIDDEN;
241 void WebBrowser_OleObject_Destroy(WebBrowser*) DECLSPEC_HIDDEN;
243 void DocHost_Init(DocHost*,IWebBrowser2*,const IDocHostContainerVtbl*) DECLSPEC_HIDDEN;
244 void DocHost_Release(DocHost*) DECLSPEC_HIDDEN;
245 void DocHost_ClientSite_Init(DocHost*) DECLSPEC_HIDDEN;
246 void DocHost_ClientSite_Release(DocHost*) DECLSPEC_HIDDEN;
247 void DocHost_Frame_Init(DocHost*) DECLSPEC_HIDDEN;
248 void release_dochost_client(DocHost*) DECLSPEC_HIDDEN;
250 void IEHTMLWindow_Init(DocHost*) DECLSPEC_HIDDEN;
251 void NewWindowManager_Init(DocHost*) DECLSPEC_HIDDEN;
253 void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*) DECLSPEC_HIDDEN;
254 BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**) DECLSPEC_HIDDEN;
256 HRESULT create_browser_service(DocHost*,ShellBrowser**) DECLSPEC_HIDDEN;
257 void detach_browser_service(ShellBrowser*) DECLSPEC_HIDDEN;
258 HRESULT create_shell_ui_helper(IShellUIHelper2**) DECLSPEC_HIDDEN;
260 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*) DECLSPEC_HIDDEN;
261 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
263 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*) DECLSPEC_HIDDEN;
264 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
265 HRESULT go_home(DocHost*) DECLSPEC_HIDDEN;
266 HRESULT go_back(DocHost*) DECLSPEC_HIDDEN;
267 HRESULT go_forward(DocHost*) DECLSPEC_HIDDEN;
268 HRESULT refresh_document(DocHost*) DECLSPEC_HIDDEN;
269 HRESULT get_location_url(DocHost*,BSTR*) DECLSPEC_HIDDEN;
270 HRESULT set_dochost_url(DocHost*,const WCHAR*) DECLSPEC_HIDDEN;
271 void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*) DECLSPEC_HIDDEN;
272 HRESULT dochost_object_available(DocHost*,IUnknown*) DECLSPEC_HIDDEN;
273 void set_doc_state(DocHost*,READYSTATE) DECLSPEC_HIDDEN;
274 void deactivate_document(DocHost*) DECLSPEC_HIDDEN;
275 void create_doc_view_hwnd(DocHost*) 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 const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
315 extern LONG module_ref DECLSPEC_HIDDEN;
316 extern HINSTANCE ieframe_instance DECLSPEC_HIDDEN;
318 static inline void lock_module(void) {
319 InterlockedIncrement(&module_ref);
322 static inline void unlock_module(void) {
323 InterlockedDecrement(&module_ref);
326 static inline void *heap_alloc(size_t len)
328 return HeapAlloc(GetProcessHeap(), 0, len);
331 static inline void *heap_alloc_zero(size_t len)
333 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
336 static inline void *heap_realloc(void *mem, size_t len)
338 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
341 static inline BOOL heap_free(void *mem)
343 return HeapFree(GetProcessHeap(), 0, mem);
346 static inline LPWSTR heap_strdupW(LPCWSTR str)
348 LPWSTR ret = NULL;
350 if(str) {
351 DWORD size;
353 size = (strlenW(str)+1)*sizeof(WCHAR);
354 ret = heap_alloc(size);
355 if(ret)
356 memcpy(ret, str, size);
359 return ret;
362 static inline LPWSTR co_strdupW(LPCWSTR str)
364 WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
365 if (ret)
366 lstrcpyW(ret, str);
367 return ret;
370 static inline LPWSTR co_strdupAtoW(LPCSTR str)
372 INT len;
373 WCHAR *ret;
374 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
375 ret = CoTaskMemAlloc(len*sizeof(WCHAR));
376 if (ret)
377 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
378 return ret;
381 static inline LPSTR co_strdupWtoA(LPCWSTR str)
383 INT len;
384 CHAR *ret;
385 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
386 ret = CoTaskMemAlloc(len);
387 if (ret)
388 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
389 return ret;