mshtml: Properly release DispatchEx data.
[wine/multimedia.git] / dlls / mshtml / mshtml_private.h
blobecae0a55310d4f2fc6e4709f91d46d774fa2aa98
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 "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 {
157 DispatchEx dispex;
158 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
159 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
160 const IDispatchExVtbl *lpIDispatchExVtbl;
162 LONG ref;
164 HTMLDocument *doc;
165 nsIDOMWindow *nswindow;
167 IHTMLEventObj *event;
169 struct list entry;
170 } HTMLWindow;
172 typedef enum {
173 UNKNOWN_USERMODE,
174 BROWSEMODE,
175 EDITMODE
176 } USERMODE;
178 typedef enum {
179 SCRIPTMODE_GECKO,
180 SCRIPTMODE_ACTIVESCRIPT
181 } SCRIPTMODE;
183 typedef struct {
184 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
186 ConnectionPoint *cp_list;
187 IUnknown *outer;
188 } ConnectionPointContainer;
190 struct ConnectionPoint {
191 const IConnectionPointVtbl *lpConnectionPointVtbl;
193 IConnectionPointContainer *container;
195 union {
196 IUnknown *unk;
197 IDispatch *disp;
198 IPropertyNotifySink *propnotif;
199 } *sinks;
200 DWORD sinks_size;
202 const IID *iid;
204 ConnectionPoint *next;
207 struct HTMLLocation {
208 DispatchEx dispex;
209 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
211 LONG ref;
213 HTMLDocument *doc;
216 typedef struct {
217 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
219 LONG ref;
221 HTMLDocument *doc;
222 } HTMLOptionElementFactory;
224 struct HTMLDocument {
225 DispatchEx dispex;
226 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
227 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
228 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
229 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
230 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
231 const IPersistFileVtbl *lpPersistFileVtbl;
232 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
233 const IMonikerPropVtbl *lpMonikerPropVtbl;
234 const IOleObjectVtbl *lpOleObjectVtbl;
235 const IOleDocumentVtbl *lpOleDocumentVtbl;
236 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
237 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
238 const IViewObject2Vtbl *lpViewObject2Vtbl;
239 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
240 const IServiceProviderVtbl *lpServiceProviderVtbl;
241 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
242 const IOleControlVtbl *lpOleControlVtbl;
243 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
244 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
245 const ICustomDocVtbl *lpCustomDocVtbl;
246 const IDispatchExVtbl *lpIDispatchExVtbl;
247 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
248 LONG ref;
250 NSContainer *nscontainer;
251 HTMLWindow *window;
252 nsIDOMHTMLDocument *nsdoc;
254 IOleClientSite *client;
255 IDocHostUIHandler *hostui;
256 IOleInPlaceSite *ipsite;
257 IOleInPlaceFrame *frame;
258 IOleInPlaceUIWindow *ip_window;
260 IOleUndoManager *undomgr;
262 nsChannelBSC *bscallback;
263 IMoniker *mon;
264 LPOLESTR url;
265 struct list bindings;
267 struct list script_hosts;
269 HWND hwnd;
270 HWND tooltips_hwnd;
272 DOCHOSTUIINFO hostinfo;
274 USERMODE usermode;
275 SCRIPTMODE scriptmode;
276 READYSTATE readystate;
277 BOOL in_place_active;
278 BOOL ui_active;
279 BOOL window_active;
280 BOOL has_key_path;
281 BOOL container_locked;
282 BOOL focus;
283 LPWSTR mime;
285 DWORD update;
287 event_target_t *event_target;
288 ConnectionPointContainer cp_container;
289 ConnectionPoint cp_htmldocevents;
290 ConnectionPoint cp_htmldocevents2;
291 ConnectionPoint cp_propnotif;
293 HTMLOptionElementFactory *option_factory;
294 HTMLLocation *location;
296 struct list selection_list;
297 struct list range_list;
299 HTMLDOMNode *nodes;
302 typedef struct {
303 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
304 NSContainer *This;
305 } nsEventListener;
307 typedef struct _mutation_queue_t {
308 DWORD type;
309 nsISupports *nsiface;
311 struct _mutation_queue_t *next;
312 } mutation_queue_t;
314 struct NSContainer {
315 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
316 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
317 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
318 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
319 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
320 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
321 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
322 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
324 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
326 const nsIRunnableVtbl *lpRunnableVtbl;
328 nsEventListener blur_listener;
329 nsEventListener focus_listener;
330 nsEventListener keypress_listener;
331 nsEventListener load_listener;
332 nsEventListener htmlevent_listener;
334 nsIWebBrowser *webbrowser;
335 nsIWebNavigation *navigation;
336 nsIBaseWindow *window;
337 nsIWebBrowserFocus *focus;
339 nsIEditor *editor;
340 nsIController *editor_controller;
342 LONG ref;
344 NSContainer *parent;
345 HTMLDocument *doc;
347 nsIURIContentListener *content_listener;
349 HWND hwnd;
351 mutation_queue_t *mutation_queue;
352 mutation_queue_t *mutation_queue_tail;
354 nsChannelBSC *bscallback; /* hack */
355 HWND reset_focus; /* hack */
357 BOOL *event_vector;
360 typedef struct {
361 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
362 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
363 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
365 LONG ref;
367 nsIChannel *channel;
368 nsIHttpChannel *http_channel;
369 nsIHttpChannelInternal *http_channel_internal;
370 nsIWineURI *uri;
371 nsIInputStream *post_data_stream;
372 nsILoadGroup *load_group;
373 nsIInterfaceRequestor *notif_callback;
374 nsISupports *owner;
375 nsLoadFlags load_flags;
376 nsIURI *original_uri;
377 char *content_type;
378 char *charset;
379 PRUint32 response_status;
380 } nsChannel;
382 typedef struct {
383 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
384 void (*destructor)(HTMLDOMNode*);
385 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
386 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
387 } NodeImplVtbl;
389 struct HTMLDOMNode {
390 DispatchEx dispex;
391 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
392 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
393 const NodeImplVtbl *vtbl;
395 LONG ref;
397 nsIDOMNode *nsnode;
398 HTMLDocument *doc;
399 event_target_t *event_target;
401 HTMLDOMNode *next;
404 typedef struct {
405 HTMLDOMNode node;
406 ConnectionPointContainer cp_container;
408 const IHTMLElementVtbl *lpHTMLElementVtbl;
409 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
410 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
412 nsIDOMHTMLElement *nselem;
413 } HTMLElement;
415 typedef struct {
416 HTMLElement element;
418 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
420 ConnectionPoint cp;
421 } HTMLTextContainer;
423 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
424 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
426 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
427 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
428 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
429 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
430 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
431 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
432 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
433 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
434 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
435 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
436 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
437 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
438 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
439 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
440 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
441 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
442 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
443 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
444 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
445 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
446 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
447 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
448 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
449 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
450 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
452 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
453 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
454 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
455 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
456 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
457 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
458 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
459 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
460 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
462 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
464 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
466 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
467 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
468 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
469 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
471 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
472 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
473 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
475 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
476 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
477 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
478 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
479 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
481 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
483 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
484 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
486 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
488 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
490 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
491 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
493 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
494 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
495 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocument**);
497 HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
498 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
499 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
500 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
501 IOmNavigator *OmNavigator_Create(void);
503 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
504 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
505 void HTMLDocument_Persist_Init(HTMLDocument*);
506 void HTMLDocument_OleCmd_Init(HTMLDocument*);
507 void HTMLDocument_OleObj_Init(HTMLDocument*);
508 void HTMLDocument_View_Init(HTMLDocument*);
509 void HTMLDocument_Window_Init(HTMLDocument*);
510 void HTMLDocument_Service_Init(HTMLDocument*);
511 void HTMLDocument_Hlink_Init(HTMLDocument*);
513 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
515 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
516 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
517 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
519 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
520 void NSContainer_Release(NSContainer*);
522 void init_mutation(NSContainer*);
523 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
524 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
526 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
527 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
528 void notif_focus(HTMLDocument*);
530 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
531 void hide_tooltip(HTMLDocument*);
532 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
534 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
536 BOOL load_gecko(BOOL);
537 void close_gecko(void);
538 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
539 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
540 void release_nsio(void);
541 BOOL install_wine_gecko(BOOL);
543 HRESULT nsuri_to_url(LPCWSTR,BSTR*);
545 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
547 void call_property_onchanged(ConnectionPoint*,DISPID);
548 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
550 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
551 void nsfree(void*);
553 void nsACString_Init(nsACString*,const char*);
554 void nsACString_SetData(nsACString*,const char*);
555 PRUint32 nsACString_GetData(const nsACString*,const char**);
556 void nsACString_Finish(nsACString*);
558 void nsAString_Init(nsAString*,const PRUnichar*);
559 void nsAString_SetData(nsAString*,const PRUnichar*);
560 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
561 void nsAString_Finish(nsAString*);
563 nsICommandParams *create_nscommand_params(void);
564 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
565 void get_editor_controller(NSContainer*);
566 void init_nsevents(NSContainer*);
567 void add_nsevent_listener(NSContainer*,LPCWSTR);
568 nsresult get_nsinterface(nsISupports*,REFIID,void**);
569 void update_nsdocument(HTMLDocument*);
571 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
572 void set_current_mon(HTMLDocument*,IMoniker*);
573 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
575 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
577 nsChannelBSC *create_channelbsc(IMoniker*);
578 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
579 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
580 IMoniker *get_channelbsc_mon(nsChannelBSC*);
582 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
583 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
584 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
585 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
586 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
588 void detach_selection(HTMLDocument*);
589 void detach_ranges(HTMLDocument*);
590 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
592 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
594 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
595 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
596 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
597 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
598 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
599 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
600 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
601 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
602 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
603 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
604 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
605 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
606 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
607 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
609 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
610 void HTMLElement_Init(HTMLElement*);
611 void HTMLElement2_Init(HTMLElement*);
612 void HTMLElement3_Init(HTMLElement*);
613 void HTMLTextContainer_Init(HTMLTextContainer*);
615 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
616 void HTMLDOMNode_destructor(HTMLDOMNode*);
618 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
619 void HTMLElement_destructor(HTMLDOMNode*);
621 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
622 void release_nodes(HTMLDocument*);
624 void release_script_hosts(HTMLDocument*);
625 void connect_scripts(HTMLDocument*);
626 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
627 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
628 void set_script_mode(HTMLDocument*,SCRIPTMODE);
630 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
631 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
632 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
634 /* commands */
635 typedef struct {
636 DWORD id;
637 HRESULT (*query)(HTMLDocument*,OLECMD*);
638 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
639 } cmdtable_t;
641 extern const cmdtable_t editmode_cmds[];
643 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
645 /* timer */
646 #define UPDATE_UI 0x0001
647 #define UPDATE_TITLE 0x0002
649 void update_doc(HTMLDocument *This, DWORD flags);
650 void update_title(HTMLDocument*);
652 /* editor */
653 void init_editor(HTMLDocument*);
654 void set_ns_editmode(NSContainer*);
655 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
656 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
657 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
658 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
659 void handle_edit_load(HTMLDocument*);
660 HRESULT editor_is_dirty(HTMLDocument*);
661 void set_dirty(HTMLDocument*,VARIANT_BOOL);
663 extern DWORD mshtml_tls;
665 typedef struct task_t {
666 HTMLDocument *doc;
668 enum {
669 TASK_SETDOWNLOADSTATE,
670 TASK_PARSECOMPLETE,
671 TASK_SETPROGRESS,
672 TASK_START_BINDING
673 } task_id;
675 nsChannelBSC *bscallback;
677 struct task_t *next;
678 } task_t;
680 typedef struct {
681 HWND thread_hwnd;
682 task_t *task_queue_head;
683 task_t *task_queue_tail;
684 struct list timer_list;
685 } thread_data_t;
687 thread_data_t *get_thread_data(BOOL);
688 HWND get_thread_hwnd(void);
689 void push_task(task_t*);
690 void remove_doc_tasks(const HTMLDocument*);
691 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
692 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
694 void release_typelib(void);
695 void call_disp_func(HTMLDocument*,IDispatch*,IDispatch*);
697 const char *debugstr_variant(const VARIANT*);
699 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
700 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
701 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
702 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
703 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
705 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
707 /* memory allocation functions */
709 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
711 return HeapAlloc(GetProcessHeap(), 0, len);
714 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
716 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
719 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
721 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
724 static inline BOOL heap_free(void *mem)
726 return HeapFree(GetProcessHeap(), 0, mem);
729 static inline LPWSTR heap_strdupW(LPCWSTR str)
731 LPWSTR ret = NULL;
733 if(str) {
734 DWORD size;
736 size = (strlenW(str)+1)*sizeof(WCHAR);
737 ret = heap_alloc(size);
738 memcpy(ret, str, size);
741 return ret;
744 static inline char *heap_strdupA(const char *str)
746 char *ret = NULL;
748 if(str) {
749 DWORD size;
751 size = strlen(str)+1;
752 ret = heap_alloc(size);
753 memcpy(ret, str, size);
756 return ret;
759 static inline WCHAR *heap_strdupAtoW(const char *str)
761 LPWSTR ret = NULL;
763 if(str) {
764 DWORD len;
766 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
767 ret = heap_alloc(len*sizeof(WCHAR));
768 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
771 return ret;
774 static inline char *heap_strdupWtoA(LPCWSTR str)
776 char *ret = NULL;
778 if(str) {
779 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
780 ret = heap_alloc(size);
781 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
784 return ret;
787 HINSTANCE get_shdoclc(void);
789 extern HINSTANCE hInst;