mshtml: COM cleanup for the IOleInPlaceObjectWindowless iface.
[wine/multimedia.git] / dlls / shdocvw / shdocvw.h
blob15a85edeed29dca3c750d2ba97ab497e4052e64f
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 IConnectionPointContainer IConnectionPointContainer_iface;
64 ConnectionPoint *wbe2;
65 ConnectionPoint *wbe;
66 ConnectionPoint *pns;
68 IUnknown *impl;
69 } ConnectionPointContainer;
71 typedef struct {
72 IHlinkFrame IHlinkFrame_iface;
73 ITargetFrame2 ITargetFrame2_iface;
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 IOleClientSite IOleClientSite_iface;
97 IOleInPlaceSite IOleInPlaceSite_iface;
98 IDocHostUIHandler2 IDocHostUIHandler2_iface;
99 IOleDocumentSite IOleDocumentSite_iface;
100 IOleControlSite IOleControlSite_iface;
101 IOleCommandTarget IOleCommandTarget_iface;
102 IDispatch IDispatch_iface;
103 IPropertyNotifySink IPropertyNotifySink_iface;
104 IServiceProvider IServiceProvider_iface;
106 /* Interfaces of InPlaceFrame object */
107 IOleInPlaceFrame IOleInPlaceFrame_iface;
109 IDispatch *disp;
111 IDispatch *client_disp;
112 IDocHostUIHandler *hostui;
113 IOleInPlaceFrame *frame;
115 IUnknown *document;
116 IOleDocumentView *view;
117 IUnknown *doc_navigate;
119 const IDocHostContainerVtbl *container_vtbl;
121 HWND hwnd;
122 HWND frame_hwnd;
124 LPOLESTR url;
126 VARIANT_BOOL silent;
127 VARIANT_BOOL offline;
128 VARIANT_BOOL busy;
130 READYSTATE ready_state;
131 READYSTATE doc_state;
132 DWORD prop_notif_cookie;
133 BOOL is_prop_notif;
135 ConnectionPointContainer cps;
138 struct WebBrowser {
139 IWebBrowser2 IWebBrowser2_iface;
140 IOleObject IOleObject_iface;
141 IOleInPlaceObject IOleInPlaceObject_iface;
142 IOleControl IOleControl_iface;
143 IPersistStorage IPersistStorage_iface;
144 IPersistMemory IPersistMemory_iface;
145 IPersistStreamInit IPersistStreamInit_iface;
146 IProvideClassInfo2 IProvideClassInfo2_iface;
147 IViewObject2 IViewObject2_iface;
148 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
149 IOleCommandTarget IOleCommandTarget_iface;
150 IServiceProvider IServiceProvider_iface;
151 IDataObject IDataObject_iface;
152 HlinkFrame hlink_frame;
154 LONG ref;
156 INT version;
158 IOleClientSite *client;
159 IOleContainer *container;
160 IOleInPlaceSite *inplace;
162 /* window context */
164 HWND frame_hwnd;
165 IOleInPlaceUIWindow *uiwindow;
166 RECT pos_rect;
167 RECT clip_rect;
168 OLEINPLACEFRAMEINFO frameinfo;
169 SIZEL extent;
171 HWND shell_embedding_hwnd;
173 VARIANT_BOOL register_browser;
174 VARIANT_BOOL visible;
175 VARIANT_BOOL menu_bar;
176 VARIANT_BOOL address_bar;
177 VARIANT_BOOL status_bar;
178 VARIANT_BOOL tool_bar;
179 VARIANT_BOOL full_screen;
180 VARIANT_BOOL theater_mode;
182 DocHost doc_host;
185 struct InternetExplorer {
186 IWebBrowser2 IWebBrowser2_iface;
187 HlinkFrame hlink_frame;
189 LONG ref;
191 HWND frame_hwnd;
192 HWND status_hwnd;
193 HMENU menu;
195 DocHost doc_host;
198 void WebBrowser_OleObject_Init(WebBrowser*);
199 void WebBrowser_ViewObject_Init(WebBrowser*);
200 void WebBrowser_Persist_Init(WebBrowser*);
201 void WebBrowser_ClassInfo_Init(WebBrowser*);
203 void WebBrowser_OleObject_Destroy(WebBrowser*);
205 void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*);
206 void DocHost_ClientSite_Init(DocHost*);
207 void DocHost_Frame_Init(DocHost*);
208 void release_dochost_client(DocHost*);
210 void DocHost_Release(DocHost*);
211 void DocHost_ClientSite_Release(DocHost*);
213 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
214 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
216 void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*);
217 BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**);
219 HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**);
220 HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
222 void create_doc_view_hwnd(DocHost*);
223 void deactivate_document(DocHost*);
224 HRESULT dochost_object_available(DocHost*,IUnknown*);
225 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
226 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
227 HRESULT go_home(DocHost*);
228 void set_doc_state(DocHost*,READYSTATE);
229 HRESULT get_location_url(DocHost*,BSTR*);
231 #define WM_DOCHOSTTASK (WM_USER+0x300)
232 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
233 LRESULT process_dochost_task(DocHost*,LPARAM);
235 HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
236 void InternetExplorer_WebBrowser_Init(InternetExplorer*);
238 HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
240 HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**);
242 HRESULT TaskbarList_Create(IUnknown*,REFIID,void**);
244 /**********************************************************************
245 * Dll lifetime tracking declaration for shdocvw.dll
247 extern LONG SHDOCVW_refCount;
248 static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_refCount ); }
249 static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
251 extern HINSTANCE shdocvw_hinstance;
252 extern void register_iewindow_class(void);
253 extern void unregister_iewindow_class(void);
254 extern HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR);
256 HRESULT register_class_object(BOOL);
257 HRESULT get_typeinfo(ITypeInfo**);
258 DWORD register_iexplore(BOOL);
260 const char *debugstr_variant(const VARIANT*);
262 /* memory allocation functions */
264 static inline void *heap_alloc(size_t len)
266 return HeapAlloc(GetProcessHeap(), 0, len);
269 static inline void *heap_alloc_zero(size_t len)
271 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
274 static inline void *heap_realloc(void *mem, size_t len)
276 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
279 static inline BOOL heap_free(void *mem)
281 return HeapFree(GetProcessHeap(), 0, mem);
284 static inline LPWSTR heap_strdupW(LPCWSTR str)
286 LPWSTR ret = NULL;
288 if(str) {
289 DWORD size;
291 size = (strlenW(str)+1)*sizeof(WCHAR);
292 ret = heap_alloc(size);
293 memcpy(ret, str, size);
296 return ret;
299 static inline LPWSTR co_strdupW(LPCWSTR str)
301 WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
302 if (ret)
303 lstrcpyW(ret, str);
304 return ret;
307 static inline LPWSTR co_strdupAtoW(LPCSTR str)
309 INT len;
310 WCHAR *ret;
311 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
312 ret = CoTaskMemAlloc(len*sizeof(WCHAR));
313 if (ret)
314 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
315 return ret;
318 static inline LPSTR co_strdupWtoA(LPCWSTR str)
320 INT len;
321 CHAR *ret;
322 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
323 ret = CoTaskMemAlloc(len);
324 if (ret)
325 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
326 return ret;
329 #endif /* __WINE_SHDOCVW_H */