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*);
137 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
141 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
142 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
143 const IDispatchExVtbl *lpIDispatchExVtbl;
148 nsIDOMWindow *nswindow;
150 IHTMLEventObj *event;
162 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
164 ConnectionPoint *cp_list;
166 } ConnectionPointContainer;
168 struct ConnectionPoint {
169 const IConnectionPointVtbl *lpConnectionPointVtbl;
171 IConnectionPointContainer *container;
176 IPropertyNotifySink *propnotif;
182 ConnectionPoint *next;
186 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
194 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
199 } HTMLOptionElementFactory;
201 struct HTMLDocument {
203 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
204 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
205 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
206 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
207 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
208 const IPersistFileVtbl *lpPersistFileVtbl;
209 const IMonikerPropVtbl *lpMonikerPropVtbl;
210 const IOleObjectVtbl *lpOleObjectVtbl;
211 const IOleDocumentVtbl *lpOleDocumentVtbl;
212 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
213 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
214 const IViewObject2Vtbl *lpViewObject2Vtbl;
215 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
216 const IServiceProviderVtbl *lpServiceProviderVtbl;
217 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
218 const IOleControlVtbl *lpOleControlVtbl;
219 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
220 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
221 const ICustomDocVtbl *lpCustomDocVtbl;
222 const IDispatchExVtbl *lpIDispatchExVtbl;
226 NSContainer *nscontainer;
229 IOleClientSite *client;
230 IDocHostUIHandler *hostui;
231 IOleInPlaceSite *ipsite;
232 IOleInPlaceFrame *frame;
233 IOleInPlaceUIWindow *ip_window;
235 IOleUndoManager *undomgr;
237 nsChannelBSC *bscallback;
240 struct list bindings;
242 struct list script_hosts;
247 DOCHOSTUIINFO hostinfo;
250 READYSTATE readystate;
251 BOOL in_place_active;
255 BOOL container_locked;
261 ConnectionPointContainer cp_container;
262 ConnectionPoint cp_htmldocevents;
263 ConnectionPoint cp_htmldocevents2;
264 ConnectionPoint cp_propnotif;
266 HTMLOptionElementFactory *option_factory;
267 HTMLLocation *location;
269 struct list selection_list;
270 struct list range_list;
276 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
281 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
282 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
283 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
284 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
285 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
286 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
287 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
288 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
290 nsEventListener blur_listener;
291 nsEventListener focus_listener;
292 nsEventListener keypress_listener;
293 nsEventListener load_listener;
294 nsEventListener node_insert_listener;
295 nsEventListener htmlevent_listener;
297 nsIWebBrowser *webbrowser;
298 nsIWebNavigation *navigation;
299 nsIBaseWindow *window;
300 nsIWebBrowserFocus *focus;
303 nsIController *editor_controller;
310 nsIURIContentListener *content_listener;
314 nsChannelBSC *bscallback; /* hack */
315 HWND reset_focus; /* hack */
317 BOOL event_vector[EVENTID_LAST];
321 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
322 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
327 nsIHttpChannel *http_channel;
329 nsIInputStream *post_data_stream;
330 nsILoadGroup *load_group;
331 nsIInterfaceRequestor *notif_callback;
332 nsLoadFlags load_flags;
333 nsIURI *original_uri;
339 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
340 void (*destructor)(HTMLDOMNode*);
345 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
346 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
347 const NodeImplVtbl *vtbl;
353 event_target_t *event_target;
360 ConnectionPointContainer cp_container;
362 const IHTMLElementVtbl *lpHTMLElementVtbl;
363 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
365 nsIDOMHTMLElement *nselem;
371 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
376 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
377 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
379 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
380 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
381 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
382 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
383 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
384 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
385 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
386 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
387 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
388 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
389 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
390 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
391 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
392 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
393 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
394 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
395 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
396 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
397 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
398 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
399 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
400 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
401 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
402 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
404 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
405 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
406 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
407 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
408 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
409 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
410 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
411 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
412 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
414 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
415 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
416 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
418 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
419 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
420 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
422 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
423 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
424 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
425 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
427 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
429 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
430 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
432 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
434 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
435 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
437 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
438 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
440 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
441 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
442 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
443 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
444 IOmNavigator *OmNavigator_Create(void);
445 void setup_nswindow(HTMLWindow*);
447 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
448 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
449 void HTMLDocument_Persist_Init(HTMLDocument*);
450 void HTMLDocument_OleCmd_Init(HTMLDocument*);
451 void HTMLDocument_OleObj_Init(HTMLDocument*);
452 void HTMLDocument_View_Init(HTMLDocument*);
453 void HTMLDocument_Window_Init(HTMLDocument*);
454 void HTMLDocument_Service_Init(HTMLDocument*);
455 void HTMLDocument_Hlink_Init(HTMLDocument*);
457 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
458 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
459 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
461 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
462 void NSContainer_Release(NSContainer*);
464 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
465 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
466 void notif_focus(HTMLDocument*);
468 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
469 void hide_tooltip(HTMLDocument*);
470 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
472 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
474 BOOL load_gecko(BOOL);
475 void close_gecko(void);
476 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
477 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
478 BOOL install_wine_gecko(BOOL);
480 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
482 void call_property_onchanged(ConnectionPoint*,DISPID);
483 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
485 void *nsalloc(size_t);
488 void nsACString_Init(nsACString*,const char*);
489 void nsACString_SetData(nsACString*,const char*);
490 PRUint32 nsACString_GetData(const nsACString*,const char**);
491 void nsACString_Finish(nsACString*);
493 void nsAString_Init(nsAString*,const PRUnichar*);
494 void nsAString_SetData(nsAString*,const PRUnichar*);
495 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
496 void nsAString_Finish(nsAString*);
498 nsIInputStream *create_nsstream(const char*,PRInt32);
499 nsICommandParams *create_nscommand_params(void);
500 nsIMutableArray *create_nsarray(void);
501 nsIWritableVariant *create_nsvariant(void);
502 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
503 void get_editor_controller(NSContainer*);
504 void init_nsevents(NSContainer*);
505 void add_nsevent_listener(NSContainer*,LPCWSTR);
506 nsresult get_nsinterface(nsISupports*,REFIID,void**);
508 void check_event_attr(HTMLDocument*,nsIDOMElement*);
509 void release_event_target(event_target_t*);
510 void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
511 HRESULT set_node_event(HTMLDOMNode*,eventid_t,VARIANT*);
512 eventid_t str_to_eid(LPCWSTR);
514 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
515 void set_current_mon(HTMLDocument*,IMoniker*);
516 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
518 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
520 nsChannelBSC *create_channelbsc(IMoniker*);
521 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
522 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
523 IMoniker *get_channelbsc_mon(nsChannelBSC*);
525 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
526 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
527 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
528 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
529 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
531 void detach_selection(HTMLDocument*);
532 void detach_ranges(HTMLDocument*);
534 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
536 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
537 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
538 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
539 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
540 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
541 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
542 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
543 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
544 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
545 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
546 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
547 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
549 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
550 void HTMLElement_Init(HTMLElement*);
551 void HTMLElement2_Init(HTMLElement*);
552 void HTMLTextContainer_Init(HTMLTextContainer*);
554 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
555 void HTMLDOMNode_destructor(HTMLDOMNode*);
557 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
558 void HTMLElement_destructor(HTMLDOMNode*);
560 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
561 void release_nodes(HTMLDocument*);
563 void release_script_hosts(HTMLDocument*);
564 void connect_scripts(HTMLDocument*);
565 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
566 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
568 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
573 HRESULT (*query)(HTMLDocument*,OLECMD*);
574 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
577 extern const cmdtable_t editmode_cmds[];
579 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
582 #define UPDATE_UI 0x0001
583 #define UPDATE_TITLE 0x0002
585 void update_doc(HTMLDocument *This, DWORD flags);
586 void update_title(HTMLDocument*);
589 void init_editor(HTMLDocument*);
590 void set_ns_editmode(NSContainer*);
591 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
592 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
593 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
594 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
595 void handle_edit_load(HTMLDocument*);
596 HRESULT editor_is_dirty(HTMLDocument*);
597 void set_dirty(HTMLDocument*,VARIANT_BOOL);
599 extern DWORD mshtml_tls;
601 typedef struct task_t {
605 TASK_SETDOWNLOADSTATE,
611 nsChannelBSC *bscallback;
618 task_t *task_queue_head;
619 task_t *task_queue_tail;
620 struct list timer_list;
623 thread_data_t *get_thread_data(BOOL);
624 HWND get_thread_hwnd(void);
625 void push_task(task_t*);
626 void remove_doc_tasks(const HTMLDocument*);
627 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
628 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
630 HRESULT get_typeinfo(tid_t,ITypeInfo**);
631 void release_typelib(void);
632 void call_disp_func(HTMLDocument*,IDispatch*);
634 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
635 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
636 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
637 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
638 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
640 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
642 extern LONG module_ref;
643 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
644 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
646 /* memory allocation functions */
648 static inline void *heap_alloc(size_t len)
650 return HeapAlloc(GetProcessHeap(), 0, len);
653 static inline void *heap_alloc_zero(size_t len)
655 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
658 static inline void *heap_realloc(void *mem, size_t len)
660 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
663 static inline BOOL heap_free(void *mem)
665 return HeapFree(GetProcessHeap(), 0, mem);
668 static inline LPWSTR heap_strdupW(LPCWSTR str)
675 size = (strlenW(str)+1)*sizeof(WCHAR);
676 ret = heap_alloc(size);
677 memcpy(ret, str, size);
683 static inline char *heap_strdupA(const char *str)
690 size = strlen(str)+1;
691 ret = heap_alloc(size);
692 memcpy(ret, str, size);
698 static inline WCHAR *heap_strdupAtoW(const char *str)
705 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
706 ret = heap_alloc(len*sizeof(WCHAR));
707 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
713 static inline char *heap_strdupWtoA(LPCWSTR str)
718 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
719 ret = heap_alloc(size);
720 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
726 HINSTANCE get_shdoclc(void);
728 extern HINSTANCE hInst;