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
26 #include "wine/list.h"
27 #include "wine/unicode.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))
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 */
64 DispDOMChildrenCollection_tid
,
66 DispHTMLCommentElement_tid
,
68 DispHTMLDOMTextNode_tid
,
69 DispHTMLElementCollection_tid
,
70 DispHTMLGenericElement_tid
,
72 DispHTMLInputElement_tid
,
73 DispHTMLOptionElement_tid
,
74 DispHTMLSelectElement_tid
,
78 DispHTMLUnknownElement_tid
,
81 IHTMLBodyElement2_tid
,
82 IHTMLCommentElement_tid
,
87 IHTMLDOMChildrenCollection_tid
,
95 IHTMLElementCollection_tid
,
96 IHTMLGenericElement_tid
,
98 IHTMLInputElement_tid
,
99 IHTMLOptionElement_tid
,
100 IHTMLSelectElement_tid
,
104 IHTMLTextContainer_tid
,
120 typedef struct dispex_data_t dispex_data_t
;
121 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
123 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
124 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
127 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
128 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
129 } dispex_static_data_vtbl_t
;
132 const dispex_static_data_vtbl_t
*vtbl
;
133 const tid_t disp_tid
;
135 const tid_t
* const iface_tids
;
136 } dispex_static_data_t
;
139 const IDispatchExVtbl
*lpIDispatchExVtbl
;
143 dispex_static_data_t
*data
;
144 dispex_dynamic_data_t
*dynamic_data
;
147 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
148 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
152 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
153 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
154 const IDispatchExVtbl
*lpIDispatchExVtbl
;
159 nsIDOMWindow
*nswindow
;
161 IHTMLEventObj
*event
;
174 SCRIPTMODE_ACTIVESCRIPT
178 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
180 ConnectionPoint
*cp_list
;
182 } ConnectionPointContainer
;
184 struct ConnectionPoint
{
185 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
187 IConnectionPointContainer
*container
;
192 IPropertyNotifySink
*propnotif
;
198 ConnectionPoint
*next
;
202 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
210 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
215 } HTMLOptionElementFactory
;
217 struct HTMLDocument
{
219 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
220 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
221 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
222 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
223 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
224 const IPersistFileVtbl
*lpPersistFileVtbl
;
225 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
226 const IOleObjectVtbl
*lpOleObjectVtbl
;
227 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
228 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
229 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
230 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
231 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
232 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
233 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
234 const IOleControlVtbl
*lpOleControlVtbl
;
235 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
236 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
237 const ICustomDocVtbl
*lpCustomDocVtbl
;
238 const IDispatchExVtbl
*lpIDispatchExVtbl
;
242 NSContainer
*nscontainer
;
245 IOleClientSite
*client
;
246 IDocHostUIHandler
*hostui
;
247 IOleInPlaceSite
*ipsite
;
248 IOleInPlaceFrame
*frame
;
249 IOleInPlaceUIWindow
*ip_window
;
251 IOleUndoManager
*undomgr
;
253 nsChannelBSC
*bscallback
;
256 struct list bindings
;
258 struct list script_hosts
;
263 DOCHOSTUIINFO hostinfo
;
266 SCRIPTMODE scriptmode
;
267 READYSTATE readystate
;
268 BOOL in_place_active
;
272 BOOL container_locked
;
278 ConnectionPointContainer cp_container
;
279 ConnectionPoint cp_htmldocevents
;
280 ConnectionPoint cp_htmldocevents2
;
281 ConnectionPoint cp_propnotif
;
283 HTMLOptionElementFactory
*option_factory
;
284 HTMLLocation
*location
;
286 struct list selection_list
;
287 struct list range_list
;
293 const nsIDOMEventListenerVtbl
*lpDOMEventListenerVtbl
;
298 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
299 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
300 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
301 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
302 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
303 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
304 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
305 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
307 nsEventListener blur_listener
;
308 nsEventListener focus_listener
;
309 nsEventListener keypress_listener
;
310 nsEventListener load_listener
;
311 nsEventListener node_insert_listener
;
312 nsEventListener htmlevent_listener
;
314 nsIWebBrowser
*webbrowser
;
315 nsIWebNavigation
*navigation
;
316 nsIBaseWindow
*window
;
317 nsIWebBrowserFocus
*focus
;
320 nsIController
*editor_controller
;
327 nsIURIContentListener
*content_listener
;
331 nsChannelBSC
*bscallback
; /* hack */
332 HWND reset_focus
; /* hack */
334 BOOL event_vector
[EVENTID_LAST
];
338 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
339 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
344 nsIHttpChannel
*http_channel
;
346 nsIInputStream
*post_data_stream
;
347 nsILoadGroup
*load_group
;
348 nsIInterfaceRequestor
*notif_callback
;
349 nsLoadFlags load_flags
;
350 nsIURI
*original_uri
;
356 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
357 void (*destructor
)(HTMLDOMNode
*);
362 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
363 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
364 const NodeImplVtbl
*vtbl
;
370 event_target_t
*event_target
;
377 ConnectionPointContainer cp_container
;
379 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
380 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
382 nsIDOMHTMLElement
*nselem
;
388 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
395 const IHTMLStyleVtbl
*lpHTMLStyleVtbl
;
396 const IHTMLStyle2Vtbl
*lpHTMLStyle2Vtbl
;
400 nsIDOMCSSStyleDeclaration
*nsstyle
;
403 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
404 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
406 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
407 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
408 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
409 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
410 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
411 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
412 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
413 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
414 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
415 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
416 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
417 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
418 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
419 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
420 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
421 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
422 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
423 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
424 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
425 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
426 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
427 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
428 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
429 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
431 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
432 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
433 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
434 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
435 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
436 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
437 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
438 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
439 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
441 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
442 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
443 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
445 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
446 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
447 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
449 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
450 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
451 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
452 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
454 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
456 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
457 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
459 #define HTMLSTYLE(x) ((IHTMLStyle*) &(x)->lpHTMLStyleVtbl)
460 #define HTMLSTYLE2(x) ((IHTMLStyle2*) &(x)->lpHTMLStyle2Vtbl)
462 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
464 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
465 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
467 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
468 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
470 HTMLWindow
*HTMLWindow_Create(HTMLDocument
*);
471 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
472 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLDocument
*);
473 HTMLLocation
*HTMLLocation_Create(HTMLDocument
*);
474 IOmNavigator
*OmNavigator_Create(void);
475 void setup_nswindow(HTMLWindow
*);
477 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
478 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
479 void HTMLDocument_Persist_Init(HTMLDocument
*);
480 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
481 void HTMLDocument_OleObj_Init(HTMLDocument
*);
482 void HTMLDocument_View_Init(HTMLDocument
*);
483 void HTMLDocument_Window_Init(HTMLDocument
*);
484 void HTMLDocument_Service_Init(HTMLDocument
*);
485 void HTMLDocument_Hlink_Init(HTMLDocument
*);
487 void HTMLStyle2_Init(HTMLStyle
*);
489 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
);
490 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
491 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
493 NSContainer
*NSContainer_Create(HTMLDocument
*,NSContainer
*);
494 void NSContainer_Release(NSContainer
*);
496 void HTMLDocument_LockContainer(HTMLDocument
*,BOOL
);
497 void show_context_menu(HTMLDocument
*,DWORD
,POINT
*,IDispatch
*);
498 void notif_focus(HTMLDocument
*);
500 void show_tooltip(HTMLDocument
*,DWORD
,DWORD
,LPCWSTR
);
501 void hide_tooltip(HTMLDocument
*);
502 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
504 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
506 BOOL
load_gecko(BOOL
);
507 void close_gecko(void);
508 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
509 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
510 BOOL
install_wine_gecko(BOOL
);
512 void hlink_frame_navigate(HTMLDocument
*,IHlinkFrame
*,LPCWSTR
,nsIInputStream
*,DWORD
);
514 void call_property_onchanged(ConnectionPoint
*,DISPID
);
515 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
517 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
520 void nsACString_Init(nsACString
*,const char*);
521 void nsACString_SetData(nsACString
*,const char*);
522 PRUint32
nsACString_GetData(const nsACString
*,const char**);
523 void nsACString_Finish(nsACString
*);
525 void nsAString_Init(nsAString
*,const PRUnichar
*);
526 void nsAString_SetData(nsAString
*,const PRUnichar
*);
527 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
528 void nsAString_Finish(nsAString
*);
530 nsIInputStream
*create_nsstream(const char*,PRInt32
);
531 nsICommandParams
*create_nscommand_params(void);
532 nsIMutableArray
*create_nsarray(void);
533 nsIWritableVariant
*create_nsvariant(void);
534 void nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
535 void get_editor_controller(NSContainer
*);
536 void init_nsevents(NSContainer
*);
537 void add_nsevent_listener(NSContainer
*,LPCWSTR
);
538 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
540 void check_event_attr(HTMLDocument
*,nsIDOMElement
*);
541 void release_event_target(event_target_t
*);
542 void fire_event(HTMLDocument
*,eventid_t
,nsIDOMNode
*);
543 HRESULT
set_node_event(HTMLDOMNode
*,eventid_t
,VARIANT
*);
544 eventid_t
str_to_eid(LPCWSTR
);
546 void set_document_bscallback(HTMLDocument
*,nsChannelBSC
*);
547 void set_current_mon(HTMLDocument
*,IMoniker
*);
548 HRESULT
start_binding(HTMLDocument
*,BSCallback
*,IBindCtx
*);
550 HRESULT
bind_mon_to_buffer(HTMLDocument
*,IMoniker
*,void**,DWORD
*);
552 nsChannelBSC
*create_channelbsc(IMoniker
*);
553 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
554 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
555 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
557 IHTMLSelectionObject
*HTMLSelectionObject_Create(HTMLDocument
*,nsISelection
*);
558 IHTMLTxtRange
*HTMLTxtRange_Create(HTMLDocument
*,nsIDOMRange
*);
559 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
560 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
561 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
563 void detach_selection(HTMLDocument
*);
564 void detach_ranges(HTMLDocument
*);
566 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocument
*,nsIDOMNode
*);
568 HTMLElement
*HTMLElement_Create(HTMLDocument
*,nsIDOMNode
*,BOOL
);
569 HTMLElement
*HTMLCommentElement_Create(HTMLDocument
*,nsIDOMNode
*);
570 HTMLElement
*HTMLAnchorElement_Create(nsIDOMHTMLElement
*);
571 HTMLElement
*HTMLBodyElement_Create(nsIDOMHTMLElement
*);
572 HTMLElement
*HTMLImgElement_Create(nsIDOMHTMLElement
*);
573 HTMLElement
*HTMLInputElement_Create(nsIDOMHTMLElement
*);
574 HTMLElement
*HTMLOptionElement_Create(nsIDOMHTMLElement
*);
575 HTMLElement
*HTMLScriptElement_Create(nsIDOMHTMLElement
*);
576 HTMLElement
*HTMLSelectElement_Create(nsIDOMHTMLElement
*);
577 HTMLElement
*HTMLTable_Create(nsIDOMHTMLElement
*);
578 HTMLElement
*HTMLTableRow_Create(nsIDOMHTMLElement
*);
579 HTMLElement
*HTMLTextAreaElement_Create(nsIDOMHTMLElement
*);
580 HTMLElement
*HTMLGenericElement_Create(nsIDOMHTMLElement
*);
582 void HTMLDOMNode_Init(HTMLDocument
*,HTMLDOMNode
*,nsIDOMNode
*);
583 void HTMLElement_Init(HTMLElement
*);
584 void HTMLElement2_Init(HTMLElement
*);
585 void HTMLTextContainer_Init(HTMLTextContainer
*);
587 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
588 void HTMLDOMNode_destructor(HTMLDOMNode
*);
590 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
591 void HTMLElement_destructor(HTMLDOMNode
*);
593 HTMLDOMNode
*get_node(HTMLDocument
*,nsIDOMNode
*,BOOL
);
594 void release_nodes(HTMLDocument
*);
596 void release_script_hosts(HTMLDocument
*);
597 void connect_scripts(HTMLDocument
*);
598 void doc_insert_script(HTMLDocument
*,nsIDOMHTMLScriptElement
*);
599 IDispatch
*script_parse_event(HTMLDocument
*,LPCWSTR
);
600 void set_script_mode(HTMLDocument
*,SCRIPTMODE
);
602 IHTMLElementCollection
*HTMLElementCollection_Create(IUnknown
*,HTMLElement
**,DWORD
);
603 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
604 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocument
*,IUnknown
*,nsIDOMNodeList
*);
605 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocument
*,IUnknown
*,nsIDOMHTMLCollection
*);
610 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
611 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
614 extern const cmdtable_t editmode_cmds
[];
616 void do_ns_command(NSContainer
*,const char*,nsICommandParams
*);
619 #define UPDATE_UI 0x0001
620 #define UPDATE_TITLE 0x0002
622 void update_doc(HTMLDocument
*This
, DWORD flags
);
623 void update_title(HTMLDocument
*);
626 void init_editor(HTMLDocument
*);
627 void set_ns_editmode(NSContainer
*);
628 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
629 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
630 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
631 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
632 void handle_edit_load(HTMLDocument
*);
633 HRESULT
editor_is_dirty(HTMLDocument
*);
634 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
636 extern DWORD mshtml_tls
;
638 typedef struct task_t
{
642 TASK_SETDOWNLOADSTATE
,
648 nsChannelBSC
*bscallback
;
655 task_t
*task_queue_head
;
656 task_t
*task_queue_tail
;
657 struct list timer_list
;
660 thread_data_t
*get_thread_data(BOOL
);
661 HWND
get_thread_hwnd(void);
662 void push_task(task_t
*);
663 void remove_doc_tasks(const HTMLDocument
*);
664 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
665 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
667 HRESULT
get_typeinfo(tid_t
,ITypeInfo
**);
668 void release_typelib(void);
669 void call_disp_func(HTMLDocument
*,IDispatch
*);
671 const char *debugstr_variant(const VARIANT
*);
673 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
674 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
675 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
676 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
677 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
679 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
681 extern LONG module_ref
;
682 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
683 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
685 /* memory allocation functions */
687 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
689 return HeapAlloc(GetProcessHeap(), 0, len
);
692 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
694 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
697 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
699 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
702 static inline BOOL
heap_free(void *mem
)
704 return HeapFree(GetProcessHeap(), 0, mem
);
707 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
714 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
715 ret
= heap_alloc(size
);
716 memcpy(ret
, str
, size
);
722 static inline char *heap_strdupA(const char *str
)
729 size
= strlen(str
)+1;
730 ret
= heap_alloc(size
);
731 memcpy(ret
, str
, size
);
737 static inline WCHAR
*heap_strdupAtoW(const char *str
)
744 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
745 ret
= heap_alloc(len
*sizeof(WCHAR
));
746 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
752 static inline char *heap_strdupWtoA(LPCWSTR str
)
757 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
758 ret
= heap_alloc(size
);
759 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
765 HINSTANCE
get_shdoclc(void);
767 extern HINSTANCE hInst
;