mshtml: Don't create window in create_doc_from_nsdoc.
[wine/multimedia.git] / dlls / mshtml / mshtml_private.h
blob21e6e2a63105a476803faed08e218555c751fda5
1 /*
2 * Copyright 2005-2009 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 "perhist.h"
25 #include "dispex.h"
27 #include "wine/list.h"
28 #include "wine/unicode.h"
30 #ifdef INIT_GUID
31 #include "initguid.h"
32 #endif
34 #include "nsiface.h"
36 #define NS_OK ((nsresult)0x00000000L)
37 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
38 #define NS_NOINTERFACE ((nsresult)0x80004002L)
39 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
40 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
41 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
42 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
44 #define NS_FAILED(res) ((res) & 0x80000000)
45 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
47 #define NSAPI WINAPI
49 #define MSHTML_E_NODOC 0x800a025c
51 typedef struct HTMLDOMNode HTMLDOMNode;
52 typedef struct ConnectionPoint ConnectionPoint;
53 typedef struct BSCallback BSCallback;
54 typedef struct nsChannelBSC nsChannelBSC;
55 typedef struct event_target_t event_target_t;
57 /* NOTE: make sure to keep in sync with dispex.c */
58 typedef enum {
59 NULL_tid,
60 DispCEventObj_tid,
61 DispDOMChildrenCollection_tid,
62 DispHTMLBody_tid,
63 DispHTMLCommentElement_tid,
64 DispHTMLCurrentStyle_tid,
65 DispHTMLDocument_tid,
66 DispHTMLDOMTextNode_tid,
67 DispHTMLElementCollection_tid,
68 DispHTMLGenericElement_tid,
69 DispHTMLIFrame_tid,
70 DispHTMLImg_tid,
71 DispHTMLInputElement_tid,
72 DispHTMLLocation_tid,
73 DispHTMLNavigator_tid,
74 DispHTMLOptionElement_tid,
75 DispHTMLSelectElement_tid,
76 DispHTMLStyle_tid,
77 DispHTMLTable_tid,
78 DispHTMLTableRow_tid,
79 DispHTMLUnknownElement_tid,
80 DispHTMLWindow2_tid,
81 IHTMLBodyElement_tid,
82 IHTMLBodyElement2_tid,
83 IHTMLCommentElement_tid,
84 IHTMLCurrentStyle_tid,
85 IHTMLCurrentStyle2_tid,
86 IHTMLCurrentStyle3_tid,
87 IHTMLCurrentStyle4_tid,
88 IHTMLDocument2_tid,
89 IHTMLDocument3_tid,
90 IHTMLDocument4_tid,
91 IHTMLDocument5_tid,
92 IHTMLDOMChildrenCollection_tid,
93 IHTMLDOMNode_tid,
94 IHTMLDOMNode2_tid,
95 IHTMLDOMTextNode_tid,
96 IHTMLElement_tid,
97 IHTMLElement2_tid,
98 IHTMLElement3_tid,
99 IHTMLElement4_tid,
100 IHTMLElementCollection_tid,
101 IHTMLEventObj_tid,
102 IHTMLFrameBase2_tid,
103 IHTMLGenericElement_tid,
104 IHTMLImgElement_tid,
105 IHTMLInputElement_tid,
106 IHTMLLocation_tid,
107 IHTMLOptionElement_tid,
108 IHTMLSelectElement_tid,
109 IHTMLStyle_tid,
110 IHTMLStyle2_tid,
111 IHTMLStyle3_tid,
112 IHTMLStyle4_tid,
113 IHTMLTable_tid,
114 IHTMLTableRow_tid,
115 IHTMLTextContainer_tid,
116 IHTMLUniqueName_tid,
117 IHTMLWindow2_tid,
118 IHTMLWindow3_tid,
119 IOmNavigator_tid,
120 LAST_tid
121 } tid_t;
123 typedef struct dispex_data_t dispex_data_t;
124 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
126 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
127 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
129 typedef struct {
130 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
131 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
132 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
133 } dispex_static_data_vtbl_t;
135 typedef struct {
136 const dispex_static_data_vtbl_t *vtbl;
137 const tid_t disp_tid;
138 dispex_data_t *data;
139 const tid_t* const iface_tids;
140 } dispex_static_data_t;
142 typedef struct {
143 const IDispatchExVtbl *lpIDispatchExVtbl;
145 IUnknown *outer;
147 dispex_static_data_t *data;
148 dispex_dynamic_data_t *dynamic_data;
149 } DispatchEx;
151 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
152 void release_dispex(DispatchEx*);
153 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
154 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
156 typedef struct HTMLWindow HTMLWindow;
158 typedef enum {
159 SCRIPTMODE_GECKO,
160 SCRIPTMODE_ACTIVESCRIPT
161 } SCRIPTMODE;
163 typedef struct ScriptHost ScriptHost;
165 typedef struct {
166 WCHAR *name;
167 ScriptHost *script_host;
168 DISPID id;
169 } global_prop_t;
171 typedef struct {
172 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
174 LONG ref;
176 HTMLWindow *window;
177 } HTMLOptionElementFactory;
179 struct HTMLLocation {
180 DispatchEx dispex;
181 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
183 LONG ref;
185 HTMLWindow *window;
188 struct HTMLWindow {
189 DispatchEx dispex;
190 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
191 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
192 const IDispatchExVtbl *lpIDispatchExVtbl;
194 LONG ref;
196 HTMLDocument *doc;
197 nsIDOMWindow *nswindow;
199 event_target_t *event_target;
200 IHTMLEventObj *event;
201 BOOL *event_vector;
203 SCRIPTMODE scriptmode;
204 struct list script_hosts;
206 HTMLOptionElementFactory *option_factory;
207 HTMLLocation *location;
209 global_prop_t *global_props;
210 DWORD global_prop_cnt;
211 DWORD global_prop_size;
213 struct list entry;
216 typedef enum {
217 UNKNOWN_USERMODE,
218 BROWSEMODE,
219 EDITMODE
220 } USERMODE;
222 typedef struct {
223 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
225 ConnectionPoint *cp_list;
226 IUnknown *outer;
227 } ConnectionPointContainer;
229 struct ConnectionPoint {
230 const IConnectionPointVtbl *lpConnectionPointVtbl;
232 IConnectionPointContainer *container;
234 union {
235 IUnknown *unk;
236 IDispatch *disp;
237 IPropertyNotifySink *propnotif;
238 } *sinks;
239 DWORD sinks_size;
241 const IID *iid;
243 ConnectionPoint *next;
246 typedef struct {
247 HRESULT (*query_interface)(HTMLDocument*,REFIID,void**);
248 ULONG (*addref)(HTMLDocument*);
249 ULONG (*release)(HTMLDocument*);
250 } htmldoc_vtbl_t;
252 struct HTMLDocument {
253 DispatchEx dispex;
254 const htmldoc_vtbl_t *vtbl;
255 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
256 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
257 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
258 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
259 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
260 const IPersistFileVtbl *lpPersistFileVtbl;
261 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
262 const IMonikerPropVtbl *lpMonikerPropVtbl;
263 const IOleObjectVtbl *lpOleObjectVtbl;
264 const IOleDocumentVtbl *lpOleDocumentVtbl;
265 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
266 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
267 const IViewObject2Vtbl *lpViewObject2Vtbl;
268 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
269 const IServiceProviderVtbl *lpServiceProviderVtbl;
270 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
271 const IOleControlVtbl *lpOleControlVtbl;
272 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
273 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
274 const ICustomDocVtbl *lpCustomDocVtbl;
275 const IDispatchExVtbl *lpIDispatchExVtbl;
276 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
278 NSContainer *nscontainer;
279 HTMLWindow *window;
280 nsIDOMHTMLDocument *nsdoc;
282 IOleClientSite *client;
283 IDocHostUIHandler *hostui;
284 IOleInPlaceSite *ipsite;
285 IOleInPlaceFrame *frame;
286 IOleInPlaceUIWindow *ip_window;
288 IOleUndoManager *undomgr;
290 nsChannelBSC *bscallback;
291 IMoniker *mon;
292 LPOLESTR url;
293 struct list bindings;
295 HWND hwnd;
296 HWND tooltips_hwnd;
298 DOCHOSTUIINFO hostinfo;
300 USERMODE usermode;
301 READYSTATE readystate;
302 BOOL in_place_active;
303 BOOL ui_active;
304 BOOL window_active;
305 BOOL has_key_path;
306 BOOL container_locked;
307 BOOL focus;
308 LPWSTR mime;
310 DWORD update;
312 event_target_t *event_target;
313 ConnectionPointContainer cp_container;
314 ConnectionPoint cp_htmldocevents;
315 ConnectionPoint cp_htmldocevents2;
316 ConnectionPoint cp_propnotif;
318 struct list selection_list;
319 struct list range_list;
321 HTMLDOMNode *nodes;
324 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
326 return This->vtbl->query_interface(This, riid, ppv);
329 static inline ULONG htmldoc_addref(HTMLDocument *This)
331 return This->vtbl->addref(This);
334 static inline ULONG htmldoc_release(HTMLDocument *This)
336 return This->vtbl->release(This);
339 typedef struct {
340 HTMLDocument basedoc;
342 LONG ref;
343 } HTMLDocumentNode;
345 typedef struct {
346 HTMLDocument basedoc;
348 LONG ref;
349 } HTMLDocumentObj;
351 typedef struct {
352 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
353 NSContainer *This;
354 } nsEventListener;
356 typedef struct _mutation_queue_t {
357 DWORD type;
358 nsISupports *nsiface;
360 struct _mutation_queue_t *next;
361 } mutation_queue_t;
363 struct NSContainer {
364 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
365 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
366 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
367 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
368 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
369 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
370 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
371 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
373 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
375 const nsIRunnableVtbl *lpRunnableVtbl;
377 nsEventListener blur_listener;
378 nsEventListener focus_listener;
379 nsEventListener keypress_listener;
380 nsEventListener load_listener;
381 nsEventListener htmlevent_listener;
383 nsIWebBrowser *webbrowser;
384 nsIWebNavigation *navigation;
385 nsIBaseWindow *window;
386 nsIWebBrowserFocus *focus;
388 nsIEditor *editor;
389 nsIController *editor_controller;
391 LONG ref;
393 NSContainer *parent;
394 HTMLDocument *doc;
396 nsIURIContentListener *content_listener;
398 HWND hwnd;
400 mutation_queue_t *mutation_queue;
401 mutation_queue_t *mutation_queue_tail;
403 nsChannelBSC *bscallback; /* hack */
404 HWND reset_focus; /* hack */
407 typedef struct {
408 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
409 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
410 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
412 LONG ref;
414 nsIChannel *channel;
415 nsIHttpChannel *http_channel;
416 nsIHttpChannelInternal *http_channel_internal;
417 nsIWineURI *uri;
418 nsIInputStream *post_data_stream;
419 nsILoadGroup *load_group;
420 nsIInterfaceRequestor *notif_callback;
421 nsISupports *owner;
422 nsLoadFlags load_flags;
423 nsIURI *original_uri;
424 char *content_type;
425 char *charset;
426 PRUint32 response_status;
427 } nsChannel;
429 typedef struct {
430 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
431 void (*destructor)(HTMLDOMNode*);
432 event_target_t **(*get_event_target)(HTMLDOMNode*);
433 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
434 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
435 } NodeImplVtbl;
437 struct HTMLDOMNode {
438 DispatchEx dispex;
439 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
440 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
441 const NodeImplVtbl *vtbl;
443 LONG ref;
445 nsIDOMNode *nsnode;
446 HTMLDocument *doc;
447 event_target_t *event_target;
449 HTMLDOMNode *next;
452 typedef struct {
453 HTMLDOMNode node;
454 ConnectionPointContainer cp_container;
456 const IHTMLElementVtbl *lpHTMLElementVtbl;
457 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
458 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
460 nsIDOMHTMLElement *nselem;
461 } HTMLElement;
463 typedef struct {
464 HTMLElement element;
466 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
468 ConnectionPoint cp;
469 } HTMLTextContainer;
471 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
472 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
474 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
475 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
476 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
477 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
478 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
479 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
480 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
481 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
482 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
483 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
484 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
485 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
486 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
487 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
488 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
489 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
490 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
491 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
492 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
493 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
494 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
495 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
496 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
497 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
498 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
500 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
501 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
502 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
503 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
504 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
505 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
506 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
507 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
508 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
510 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
512 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
514 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
515 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
516 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
517 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
519 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
520 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
521 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
523 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
524 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
525 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
526 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
527 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
529 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
531 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
532 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
534 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
536 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
538 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
539 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
541 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
542 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
543 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLWindow*,HTMLDocumentNode**);
545 HRESULT HTMLWindow_Create(nsIDOMWindow*,HTMLWindow**);
546 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
547 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
548 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
549 IOmNavigator *OmNavigator_Create(void);
551 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
552 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
553 void HTMLDocument_Persist_Init(HTMLDocument*);
554 void HTMLDocument_OleCmd_Init(HTMLDocument*);
555 void HTMLDocument_OleObj_Init(HTMLDocument*);
556 void HTMLDocument_View_Init(HTMLDocument*);
557 void HTMLDocument_Window_Init(HTMLDocument*);
558 void HTMLDocument_Service_Init(HTMLDocument*);
559 void HTMLDocument_Hlink_Init(HTMLDocument*);
561 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
563 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
564 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
565 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
567 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
568 void NSContainer_Release(NSContainer*);
570 void init_mutation(NSContainer*);
571 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
572 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
574 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
575 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
576 void notif_focus(HTMLDocument*);
578 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
579 void hide_tooltip(HTMLDocument*);
580 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
582 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
584 BOOL load_gecko(BOOL);
585 void close_gecko(void);
586 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
587 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
588 void release_nsio(void);
589 BOOL install_wine_gecko(BOOL);
591 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
593 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
595 void call_property_onchanged(ConnectionPoint*,DISPID);
596 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
598 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
599 void nsfree(void*);
601 void nsACString_Init(nsACString*,const char*);
602 void nsACString_SetData(nsACString*,const char*);
603 PRUint32 nsACString_GetData(const nsACString*,const char**);
604 void nsACString_Finish(nsACString*);
606 void nsAString_Init(nsAString*,const PRUnichar*);
607 void nsAString_SetData(nsAString*,const PRUnichar*);
608 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
609 void nsAString_Finish(nsAString*);
611 nsICommandParams *create_nscommand_params(void);
612 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
613 void get_editor_controller(NSContainer*);
614 void init_nsevents(NSContainer*);
615 void add_nsevent_listener(HTMLWindow*,LPCWSTR);
616 nsresult get_nsinterface(nsISupports*,REFIID,void**);
617 void update_nsdocument(HTMLDocument*);
619 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
620 void set_current_mon(HTMLDocument*,IMoniker*);
621 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
623 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
625 nsChannelBSC *create_channelbsc(IMoniker*);
626 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
627 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
628 IMoniker *get_channelbsc_mon(nsChannelBSC*);
630 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
631 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
632 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
633 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
634 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
636 void detach_selection(HTMLDocument*);
637 void detach_ranges(HTMLDocument*);
638 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
640 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
642 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
643 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
644 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
645 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
646 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
647 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
648 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
649 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
650 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
651 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
652 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
653 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
654 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
655 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
657 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
658 void HTMLElement_Init(HTMLElement*);
659 void HTMLElement2_Init(HTMLElement*);
660 void HTMLElement3_Init(HTMLElement*);
661 void HTMLTextContainer_Init(HTMLTextContainer*);
663 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
664 void HTMLDOMNode_destructor(HTMLDOMNode*);
666 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
667 void HTMLElement_destructor(HTMLDOMNode*);
669 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
670 void release_nodes(HTMLDocument*);
672 void release_script_hosts(HTMLWindow*);
673 void connect_scripts(HTMLWindow*);
674 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
675 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
676 void set_script_mode(HTMLWindow*,SCRIPTMODE);
677 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
678 IDispatch *get_script_disp(ScriptHost*);
680 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
681 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
682 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
684 /* commands */
685 typedef struct {
686 DWORD id;
687 HRESULT (*query)(HTMLDocument*,OLECMD*);
688 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
689 } cmdtable_t;
691 extern const cmdtable_t editmode_cmds[];
693 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
695 /* timer */
696 #define UPDATE_UI 0x0001
697 #define UPDATE_TITLE 0x0002
699 void update_doc(HTMLDocument *This, DWORD flags);
700 void update_title(HTMLDocument*);
702 /* editor */
703 void init_editor(HTMLDocument*);
704 void set_ns_editmode(NSContainer*);
705 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
706 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
707 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
708 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
709 void handle_edit_load(HTMLDocument*);
710 HRESULT editor_is_dirty(HTMLDocument*);
711 void set_dirty(HTMLDocument*,VARIANT_BOOL);
713 extern DWORD mshtml_tls;
715 typedef struct task_t {
716 HTMLDocument *doc;
718 enum {
719 TASK_SETDOWNLOADSTATE,
720 TASK_PARSECOMPLETE,
721 TASK_SETPROGRESS,
722 TASK_START_BINDING
723 } task_id;
725 nsChannelBSC *bscallback;
727 struct task_t *next;
728 } task_t;
730 typedef struct {
731 HWND thread_hwnd;
732 task_t *task_queue_head;
733 task_t *task_queue_tail;
734 struct list timer_list;
735 } thread_data_t;
737 thread_data_t *get_thread_data(BOOL);
738 HWND get_thread_hwnd(void);
739 void push_task(task_t*);
740 void remove_doc_tasks(const HTMLDocument*);
741 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
742 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
744 void release_typelib(void);
745 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
747 const char *debugstr_variant(const VARIANT*);
749 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
750 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
751 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
752 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
753 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
755 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
757 /* memory allocation functions */
759 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
761 return HeapAlloc(GetProcessHeap(), 0, len);
764 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
766 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
769 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
771 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
774 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
776 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
779 static inline BOOL heap_free(void *mem)
781 return HeapFree(GetProcessHeap(), 0, mem);
784 static inline LPWSTR heap_strdupW(LPCWSTR str)
786 LPWSTR ret = NULL;
788 if(str) {
789 DWORD size;
791 size = (strlenW(str)+1)*sizeof(WCHAR);
792 ret = heap_alloc(size);
793 memcpy(ret, str, size);
796 return ret;
799 static inline char *heap_strdupA(const char *str)
801 char *ret = NULL;
803 if(str) {
804 DWORD size;
806 size = strlen(str)+1;
807 ret = heap_alloc(size);
808 memcpy(ret, str, size);
811 return ret;
814 static inline WCHAR *heap_strdupAtoW(const char *str)
816 LPWSTR ret = NULL;
818 if(str) {
819 DWORD len;
821 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
822 ret = heap_alloc(len*sizeof(WCHAR));
823 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
826 return ret;
829 static inline char *heap_strdupWtoA(LPCWSTR str)
831 char *ret = NULL;
833 if(str) {
834 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
835 ret = heap_alloc(size);
836 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
839 return ret;
842 HINSTANCE get_shdoclc(void);
844 extern HINSTANCE hInst;