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
,
76 DispHTMLUnknownElement_tid
,
79 IHTMLBodyElement2_tid
,
80 IHTMLCommentElement_tid
,
81 IHTMLControlElement_tid
,
86 IHTMLDOMChildrenCollection_tid
,
94 IHTMLElementCollection_tid
,
95 IHTMLGenericElement_tid
,
97 IHTMLInputElement_tid
,
98 IHTMLOptionElement_tid
,
99 IHTMLSelectElement_tid
,
101 IHTMLTextContainer_tid
,
117 typedef struct dispex_data_t dispex_data_t
;
118 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
120 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
121 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
124 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
125 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
126 } dispex_static_data_vtbl_t
;
129 const dispex_static_data_vtbl_t
*vtbl
;
130 const tid_t disp_tid
;
132 const tid_t
* const iface_tids
;
133 } dispex_static_data_t
;
136 const IDispatchExVtbl
*lpIDispatchExVtbl
;
140 dispex_static_data_t
*data
;
141 dispex_dynamic_data_t
*dynamic_data
;
144 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
145 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
149 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
150 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
151 const IDispatchExVtbl
*lpIDispatchExVtbl
;
156 nsIDOMWindow
*nswindow
;
158 IHTMLEventObj
*event
;
171 SCRIPTMODE_ACTIVESCRIPT
175 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
177 ConnectionPoint
*cp_list
;
179 } ConnectionPointContainer
;
181 struct ConnectionPoint
{
182 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
184 IConnectionPointContainer
*container
;
189 IPropertyNotifySink
*propnotif
;
195 ConnectionPoint
*next
;
199 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
207 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
212 } HTMLOptionElementFactory
;
214 struct HTMLDocument
{
216 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
217 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
218 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
219 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
220 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
221 const IPersistFileVtbl
*lpPersistFileVtbl
;
222 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
223 const IOleObjectVtbl
*lpOleObjectVtbl
;
224 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
225 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
226 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
227 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
228 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
229 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
230 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
231 const IOleControlVtbl
*lpOleControlVtbl
;
232 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
233 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
234 const ICustomDocVtbl
*lpCustomDocVtbl
;
235 const IDispatchExVtbl
*lpIDispatchExVtbl
;
239 NSContainer
*nscontainer
;
242 IOleClientSite
*client
;
243 IDocHostUIHandler
*hostui
;
244 IOleInPlaceSite
*ipsite
;
245 IOleInPlaceFrame
*frame
;
246 IOleInPlaceUIWindow
*ip_window
;
248 IOleUndoManager
*undomgr
;
250 nsChannelBSC
*bscallback
;
253 struct list bindings
;
255 struct list script_hosts
;
260 DOCHOSTUIINFO hostinfo
;
263 SCRIPTMODE scriptmode
;
264 READYSTATE readystate
;
265 BOOL in_place_active
;
269 BOOL container_locked
;
275 ConnectionPointContainer cp_container
;
276 ConnectionPoint cp_htmldocevents
;
277 ConnectionPoint cp_htmldocevents2
;
278 ConnectionPoint cp_propnotif
;
280 HTMLOptionElementFactory
*option_factory
;
281 HTMLLocation
*location
;
283 struct list selection_list
;
284 struct list range_list
;
290 const nsIDOMEventListenerVtbl
*lpDOMEventListenerVtbl
;
295 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
296 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
297 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
298 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
299 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
300 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
301 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
302 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
304 nsEventListener blur_listener
;
305 nsEventListener focus_listener
;
306 nsEventListener keypress_listener
;
307 nsEventListener load_listener
;
308 nsEventListener node_insert_listener
;
309 nsEventListener htmlevent_listener
;
311 nsIWebBrowser
*webbrowser
;
312 nsIWebNavigation
*navigation
;
313 nsIBaseWindow
*window
;
314 nsIWebBrowserFocus
*focus
;
317 nsIController
*editor_controller
;
324 nsIURIContentListener
*content_listener
;
328 nsChannelBSC
*bscallback
; /* hack */
329 HWND reset_focus
; /* hack */
331 BOOL event_vector
[EVENTID_LAST
];
335 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
336 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
341 nsIHttpChannel
*http_channel
;
343 nsIInputStream
*post_data_stream
;
344 nsILoadGroup
*load_group
;
345 nsIInterfaceRequestor
*notif_callback
;
346 nsLoadFlags load_flags
;
347 nsIURI
*original_uri
;
353 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
354 void (*destructor
)(HTMLDOMNode
*);
359 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
360 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
361 const NodeImplVtbl
*vtbl
;
367 event_target_t
*event_target
;
374 ConnectionPointContainer cp_container
;
376 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
377 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
379 nsIDOMHTMLElement
*nselem
;
385 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
390 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
391 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
393 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
394 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
395 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
396 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
397 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
398 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
399 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
400 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
401 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
402 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
403 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
404 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
405 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
406 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
407 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
408 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
409 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
410 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
411 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
412 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
413 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
414 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
415 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
416 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
418 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
419 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
420 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
421 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
422 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
423 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
424 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
425 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
426 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
428 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
429 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
430 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
432 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
433 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
434 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
436 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
437 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
438 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
439 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
441 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
443 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
444 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
446 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
448 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
449 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
451 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
452 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
454 HTMLWindow
*HTMLWindow_Create(HTMLDocument
*);
455 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
456 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLDocument
*);
457 HTMLLocation
*HTMLLocation_Create(HTMLDocument
*);
458 IOmNavigator
*OmNavigator_Create(void);
459 void setup_nswindow(HTMLWindow
*);
461 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
462 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
463 void HTMLDocument_Persist_Init(HTMLDocument
*);
464 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
465 void HTMLDocument_OleObj_Init(HTMLDocument
*);
466 void HTMLDocument_View_Init(HTMLDocument
*);
467 void HTMLDocument_Window_Init(HTMLDocument
*);
468 void HTMLDocument_Service_Init(HTMLDocument
*);
469 void HTMLDocument_Hlink_Init(HTMLDocument
*);
471 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
);
472 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
473 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
475 NSContainer
*NSContainer_Create(HTMLDocument
*,NSContainer
*);
476 void NSContainer_Release(NSContainer
*);
478 void HTMLDocument_LockContainer(HTMLDocument
*,BOOL
);
479 void show_context_menu(HTMLDocument
*,DWORD
,POINT
*,IDispatch
*);
480 void notif_focus(HTMLDocument
*);
482 void show_tooltip(HTMLDocument
*,DWORD
,DWORD
,LPCWSTR
);
483 void hide_tooltip(HTMLDocument
*);
484 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
486 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
488 BOOL
load_gecko(BOOL
);
489 void close_gecko(void);
490 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
491 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
492 BOOL
install_wine_gecko(BOOL
);
494 void hlink_frame_navigate(HTMLDocument
*,IHlinkFrame
*,LPCWSTR
,nsIInputStream
*,DWORD
);
496 void call_property_onchanged(ConnectionPoint
*,DISPID
);
497 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
499 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
502 void nsACString_Init(nsACString
*,const char*);
503 void nsACString_SetData(nsACString
*,const char*);
504 PRUint32
nsACString_GetData(const nsACString
*,const char**);
505 void nsACString_Finish(nsACString
*);
507 void nsAString_Init(nsAString
*,const PRUnichar
*);
508 void nsAString_SetData(nsAString
*,const PRUnichar
*);
509 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
510 void nsAString_Finish(nsAString
*);
512 nsIInputStream
*create_nsstream(const char*,PRInt32
);
513 nsICommandParams
*create_nscommand_params(void);
514 nsIMutableArray
*create_nsarray(void);
515 nsIWritableVariant
*create_nsvariant(void);
516 void nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
517 void get_editor_controller(NSContainer
*);
518 void init_nsevents(NSContainer
*);
519 void add_nsevent_listener(NSContainer
*,LPCWSTR
);
520 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
522 void check_event_attr(HTMLDocument
*,nsIDOMElement
*);
523 void release_event_target(event_target_t
*);
524 void fire_event(HTMLDocument
*,eventid_t
,nsIDOMNode
*);
525 HRESULT
set_node_event(HTMLDOMNode
*,eventid_t
,VARIANT
*);
526 eventid_t
str_to_eid(LPCWSTR
);
528 void set_document_bscallback(HTMLDocument
*,nsChannelBSC
*);
529 void set_current_mon(HTMLDocument
*,IMoniker
*);
530 HRESULT
start_binding(HTMLDocument
*,BSCallback
*,IBindCtx
*);
532 HRESULT
bind_mon_to_buffer(HTMLDocument
*,IMoniker
*,void**,DWORD
*);
534 nsChannelBSC
*create_channelbsc(IMoniker
*);
535 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
536 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
537 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
539 IHTMLSelectionObject
*HTMLSelectionObject_Create(HTMLDocument
*,nsISelection
*);
540 IHTMLTxtRange
*HTMLTxtRange_Create(HTMLDocument
*,nsIDOMRange
*);
541 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
542 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
543 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
545 void detach_selection(HTMLDocument
*);
546 void detach_ranges(HTMLDocument
*);
548 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocument
*,nsIDOMNode
*);
550 HTMLElement
*HTMLElement_Create(HTMLDocument
*,nsIDOMNode
*,BOOL
);
551 HTMLElement
*HTMLCommentElement_Create(HTMLDocument
*,nsIDOMNode
*);
552 HTMLElement
*HTMLAnchorElement_Create(nsIDOMHTMLElement
*);
553 HTMLElement
*HTMLBodyElement_Create(nsIDOMHTMLElement
*);
554 HTMLElement
*HTMLImgElement_Create(nsIDOMHTMLElement
*);
555 HTMLElement
*HTMLInputElement_Create(nsIDOMHTMLElement
*);
556 HTMLElement
*HTMLOptionElement_Create(nsIDOMHTMLElement
*);
557 HTMLElement
*HTMLScriptElement_Create(nsIDOMHTMLElement
*);
558 HTMLElement
*HTMLSelectElement_Create(nsIDOMHTMLElement
*);
559 HTMLElement
*HTMLTable_Create(nsIDOMHTMLElement
*);
560 HTMLElement
*HTMLTextAreaElement_Create(nsIDOMHTMLElement
*);
561 HTMLElement
*HTMLGenericElement_Create(nsIDOMHTMLElement
*);
563 void HTMLDOMNode_Init(HTMLDocument
*,HTMLDOMNode
*,nsIDOMNode
*);
564 void HTMLElement_Init(HTMLElement
*);
565 void HTMLElement2_Init(HTMLElement
*);
566 void HTMLTextContainer_Init(HTMLTextContainer
*);
568 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
569 void HTMLDOMNode_destructor(HTMLDOMNode
*);
571 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
572 void HTMLElement_destructor(HTMLDOMNode
*);
574 HTMLDOMNode
*get_node(HTMLDocument
*,nsIDOMNode
*,BOOL
);
575 void release_nodes(HTMLDocument
*);
577 void release_script_hosts(HTMLDocument
*);
578 void connect_scripts(HTMLDocument
*);
579 void doc_insert_script(HTMLDocument
*,nsIDOMHTMLScriptElement
*);
580 IDispatch
*script_parse_event(HTMLDocument
*,LPCWSTR
);
581 void set_script_mode(HTMLDocument
*,SCRIPTMODE
);
583 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*);
584 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocument
*,IUnknown
*,nsIDOMNodeList
*);
589 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
590 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
593 extern const cmdtable_t editmode_cmds
[];
595 void do_ns_command(NSContainer
*,const char*,nsICommandParams
*);
598 #define UPDATE_UI 0x0001
599 #define UPDATE_TITLE 0x0002
601 void update_doc(HTMLDocument
*This
, DWORD flags
);
602 void update_title(HTMLDocument
*);
605 void init_editor(HTMLDocument
*);
606 void set_ns_editmode(NSContainer
*);
607 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
608 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
609 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
610 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
611 void handle_edit_load(HTMLDocument
*);
612 HRESULT
editor_is_dirty(HTMLDocument
*);
613 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
615 extern DWORD mshtml_tls
;
617 typedef struct task_t
{
621 TASK_SETDOWNLOADSTATE
,
627 nsChannelBSC
*bscallback
;
634 task_t
*task_queue_head
;
635 task_t
*task_queue_tail
;
636 struct list timer_list
;
639 thread_data_t
*get_thread_data(BOOL
);
640 HWND
get_thread_hwnd(void);
641 void push_task(task_t
*);
642 void remove_doc_tasks(const HTMLDocument
*);
643 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
644 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
646 HRESULT
get_typeinfo(tid_t
,ITypeInfo
**);
647 void release_typelib(void);
648 void call_disp_func(HTMLDocument
*,IDispatch
*);
650 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
651 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
652 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
653 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
654 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
656 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
658 extern LONG module_ref
;
659 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
660 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
662 /* memory allocation functions */
664 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
666 return HeapAlloc(GetProcessHeap(), 0, len
);
669 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
671 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
674 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
676 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
679 static inline BOOL
heap_free(void *mem
)
681 return HeapFree(GetProcessHeap(), 0, mem
);
684 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
691 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
692 ret
= heap_alloc(size
);
693 memcpy(ret
, str
, size
);
699 static inline char *heap_strdupA(const char *str
)
706 size
= strlen(str
)+1;
707 ret
= heap_alloc(size
);
708 memcpy(ret
, str
, size
);
714 static inline WCHAR
*heap_strdupAtoW(const char *str
)
721 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
722 ret
= heap_alloc(len
*sizeof(WCHAR
));
723 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
729 static inline char *heap_strdupWtoA(LPCWSTR str
)
734 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
735 ret
= heap_alloc(size
);
736 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
742 HINSTANCE
get_shdoclc(void);
744 extern HINSTANCE hInst
;