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
,
67 DispHTMLCurrentStyle_tid
,
69 DispHTMLDOMTextNode_tid
,
70 DispHTMLElementCollection_tid
,
71 DispHTMLGenericElement_tid
,
74 DispHTMLInputElement_tid
,
75 DispHTMLOptionElement_tid
,
76 DispHTMLSelectElement_tid
,
80 DispHTMLUnknownElement_tid
,
83 IHTMLBodyElement2_tid
,
84 IHTMLCommentElement_tid
,
85 IHTMLCurrentStyle_tid
,
90 IHTMLDOMChildrenCollection_tid
,
98 IHTMLElementCollection_tid
,
100 IHTMLGenericElement_tid
,
102 IHTMLInputElement_tid
,
103 IHTMLOptionElement_tid
,
104 IHTMLSelectElement_tid
,
109 IHTMLTextContainer_tid
,
125 typedef struct dispex_data_t dispex_data_t
;
126 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
128 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
129 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
132 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
133 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
134 } dispex_static_data_vtbl_t
;
137 const dispex_static_data_vtbl_t
*vtbl
;
138 const tid_t disp_tid
;
140 const tid_t
* const iface_tids
;
141 } dispex_static_data_t
;
144 const IDispatchExVtbl
*lpIDispatchExVtbl
;
148 dispex_static_data_t
*data
;
149 dispex_dynamic_data_t
*dynamic_data
;
152 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
153 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
157 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
158 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
159 const IDispatchExVtbl
*lpIDispatchExVtbl
;
164 nsIDOMWindow
*nswindow
;
166 IHTMLEventObj
*event
;
179 SCRIPTMODE_ACTIVESCRIPT
183 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
185 ConnectionPoint
*cp_list
;
187 } ConnectionPointContainer
;
189 struct ConnectionPoint
{
190 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
192 IConnectionPointContainer
*container
;
197 IPropertyNotifySink
*propnotif
;
203 ConnectionPoint
*next
;
207 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
215 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
220 } HTMLOptionElementFactory
;
222 struct HTMLDocument
{
224 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
225 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
226 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
227 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
228 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
229 const IPersistFileVtbl
*lpPersistFileVtbl
;
230 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
231 const IOleObjectVtbl
*lpOleObjectVtbl
;
232 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
233 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
234 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
235 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
236 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
237 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
238 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
239 const IOleControlVtbl
*lpOleControlVtbl
;
240 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
241 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
242 const ICustomDocVtbl
*lpCustomDocVtbl
;
243 const IDispatchExVtbl
*lpIDispatchExVtbl
;
247 NSContainer
*nscontainer
;
249 nsIDOMHTMLDocument
*nsdoc
;
251 IOleClientSite
*client
;
252 IDocHostUIHandler
*hostui
;
253 IOleInPlaceSite
*ipsite
;
254 IOleInPlaceFrame
*frame
;
255 IOleInPlaceUIWindow
*ip_window
;
257 IOleUndoManager
*undomgr
;
259 nsChannelBSC
*bscallback
;
262 struct list bindings
;
264 struct list script_hosts
;
269 DOCHOSTUIINFO hostinfo
;
272 SCRIPTMODE scriptmode
;
273 READYSTATE readystate
;
274 BOOL in_place_active
;
278 BOOL container_locked
;
284 ConnectionPointContainer cp_container
;
285 ConnectionPoint cp_htmldocevents
;
286 ConnectionPoint cp_htmldocevents2
;
287 ConnectionPoint cp_propnotif
;
289 HTMLOptionElementFactory
*option_factory
;
290 HTMLLocation
*location
;
292 struct list selection_list
;
293 struct list range_list
;
299 const nsIDOMEventListenerVtbl
*lpDOMEventListenerVtbl
;
304 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
305 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
306 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
307 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
308 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
309 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
310 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
311 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
313 nsEventListener blur_listener
;
314 nsEventListener focus_listener
;
315 nsEventListener keypress_listener
;
316 nsEventListener load_listener
;
317 nsEventListener node_insert_listener
;
318 nsEventListener htmlevent_listener
;
320 nsIWebBrowser
*webbrowser
;
321 nsIWebNavigation
*navigation
;
322 nsIBaseWindow
*window
;
323 nsIWebBrowserFocus
*focus
;
326 nsIController
*editor_controller
;
333 nsIURIContentListener
*content_listener
;
337 nsChannelBSC
*bscallback
; /* hack */
338 HWND reset_focus
; /* hack */
340 BOOL event_vector
[EVENTID_LAST
];
344 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
345 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
350 nsIHttpChannel
*http_channel
;
352 nsIInputStream
*post_data_stream
;
353 nsILoadGroup
*load_group
;
354 nsIInterfaceRequestor
*notif_callback
;
355 nsLoadFlags load_flags
;
356 nsIURI
*original_uri
;
362 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
363 void (*destructor
)(HTMLDOMNode
*);
364 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
365 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
370 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
371 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
372 const NodeImplVtbl
*vtbl
;
378 event_target_t
*event_target
;
385 ConnectionPointContainer cp_container
;
387 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
388 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
389 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
391 nsIDOMHTMLElement
*nselem
;
397 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
402 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
403 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
405 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
406 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
407 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
408 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
409 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
410 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
411 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
412 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
413 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
414 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
415 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
416 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
417 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
418 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
419 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
420 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
421 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
422 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
423 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
424 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
425 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
426 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
427 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
428 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
430 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
431 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
432 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
433 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
434 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
435 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
436 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
437 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
438 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
440 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
441 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
442 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
444 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
445 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
446 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
448 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
449 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
450 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
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 DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
461 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
462 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
464 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
465 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
467 HTMLWindow
*HTMLWindow_Create(HTMLDocument
*);
468 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
469 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLDocument
*);
470 HTMLLocation
*HTMLLocation_Create(HTMLDocument
*);
471 IOmNavigator
*OmNavigator_Create(void);
473 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
474 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
475 void HTMLDocument_Persist_Init(HTMLDocument
*);
476 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
477 void HTMLDocument_OleObj_Init(HTMLDocument
*);
478 void HTMLDocument_View_Init(HTMLDocument
*);
479 void HTMLDocument_Window_Init(HTMLDocument
*);
480 void HTMLDocument_Service_Init(HTMLDocument
*);
481 void HTMLDocument_Hlink_Init(HTMLDocument
*);
483 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
485 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
);
486 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
487 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
489 NSContainer
*NSContainer_Create(HTMLDocument
*,NSContainer
*);
490 void NSContainer_Release(NSContainer
*);
492 void HTMLDocument_LockContainer(HTMLDocument
*,BOOL
);
493 void show_context_menu(HTMLDocument
*,DWORD
,POINT
*,IDispatch
*);
494 void notif_focus(HTMLDocument
*);
496 void show_tooltip(HTMLDocument
*,DWORD
,DWORD
,LPCWSTR
);
497 void hide_tooltip(HTMLDocument
*);
498 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
500 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
502 BOOL
load_gecko(BOOL
);
503 void close_gecko(void);
504 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
505 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
506 BOOL
install_wine_gecko(BOOL
);
508 void hlink_frame_navigate(HTMLDocument
*,IHlinkFrame
*,LPCWSTR
,nsIInputStream
*,DWORD
);
510 void call_property_onchanged(ConnectionPoint
*,DISPID
);
511 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
513 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
516 void nsACString_Init(nsACString
*,const char*);
517 void nsACString_SetData(nsACString
*,const char*);
518 PRUint32
nsACString_GetData(const nsACString
*,const char**);
519 void nsACString_Finish(nsACString
*);
521 void nsAString_Init(nsAString
*,const PRUnichar
*);
522 void nsAString_SetData(nsAString
*,const PRUnichar
*);
523 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
524 void nsAString_Finish(nsAString
*);
526 nsIInputStream
*create_nsstream(const char*,PRInt32
);
527 nsICommandParams
*create_nscommand_params(void);
528 nsIMutableArray
*create_nsarray(void);
529 nsIWritableVariant
*create_nsvariant(void);
530 void nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
531 void get_editor_controller(NSContainer
*);
532 void init_nsevents(NSContainer
*);
533 void add_nsevent_listener(NSContainer
*,LPCWSTR
);
534 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
535 void update_nsdocument(HTMLDocument
*);
537 void check_event_attr(HTMLDocument
*,nsIDOMElement
*);
538 void release_event_target(event_target_t
*);
539 void fire_event(HTMLDocument
*,eventid_t
,nsIDOMNode
*);
540 HRESULT
set_node_event(HTMLDOMNode
*,eventid_t
,VARIANT
*);
541 eventid_t
str_to_eid(LPCWSTR
);
543 void set_document_bscallback(HTMLDocument
*,nsChannelBSC
*);
544 void set_current_mon(HTMLDocument
*,IMoniker
*);
545 HRESULT
start_binding(HTMLDocument
*,BSCallback
*,IBindCtx
*);
547 HRESULT
bind_mon_to_buffer(HTMLDocument
*,IMoniker
*,void**,DWORD
*);
549 nsChannelBSC
*create_channelbsc(IMoniker
*);
550 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
551 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
552 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
554 IHTMLSelectionObject
*HTMLSelectionObject_Create(HTMLDocument
*,nsISelection
*);
555 IHTMLTxtRange
*HTMLTxtRange_Create(HTMLDocument
*,nsIDOMRange
*);
556 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
557 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
558 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
560 void detach_selection(HTMLDocument
*);
561 void detach_ranges(HTMLDocument
*);
563 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocument
*,nsIDOMNode
*);
565 HTMLElement
*HTMLElement_Create(HTMLDocument
*,nsIDOMNode
*,BOOL
);
566 HTMLElement
*HTMLCommentElement_Create(HTMLDocument
*,nsIDOMNode
*);
567 HTMLElement
*HTMLAnchorElement_Create(nsIDOMHTMLElement
*);
568 HTMLElement
*HTMLBodyElement_Create(nsIDOMHTMLElement
*);
569 HTMLElement
*HTMLIFrame_Create(nsIDOMHTMLElement
*);
570 HTMLElement
*HTMLImgElement_Create(nsIDOMHTMLElement
*);
571 HTMLElement
*HTMLInputElement_Create(nsIDOMHTMLElement
*);
572 HTMLElement
*HTMLOptionElement_Create(nsIDOMHTMLElement
*);
573 HTMLElement
*HTMLScriptElement_Create(nsIDOMHTMLElement
*);
574 HTMLElement
*HTMLSelectElement_Create(nsIDOMHTMLElement
*);
575 HTMLElement
*HTMLTable_Create(nsIDOMHTMLElement
*);
576 HTMLElement
*HTMLTableRow_Create(nsIDOMHTMLElement
*);
577 HTMLElement
*HTMLTextAreaElement_Create(nsIDOMHTMLElement
*);
578 HTMLElement
*HTMLGenericElement_Create(nsIDOMHTMLElement
*);
580 void HTMLDOMNode_Init(HTMLDocument
*,HTMLDOMNode
*,nsIDOMNode
*);
581 void HTMLElement_Init(HTMLElement
*);
582 void HTMLElement2_Init(HTMLElement
*);
583 void HTMLElement3_Init(HTMLElement
*);
584 void HTMLTextContainer_Init(HTMLTextContainer
*);
586 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
587 void HTMLDOMNode_destructor(HTMLDOMNode
*);
589 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
590 void HTMLElement_destructor(HTMLDOMNode
*);
592 HTMLDOMNode
*get_node(HTMLDocument
*,nsIDOMNode
*,BOOL
);
593 void release_nodes(HTMLDocument
*);
595 void release_script_hosts(HTMLDocument
*);
596 void connect_scripts(HTMLDocument
*);
597 void doc_insert_script(HTMLDocument
*,nsIDOMHTMLScriptElement
*);
598 IDispatch
*script_parse_event(HTMLDocument
*,LPCWSTR
);
599 void set_script_mode(HTMLDocument
*,SCRIPTMODE
);
601 IHTMLElementCollection
*HTMLElementCollection_Create(IUnknown
*,HTMLElement
**,DWORD
);
602 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
603 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocument
*,IUnknown
*,nsIDOMNodeList
*);
604 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocument
*,IUnknown
*,nsIDOMHTMLCollection
*);
609 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
610 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
613 extern const cmdtable_t editmode_cmds
[];
615 void do_ns_command(NSContainer
*,const char*,nsICommandParams
*);
618 #define UPDATE_UI 0x0001
619 #define UPDATE_TITLE 0x0002
621 void update_doc(HTMLDocument
*This
, DWORD flags
);
622 void update_title(HTMLDocument
*);
625 void init_editor(HTMLDocument
*);
626 void set_ns_editmode(NSContainer
*);
627 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
628 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
629 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
630 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
631 void handle_edit_load(HTMLDocument
*);
632 HRESULT
editor_is_dirty(HTMLDocument
*);
633 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
635 extern DWORD mshtml_tls
;
637 typedef struct task_t
{
641 TASK_SETDOWNLOADSTATE
,
647 nsChannelBSC
*bscallback
;
654 task_t
*task_queue_head
;
655 task_t
*task_queue_tail
;
656 struct list timer_list
;
659 thread_data_t
*get_thread_data(BOOL
);
660 HWND
get_thread_hwnd(void);
661 void push_task(task_t
*);
662 void remove_doc_tasks(const HTMLDocument
*);
663 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
664 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
666 HRESULT
get_typeinfo(tid_t
,ITypeInfo
**);
667 void release_typelib(void);
668 void call_disp_func(HTMLDocument
*,IDispatch
*);
670 const char *debugstr_variant(const VARIANT
*);
672 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
673 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
674 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
675 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
676 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
678 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
680 extern LONG module_ref
;
681 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
682 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
684 /* memory allocation functions */
686 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
688 return HeapAlloc(GetProcessHeap(), 0, len
);
691 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
693 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
696 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
698 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
701 static inline BOOL
heap_free(void *mem
)
703 return HeapFree(GetProcessHeap(), 0, mem
);
706 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
713 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
714 ret
= heap_alloc(size
);
715 memcpy(ret
, str
, size
);
721 static inline char *heap_strdupA(const char *str
)
728 size
= strlen(str
)+1;
729 ret
= heap_alloc(size
);
730 memcpy(ret
, str
, size
);
736 static inline WCHAR
*heap_strdupAtoW(const char *str
)
743 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
744 ret
= heap_alloc(len
*sizeof(WCHAR
));
745 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
751 static inline char *heap_strdupWtoA(LPCWSTR str
)
756 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
757 ret
= heap_alloc(size
);
758 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
764 HINSTANCE
get_shdoclc(void);
766 extern HINSTANCE hInst
;