ddraw: Add full implementation of IDirect3DDevice7_Load.
[wine.git] / dlls / mshtml / mshtml_private.h
blob921d9751e16b9dbbc8867c5979444b59132f446d
1 /*
2 * Copyright 2005-2008 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 "wingdi.h"
20 #include "docobj.h"
21 #include "mshtml.h"
22 #include "mshtmhst.h"
23 #include "hlink.h"
24 #include "dispex.h"
26 #include "wine/list.h"
27 #include "wine/unicode.h"
29 #ifdef INIT_GUID
30 #include "initguid.h"
31 #endif
33 #include "nsiface.h"
35 #define GENERATE_MSHTML_NS_FAILURE(code) \
36 ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
38 #define NS_OK ((nsresult)0x00000000L)
39 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
40 #define NS_NOINTERFACE ((nsresult)0x80004002L)
41 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
42 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
43 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
44 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
46 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
48 #define NS_FAILED(res) ((res) & 0x80000000)
49 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
51 #define NSAPI WINAPI
53 #define MSHTML_E_NODOC 0x800a025c
55 typedef struct HTMLDOMNode HTMLDOMNode;
56 typedef struct ConnectionPoint ConnectionPoint;
57 typedef struct BSCallback BSCallback;
58 typedef struct nsChannelBSC nsChannelBSC;
59 typedef struct event_target_t event_target_t;
61 /* NOTE: make sure to keep in sync with dispex.c */
62 typedef enum {
63 NULL_tid,
64 DispDOMChildrenCollection_tid,
65 DispHTMLCommentElement_tid,
66 DispHTMLDocument_tid,
67 DispHTMLDOMTextNode_tid,
68 DispHTMLElementCollection_tid,
69 DispHTMLImg_tid,
70 DispHTMLInputElement_tid,
71 DispHTMLOptionElement_tid,
72 DispHTMLStyle_tid,
73 DispHTMLUnknownElement_tid,
74 DispHTMLWindow2_tid,
75 IHTMLCommentElement_tid,
76 IHTMLDocument2_tid,
77 IHTMLDocument3_tid,
78 IHTMLDocument4_tid,
79 IHTMLDocument5_tid,
80 IHTMLDOMChildrenCollection_tid,
81 IHTMLDOMNode_tid,
82 IHTMLDOMNode2_tid,
83 IHTMLDOMTextNode_tid,
84 IHTMLElement_tid,
85 IHTMLElement2_tid,
86 IHTMLElementCollection_tid,
87 IHTMLImgElement_tid,
88 IHTMLInputElement_tid,
89 IHTMLOptionElement_tid,
90 IHTMLStyle_tid,
91 IHTMLWindow2_tid,
92 IHTMLWindow3_tid,
93 IOmNavigator_tid,
94 LAST_tid
95 } tid_t;
97 typedef struct dispex_data_t dispex_data_t;
99 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
100 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
102 typedef struct {
103 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
104 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
105 } dispex_static_data_vtbl_t;
107 typedef struct {
108 const dispex_static_data_vtbl_t *vtbl;
109 const tid_t disp_tid;
110 dispex_data_t *data;
111 const tid_t iface_tids[];
112 } dispex_static_data_t;
114 typedef struct {
115 const IDispatchExVtbl *lpIDispatchExVtbl;
117 IUnknown *outer;
119 dispex_static_data_t *data;
120 } DispatchEx;
122 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
124 typedef struct {
125 DispatchEx dispex;
126 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
127 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
128 const IDispatchExVtbl *lpIDispatchExVtbl;
130 LONG ref;
132 HTMLDocument *doc;
133 nsIDOMWindow *nswindow;
135 IHTMLEventObj *event;
137 struct list entry;
138 } HTMLWindow;
140 typedef enum {
141 UNKNOWN_USERMODE,
142 BROWSEMODE,
143 EDITMODE
144 } USERMODE;
146 typedef struct {
147 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
149 ConnectionPoint *cp_list;
150 IUnknown *outer;
151 } ConnectionPointContainer;
153 struct ConnectionPoint {
154 const IConnectionPointVtbl *lpConnectionPointVtbl;
156 IConnectionPointContainer *container;
158 union {
159 IUnknown *unk;
160 IDispatch *disp;
161 IPropertyNotifySink *propnotif;
162 } *sinks;
163 DWORD sinks_size;
165 const IID *iid;
167 ConnectionPoint *next;
170 typedef struct {
171 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
173 LONG ref;
175 HTMLDocument *doc;
176 } HTMLLocation;
178 typedef struct {
179 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
181 LONG ref;
183 HTMLDocument *doc;
184 } HTMLOptionElementFactory;
186 struct HTMLDocument {
187 DispatchEx dispex;
188 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
189 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
190 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
191 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
192 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
193 const IPersistFileVtbl *lpPersistFileVtbl;
194 const IMonikerPropVtbl *lpMonikerPropVtbl;
195 const IOleObjectVtbl *lpOleObjectVtbl;
196 const IOleDocumentVtbl *lpOleDocumentVtbl;
197 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
198 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
199 const IViewObject2Vtbl *lpViewObject2Vtbl;
200 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
201 const IServiceProviderVtbl *lpServiceProviderVtbl;
202 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
203 const IOleControlVtbl *lpOleControlVtbl;
204 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
205 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
206 const ICustomDocVtbl *lpCustomDocVtbl;
207 const IDispatchExVtbl *lpIDispatchExVtbl;
209 LONG ref;
211 NSContainer *nscontainer;
212 HTMLWindow *window;
214 IOleClientSite *client;
215 IDocHostUIHandler *hostui;
216 IOleInPlaceSite *ipsite;
217 IOleInPlaceFrame *frame;
218 IOleInPlaceUIWindow *ip_window;
220 IOleUndoManager *undomgr;
222 nsChannelBSC *bscallback;
223 IMoniker *mon;
224 LPOLESTR url;
225 struct list bindings;
227 struct list script_hosts;
229 HWND hwnd;
230 HWND tooltips_hwnd;
232 DOCHOSTUIINFO hostinfo;
234 USERMODE usermode;
235 READYSTATE readystate;
236 BOOL in_place_active;
237 BOOL ui_active;
238 BOOL window_active;
239 BOOL has_key_path;
240 BOOL container_locked;
241 BOOL focus;
242 LPWSTR mime;
244 DWORD update;
246 ConnectionPointContainer cp_container;
247 ConnectionPoint cp_htmldocevents;
248 ConnectionPoint cp_htmldocevents2;
249 ConnectionPoint cp_propnotif;
251 HTMLOptionElementFactory *option_factory;
252 HTMLLocation *location;
254 struct list selection_list;
255 struct list range_list;
257 HTMLDOMNode *nodes;
260 typedef struct {
261 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
262 NSContainer *This;
263 } nsEventListener;
265 struct NSContainer {
266 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
267 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
268 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
269 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
270 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
271 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
272 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
273 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
275 nsEventListener blur_listener;
276 nsEventListener focus_listener;
277 nsEventListener keypress_listener;
278 nsEventListener load_listener;
279 nsEventListener node_insert_listener;
281 nsIWebBrowser *webbrowser;
282 nsIWebNavigation *navigation;
283 nsIBaseWindow *window;
284 nsIWebBrowserFocus *focus;
286 nsIEditor *editor;
287 nsIController *editor_controller;
289 LONG ref;
291 NSContainer *parent;
292 HTMLDocument *doc;
294 nsIURIContentListener *content_listener;
296 HWND hwnd;
298 nsChannelBSC *bscallback; /* hack */
299 HWND reset_focus; /* hack */
302 typedef struct {
303 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
304 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
306 LONG ref;
308 nsIChannel *channel;
309 nsIHttpChannel *http_channel;
310 nsIWineURI *uri;
311 nsIInputStream *post_data_stream;
312 nsILoadGroup *load_group;
313 nsIInterfaceRequestor *notif_callback;
314 nsLoadFlags load_flags;
315 nsIURI *original_uri;
316 char *content_type;
317 char *charset;
318 } nsChannel;
320 typedef struct {
321 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
322 void (*destructor)(HTMLDOMNode*);
323 } NodeImplVtbl;
325 struct HTMLDOMNode {
326 DispatchEx dispex;
327 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
328 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
329 const NodeImplVtbl *vtbl;
331 LONG ref;
333 nsIDOMNode *nsnode;
334 HTMLDocument *doc;
335 event_target_t *event_target;
337 HTMLDOMNode *next;
340 typedef struct {
341 HTMLDOMNode node;
342 ConnectionPointContainer cp_container;
344 const IHTMLElementVtbl *lpHTMLElementVtbl;
345 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
347 nsIDOMHTMLElement *nselem;
348 } HTMLElement;
350 typedef struct {
351 HTMLElement element;
353 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
355 ConnectionPoint cp;
356 } HTMLTextContainer;
358 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
359 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
361 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
362 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
363 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
364 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
365 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
366 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
367 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
368 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
369 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
370 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
371 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
372 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
373 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
374 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
375 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
376 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
377 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
378 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
379 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
380 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
381 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
382 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
383 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
384 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
386 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
387 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
388 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
389 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
390 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
391 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
392 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
393 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
394 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
396 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
397 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
398 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
400 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
401 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
402 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
404 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
405 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
406 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
407 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
409 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
411 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
412 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
414 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
416 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
417 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
419 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
420 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
422 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
423 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
424 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
425 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
426 IOmNavigator *OmNavigator_Create(void);
427 void setup_nswindow(HTMLWindow*);
429 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
430 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
431 void HTMLDocument_Persist_Init(HTMLDocument*);
432 void HTMLDocument_OleCmd_Init(HTMLDocument*);
433 void HTMLDocument_OleObj_Init(HTMLDocument*);
434 void HTMLDocument_View_Init(HTMLDocument*);
435 void HTMLDocument_Window_Init(HTMLDocument*);
436 void HTMLDocument_Service_Init(HTMLDocument*);
437 void HTMLDocument_Hlink_Init(HTMLDocument*);
439 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
440 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
441 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
443 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
444 void NSContainer_Release(NSContainer*);
446 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
447 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
448 void notif_focus(HTMLDocument*);
450 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
451 void hide_tooltip(HTMLDocument*);
452 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
454 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
456 BOOL load_gecko(BOOL);
457 void close_gecko(void);
458 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
459 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
460 BOOL install_wine_gecko(BOOL);
462 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
464 void call_property_onchanged(ConnectionPoint*,DISPID);
465 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
467 void *nsalloc(size_t);
468 void nsfree(void*);
470 void nsACString_Init(nsACString*,const char*);
471 void nsACString_SetData(nsACString*,const char*);
472 PRUint32 nsACString_GetData(const nsACString*,const char**);
473 void nsACString_Finish(nsACString*);
475 void nsAString_Init(nsAString*,const PRUnichar*);
476 void nsAString_SetData(nsAString*,const PRUnichar*);
477 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
478 void nsAString_Finish(nsAString*);
480 nsIInputStream *create_nsstream(const char*,PRInt32);
481 nsICommandParams *create_nscommand_params(void);
482 nsIMutableArray *create_nsarray(void);
483 nsIWritableVariant *create_nsvariant(void);
484 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
485 void get_editor_controller(NSContainer*);
486 void init_nsevents(NSContainer*);
487 nsresult get_nsinterface(nsISupports*,REFIID,void**);
489 typedef enum {
490 EVENTID_LOAD,
491 EVENTID_LAST
492 } eventid_t;
494 void check_event_attr(HTMLDocument*,nsIDOMElement*);
495 void release_event_target(event_target_t*);
496 void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
498 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
499 void set_current_mon(HTMLDocument*,IMoniker*);
500 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
502 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
504 nsChannelBSC *create_channelbsc(IMoniker*);
505 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
506 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
507 IMoniker *get_channelbsc_mon(nsChannelBSC*);
509 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
510 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
511 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
512 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
513 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
515 void detach_selection(HTMLDocument*);
516 void detach_ranges(HTMLDocument*);
518 HTMLDOMNode *HTMLDOMTextNode_Create(nsIDOMNode*);
520 HTMLElement *HTMLElement_Create(nsIDOMNode*);
521 HTMLElement *HTMLCommentElement_Create(nsIDOMNode*);
522 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
523 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
524 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
525 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
526 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
527 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
528 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
529 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
530 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
532 void HTMLElement_Init(HTMLElement*);
533 void HTMLElement2_Init(HTMLElement*);
534 void HTMLTextContainer_Init(HTMLTextContainer*);
536 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
537 void HTMLDOMNode_destructor(HTMLDOMNode*);
539 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
540 void HTMLElement_destructor(HTMLDOMNode*);
542 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
543 void release_nodes(HTMLDocument*);
545 void release_script_hosts(HTMLDocument*);
546 void connect_scripts(HTMLDocument*);
547 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
548 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
550 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
552 /* commands */
553 typedef struct {
554 DWORD id;
555 HRESULT (*query)(HTMLDocument*,OLECMD*);
556 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
557 } cmdtable_t;
559 extern const cmdtable_t editmode_cmds[];
561 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
563 /* timer */
564 #define UPDATE_UI 0x0001
565 #define UPDATE_TITLE 0x0002
567 void update_doc(HTMLDocument *This, DWORD flags);
568 void update_title(HTMLDocument*);
570 /* editor */
571 void init_editor(HTMLDocument*);
572 void set_ns_editmode(NSContainer*);
573 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
574 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
575 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
576 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
577 void handle_edit_load(HTMLDocument*);
578 HRESULT editor_is_dirty(HTMLDocument*);
579 void set_dirty(HTMLDocument*,VARIANT_BOOL);
581 extern DWORD mshtml_tls;
583 typedef struct task_t {
584 HTMLDocument *doc;
586 enum {
587 TASK_SETDOWNLOADSTATE,
588 TASK_PARSECOMPLETE,
589 TASK_SETPROGRESS,
590 TASK_START_BINDING
591 } task_id;
593 nsChannelBSC *bscallback;
595 struct task_t *next;
596 } task_t;
598 typedef struct {
599 HWND thread_hwnd;
600 task_t *task_queue_head;
601 task_t *task_queue_tail;
602 struct list timer_list;
603 } thread_data_t;
605 thread_data_t *get_thread_data(BOOL);
606 HWND get_thread_hwnd(void);
607 void push_task(task_t*);
608 void remove_doc_tasks(const HTMLDocument*);
609 DWORD set_task_timer(HTMLDocument*,DWORD,IDispatch*);
611 HRESULT get_typeinfo(tid_t,ITypeInfo**);
612 void release_typelib(void);
613 void call_disp_func(HTMLDocument*,IDispatch*);
615 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
616 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
617 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
618 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
619 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
621 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
623 extern LONG module_ref;
624 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
625 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
627 /* memory allocation functions */
629 static inline void *heap_alloc(size_t len)
631 return HeapAlloc(GetProcessHeap(), 0, len);
634 static inline void *heap_alloc_zero(size_t len)
636 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
639 static inline void *heap_realloc(void *mem, size_t len)
641 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
644 static inline BOOL heap_free(void *mem)
646 return HeapFree(GetProcessHeap(), 0, mem);
649 static inline LPWSTR heap_strdupW(LPCWSTR str)
651 LPWSTR ret = NULL;
653 if(str) {
654 DWORD size;
656 size = (strlenW(str)+1)*sizeof(WCHAR);
657 ret = heap_alloc(size);
658 memcpy(ret, str, size);
661 return ret;
664 static inline char *heap_strdupA(const char *str)
666 char *ret = NULL;
668 if(str) {
669 DWORD size;
671 size = strlen(str)+1;
672 ret = heap_alloc(size);
673 memcpy(ret, str, size);
676 return ret;
679 static inline WCHAR *heap_strdupAtoW(const char *str)
681 LPWSTR ret = NULL;
683 if(str) {
684 DWORD len;
686 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
687 ret = heap_alloc(len*sizeof(WCHAR));
688 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
691 return ret;
694 static inline char *heap_strdupWtoA(LPCWSTR str)
696 char *ret = NULL;
698 if(str) {
699 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
700 ret = heap_alloc(size);
701 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
704 return ret;
707 HINSTANCE get_shdoclc(void);
709 extern HINSTANCE hInst;