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
,
65 DispHTMLCommentElement_tid
,
67 DispHTMLDOMTextNode_tid
,
68 DispHTMLElementCollection_tid
,
69 DispHTMLGenericElement_tid
,
71 DispHTMLInputElement_tid
,
72 DispHTMLOptionElement_tid
,
73 DispHTMLSelectElement_tid
,
75 DispHTMLUnknownElement_tid
,
77 IHTMLCommentElement_tid
,
82 IHTMLDOMChildrenCollection_tid
,
88 IHTMLElementCollection_tid
,
89 IHTMLGenericElement_tid
,
91 IHTMLInputElement_tid
,
92 IHTMLOptionElement_tid
,
93 IHTMLSelectElement_tid
,
109 typedef struct dispex_data_t dispex_data_t
;
110 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
112 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
113 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
116 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
117 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
118 } dispex_static_data_vtbl_t
;
121 const dispex_static_data_vtbl_t
*vtbl
;
122 const tid_t disp_tid
;
124 const tid_t
* const iface_tids
;
125 } dispex_static_data_t
;
128 const IDispatchExVtbl
*lpIDispatchExVtbl
;
132 dispex_static_data_t
*data
;
133 dispex_dynamic_data_t
*dynamic_data
;
136 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
140 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
141 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
142 const IDispatchExVtbl
*lpIDispatchExVtbl
;
147 nsIDOMWindow
*nswindow
;
149 IHTMLEventObj
*event
;
161 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
163 ConnectionPoint
*cp_list
;
165 } ConnectionPointContainer
;
167 struct ConnectionPoint
{
168 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
170 IConnectionPointContainer
*container
;
175 IPropertyNotifySink
*propnotif
;
181 ConnectionPoint
*next
;
185 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
193 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
198 } HTMLOptionElementFactory
;
200 struct HTMLDocument
{
202 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
203 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
204 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
205 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
206 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
207 const IPersistFileVtbl
*lpPersistFileVtbl
;
208 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
209 const IOleObjectVtbl
*lpOleObjectVtbl
;
210 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
211 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
212 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
213 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
214 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
215 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
216 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
217 const IOleControlVtbl
*lpOleControlVtbl
;
218 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
219 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
220 const ICustomDocVtbl
*lpCustomDocVtbl
;
221 const IDispatchExVtbl
*lpIDispatchExVtbl
;
225 NSContainer
*nscontainer
;
228 IOleClientSite
*client
;
229 IDocHostUIHandler
*hostui
;
230 IOleInPlaceSite
*ipsite
;
231 IOleInPlaceFrame
*frame
;
232 IOleInPlaceUIWindow
*ip_window
;
234 IOleUndoManager
*undomgr
;
236 nsChannelBSC
*bscallback
;
239 struct list bindings
;
241 struct list script_hosts
;
246 DOCHOSTUIINFO hostinfo
;
249 READYSTATE readystate
;
250 BOOL in_place_active
;
254 BOOL container_locked
;
260 ConnectionPointContainer cp_container
;
261 ConnectionPoint cp_htmldocevents
;
262 ConnectionPoint cp_htmldocevents2
;
263 ConnectionPoint cp_propnotif
;
265 HTMLOptionElementFactory
*option_factory
;
266 HTMLLocation
*location
;
268 struct list selection_list
;
269 struct list range_list
;
275 const nsIDOMEventListenerVtbl
*lpDOMEventListenerVtbl
;
280 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
281 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
282 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
283 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
284 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
285 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
286 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
287 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
289 nsEventListener blur_listener
;
290 nsEventListener focus_listener
;
291 nsEventListener keypress_listener
;
292 nsEventListener load_listener
;
293 nsEventListener node_insert_listener
;
294 nsEventListener htmlevent_listener
;
296 nsIWebBrowser
*webbrowser
;
297 nsIWebNavigation
*navigation
;
298 nsIBaseWindow
*window
;
299 nsIWebBrowserFocus
*focus
;
302 nsIController
*editor_controller
;
309 nsIURIContentListener
*content_listener
;
313 nsChannelBSC
*bscallback
; /* hack */
314 HWND reset_focus
; /* hack */
316 BOOL event_vector
[EVENTID_LAST
];
320 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
321 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
326 nsIHttpChannel
*http_channel
;
328 nsIInputStream
*post_data_stream
;
329 nsILoadGroup
*load_group
;
330 nsIInterfaceRequestor
*notif_callback
;
331 nsLoadFlags load_flags
;
332 nsIURI
*original_uri
;
338 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
339 void (*destructor
)(HTMLDOMNode
*);
344 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
345 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
346 const NodeImplVtbl
*vtbl
;
352 event_target_t
*event_target
;
359 ConnectionPointContainer cp_container
;
361 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
362 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
364 nsIDOMHTMLElement
*nselem
;
370 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
375 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
376 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
378 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
379 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
380 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
381 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
382 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
383 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
384 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
385 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
386 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
387 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
388 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
389 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
390 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
391 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
392 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
393 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
394 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
395 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
396 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
397 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
398 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
399 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
400 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
401 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
403 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
404 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
405 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
406 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
407 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
408 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
409 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
410 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
411 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
413 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
414 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
415 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
417 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
418 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
419 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
421 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
422 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
423 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
424 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
426 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
428 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
429 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
431 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
433 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
434 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
436 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
437 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
439 HTMLWindow
*HTMLWindow_Create(HTMLDocument
*);
440 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
441 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLDocument
*);
442 HTMLLocation
*HTMLLocation_Create(HTMLDocument
*);
443 IOmNavigator
*OmNavigator_Create(void);
444 void setup_nswindow(HTMLWindow
*);
446 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
447 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
448 void HTMLDocument_Persist_Init(HTMLDocument
*);
449 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
450 void HTMLDocument_OleObj_Init(HTMLDocument
*);
451 void HTMLDocument_View_Init(HTMLDocument
*);
452 void HTMLDocument_Window_Init(HTMLDocument
*);
453 void HTMLDocument_Service_Init(HTMLDocument
*);
454 void HTMLDocument_Hlink_Init(HTMLDocument
*);
456 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
);
457 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
458 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
460 NSContainer
*NSContainer_Create(HTMLDocument
*,NSContainer
*);
461 void NSContainer_Release(NSContainer
*);
463 void HTMLDocument_LockContainer(HTMLDocument
*,BOOL
);
464 void show_context_menu(HTMLDocument
*,DWORD
,POINT
*,IDispatch
*);
465 void notif_focus(HTMLDocument
*);
467 void show_tooltip(HTMLDocument
*,DWORD
,DWORD
,LPCWSTR
);
468 void hide_tooltip(HTMLDocument
*);
469 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
471 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
473 BOOL
load_gecko(BOOL
);
474 void close_gecko(void);
475 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
476 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
477 BOOL
install_wine_gecko(BOOL
);
479 void hlink_frame_navigate(HTMLDocument
*,IHlinkFrame
*,LPCWSTR
,nsIInputStream
*,DWORD
);
481 void call_property_onchanged(ConnectionPoint
*,DISPID
);
482 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
484 void *nsalloc(size_t);
487 void nsACString_Init(nsACString
*,const char*);
488 void nsACString_SetData(nsACString
*,const char*);
489 PRUint32
nsACString_GetData(const nsACString
*,const char**);
490 void nsACString_Finish(nsACString
*);
492 void nsAString_Init(nsAString
*,const PRUnichar
*);
493 void nsAString_SetData(nsAString
*,const PRUnichar
*);
494 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
495 void nsAString_Finish(nsAString
*);
497 nsIInputStream
*create_nsstream(const char*,PRInt32
);
498 nsICommandParams
*create_nscommand_params(void);
499 nsIMutableArray
*create_nsarray(void);
500 nsIWritableVariant
*create_nsvariant(void);
501 void nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
502 void get_editor_controller(NSContainer
*);
503 void init_nsevents(NSContainer
*);
504 void add_nsevent_listener(NSContainer
*,LPCWSTR
);
505 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
507 void check_event_attr(HTMLDocument
*,nsIDOMElement
*);
508 void release_event_target(event_target_t
*);
509 void fire_event(HTMLDocument
*,eventid_t
,nsIDOMNode
*);
510 HRESULT
set_node_event(HTMLDOMNode
*,eventid_t
,VARIANT
*);
511 eventid_t
str_to_eid(LPCWSTR
);
513 void set_document_bscallback(HTMLDocument
*,nsChannelBSC
*);
514 void set_current_mon(HTMLDocument
*,IMoniker
*);
515 HRESULT
start_binding(HTMLDocument
*,BSCallback
*,IBindCtx
*);
517 HRESULT
bind_mon_to_buffer(HTMLDocument
*,IMoniker
*,void**,DWORD
*);
519 nsChannelBSC
*create_channelbsc(IMoniker
*);
520 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
521 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
522 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
524 IHTMLSelectionObject
*HTMLSelectionObject_Create(HTMLDocument
*,nsISelection
*);
525 IHTMLTxtRange
*HTMLTxtRange_Create(HTMLDocument
*,nsIDOMRange
*);
526 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
527 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
528 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
530 void detach_selection(HTMLDocument
*);
531 void detach_ranges(HTMLDocument
*);
533 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocument
*,nsIDOMNode
*);
535 HTMLElement
*HTMLElement_Create(HTMLDocument
*,nsIDOMNode
*,BOOL
);
536 HTMLElement
*HTMLCommentElement_Create(HTMLDocument
*,nsIDOMNode
*);
537 HTMLElement
*HTMLAnchorElement_Create(nsIDOMHTMLElement
*);
538 HTMLElement
*HTMLBodyElement_Create(nsIDOMHTMLElement
*);
539 HTMLElement
*HTMLImgElement_Create(nsIDOMHTMLElement
*);
540 HTMLElement
*HTMLInputElement_Create(nsIDOMHTMLElement
*);
541 HTMLElement
*HTMLOptionElement_Create(nsIDOMHTMLElement
*);
542 HTMLElement
*HTMLScriptElement_Create(nsIDOMHTMLElement
*);
543 HTMLElement
*HTMLSelectElement_Create(nsIDOMHTMLElement
*);
544 HTMLElement
*HTMLTable_Create(nsIDOMHTMLElement
*);
545 HTMLElement
*HTMLTextAreaElement_Create(nsIDOMHTMLElement
*);
546 HTMLElement
*HTMLGenericElement_Create(nsIDOMHTMLElement
*);
548 void HTMLDOMNode_Init(HTMLDocument
*,HTMLDOMNode
*,nsIDOMNode
*);
549 void HTMLElement_Init(HTMLElement
*);
550 void HTMLElement2_Init(HTMLElement
*);
551 void HTMLTextContainer_Init(HTMLTextContainer
*);
553 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
554 void HTMLDOMNode_destructor(HTMLDOMNode
*);
556 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
557 void HTMLElement_destructor(HTMLDOMNode
*);
559 HTMLDOMNode
*get_node(HTMLDocument
*,nsIDOMNode
*,BOOL
);
560 void release_nodes(HTMLDocument
*);
562 void release_script_hosts(HTMLDocument
*);
563 void connect_scripts(HTMLDocument
*);
564 void doc_insert_script(HTMLDocument
*,nsIDOMHTMLScriptElement
*);
565 IDispatch
*script_parse_event(HTMLDocument
*,LPCWSTR
);
567 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*);
572 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
573 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
576 extern const cmdtable_t editmode_cmds
[];
578 void do_ns_command(NSContainer
*,const char*,nsICommandParams
*);
581 #define UPDATE_UI 0x0001
582 #define UPDATE_TITLE 0x0002
584 void update_doc(HTMLDocument
*This
, DWORD flags
);
585 void update_title(HTMLDocument
*);
588 void init_editor(HTMLDocument
*);
589 void set_ns_editmode(NSContainer
*);
590 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
591 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
592 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
593 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
594 void handle_edit_load(HTMLDocument
*);
595 HRESULT
editor_is_dirty(HTMLDocument
*);
596 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
598 extern DWORD mshtml_tls
;
600 typedef struct task_t
{
604 TASK_SETDOWNLOADSTATE
,
610 nsChannelBSC
*bscallback
;
617 task_t
*task_queue_head
;
618 task_t
*task_queue_tail
;
619 struct list timer_list
;
622 thread_data_t
*get_thread_data(BOOL
);
623 HWND
get_thread_hwnd(void);
624 void push_task(task_t
*);
625 void remove_doc_tasks(const HTMLDocument
*);
626 DWORD
set_task_timer(HTMLDocument
*,DWORD
,IDispatch
*);
628 HRESULT
get_typeinfo(tid_t
,ITypeInfo
**);
629 void release_typelib(void);
630 void call_disp_func(HTMLDocument
*,IDispatch
*);
632 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
633 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
634 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
635 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
636 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
638 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
640 extern LONG module_ref
;
641 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
642 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
644 /* memory allocation functions */
646 static inline void *heap_alloc(size_t len
)
648 return HeapAlloc(GetProcessHeap(), 0, len
);
651 static inline void *heap_alloc_zero(size_t len
)
653 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
656 static inline void *heap_realloc(void *mem
, size_t len
)
658 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
661 static inline BOOL
heap_free(void *mem
)
663 return HeapFree(GetProcessHeap(), 0, mem
);
666 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
673 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
674 ret
= heap_alloc(size
);
675 memcpy(ret
, str
, size
);
681 static inline char *heap_strdupA(const char *str
)
688 size
= strlen(str
)+1;
689 ret
= heap_alloc(size
);
690 memcpy(ret
, str
, size
);
696 static inline WCHAR
*heap_strdupAtoW(const char *str
)
703 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
704 ret
= heap_alloc(len
*sizeof(WCHAR
));
705 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
711 static inline char *heap_strdupWtoA(LPCWSTR str
)
716 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
717 ret
= heap_alloc(size
);
718 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
724 HINSTANCE
get_shdoclc(void);
726 extern HINSTANCE hInst
;