dpwsockx: Implementation of SPInit
[wine/gsoc_dplay.git] / dlls / mshtml / mshtml_private.h
blobc3be4b98760c7b9749c7e15235ac7c0b8e07c717
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 (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
131 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
132 } dispex_static_data_vtbl_t;
134 typedef struct {
135 const dispex_static_data_vtbl_t *vtbl;
136 const tid_t disp_tid;
137 dispex_data_t *data;
138 const tid_t* const iface_tids;
139 } dispex_static_data_t;
141 typedef struct {
142 const IDispatchExVtbl *lpIDispatchExVtbl;
144 IUnknown *outer;
146 dispex_static_data_t *data;
147 dispex_dynamic_data_t *dynamic_data;
148 } DispatchEx;
150 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
151 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
152 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
154 typedef struct {
155 DispatchEx dispex;
156 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
157 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
158 const IDispatchExVtbl *lpIDispatchExVtbl;
160 LONG ref;
162 HTMLDocument *doc;
163 nsIDOMWindow *nswindow;
165 IHTMLEventObj *event;
167 struct list entry;
168 } HTMLWindow;
170 typedef enum {
171 UNKNOWN_USERMODE,
172 BROWSEMODE,
173 EDITMODE
174 } USERMODE;
176 typedef enum {
177 SCRIPTMODE_GECKO,
178 SCRIPTMODE_ACTIVESCRIPT
179 } SCRIPTMODE;
181 typedef struct {
182 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
184 ConnectionPoint *cp_list;
185 IUnknown *outer;
186 } ConnectionPointContainer;
188 struct ConnectionPoint {
189 const IConnectionPointVtbl *lpConnectionPointVtbl;
191 IConnectionPointContainer *container;
193 union {
194 IUnknown *unk;
195 IDispatch *disp;
196 IPropertyNotifySink *propnotif;
197 } *sinks;
198 DWORD sinks_size;
200 const IID *iid;
202 ConnectionPoint *next;
205 struct HTMLLocation {
206 DispatchEx dispex;
207 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
209 LONG ref;
211 HTMLDocument *doc;
214 typedef struct {
215 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
217 LONG ref;
219 HTMLDocument *doc;
220 } HTMLOptionElementFactory;
222 struct HTMLDocument {
223 DispatchEx dispex;
224 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
225 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
226 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
227 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
228 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
229 const IPersistFileVtbl *lpPersistFileVtbl;
230 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
231 const IMonikerPropVtbl *lpMonikerPropVtbl;
232 const IOleObjectVtbl *lpOleObjectVtbl;
233 const IOleDocumentVtbl *lpOleDocumentVtbl;
234 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
235 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
236 const IViewObject2Vtbl *lpViewObject2Vtbl;
237 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
238 const IServiceProviderVtbl *lpServiceProviderVtbl;
239 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
240 const IOleControlVtbl *lpOleControlVtbl;
241 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
242 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
243 const ICustomDocVtbl *lpCustomDocVtbl;
244 const IDispatchExVtbl *lpIDispatchExVtbl;
245 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
246 LONG ref;
248 NSContainer *nscontainer;
249 HTMLWindow *window;
250 nsIDOMHTMLDocument *nsdoc;
252 IOleClientSite *client;
253 IDocHostUIHandler *hostui;
254 IOleInPlaceSite *ipsite;
255 IOleInPlaceFrame *frame;
256 IOleInPlaceUIWindow *ip_window;
258 IOleUndoManager *undomgr;
260 nsChannelBSC *bscallback;
261 IMoniker *mon;
262 LPOLESTR url;
263 struct list bindings;
265 struct list script_hosts;
267 HWND hwnd;
268 HWND tooltips_hwnd;
270 DOCHOSTUIINFO hostinfo;
272 USERMODE usermode;
273 SCRIPTMODE scriptmode;
274 READYSTATE readystate;
275 BOOL in_place_active;
276 BOOL ui_active;
277 BOOL window_active;
278 BOOL has_key_path;
279 BOOL container_locked;
280 BOOL focus;
281 LPWSTR mime;
283 DWORD update;
285 event_target_t *event_target;
286 ConnectionPointContainer cp_container;
287 ConnectionPoint cp_htmldocevents;
288 ConnectionPoint cp_htmldocevents2;
289 ConnectionPoint cp_propnotif;
291 HTMLOptionElementFactory *option_factory;
292 HTMLLocation *location;
294 struct list selection_list;
295 struct list range_list;
297 HTMLDOMNode *nodes;
300 typedef struct {
301 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
302 NSContainer *This;
303 } nsEventListener;
305 typedef struct _mutation_queue_t {
306 DWORD type;
307 nsISupports *nsiface;
309 struct _mutation_queue_t *next;
310 } mutation_queue_t;
312 struct NSContainer {
313 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
314 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
315 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
316 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
317 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
318 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
319 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
320 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
322 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
324 const nsIRunnableVtbl *lpRunnableVtbl;
326 nsEventListener blur_listener;
327 nsEventListener focus_listener;
328 nsEventListener keypress_listener;
329 nsEventListener load_listener;
330 nsEventListener htmlevent_listener;
332 nsIWebBrowser *webbrowser;
333 nsIWebNavigation *navigation;
334 nsIBaseWindow *window;
335 nsIWebBrowserFocus *focus;
337 nsIEditor *editor;
338 nsIController *editor_controller;
340 LONG ref;
342 NSContainer *parent;
343 HTMLDocument *doc;
345 nsIURIContentListener *content_listener;
347 HWND hwnd;
349 mutation_queue_t *mutation_queue;
350 mutation_queue_t *mutation_queue_tail;
352 nsChannelBSC *bscallback; /* hack */
353 HWND reset_focus; /* hack */
355 BOOL *event_vector;
358 typedef struct {
359 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
360 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
361 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
363 LONG ref;
365 nsIChannel *channel;
366 nsIHttpChannel *http_channel;
367 nsIHttpChannelInternal *http_channel_internal;
368 nsIWineURI *uri;
369 nsIInputStream *post_data_stream;
370 nsILoadGroup *load_group;
371 nsIInterfaceRequestor *notif_callback;
372 nsISupports *owner;
373 nsLoadFlags load_flags;
374 nsIURI *original_uri;
375 char *content_type;
376 char *charset;
377 PRUint32 response_status;
378 } nsChannel;
380 typedef struct {
381 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
382 void (*destructor)(HTMLDOMNode*);
383 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
384 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
385 } NodeImplVtbl;
387 struct HTMLDOMNode {
388 DispatchEx dispex;
389 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
390 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
391 const NodeImplVtbl *vtbl;
393 LONG ref;
395 nsIDOMNode *nsnode;
396 HTMLDocument *doc;
397 event_target_t *event_target;
399 HTMLDOMNode *next;
402 typedef struct {
403 HTMLDOMNode node;
404 ConnectionPointContainer cp_container;
406 const IHTMLElementVtbl *lpHTMLElementVtbl;
407 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
408 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
410 nsIDOMHTMLElement *nselem;
411 } HTMLElement;
413 typedef struct {
414 HTMLElement element;
416 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
418 ConnectionPoint cp;
419 } HTMLTextContainer;
421 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
422 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
424 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
425 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
426 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
427 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
428 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
429 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
430 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
431 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
432 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
433 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
434 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
435 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
436 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
437 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
438 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
439 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
440 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
441 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
442 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
443 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
444 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
445 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
446 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
447 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
448 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
450 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
451 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
452 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
453 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
454 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
455 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
456 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
457 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
458 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
460 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
462 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
464 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
465 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
466 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
467 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
469 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
470 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
471 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
473 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
474 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
475 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
476 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
477 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
479 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
481 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
482 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
484 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
486 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
488 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
489 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
491 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
492 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
493 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocument**);
495 HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
496 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
497 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
498 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
499 IOmNavigator *OmNavigator_Create(void);
501 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
502 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
503 void HTMLDocument_Persist_Init(HTMLDocument*);
504 void HTMLDocument_OleCmd_Init(HTMLDocument*);
505 void HTMLDocument_OleObj_Init(HTMLDocument*);
506 void HTMLDocument_View_Init(HTMLDocument*);
507 void HTMLDocument_Window_Init(HTMLDocument*);
508 void HTMLDocument_Service_Init(HTMLDocument*);
509 void HTMLDocument_Hlink_Init(HTMLDocument*);
511 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
513 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
514 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
515 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
517 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
518 void NSContainer_Release(NSContainer*);
520 void init_mutation(NSContainer*);
521 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
522 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
524 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
525 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
526 void notif_focus(HTMLDocument*);
528 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
529 void hide_tooltip(HTMLDocument*);
530 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
532 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
534 BOOL load_gecko(BOOL);
535 void close_gecko(void);
536 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
537 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
538 void release_nsio(void);
539 BOOL install_wine_gecko(BOOL);
541 HRESULT nsuri_to_url(LPCWSTR,BSTR*);
543 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
545 void call_property_onchanged(ConnectionPoint*,DISPID);
546 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
548 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
549 void nsfree(void*);
551 void nsACString_Init(nsACString*,const char*);
552 void nsACString_SetData(nsACString*,const char*);
553 PRUint32 nsACString_GetData(const nsACString*,const char**);
554 void nsACString_Finish(nsACString*);
556 void nsAString_Init(nsAString*,const PRUnichar*);
557 void nsAString_SetData(nsAString*,const PRUnichar*);
558 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
559 void nsAString_Finish(nsAString*);
561 nsICommandParams *create_nscommand_params(void);
562 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
563 void get_editor_controller(NSContainer*);
564 void init_nsevents(NSContainer*);
565 void add_nsevent_listener(NSContainer*,LPCWSTR);
566 nsresult get_nsinterface(nsISupports*,REFIID,void**);
567 void update_nsdocument(HTMLDocument*);
569 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
570 void set_current_mon(HTMLDocument*,IMoniker*);
571 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
573 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
575 nsChannelBSC *create_channelbsc(IMoniker*);
576 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
577 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
578 IMoniker *get_channelbsc_mon(nsChannelBSC*);
580 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
581 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
582 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
583 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
584 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
586 void detach_selection(HTMLDocument*);
587 void detach_ranges(HTMLDocument*);
588 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
590 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
592 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
593 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
594 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
595 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
596 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
597 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
598 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
599 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
600 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
601 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
602 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
603 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
604 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
605 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
607 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
608 void HTMLElement_Init(HTMLElement*);
609 void HTMLElement2_Init(HTMLElement*);
610 void HTMLElement3_Init(HTMLElement*);
611 void HTMLTextContainer_Init(HTMLTextContainer*);
613 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
614 void HTMLDOMNode_destructor(HTMLDOMNode*);
616 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
617 void HTMLElement_destructor(HTMLDOMNode*);
619 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
620 void release_nodes(HTMLDocument*);
622 void release_script_hosts(HTMLDocument*);
623 void connect_scripts(HTMLDocument*);
624 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
625 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
626 void set_script_mode(HTMLDocument*,SCRIPTMODE);
628 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
629 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
630 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
632 /* commands */
633 typedef struct {
634 DWORD id;
635 HRESULT (*query)(HTMLDocument*,OLECMD*);
636 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
637 } cmdtable_t;
639 extern const cmdtable_t editmode_cmds[];
641 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
643 /* timer */
644 #define UPDATE_UI 0x0001
645 #define UPDATE_TITLE 0x0002
647 void update_doc(HTMLDocument *This, DWORD flags);
648 void update_title(HTMLDocument*);
650 /* editor */
651 void init_editor(HTMLDocument*);
652 void set_ns_editmode(NSContainer*);
653 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
654 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
655 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
656 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
657 void handle_edit_load(HTMLDocument*);
658 HRESULT editor_is_dirty(HTMLDocument*);
659 void set_dirty(HTMLDocument*,VARIANT_BOOL);
661 extern DWORD mshtml_tls;
663 typedef struct task_t {
664 HTMLDocument *doc;
666 enum {
667 TASK_SETDOWNLOADSTATE,
668 TASK_PARSECOMPLETE,
669 TASK_SETPROGRESS,
670 TASK_START_BINDING
671 } task_id;
673 nsChannelBSC *bscallback;
675 struct task_t *next;
676 } task_t;
678 typedef struct {
679 HWND thread_hwnd;
680 task_t *task_queue_head;
681 task_t *task_queue_tail;
682 struct list timer_list;
683 } thread_data_t;
685 thread_data_t *get_thread_data(BOOL);
686 HWND get_thread_hwnd(void);
687 void push_task(task_t*);
688 void remove_doc_tasks(const HTMLDocument*);
689 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
690 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
692 void release_typelib(void);
693 void call_disp_func(HTMLDocument*,IDispatch*,IDispatch*);
695 const char *debugstr_variant(const VARIANT*);
697 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
698 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
699 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
700 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
701 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
703 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
705 /* memory allocation functions */
707 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
709 return HeapAlloc(GetProcessHeap(), 0, len);
712 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
714 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
717 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
719 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
722 static inline BOOL heap_free(void *mem)
724 return HeapFree(GetProcessHeap(), 0, mem);
727 static inline LPWSTR heap_strdupW(LPCWSTR str)
729 LPWSTR ret = NULL;
731 if(str) {
732 DWORD size;
734 size = (strlenW(str)+1)*sizeof(WCHAR);
735 ret = heap_alloc(size);
736 memcpy(ret, str, size);
739 return ret;
742 static inline char *heap_strdupA(const char *str)
744 char *ret = NULL;
746 if(str) {
747 DWORD size;
749 size = strlen(str)+1;
750 ret = heap_alloc(size);
751 memcpy(ret, str, size);
754 return ret;
757 static inline WCHAR *heap_strdupAtoW(const char *str)
759 LPWSTR ret = NULL;
761 if(str) {
762 DWORD len;
764 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
765 ret = heap_alloc(len*sizeof(WCHAR));
766 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
769 return ret;
772 static inline char *heap_strdupWtoA(LPCWSTR str)
774 char *ret = NULL;
776 if(str) {
777 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
778 ret = heap_alloc(size);
779 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
782 return ret;
785 HINSTANCE get_shdoclc(void);
787 extern HINSTANCE hInst;