2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/list.h"
28 #include "wine/unicode.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))
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 */
61 DispDOMChildrenCollection_tid,
62 DispHTMLAnchorElement_tid,
64 DispHTMLCommentElement_tid,
65 DispHTMLCurrentStyle_tid,
67 DispHTMLDOMTextNode_tid,
68 DispHTMLElementCollection_tid,
69 DispHTMLGenericElement_tid,
72 DispHTMLInputElement_tid,
74 DispHTMLNavigator_tid,
75 DispHTMLOptionElement_tid,
76 DispHTMLSelectElement_tid,
80 DispHTMLUnknownElement_tid,
82 IHTMLAnchorElement_tid,
84 IHTMLBodyElement2_tid,
85 IHTMLCommentElement_tid,
86 IHTMLCurrentStyle_tid,
87 IHTMLCurrentStyle2_tid,
88 IHTMLCurrentStyle3_tid,
89 IHTMLCurrentStyle4_tid,
94 IHTMLDOMChildrenCollection_tid,
102 IHTMLElementCollection_tid,
106 IHTMLGenericElement_tid,
107 IHTMLImageElementFactory_tid,
109 IHTMLInputElement_tid,
111 IHTMLOptionElement_tid,
112 IHTMLSelectElement_tid,
119 IHTMLTextContainer_tid,
128 typedef struct dispex_data_t dispex_data_t;
129 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
131 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
132 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
135 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
136 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
137 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
138 } dispex_static_data_vtbl_t;
141 const dispex_static_data_vtbl_t *vtbl;
142 const tid_t disp_tid;
144 const tid_t* const iface_tids;
145 } dispex_static_data_t;
148 const IDispatchExVtbl *lpIDispatchExVtbl;
152 dispex_static_data_t *data;
153 dispex_dynamic_data_t *dynamic_data;
156 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
157 void release_dispex(DispatchEx*);
158 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
159 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
161 typedef struct HTMLDocumentNode HTMLDocumentNode;
162 typedef struct HTMLDocumentObj HTMLDocumentObj;
163 typedef struct HTMLFrameBase HTMLFrameBase;
167 SCRIPTMODE_ACTIVESCRIPT
170 typedef struct ScriptHost ScriptHost;
175 } global_prop_type_t;
178 global_prop_type_t type;
180 ScriptHost *script_host;
185 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
190 } HTMLOptionElementFactory;
194 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
199 } HTMLImageElementFactory;
201 struct HTMLLocation {
203 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
217 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
218 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
219 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
220 const IDispatchExVtbl *lpIDispatchExVtbl;
224 windowref_t *window_ref;
227 HTMLDocumentNode *doc;
228 HTMLDocumentObj *doc_obj;
229 nsIDOMWindow *nswindow;
231 HTMLFrameBase *frame_element;
232 READYSTATE readystate;
234 nsChannelBSC *bscallback;
238 event_target_t *event_target;
239 IHTMLEventObj *event;
241 SCRIPTMODE scriptmode;
242 struct list script_hosts;
244 HTMLOptionElementFactory *option_factory;
245 HTMLImageElementFactory *image_factory;
246 HTMLLocation *location;
248 global_prop_t *global_props;
249 DWORD global_prop_cnt;
250 DWORD global_prop_size;
252 struct list children;
253 struct list sibling_entry;
264 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
266 ConnectionPoint *cp_list;
268 } ConnectionPointContainer;
270 struct ConnectionPoint {
271 const IConnectionPointVtbl *lpConnectionPointVtbl;
273 IConnectionPointContainer *container;
278 IPropertyNotifySink *propnotif;
284 ConnectionPoint *next;
287 struct HTMLDocument {
288 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
289 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
290 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
291 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
292 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
293 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
294 const IPersistFileVtbl *lpPersistFileVtbl;
295 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
296 const IMonikerPropVtbl *lpMonikerPropVtbl;
297 const IOleObjectVtbl *lpOleObjectVtbl;
298 const IOleDocumentVtbl *lpOleDocumentVtbl;
299 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
300 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
301 const IViewObject2Vtbl *lpViewObject2Vtbl;
302 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
303 const IServiceProviderVtbl *lpServiceProviderVtbl;
304 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
305 const IOleControlVtbl *lpOleControlVtbl;
306 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
307 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
308 const IDispatchExVtbl *lpIDispatchExVtbl;
309 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
314 HTMLDocumentObj *doc_obj;
315 HTMLDocumentNode *doc_node;
321 ConnectionPointContainer cp_container;
322 ConnectionPoint cp_htmldocevents;
323 ConnectionPoint cp_htmldocevents2;
324 ConnectionPoint cp_propnotif;
327 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
329 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
332 static inline ULONG htmldoc_addref(HTMLDocument *This)
334 return IUnknown_AddRef(This->unk_impl);
337 static inline ULONG htmldoc_release(HTMLDocument *This)
339 return IUnknown_Release(This->unk_impl);
342 struct HTMLDocumentObj {
343 HTMLDocument basedoc;
345 const ICustomDocVtbl *lpCustomDocVtbl;
349 NSContainer *nscontainer;
351 IOleClientSite *client;
352 IDocHostUIHandler *hostui;
353 IOleInPlaceSite *ipsite;
354 IOleInPlaceFrame *frame;
355 IOleInPlaceUIWindow *ip_window;
357 DOCHOSTUIINFO hostinfo;
359 IOleUndoManager *undomgr;
364 BOOL in_place_active;
368 BOOL container_locked;
378 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
379 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
380 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
381 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
382 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
383 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
384 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
385 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
387 nsIWebBrowser *webbrowser;
388 nsIWebNavigation *navigation;
389 nsIBaseWindow *window;
390 nsIWebBrowserFocus *focus;
393 nsIController *editor_controller;
398 HTMLDocumentObj *doc;
400 nsIURIContentListener *content_listener;
404 nsChannelBSC *bscallback; /* hack */
405 HWND reset_focus; /* hack */
409 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
410 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
411 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
416 nsIHttpChannel *http_channel;
417 nsIHttpChannelInternal *http_channel_internal;
419 nsIInputStream *post_data_stream;
420 nsILoadGroup *load_group;
421 nsIInterfaceRequestor *notif_callback;
423 nsLoadFlags load_flags;
424 nsIURI *original_uri;
427 PRUint32 response_status;
431 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
432 void (*destructor)(HTMLDOMNode*);
433 event_target_t **(*get_event_target)(HTMLDOMNode*);
434 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
435 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
436 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
441 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
442 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
443 const NodeImplVtbl *vtbl;
448 HTMLDocumentNode *doc;
449 event_target_t *event_target;
456 ConnectionPointContainer cp_container;
458 const IHTMLElementVtbl *lpHTMLElementVtbl;
459 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
460 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
462 nsIDOMHTMLElement *nselem;
468 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
473 struct HTMLFrameBase {
476 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
478 HTMLWindow *content_window;
481 typedef struct _mutation_queue_t {
483 nsISupports *nsiface;
485 struct _mutation_queue_t *next;
488 typedef struct nsDocumentEventListener nsDocumentEventListener;
490 struct HTMLDocumentNode {
492 HTMLDocument basedoc;
494 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
496 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
497 const nsIRunnableVtbl *lpIRunnableVtbl;
501 nsIDOMHTMLDocument *nsdoc;
505 IInternetSecurityManager *secmgr;
506 nsDocumentEventListener *nsevent_listener;
509 mutation_queue_t *mutation_queue;
510 mutation_queue_t *mutation_queue_tail;
512 struct list bindings;
513 struct list selection_list;
514 struct list range_list;
517 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
518 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
519 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
521 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
522 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
523 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
524 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
525 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
526 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
527 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
528 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
529 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
530 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
531 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
532 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
533 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
534 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
535 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
536 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
537 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
538 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
539 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
540 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
541 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
542 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
543 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
544 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
545 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
546 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
548 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
549 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
550 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
551 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
552 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
553 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
554 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
555 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
556 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
558 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
560 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
562 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
563 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
564 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
565 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
567 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
568 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
569 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
571 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
572 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
573 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
574 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
575 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
577 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
578 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
580 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
581 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
582 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
584 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
586 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
588 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
590 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
591 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
593 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
594 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
595 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
597 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
598 void update_window_doc(HTMLWindow*);
599 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
600 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
601 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
602 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
603 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
604 IOmNavigator *OmNavigator_Create(void);
606 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
607 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
608 void HTMLDocument_Persist_Init(HTMLDocument*);
609 void HTMLDocument_OleCmd_Init(HTMLDocument*);
610 void HTMLDocument_OleObj_Init(HTMLDocument*);
611 void HTMLDocument_View_Init(HTMLDocument*);
612 void HTMLDocument_Window_Init(HTMLDocument*);
613 void HTMLDocument_Service_Init(HTMLDocument*);
614 void HTMLDocument_Hlink_Init(HTMLDocument*);
616 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
618 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
620 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
621 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
622 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
624 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
625 void NSContainer_Release(NSContainer*);
627 void init_mutation(HTMLDocumentNode*);
628 void release_mutation(HTMLDocumentNode*);
630 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
631 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
632 void notif_focus(HTMLDocumentObj*);
634 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
635 void hide_tooltip(HTMLDocumentObj*);
636 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
638 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
640 BOOL load_gecko(BOOL);
641 void close_gecko(void);
642 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
643 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
644 void release_nsio(void);
645 BOOL install_wine_gecko(BOOL);
647 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
649 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
650 HRESULT navigate_url(HTMLDocumentNode*,OLECHAR*);
652 void call_property_onchanged(ConnectionPoint*,DISPID);
653 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
655 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
658 void nsACString_Init(nsACString*,const char*);
659 void nsACString_SetData(nsACString*,const char*);
660 PRUint32 nsACString_GetData(const nsACString*,const char**);
661 void nsACString_Finish(nsACString*);
663 void nsAString_Init(nsAString*,const PRUnichar*);
664 void nsAString_SetData(nsAString*,const PRUnichar*);
665 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
666 void nsAString_Finish(nsAString*);
668 nsICommandParams *create_nscommand_params(void);
669 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
670 void get_editor_controller(NSContainer*);
671 nsresult get_nsinterface(nsISupports*,REFIID,void**);
673 void init_nsevents(HTMLDocumentNode*);
674 void release_nsevents(HTMLDocumentNode*);
675 void add_nsevent_listener(HTMLDocumentNode*,LPCWSTR);
677 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
678 void set_current_mon(HTMLWindow*,IMoniker*);
679 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
680 void abort_document_bindings(HTMLDocumentNode*);
682 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
684 nsChannelBSC *create_channelbsc(IMoniker*);
685 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
686 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
687 IMoniker *get_channelbsc_mon(nsChannelBSC*);
689 void set_ready_state(HTMLWindow*,READYSTATE);
691 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
692 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
693 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
694 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
695 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
697 void detach_selection(HTMLDocumentNode*);
698 void detach_ranges(HTMLDocumentNode*);
699 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
701 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
703 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
705 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
706 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
707 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
708 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
709 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*);
710 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*);
711 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
712 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
713 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
714 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
715 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
716 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
717 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
718 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
719 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
721 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
722 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
723 void HTMLElement2_Init(HTMLElement*);
724 void HTMLElement3_Init(HTMLElement*);
725 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
726 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*,dispex_static_data_t*);
728 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
729 void HTMLDOMNode_destructor(HTMLDOMNode*);
731 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
732 void HTMLElement_destructor(HTMLDOMNode*);
734 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
735 void HTMLFrameBase_destructor(HTMLFrameBase*);
737 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
738 void release_nodes(HTMLDocumentNode*);
740 void release_script_hosts(HTMLWindow*);
741 void connect_scripts(HTMLWindow*);
742 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
743 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
744 void set_script_mode(HTMLWindow*,SCRIPTMODE);
745 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
746 IDispatch *get_script_disp(ScriptHost*);
748 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
749 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
750 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
755 HRESULT (*query)(HTMLDocument*,OLECMD*);
756 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
759 extern const cmdtable_t editmode_cmds[];
761 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
764 #define UPDATE_UI 0x0001
765 #define UPDATE_TITLE 0x0002
767 void update_doc(HTMLDocument*,DWORD);
768 void update_title(HTMLDocumentObj*);
771 void init_editor(HTMLDocument*);
772 void set_ns_editmode(NSContainer*);
773 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
774 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
775 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
776 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
777 void handle_edit_load(HTMLDocument*);
778 HRESULT editor_is_dirty(HTMLDocument*);
779 void set_dirty(HTMLDocument*,VARIANT_BOOL);
781 extern DWORD mshtml_tls;
783 typedef struct task_t task_t;
784 typedef void (*task_proc_t)(task_t*);
794 HTMLDocumentObj *doc;
799 task_t *task_queue_head;
800 task_t *task_queue_tail;
801 struct list timer_list;
804 thread_data_t *get_thread_data(BOOL);
805 HWND get_thread_hwnd(void);
807 LONG get_task_target_magic(void);
808 void push_task(task_t*,task_proc_t,LONG);
809 void remove_target_tasks(LONG);
811 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
812 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
814 void release_typelib(void);
815 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
817 const char *debugstr_variant(const VARIANT*);
819 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
820 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
821 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
822 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
823 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
825 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
827 /* memory allocation functions */
829 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
831 return HeapAlloc(GetProcessHeap(), 0, len);
834 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
836 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
839 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
841 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
844 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
846 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
849 static inline BOOL heap_free(void *mem)
851 return HeapFree(GetProcessHeap(), 0, mem);
854 static inline LPWSTR heap_strdupW(LPCWSTR str)
861 size = (strlenW(str)+1)*sizeof(WCHAR);
862 ret = heap_alloc(size);
863 memcpy(ret, str, size);
869 static inline char *heap_strdupA(const char *str)
876 size = strlen(str)+1;
877 ret = heap_alloc(size);
878 memcpy(ret, str, size);
884 static inline WCHAR *heap_strdupAtoW(const char *str)
891 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
892 ret = heap_alloc(len*sizeof(WCHAR));
893 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
899 static inline char *heap_strdupWtoA(LPCWSTR str)
904 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
905 ret = heap_alloc(size);
906 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
912 static inline void windowref_addref(windowref_t *ref)
914 InterlockedIncrement(&ref->ref);
917 static inline void windowref_release(windowref_t *ref)
919 if(!InterlockedDecrement(&ref->ref))
923 HINSTANCE get_shdoclc(void);
925 extern HINSTANCE hInst;