wined3d: Remove some unneeded context cache members from the device.
[wine/multimedia.git] / dlls / mshtml / mshtml_private.h
blobd23a96709d6482506c20b576f1fbf2ca6c22694a
1 /*
2 * Copyright 2005-2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "docobj.h"
20 #include "mshtml.h"
21 #include "mshtmhst.h"
22 #include "hlink.h"
24 #include "wine/list.h"
26 #ifdef INIT_GUID
27 #include "initguid.h"
28 #endif
30 #include "nsiface.h"
32 #define GENERATE_MSHTML_NS_FAILURE(code) \
33 ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
35 #define NS_OK ((nsresult)0x00000000L)
36 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
37 #define NS_NOINTERFACE ((nsresult)0x80004002L)
38 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
39 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
40 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
41 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
43 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
45 #define NS_FAILED(res) ((res) & 0x80000000)
46 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
48 #define NSAPI WINAPI
50 #define NS_ELEMENT_NODE 1
51 #define NS_DOCUMENT_NODE 9
53 typedef struct HTMLDOMNode HTMLDOMNode;
54 typedef struct ConnectionPoint ConnectionPoint;
55 typedef struct BSCallback BSCallback;
57 typedef struct {
58 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
60 LONG ref;
62 HTMLDocument *doc;
63 nsIDOMWindow *nswindow;
65 struct list entry;
66 } HTMLWindow;
68 typedef enum {
69 UNKNOWN_USERMODE,
70 BROWSEMODE,
71 EDITMODE
72 } USERMODE;
74 struct HTMLDocument {
75 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
76 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
77 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
78 const IPersistFileVtbl *lpPersistFileVtbl;
79 const IMonikerPropVtbl *lpMonikerPropVtbl;
80 const IOleObjectVtbl *lpOleObjectVtbl;
81 const IOleDocumentVtbl *lpOleDocumentVtbl;
82 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
83 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
84 const IViewObject2Vtbl *lpViewObject2Vtbl;
85 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
86 const IServiceProviderVtbl *lpServiceProviderVtbl;
87 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
88 const IOleControlVtbl *lpOleControlVtbl;
89 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
90 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
91 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
93 LONG ref;
95 NSContainer *nscontainer;
96 HTMLWindow *window;
98 IOleClientSite *client;
99 IDocHostUIHandler *hostui;
100 IOleInPlaceSite *ipsite;
101 IOleInPlaceFrame *frame;
103 BSCallback *bscallback;
105 HWND hwnd;
106 HWND tooltips_hwnd;
108 DOCHOSTUIINFO hostinfo;
110 USERMODE usermode;
111 READYSTATE readystate;
112 BOOL in_place_active;
113 BOOL ui_active;
114 BOOL window_active;
115 BOOL has_key_path;
116 BOOL container_locked;
118 ConnectionPoint *cp_htmldocevents;
119 ConnectionPoint *cp_htmldocevents2;
120 ConnectionPoint *cp_propnotif;
122 HTMLDOMNode *nodes;
125 struct NSContainer {
126 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
127 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
128 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
129 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
130 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
131 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
132 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
133 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
134 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
136 nsIWebBrowser *webbrowser;
137 nsIWebNavigation *navigation;
138 nsIBaseWindow *window;
139 nsIWebBrowserFocus *focus;
141 LONG ref;
143 NSContainer *parent;
144 HTMLDocument *doc;
146 nsIURIContentListener *content_listener;
148 HWND hwnd;
150 BSCallback *bscallback; /* hack */
153 typedef struct {
154 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
155 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
157 LONG ref;
159 nsIChannel *channel;
160 nsIHttpChannel *http_channel;
161 nsIWineURI *uri;
162 nsIInputStream *post_data_stream;
163 nsILoadGroup *load_group;
164 nsIInterfaceRequestor *notif_callback;
165 nsLoadFlags load_flags;
166 nsIURI *original_uri;
167 char *content;
168 } nsChannel;
170 typedef struct {
171 const nsIInputStreamVtbl *lpInputStreamVtbl;
173 LONG ref;
175 char buf[1024];
176 DWORD buf_size;
177 } nsProtocolStream;
179 struct BSCallback {
180 const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
181 const IServiceProviderVtbl *lpServiceProviderVtbl;
182 const IHttpNegotiate2Vtbl *lpHttpNegotiate2Vtbl;
183 const IInternetBindInfoVtbl *lpInternetBindInfoVtbl;
185 LONG ref;
187 LPWSTR headers;
188 HGLOBAL post_data;
189 ULONG post_data_len;
190 ULONG readed;
192 nsChannel *nschannel;
193 nsIStreamListener *nslistener;
194 nsISupports *nscontext;
196 IMoniker *mon;
197 IBinding *binding;
199 HTMLDocument *doc;
201 nsProtocolStream *nsstream;
204 struct HTMLDOMNode {
205 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
207 void (*destructor)(IUnknown*);
209 enum {
210 NT_UNKNOWN,
211 NT_HTMLELEM
212 } node_type;
214 union {
215 IUnknown *unk;
216 IHTMLElement *elem;
217 } impl;
219 nsIDOMNode *nsnode;
220 HTMLDocument *doc;
222 HTMLDOMNode *next;
225 typedef struct {
226 const IHTMLElementVtbl *lpHTMLElementVtbl;
227 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
229 void (*destructor)(IUnknown*);
231 nsIDOMHTMLElement *nselem;
232 HTMLDOMNode *node;
234 IUnknown *impl;
235 } HTMLElement;
237 typedef struct {
238 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
240 HTMLElement *element;
241 } HTMLTextContainer;
243 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
245 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
246 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
247 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
248 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
249 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
250 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
251 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
252 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
253 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
254 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
255 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
256 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
257 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
258 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
259 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
260 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
261 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
262 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
263 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
264 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
265 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
267 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
268 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
269 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
270 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
271 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
272 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
273 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
274 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
275 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
277 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
278 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
279 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
281 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
282 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
283 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
285 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
286 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
287 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
289 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
291 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
293 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
294 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
296 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
297 HTMLWindow *nswindow_to_window(nsIDOMWindow*);
299 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
300 void HTMLDocument_Persist_Init(HTMLDocument*);
301 void HTMLDocument_OleCmd_Init(HTMLDocument*);
302 void HTMLDocument_OleObj_Init(HTMLDocument*);
303 void HTMLDocument_View_Init(HTMLDocument*);
304 void HTMLDocument_Window_Init(HTMLDocument*);
305 void HTMLDocument_Service_Init(HTMLDocument*);
306 void HTMLDocument_Hlink_Init(HTMLDocument*);
307 void HTMLDocument_ConnectionPoints_Init(HTMLDocument*);
309 void HTMLDocument_ConnectionPoints_Destroy(HTMLDocument*);
311 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
312 void NSContainer_Release(NSContainer*);
314 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
315 void HTMLDocument_ShowContextMenu(HTMLDocument*,DWORD,POINT*);
317 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
318 void hide_tooltip(HTMLDocument*);
319 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
321 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
323 void close_gecko(void);
324 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
325 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
327 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
329 void call_property_onchanged(ConnectionPoint*,DISPID);
331 void *nsalloc(size_t);
332 void nsfree(void*);
334 void nsACString_Init(nsACString*,const char*);
335 void nsACString_SetData(nsACString*,const char*);
336 PRUint32 nsACString_GetData(const nsACString*,const char**,PRBool*);
337 void nsACString_Finish(nsACString*);
339 void nsAString_Init(nsAString*,const PRUnichar*);
340 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**,PRBool*);
341 void nsAString_Finish(nsAString*);
343 nsIInputStream *create_nsstream(const char*,PRInt32);
344 nsICommandParams *create_nscommand_params(void);
345 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
347 BSCallback *create_bscallback(IMoniker*);
348 HRESULT start_binding(BSCallback*);
349 void set_document_bscallback(HTMLDocument*,BSCallback*);
351 IHlink *Hlink_Create(void);
352 IHTMLSelectionObject *HTMLSelectionObject_Create(nsISelection*);
353 IHTMLTxtRange *HTMLTxtRange_Create(nsISelection*);
354 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
355 IHTMLStyleSheet *HTMLStyleSheet_Create(void);
357 void HTMLElement_Create(HTMLDOMNode*);
358 void HTMLBodyElement_Create(HTMLElement*);
359 void HTMLInputElement_Create(HTMLElement*);
360 void HTMLSelectElement_Create(HTMLElement*);
361 void HTMLTextAreaElement_Create(HTMLElement*);
363 void HTMLElement2_Init(HTMLElement*);
365 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLElement*);
367 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
368 HRESULT HTMLElement_QI(HTMLElement*,REFIID,void**);
370 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
371 void release_nodes(HTMLDocument*);
373 void install_wine_gecko(void);
375 /* editor */
376 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
378 void get_font_size(HTMLDocument*,WCHAR*);
379 void set_font_size(HTMLDocument*,LPCWSTR);
381 extern DWORD mshtml_tls;
383 typedef struct task_t {
384 HTMLDocument *doc;
386 enum {
387 TASK_SETDOWNLOADSTATE,
388 TASK_PARSECOMPLETE,
389 TASK_SETPROGRESS
390 } task_id;
392 struct task_t *next;
393 } task_t;
395 typedef struct {
396 HWND thread_hwnd;
397 task_t *task_queue_head;
398 task_t *task_queue_tail;
399 } thread_data_t;
401 thread_data_t *get_thread_data(BOOL);
402 HWND get_thread_hwnd(void);
403 void push_task(task_t*);
404 void remove_doc_tasks(HTMLDocument*);
406 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
407 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
408 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
409 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
410 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
412 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
414 extern LONG module_ref;
415 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
416 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
418 /* memory allocation functions */
420 static inline void *mshtml_alloc(size_t len)
422 return HeapAlloc(GetProcessHeap(), 0, len);
425 static inline void *mshtml_alloc_zero(size_t len)
427 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
430 static inline void *mshtml_realloc(void *mem, size_t len)
432 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
435 static inline BOOL mshtml_free(void *mem)
437 return HeapFree(GetProcessHeap(), 0, mem);
440 HINSTANCE get_shdoclc(void);
442 extern HINSTANCE hInst;