wined3d: Introduce struct wined3d_shader_src_param.
[wine/hacks.git] / dlls / mshtml / mshtml_private.h
blob3ecfdea1c3bb98e6f0c04710f3d73f82e1d65d40
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 DispCEventObj_tid,
65 DispDOMChildrenCollection_tid,
66 DispHTMLBody_tid,
67 DispHTMLCommentElement_tid,
68 DispHTMLCurrentStyle_tid,
69 DispHTMLDocument_tid,
70 DispHTMLDOMTextNode_tid,
71 DispHTMLElementCollection_tid,
72 DispHTMLGenericElement_tid,
73 DispHTMLIFrame_tid,
74 DispHTMLImg_tid,
75 DispHTMLInputElement_tid,
76 DispHTMLOptionElement_tid,
77 DispHTMLSelectElement_tid,
78 DispHTMLStyle_tid,
79 DispHTMLTable_tid,
80 DispHTMLTableRow_tid,
81 DispHTMLUnknownElement_tid,
82 DispHTMLWindow2_tid,
83 IHTMLBodyElement_tid,
84 IHTMLBodyElement2_tid,
85 IHTMLCommentElement_tid,
86 IHTMLCurrentStyle_tid,
87 IHTMLCurrentStyle2_tid,
88 IHTMLCurrentStyle3_tid,
89 IHTMLCurrentStyle4_tid,
90 IHTMLDocument2_tid,
91 IHTMLDocument3_tid,
92 IHTMLDocument4_tid,
93 IHTMLDocument5_tid,
94 IHTMLDOMChildrenCollection_tid,
95 IHTMLDOMNode_tid,
96 IHTMLDOMNode2_tid,
97 IHTMLDOMTextNode_tid,
98 IHTMLElement_tid,
99 IHTMLElement2_tid,
100 IHTMLElement3_tid,
101 IHTMLElement4_tid,
102 IHTMLElementCollection_tid,
103 IHTMLEventObj_tid,
104 IHTMLFrameBase2_tid,
105 IHTMLGenericElement_tid,
106 IHTMLImgElement_tid,
107 IHTMLInputElement_tid,
108 IHTMLLocation_tid,
109 IHTMLOptionElement_tid,
110 IHTMLSelectElement_tid,
111 IHTMLStyle_tid,
112 IHTMLStyle2_tid,
113 IHTMLStyle3_tid,
114 IHTMLStyle4_tid,
115 IHTMLTable_tid,
116 IHTMLTableRow_tid,
117 IHTMLTextContainer_tid,
118 IHTMLUniqueName_tid,
119 IHTMLWindow2_tid,
120 IHTMLWindow3_tid,
121 IOmNavigator_tid,
122 LAST_tid
123 } tid_t;
125 typedef struct dispex_data_t dispex_data_t;
126 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
128 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
129 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
131 typedef struct {
132 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
133 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
134 } dispex_static_data_vtbl_t;
136 typedef struct {
137 const dispex_static_data_vtbl_t *vtbl;
138 const tid_t disp_tid;
139 dispex_data_t *data;
140 const tid_t* const iface_tids;
141 } dispex_static_data_t;
143 typedef struct {
144 const IDispatchExVtbl *lpIDispatchExVtbl;
146 IUnknown *outer;
148 dispex_static_data_t *data;
149 dispex_dynamic_data_t *dynamic_data;
150 } DispatchEx;
152 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
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 IMonikerPropVtbl *lpMonikerPropVtbl;
233 const IOleObjectVtbl *lpOleObjectVtbl;
234 const IOleDocumentVtbl *lpOleDocumentVtbl;
235 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
236 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
237 const IViewObject2Vtbl *lpViewObject2Vtbl;
238 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
239 const IServiceProviderVtbl *lpServiceProviderVtbl;
240 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
241 const IOleControlVtbl *lpOleControlVtbl;
242 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
243 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
244 const ICustomDocVtbl *lpCustomDocVtbl;
245 const IDispatchExVtbl *lpIDispatchExVtbl;
246 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
247 LONG ref;
249 NSContainer *nscontainer;
250 HTMLWindow *window;
251 nsIDOMHTMLDocument *nsdoc;
253 IOleClientSite *client;
254 IDocHostUIHandler *hostui;
255 IOleInPlaceSite *ipsite;
256 IOleInPlaceFrame *frame;
257 IOleInPlaceUIWindow *ip_window;
259 IOleUndoManager *undomgr;
261 nsChannelBSC *bscallback;
262 IMoniker *mon;
263 LPOLESTR url;
264 struct list bindings;
266 struct list script_hosts;
268 HWND hwnd;
269 HWND tooltips_hwnd;
271 DOCHOSTUIINFO hostinfo;
273 USERMODE usermode;
274 SCRIPTMODE scriptmode;
275 READYSTATE readystate;
276 BOOL in_place_active;
277 BOOL ui_active;
278 BOOL window_active;
279 BOOL has_key_path;
280 BOOL container_locked;
281 BOOL focus;
282 LPWSTR mime;
284 DWORD update;
286 event_target_t *event_target;
287 ConnectionPointContainer cp_container;
288 ConnectionPoint cp_htmldocevents;
289 ConnectionPoint cp_htmldocevents2;
290 ConnectionPoint cp_propnotif;
292 HTMLOptionElementFactory *option_factory;
293 HTMLLocation *location;
295 struct list selection_list;
296 struct list range_list;
298 HTMLDOMNode *nodes;
301 typedef struct {
302 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
303 NSContainer *This;
304 } nsEventListener;
306 typedef struct _mutation_queue_t {
307 DWORD type;
308 nsISupports *nsiface;
310 struct _mutation_queue_t *next;
311 } mutation_queue_t;
313 struct NSContainer {
314 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
315 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
316 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
317 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
318 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
319 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
320 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
321 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
323 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
325 const nsIRunnableVtbl *lpRunnableVtbl;
327 nsEventListener blur_listener;
328 nsEventListener focus_listener;
329 nsEventListener keypress_listener;
330 nsEventListener load_listener;
331 nsEventListener htmlevent_listener;
333 nsIWebBrowser *webbrowser;
334 nsIWebNavigation *navigation;
335 nsIBaseWindow *window;
336 nsIWebBrowserFocus *focus;
338 nsIEditor *editor;
339 nsIController *editor_controller;
341 LONG ref;
343 NSContainer *parent;
344 HTMLDocument *doc;
346 nsIURIContentListener *content_listener;
348 HWND hwnd;
350 mutation_queue_t *mutation_queue;
351 mutation_queue_t *mutation_queue_tail;
353 nsChannelBSC *bscallback; /* hack */
354 HWND reset_focus; /* hack */
356 BOOL *event_vector;
359 typedef struct {
360 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
361 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
363 LONG ref;
365 nsIChannel *channel;
366 nsIHttpChannel *http_channel;
367 nsIWineURI *uri;
368 nsIInputStream *post_data_stream;
369 nsILoadGroup *load_group;
370 nsIInterfaceRequestor *notif_callback;
371 nsISupports *owner;
372 nsLoadFlags load_flags;
373 nsIURI *original_uri;
374 char *content_type;
375 char *charset;
376 } nsChannel;
378 typedef struct {
379 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
380 void (*destructor)(HTMLDOMNode*);
381 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
382 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
383 } NodeImplVtbl;
385 struct HTMLDOMNode {
386 DispatchEx dispex;
387 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
388 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
389 const NodeImplVtbl *vtbl;
391 LONG ref;
393 nsIDOMNode *nsnode;
394 HTMLDocument *doc;
395 event_target_t *event_target;
397 HTMLDOMNode *next;
400 typedef struct {
401 HTMLDOMNode node;
402 ConnectionPointContainer cp_container;
404 const IHTMLElementVtbl *lpHTMLElementVtbl;
405 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
406 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
408 nsIDOMHTMLElement *nselem;
409 } HTMLElement;
411 typedef struct {
412 HTMLElement element;
414 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
416 ConnectionPoint cp;
417 } HTMLTextContainer;
419 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
420 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
422 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
423 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
424 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
425 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
426 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
427 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
428 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
429 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
430 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
431 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
432 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
433 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
434 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
435 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
436 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
437 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
438 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
439 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
440 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
441 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
442 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
443 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
444 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
445 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
447 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
448 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
449 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
450 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
451 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
452 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
453 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
454 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
455 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
457 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
459 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
461 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
462 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
463 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
465 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
466 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
467 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
469 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
470 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
471 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
472 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
473 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
475 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
477 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
478 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
480 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
482 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
484 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
485 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
487 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
488 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
489 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocument**);
491 HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
492 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
493 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
494 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
495 IOmNavigator *OmNavigator_Create(void);
497 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
498 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
499 void HTMLDocument_Persist_Init(HTMLDocument*);
500 void HTMLDocument_OleCmd_Init(HTMLDocument*);
501 void HTMLDocument_OleObj_Init(HTMLDocument*);
502 void HTMLDocument_View_Init(HTMLDocument*);
503 void HTMLDocument_Window_Init(HTMLDocument*);
504 void HTMLDocument_Service_Init(HTMLDocument*);
505 void HTMLDocument_Hlink_Init(HTMLDocument*);
507 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
509 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
510 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
511 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
513 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
514 void NSContainer_Release(NSContainer*);
516 void init_mutation(NSContainer*);
517 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
518 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
520 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
521 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
522 void notif_focus(HTMLDocument*);
524 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
525 void hide_tooltip(HTMLDocument*);
526 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
528 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
530 BOOL load_gecko(BOOL);
531 void close_gecko(void);
532 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
533 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
534 void release_nsio(void);
535 BOOL install_wine_gecko(BOOL);
537 HRESULT nsuri_to_url(LPCWSTR,BSTR*);
539 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
541 void call_property_onchanged(ConnectionPoint*,DISPID);
542 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
544 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
545 void nsfree(void*);
547 void nsACString_Init(nsACString*,const char*);
548 void nsACString_SetData(nsACString*,const char*);
549 PRUint32 nsACString_GetData(const nsACString*,const char**);
550 void nsACString_Finish(nsACString*);
552 void nsAString_Init(nsAString*,const PRUnichar*);
553 void nsAString_SetData(nsAString*,const PRUnichar*);
554 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
555 void nsAString_Finish(nsAString*);
557 nsIInputStream *create_nsstream(const char*,PRInt32);
558 nsICommandParams *create_nscommand_params(void);
559 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
560 void get_editor_controller(NSContainer*);
561 void init_nsevents(NSContainer*);
562 void add_nsevent_listener(NSContainer*,LPCWSTR);
563 nsresult get_nsinterface(nsISupports*,REFIID,void**);
564 void update_nsdocument(HTMLDocument*);
566 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
567 void set_current_mon(HTMLDocument*,IMoniker*);
568 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
570 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
572 nsChannelBSC *create_channelbsc(IMoniker*);
573 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
574 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
575 IMoniker *get_channelbsc_mon(nsChannelBSC*);
577 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
578 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
579 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
580 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
581 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
583 void detach_selection(HTMLDocument*);
584 void detach_ranges(HTMLDocument*);
585 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
587 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
589 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
590 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
591 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
592 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
593 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
594 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
595 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
596 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
597 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
598 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
599 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
600 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
601 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
602 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
604 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
605 void HTMLElement_Init(HTMLElement*);
606 void HTMLElement2_Init(HTMLElement*);
607 void HTMLElement3_Init(HTMLElement*);
608 void HTMLTextContainer_Init(HTMLTextContainer*);
610 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
611 void HTMLDOMNode_destructor(HTMLDOMNode*);
613 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
614 void HTMLElement_destructor(HTMLDOMNode*);
616 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
617 void release_nodes(HTMLDocument*);
619 void release_script_hosts(HTMLDocument*);
620 void connect_scripts(HTMLDocument*);
621 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
622 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
623 void set_script_mode(HTMLDocument*,SCRIPTMODE);
625 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
626 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
627 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
629 /* commands */
630 typedef struct {
631 DWORD id;
632 HRESULT (*query)(HTMLDocument*,OLECMD*);
633 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
634 } cmdtable_t;
636 extern const cmdtable_t editmode_cmds[];
638 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
640 /* timer */
641 #define UPDATE_UI 0x0001
642 #define UPDATE_TITLE 0x0002
644 void update_doc(HTMLDocument *This, DWORD flags);
645 void update_title(HTMLDocument*);
647 /* editor */
648 void init_editor(HTMLDocument*);
649 void set_ns_editmode(NSContainer*);
650 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
651 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
652 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
653 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
654 void handle_edit_load(HTMLDocument*);
655 HRESULT editor_is_dirty(HTMLDocument*);
656 void set_dirty(HTMLDocument*,VARIANT_BOOL);
658 extern DWORD mshtml_tls;
660 typedef struct task_t {
661 HTMLDocument *doc;
663 enum {
664 TASK_SETDOWNLOADSTATE,
665 TASK_PARSECOMPLETE,
666 TASK_SETPROGRESS,
667 TASK_START_BINDING
668 } task_id;
670 nsChannelBSC *bscallback;
672 struct task_t *next;
673 } task_t;
675 typedef struct {
676 HWND thread_hwnd;
677 task_t *task_queue_head;
678 task_t *task_queue_tail;
679 struct list timer_list;
680 } thread_data_t;
682 thread_data_t *get_thread_data(BOOL);
683 HWND get_thread_hwnd(void);
684 void push_task(task_t*);
685 void remove_doc_tasks(const HTMLDocument*);
686 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
687 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
689 void release_typelib(void);
690 void call_disp_func(HTMLDocument*,IDispatch*,IDispatch*);
692 const char *debugstr_variant(const VARIANT*);
694 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
695 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
696 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
697 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
698 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
700 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
702 /* memory allocation functions */
704 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
706 return HeapAlloc(GetProcessHeap(), 0, len);
709 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
711 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
714 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
716 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
719 static inline BOOL heap_free(void *mem)
721 return HeapFree(GetProcessHeap(), 0, mem);
724 static inline LPWSTR heap_strdupW(LPCWSTR str)
726 LPWSTR ret = NULL;
728 if(str) {
729 DWORD size;
731 size = (strlenW(str)+1)*sizeof(WCHAR);
732 ret = heap_alloc(size);
733 memcpy(ret, str, size);
736 return ret;
739 static inline char *heap_strdupA(const char *str)
741 char *ret = NULL;
743 if(str) {
744 DWORD size;
746 size = strlen(str)+1;
747 ret = heap_alloc(size);
748 memcpy(ret, str, size);
751 return ret;
754 static inline WCHAR *heap_strdupAtoW(const char *str)
756 LPWSTR ret = NULL;
758 if(str) {
759 DWORD len;
761 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
762 ret = heap_alloc(len*sizeof(WCHAR));
763 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
766 return ret;
769 static inline char *heap_strdupWtoA(LPCWSTR str)
771 char *ret = NULL;
773 if(str) {
774 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
775 ret = heap_alloc(size);
776 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
779 return ret;
782 HINSTANCE get_shdoclc(void);
784 extern HINSTANCE hInst;