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;
170 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
172 ConnectionPoint *cp_list;
174 } ConnectionPointContainer;
176 struct ConnectionPoint {
177 const IConnectionPointVtbl *lpConnectionPointVtbl;
179 IConnectionPointContainer *container;
184 IPropertyNotifySink *propnotif;
190 ConnectionPoint *next;
194 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
202 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
207 } HTMLOptionElementFactory;
209 struct HTMLDocument {
211 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
212 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
213 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
214 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
215 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
216 const IPersistFileVtbl *lpPersistFileVtbl;
217 const IMonikerPropVtbl *lpMonikerPropVtbl;
218 const IOleObjectVtbl *lpOleObjectVtbl;
219 const IOleDocumentVtbl *lpOleDocumentVtbl;
220 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
221 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
222 const IViewObject2Vtbl *lpViewObject2Vtbl;
223 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
224 const IServiceProviderVtbl *lpServiceProviderVtbl;
225 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
226 const IOleControlVtbl *lpOleControlVtbl;
227 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
228 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
229 const ICustomDocVtbl *lpCustomDocVtbl;
230 const IDispatchExVtbl *lpIDispatchExVtbl;
234 NSContainer *nscontainer;
237 IOleClientSite *client;
238 IDocHostUIHandler *hostui;
239 IOleInPlaceSite *ipsite;
240 IOleInPlaceFrame *frame;
241 IOleInPlaceUIWindow *ip_window;
243 IOleUndoManager *undomgr;
245 nsChannelBSC *bscallback;
248 struct list bindings;
250 struct list script_hosts;
255 DOCHOSTUIINFO hostinfo;
258 READYSTATE readystate;
259 BOOL in_place_active;
263 BOOL container_locked;
269 ConnectionPointContainer cp_container;
270 ConnectionPoint cp_htmldocevents;
271 ConnectionPoint cp_htmldocevents2;
272 ConnectionPoint cp_propnotif;
274 HTMLOptionElementFactory *option_factory;
275 HTMLLocation *location;
277 struct list selection_list;
278 struct list range_list;
284 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
289 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
290 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
291 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
292 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
293 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
294 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
295 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
296 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
298 nsEventListener blur_listener;
299 nsEventListener focus_listener;
300 nsEventListener keypress_listener;
301 nsEventListener load_listener;
302 nsEventListener node_insert_listener;
303 nsEventListener htmlevent_listener;
305 nsIWebBrowser *webbrowser;
306 nsIWebNavigation *navigation;
307 nsIBaseWindow *window;
308 nsIWebBrowserFocus *focus;
311 nsIController *editor_controller;
318 nsIURIContentListener *content_listener;
322 nsChannelBSC *bscallback; /* hack */
323 HWND reset_focus; /* hack */
325 BOOL event_vector[EVENTID_LAST];
329 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
330 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
335 nsIHttpChannel *http_channel;
337 nsIInputStream *post_data_stream;
338 nsILoadGroup *load_group;
339 nsIInterfaceRequestor *notif_callback;
340 nsLoadFlags load_flags;
341 nsIURI *original_uri;
347 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
348 void (*destructor)(HTMLDOMNode*);
353 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
354 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
355 const NodeImplVtbl *vtbl;
361 event_target_t *event_target;
368 ConnectionPointContainer cp_container;
370 const IHTMLElementVtbl *lpHTMLElementVtbl;
371 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
373 nsIDOMHTMLElement *nselem;
379 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
384 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
385 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
387 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
388 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
389 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
390 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
391 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
392 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
393 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
394 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
395 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
396 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
397 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
398 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
399 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
400 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
401 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
402 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
403 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
404 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
405 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
406 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
407 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
408 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
409 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
410 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
412 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
413 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
414 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
415 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
416 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
417 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
418 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
419 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
420 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
422 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
423 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
424 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
426 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
427 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
428 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
430 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
431 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
432 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
433 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
435 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
437 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
438 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
440 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
442 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
443 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
445 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
446 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
448 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
449 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
450 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
451 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
452 IOmNavigator *OmNavigator_Create(void);
453 void setup_nswindow(HTMLWindow*);
455 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
456 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
457 void HTMLDocument_Persist_Init(HTMLDocument*);
458 void HTMLDocument_OleCmd_Init(HTMLDocument*);
459 void HTMLDocument_OleObj_Init(HTMLDocument*);
460 void HTMLDocument_View_Init(HTMLDocument*);
461 void HTMLDocument_Window_Init(HTMLDocument*);
462 void HTMLDocument_Service_Init(HTMLDocument*);
463 void HTMLDocument_Hlink_Init(HTMLDocument*);
465 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
466 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
467 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
469 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
470 void NSContainer_Release(NSContainer*);
472 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
473 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
474 void notif_focus(HTMLDocument*);
476 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
477 void hide_tooltip(HTMLDocument*);
478 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
480 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
482 BOOL load_gecko(BOOL);
483 void close_gecko(void);
484 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
485 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
486 BOOL install_wine_gecko(BOOL);
488 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
490 void call_property_onchanged(ConnectionPoint*,DISPID);
491 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
493 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
496 void nsACString_Init(nsACString*,const char*);
497 void nsACString_SetData(nsACString*,const char*);
498 PRUint32 nsACString_GetData(const nsACString*,const char**);
499 void nsACString_Finish(nsACString*);
501 void nsAString_Init(nsAString*,const PRUnichar*);
502 void nsAString_SetData(nsAString*,const PRUnichar*);
503 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
504 void nsAString_Finish(nsAString*);
506 nsIInputStream *create_nsstream(const char*,PRInt32);
507 nsICommandParams *create_nscommand_params(void);
508 nsIMutableArray *create_nsarray(void);
509 nsIWritableVariant *create_nsvariant(void);
510 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
511 void get_editor_controller(NSContainer*);
512 void init_nsevents(NSContainer*);
513 void add_nsevent_listener(NSContainer*,LPCWSTR);
514 nsresult get_nsinterface(nsISupports*,REFIID,void**);
516 void check_event_attr(HTMLDocument*,nsIDOMElement*);
517 void release_event_target(event_target_t*);
518 void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
519 HRESULT set_node_event(HTMLDOMNode*,eventid_t,VARIANT*);
520 eventid_t str_to_eid(LPCWSTR);
522 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
523 void set_current_mon(HTMLDocument*,IMoniker*);
524 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
526 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
528 nsChannelBSC *create_channelbsc(IMoniker*);
529 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
530 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
531 IMoniker *get_channelbsc_mon(nsChannelBSC*);
533 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
534 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
535 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
536 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
537 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
539 void detach_selection(HTMLDocument*);
540 void detach_ranges(HTMLDocument*);
542 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
544 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
545 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
546 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
547 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
548 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
549 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
550 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
551 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
552 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
553 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
554 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
555 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
557 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
558 void HTMLElement_Init(HTMLElement*);
559 void HTMLElement2_Init(HTMLElement*);
560 void HTMLTextContainer_Init(HTMLTextContainer*);
562 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
563 void HTMLDOMNode_destructor(HTMLDOMNode*);
565 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
566 void HTMLElement_destructor(HTMLDOMNode*);
568 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
569 void release_nodes(HTMLDocument*);
571 void release_script_hosts(HTMLDocument*);
572 void connect_scripts(HTMLDocument*);
573 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
574 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
576 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
577 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
582 HRESULT (*query)(HTMLDocument*,OLECMD*);
583 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
586 extern const cmdtable_t editmode_cmds[];
588 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
591 #define UPDATE_UI 0x0001
592 #define UPDATE_TITLE 0x0002
594 void update_doc(HTMLDocument *This, DWORD flags);
595 void update_title(HTMLDocument*);
598 void init_editor(HTMLDocument*);
599 void set_ns_editmode(NSContainer*);
600 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
601 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
602 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
603 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
604 void handle_edit_load(HTMLDocument*);
605 HRESULT editor_is_dirty(HTMLDocument*);
606 void set_dirty(HTMLDocument*,VARIANT_BOOL);
608 extern DWORD mshtml_tls;
610 typedef struct task_t {
614 TASK_SETDOWNLOADSTATE,
620 nsChannelBSC *bscallback;
627 task_t *task_queue_head;
628 task_t *task_queue_tail;
629 struct list timer_list;
632 thread_data_t *get_thread_data(BOOL);
633 HWND get_thread_hwnd(void);
634 void push_task(task_t*);
635 void remove_doc_tasks(const HTMLDocument*);
636 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
637 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
639 HRESULT get_typeinfo(tid_t,ITypeInfo**);
640 void release_typelib(void);
641 void call_disp_func(HTMLDocument*,IDispatch*);
643 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
644 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
645 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
646 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
647 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
649 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
651 extern LONG module_ref;
652 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
653 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
655 /* memory allocation functions */
657 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
659 return HeapAlloc(GetProcessHeap(), 0, len);
662 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
664 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
667 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
669 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
672 static inline BOOL heap_free(void *mem)
674 return HeapFree(GetProcessHeap(), 0, mem);
677 static inline LPWSTR heap_strdupW(LPCWSTR str)
684 size = (strlenW(str)+1)*sizeof(WCHAR);
685 ret = heap_alloc(size);
686 memcpy(ret, str, size);
692 static inline char *heap_strdupA(const char *str)
699 size = strlen(str)+1;
700 ret = heap_alloc(size);
701 memcpy(ret, str, size);
707 static inline WCHAR *heap_strdupAtoW(const char *str)
714 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
715 ret = heap_alloc(len*sizeof(WCHAR));
716 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
722 static inline char *heap_strdupWtoA(LPCWSTR str)
727 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
728 ret = heap_alloc(size);
729 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
735 HINSTANCE get_shdoclc(void);
737 extern HINSTANCE hInst;