winealsa.drv: Rewrite channel counting for additional readability and circumvention...
[wine.git] / dlls / shdocvw / shdocvw.h
blob4f3425d825c55119d9deb58dd6a30459e3b2dbf8
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 } IDocHostContainerVtbl;
94 struct DocHost {
95 const IOleClientSiteVtbl *lpOleClientSiteVtbl;
96 const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
97 const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
98 const IOleDocumentSiteVtbl *lpOleDocumentSiteVtbl;
99 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
100 const IDispatchVtbl *lpDispatchVtbl;
101 const IPropertyNotifySinkVtbl *lpIPropertyNotifySinkVtbl;
102 const IServiceProviderVtbl *lpServiceProviderVtbl;
104 /* Interfaces of InPlaceFrame object */
105 const IOleInPlaceFrameVtbl *lpOleInPlaceFrameVtbl;
107 IDispatch *disp;
109 IDispatch *client_disp;
110 IDocHostUIHandler *hostui;
111 IOleInPlaceFrame *frame;
113 IUnknown *document;
114 IOleDocumentView *view;
115 IUnknown *doc_navigate;
117 const IDocHostContainerVtbl *container_vtbl;
119 HWND hwnd;
120 HWND frame_hwnd;
122 LPOLESTR url;
124 VARIANT_BOOL silent;
125 VARIANT_BOOL offline;
126 VARIANT_BOOL busy;
128 READYSTATE ready_state;
129 READYSTATE doc_state;
130 DWORD prop_notif_cookie;
131 BOOL is_prop_notif;
133 ConnectionPointContainer cps;
136 struct WebBrowser {
137 /* Interfaces available via WebBrowser object */
139 const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
140 const IOleObjectVtbl *lpOleObjectVtbl;
141 const IOleInPlaceObjectVtbl *lpOleInPlaceObjectVtbl;
142 const IOleControlVtbl *lpOleControlVtbl;
143 const IPersistStorageVtbl *lpPersistStorageVtbl;
144 const IPersistMemoryVtbl *lpPersistMemoryVtbl;
145 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
146 const IProvideClassInfo2Vtbl *lpProvideClassInfoVtbl;
147 const IViewObject2Vtbl *lpViewObjectVtbl;
148 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
149 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
150 const IServiceProviderVtbl *lpServiceProviderVtbl;
151 const IDataObjectVtbl *lpDataObjectVtbl;
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 const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
187 HlinkFrame hlink_frame;
189 LONG ref;
191 HWND frame_hwnd;
192 HWND status_hwnd;
193 HMENU menu;
195 DocHost doc_host;
198 #define WEBBROWSER(x) ((IWebBrowser*) &(x)->lpWebBrowser2Vtbl)
199 #define WEBBROWSER2(x) ((IWebBrowser2*) &(x)->lpWebBrowser2Vtbl)
200 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
201 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectVtbl)
202 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
203 #define PERSTORAGE(x) ((IPersistStorage*) &(x)->lpPersistStorageVtbl)
204 #define PERMEMORY(x) ((IPersistMemory*) &(x)->lpPersistMemoryVtbl)
205 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
206 #define CLASSINFO(x) ((IProvideClassInfo2*) &(x)->lpProvideClassInfoVtbl)
207 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
208 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectVtbl);
209 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectVtbl);
210 #define ACTIVEOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
211 #define OLECMD(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
212 #define DATAOBJECT(x) ((IDataObject*) &(x)->lpDataObjectVtbl)
214 #define CLIENTSITE(x) ((IOleClientSite*) &(x)->lpOleClientSiteVtbl)
215 #define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpOleInPlaceSiteVtbl)
216 #define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpDocHostUIHandlerVtbl)
217 #define DOCHOSTUI2(x) ((IDocHostUIHandler2*) &(x)->lpDocHostUIHandlerVtbl)
218 #define DOCSITE(x) ((IOleDocumentSite*) &(x)->lpOleDocumentSiteVtbl)
219 #define CLDISP(x) ((IDispatch*) &(x)->lpDispatchVtbl)
220 #define PROPNOTIF(x) ((IPropertyNotifySink*) &(x)->lpIPropertyNotifySinkVtbl)
221 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
223 #define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl)
225 #define HLINKFRAME(x) ((IHlinkFrame*) &(x)->lpIHlinkFrameVtbl)
226 #define TARGETFRAME2(x) ((ITargetFrame2*) &(x)->lpITargetFrame2Vtbl)
228 void WebBrowser_OleObject_Init(WebBrowser*);
229 void WebBrowser_ViewObject_Init(WebBrowser*);
230 void WebBrowser_DataObject_Init(WebBrowser*);
231 void WebBrowser_Persist_Init(WebBrowser*);
232 void WebBrowser_ClassInfo_Init(WebBrowser*);
234 void WebBrowser_OleObject_Destroy(WebBrowser*);
236 void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*);
237 void DocHost_ClientSite_Init(DocHost*);
238 void DocHost_Frame_Init(DocHost*);
239 void release_dochost_client(DocHost*);
241 void DocHost_Release(DocHost*);
242 void DocHost_ClientSite_Release(DocHost*);
244 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
245 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
247 void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*);
248 BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**);
250 HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**);
251 HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
253 void create_doc_view_hwnd(DocHost*);
254 void deactivate_document(DocHost*);
255 HRESULT dochost_object_available(DocHost*,IUnknown*);
256 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
257 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
258 HRESULT go_home(DocHost*);
259 void set_doc_state(DocHost*,READYSTATE);
261 #define WM_DOCHOSTTASK (WM_USER+0x300)
262 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
263 LRESULT process_dochost_task(DocHost*,LPARAM);
265 HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
266 void InternetExplorer_WebBrowser_Init(InternetExplorer*);
268 HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
270 HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**);
272 HRESULT TaskbarList_Create(IUnknown*,REFIID,void**);
274 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
275 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
277 /**********************************************************************
278 * Dll lifetime tracking declaration for shdocvw.dll
280 extern LONG SHDOCVW_refCount;
281 static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_refCount ); }
282 static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
284 extern HINSTANCE shdocvw_hinstance;
285 extern void register_iewindow_class(void);
286 extern void unregister_iewindow_class(void);
287 extern HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR);
289 HRESULT register_class_object(BOOL);
290 HRESULT get_typeinfo(ITypeInfo**);
291 DWORD register_iexplore(BOOL);
293 const char *debugstr_variant(const VARIANT*);
295 /* memory allocation functions */
297 static inline void *heap_alloc(size_t len)
299 return HeapAlloc(GetProcessHeap(), 0, len);
302 static inline void *heap_alloc_zero(size_t len)
304 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
307 static inline void *heap_realloc(void *mem, size_t len)
309 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
312 static inline BOOL heap_free(void *mem)
314 return HeapFree(GetProcessHeap(), 0, mem);
317 static inline LPWSTR heap_strdupW(LPCWSTR str)
319 LPWSTR ret = NULL;
321 if(str) {
322 DWORD size;
324 size = (strlenW(str)+1)*sizeof(WCHAR);
325 ret = heap_alloc(size);
326 memcpy(ret, str, size);
329 return ret;
332 static inline LPWSTR co_strdupW(LPCWSTR str)
334 WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
335 if (ret)
336 lstrcpyW(ret, str);
337 return ret;
340 static inline LPWSTR co_strdupAtoW(LPCSTR str)
342 INT len;
343 WCHAR *ret;
344 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
345 ret = CoTaskMemAlloc(len*sizeof(WCHAR));
346 if (ret)
347 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
348 return ret;
351 static inline LPSTR co_strdupWtoA(LPCWSTR str)
353 INT len;
354 CHAR *ret;
355 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
356 ret = CoTaskMemAlloc(len);
357 if (ret)
358 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
359 return ret;
362 #endif /* __WINE_SHDOCVW_H */