jscript: Added Math_sin implementation.
[wine.git] / dlls / mshtml / mshtml_private.h
blobebb63bbd39cd9fa2c75cc9b9a4911ea6273ce82e
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 GENERATE_MSHTML_NS_FAILURE(code) \
37 ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
39 #define NS_OK ((nsresult)0x00000000L)
40 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
41 #define NS_NOINTERFACE ((nsresult)0x80004002L)
42 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
43 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
44 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
45 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
47 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
49 #define NS_FAILED(res) ((res) & 0x80000000)
50 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
52 #define NSAPI WINAPI
54 #define MSHTML_E_NODOC 0x800a025c
56 typedef struct HTMLDOMNode HTMLDOMNode;
57 typedef struct ConnectionPoint ConnectionPoint;
58 typedef struct BSCallback BSCallback;
59 typedef struct nsChannelBSC nsChannelBSC;
60 typedef struct event_target_t event_target_t;
62 /* NOTE: make sure to keep in sync with dispex.c */
63 typedef enum {
64 NULL_tid,
65 DispCEventObj_tid,
66 DispDOMChildrenCollection_tid,
67 DispHTMLBody_tid,
68 DispHTMLCommentElement_tid,
69 DispHTMLCurrentStyle_tid,
70 DispHTMLDocument_tid,
71 DispHTMLDOMTextNode_tid,
72 DispHTMLElementCollection_tid,
73 DispHTMLGenericElement_tid,
74 DispHTMLIFrame_tid,
75 DispHTMLImg_tid,
76 DispHTMLInputElement_tid,
77 DispHTMLOptionElement_tid,
78 DispHTMLSelectElement_tid,
79 DispHTMLStyle_tid,
80 DispHTMLTable_tid,
81 DispHTMLTableRow_tid,
82 DispHTMLUnknownElement_tid,
83 DispHTMLWindow2_tid,
84 IHTMLBodyElement_tid,
85 IHTMLBodyElement2_tid,
86 IHTMLCommentElement_tid,
87 IHTMLCurrentStyle_tid,
88 IHTMLCurrentStyle2_tid,
89 IHTMLCurrentStyle3_tid,
90 IHTMLCurrentStyle4_tid,
91 IHTMLDocument2_tid,
92 IHTMLDocument3_tid,
93 IHTMLDocument4_tid,
94 IHTMLDocument5_tid,
95 IHTMLDOMChildrenCollection_tid,
96 IHTMLDOMNode_tid,
97 IHTMLDOMNode2_tid,
98 IHTMLDOMTextNode_tid,
99 IHTMLElement_tid,
100 IHTMLElement2_tid,
101 IHTMLElement3_tid,
102 IHTMLElement4_tid,
103 IHTMLElementCollection_tid,
104 IHTMLEventObj_tid,
105 IHTMLFrameBase2_tid,
106 IHTMLGenericElement_tid,
107 IHTMLImgElement_tid,
108 IHTMLInputElement_tid,
109 IHTMLLocation_tid,
110 IHTMLOptionElement_tid,
111 IHTMLSelectElement_tid,
112 IHTMLStyle_tid,
113 IHTMLStyle2_tid,
114 IHTMLStyle3_tid,
115 IHTMLStyle4_tid,
116 IHTMLTable_tid,
117 IHTMLTableRow_tid,
118 IHTMLTextContainer_tid,
119 IHTMLUniqueName_tid,
120 IHTMLWindow2_tid,
121 IHTMLWindow3_tid,
122 IOmNavigator_tid,
123 LAST_tid
124 } tid_t;
126 typedef struct dispex_data_t dispex_data_t;
127 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
129 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
130 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
132 typedef struct {
133 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
134 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
135 } dispex_static_data_vtbl_t;
137 typedef struct {
138 const dispex_static_data_vtbl_t *vtbl;
139 const tid_t disp_tid;
140 dispex_data_t *data;
141 const tid_t* const iface_tids;
142 } dispex_static_data_t;
144 typedef struct {
145 const IDispatchExVtbl *lpIDispatchExVtbl;
147 IUnknown *outer;
149 dispex_static_data_t *data;
150 dispex_dynamic_data_t *dynamic_data;
151 } DispatchEx;
153 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
154 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
155 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
157 typedef struct {
158 DispatchEx dispex;
159 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
160 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
161 const IDispatchExVtbl *lpIDispatchExVtbl;
163 LONG ref;
165 HTMLDocument *doc;
166 nsIDOMWindow *nswindow;
168 IHTMLEventObj *event;
170 struct list entry;
171 } HTMLWindow;
173 typedef enum {
174 UNKNOWN_USERMODE,
175 BROWSEMODE,
176 EDITMODE
177 } USERMODE;
179 typedef enum {
180 SCRIPTMODE_GECKO,
181 SCRIPTMODE_ACTIVESCRIPT
182 } SCRIPTMODE;
184 typedef struct {
185 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
187 ConnectionPoint *cp_list;
188 IUnknown *outer;
189 } ConnectionPointContainer;
191 struct ConnectionPoint {
192 const IConnectionPointVtbl *lpConnectionPointVtbl;
194 IConnectionPointContainer *container;
196 union {
197 IUnknown *unk;
198 IDispatch *disp;
199 IPropertyNotifySink *propnotif;
200 } *sinks;
201 DWORD sinks_size;
203 const IID *iid;
205 ConnectionPoint *next;
208 struct HTMLLocation {
209 DispatchEx dispex;
210 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
212 LONG ref;
214 HTMLDocument *doc;
217 typedef struct {
218 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
220 LONG ref;
222 HTMLDocument *doc;
223 } HTMLOptionElementFactory;
225 struct HTMLDocument {
226 DispatchEx dispex;
227 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
228 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
229 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
230 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
231 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
232 const IPersistFileVtbl *lpPersistFileVtbl;
233 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
234 const IMonikerPropVtbl *lpMonikerPropVtbl;
235 const IOleObjectVtbl *lpOleObjectVtbl;
236 const IOleDocumentVtbl *lpOleDocumentVtbl;
237 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
238 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
239 const IViewObject2Vtbl *lpViewObject2Vtbl;
240 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
241 const IServiceProviderVtbl *lpServiceProviderVtbl;
242 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
243 const IOleControlVtbl *lpOleControlVtbl;
244 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
245 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
246 const ICustomDocVtbl *lpCustomDocVtbl;
247 const IDispatchExVtbl *lpIDispatchExVtbl;
248 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
249 LONG ref;
251 NSContainer *nscontainer;
252 HTMLWindow *window;
253 nsIDOMHTMLDocument *nsdoc;
255 IOleClientSite *client;
256 IDocHostUIHandler *hostui;
257 IOleInPlaceSite *ipsite;
258 IOleInPlaceFrame *frame;
259 IOleInPlaceUIWindow *ip_window;
261 IOleUndoManager *undomgr;
263 nsChannelBSC *bscallback;
264 IMoniker *mon;
265 LPOLESTR url;
266 struct list bindings;
268 struct list script_hosts;
270 HWND hwnd;
271 HWND tooltips_hwnd;
273 DOCHOSTUIINFO hostinfo;
275 USERMODE usermode;
276 SCRIPTMODE scriptmode;
277 READYSTATE readystate;
278 BOOL in_place_active;
279 BOOL ui_active;
280 BOOL window_active;
281 BOOL has_key_path;
282 BOOL container_locked;
283 BOOL focus;
284 LPWSTR mime;
286 DWORD update;
288 event_target_t *event_target;
289 ConnectionPointContainer cp_container;
290 ConnectionPoint cp_htmldocevents;
291 ConnectionPoint cp_htmldocevents2;
292 ConnectionPoint cp_propnotif;
294 HTMLOptionElementFactory *option_factory;
295 HTMLLocation *location;
297 struct list selection_list;
298 struct list range_list;
300 HTMLDOMNode *nodes;
303 typedef struct {
304 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
305 NSContainer *This;
306 } nsEventListener;
308 typedef struct _mutation_queue_t {
309 DWORD type;
310 nsISupports *nsiface;
312 struct _mutation_queue_t *next;
313 } mutation_queue_t;
315 struct NSContainer {
316 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
317 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
318 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
319 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
320 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
321 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
322 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
323 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
325 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
327 const nsIRunnableVtbl *lpRunnableVtbl;
329 nsEventListener blur_listener;
330 nsEventListener focus_listener;
331 nsEventListener keypress_listener;
332 nsEventListener load_listener;
333 nsEventListener htmlevent_listener;
335 nsIWebBrowser *webbrowser;
336 nsIWebNavigation *navigation;
337 nsIBaseWindow *window;
338 nsIWebBrowserFocus *focus;
340 nsIEditor *editor;
341 nsIController *editor_controller;
343 LONG ref;
345 NSContainer *parent;
346 HTMLDocument *doc;
348 nsIURIContentListener *content_listener;
350 HWND hwnd;
352 mutation_queue_t *mutation_queue;
353 mutation_queue_t *mutation_queue_tail;
355 nsChannelBSC *bscallback; /* hack */
356 HWND reset_focus; /* hack */
358 BOOL *event_vector;
361 typedef struct {
362 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
363 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
365 LONG ref;
367 nsIChannel *channel;
368 nsIHttpChannel *http_channel;
369 nsIWineURI *uri;
370 nsIInputStream *post_data_stream;
371 nsILoadGroup *load_group;
372 nsIInterfaceRequestor *notif_callback;
373 nsISupports *owner;
374 nsLoadFlags load_flags;
375 nsIURI *original_uri;
376 char *content_type;
377 char *charset;
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)
468 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
469 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
470 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
472 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
473 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
474 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
475 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
476 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
478 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
480 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
481 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
483 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
485 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
487 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
488 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
490 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
491 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
492 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocument**);
494 HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
495 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
496 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
497 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
498 IOmNavigator *OmNavigator_Create(void);
500 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
501 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
502 void HTMLDocument_Persist_Init(HTMLDocument*);
503 void HTMLDocument_OleCmd_Init(HTMLDocument*);
504 void HTMLDocument_OleObj_Init(HTMLDocument*);
505 void HTMLDocument_View_Init(HTMLDocument*);
506 void HTMLDocument_Window_Init(HTMLDocument*);
507 void HTMLDocument_Service_Init(HTMLDocument*);
508 void HTMLDocument_Hlink_Init(HTMLDocument*);
510 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
512 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
513 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
514 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
516 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
517 void NSContainer_Release(NSContainer*);
519 void init_mutation(NSContainer*);
520 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
521 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
523 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
524 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
525 void notif_focus(HTMLDocument*);
527 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
528 void hide_tooltip(HTMLDocument*);
529 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
531 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
533 BOOL load_gecko(BOOL);
534 void close_gecko(void);
535 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
536 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
537 void release_nsio(void);
538 BOOL install_wine_gecko(BOOL);
540 HRESULT nsuri_to_url(LPCWSTR,BSTR*);
542 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
544 void call_property_onchanged(ConnectionPoint*,DISPID);
545 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
547 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
548 void nsfree(void*);
550 void nsACString_Init(nsACString*,const char*);
551 void nsACString_SetData(nsACString*,const char*);
552 PRUint32 nsACString_GetData(const nsACString*,const char**);
553 void nsACString_Finish(nsACString*);
555 void nsAString_Init(nsAString*,const PRUnichar*);
556 void nsAString_SetData(nsAString*,const PRUnichar*);
557 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
558 void nsAString_Finish(nsAString*);
560 nsIInputStream *create_nsstream(const char*,PRInt32);
561 nsICommandParams *create_nscommand_params(void);
562 void 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;