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,
78 DispHTMLUnknownElement_tid,
81 IHTMLBodyElement2_tid,
82 IHTMLCommentElement_tid,
87 IHTMLDOMChildrenCollection_tid,
95 IHTMLElementCollection_tid,
96 IHTMLGenericElement_tid,
98 IHTMLInputElement_tid,
99 IHTMLOptionElement_tid,
100 IHTMLSelectElement_tid,
104 IHTMLTextContainer_tid,
120 typedef struct dispex_data_t dispex_data_t;
121 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
123 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
124 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
127 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
128 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
129 } dispex_static_data_vtbl_t;
132 const dispex_static_data_vtbl_t *vtbl;
133 const tid_t disp_tid;
135 const tid_t* const iface_tids;
136 } dispex_static_data_t;
139 const IDispatchExVtbl *lpIDispatchExVtbl;
143 dispex_static_data_t *data;
144 dispex_dynamic_data_t *dynamic_data;
147 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
148 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
152 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
153 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
154 const IDispatchExVtbl *lpIDispatchExVtbl;
159 nsIDOMWindow *nswindow;
161 IHTMLEventObj *event;
174 SCRIPTMODE_ACTIVESCRIPT
178 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
180 ConnectionPoint *cp_list;
182 } ConnectionPointContainer;
184 struct ConnectionPoint {
185 const IConnectionPointVtbl *lpConnectionPointVtbl;
187 IConnectionPointContainer *container;
192 IPropertyNotifySink *propnotif;
198 ConnectionPoint *next;
202 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
210 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
215 } HTMLOptionElementFactory;
217 struct HTMLDocument {
219 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
220 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
221 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
222 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
223 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
224 const IPersistFileVtbl *lpPersistFileVtbl;
225 const IMonikerPropVtbl *lpMonikerPropVtbl;
226 const IOleObjectVtbl *lpOleObjectVtbl;
227 const IOleDocumentVtbl *lpOleDocumentVtbl;
228 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
229 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
230 const IViewObject2Vtbl *lpViewObject2Vtbl;
231 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
232 const IServiceProviderVtbl *lpServiceProviderVtbl;
233 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
234 const IOleControlVtbl *lpOleControlVtbl;
235 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
236 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
237 const ICustomDocVtbl *lpCustomDocVtbl;
238 const IDispatchExVtbl *lpIDispatchExVtbl;
242 NSContainer *nscontainer;
245 IOleClientSite *client;
246 IDocHostUIHandler *hostui;
247 IOleInPlaceSite *ipsite;
248 IOleInPlaceFrame *frame;
249 IOleInPlaceUIWindow *ip_window;
251 IOleUndoManager *undomgr;
253 nsChannelBSC *bscallback;
256 struct list bindings;
258 struct list script_hosts;
263 DOCHOSTUIINFO hostinfo;
266 SCRIPTMODE scriptmode;
267 READYSTATE readystate;
268 BOOL in_place_active;
272 BOOL container_locked;
278 ConnectionPointContainer cp_container;
279 ConnectionPoint cp_htmldocevents;
280 ConnectionPoint cp_htmldocevents2;
281 ConnectionPoint cp_propnotif;
283 HTMLOptionElementFactory *option_factory;
284 HTMLLocation *location;
286 struct list selection_list;
287 struct list range_list;
293 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
298 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
299 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
300 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
301 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
302 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
303 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
304 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
305 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
307 nsEventListener blur_listener;
308 nsEventListener focus_listener;
309 nsEventListener keypress_listener;
310 nsEventListener load_listener;
311 nsEventListener node_insert_listener;
312 nsEventListener htmlevent_listener;
314 nsIWebBrowser *webbrowser;
315 nsIWebNavigation *navigation;
316 nsIBaseWindow *window;
317 nsIWebBrowserFocus *focus;
320 nsIController *editor_controller;
327 nsIURIContentListener *content_listener;
331 nsChannelBSC *bscallback; /* hack */
332 HWND reset_focus; /* hack */
334 BOOL event_vector[EVENTID_LAST];
338 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
339 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
344 nsIHttpChannel *http_channel;
346 nsIInputStream *post_data_stream;
347 nsILoadGroup *load_group;
348 nsIInterfaceRequestor *notif_callback;
349 nsLoadFlags load_flags;
350 nsIURI *original_uri;
356 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
357 void (*destructor)(HTMLDOMNode*);
362 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
363 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
364 const NodeImplVtbl *vtbl;
370 event_target_t *event_target;
377 ConnectionPointContainer cp_container;
379 const IHTMLElementVtbl *lpHTMLElementVtbl;
380 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
382 nsIDOMHTMLElement *nselem;
388 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
393 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
394 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
396 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
397 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
398 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
399 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
400 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
401 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
402 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
403 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
404 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
405 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
406 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
407 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
408 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
409 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
410 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
411 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
412 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
413 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
414 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
415 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
416 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
417 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
418 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
419 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
421 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
422 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
423 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
424 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
425 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
426 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
427 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
428 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
429 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
431 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
432 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
433 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
435 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
436 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
437 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
439 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
440 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
441 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
442 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
444 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
446 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
447 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
449 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
451 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
452 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
454 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
455 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
457 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
458 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
459 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
460 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
461 IOmNavigator *OmNavigator_Create(void);
462 void setup_nswindow(HTMLWindow*);
464 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
465 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
466 void HTMLDocument_Persist_Init(HTMLDocument*);
467 void HTMLDocument_OleCmd_Init(HTMLDocument*);
468 void HTMLDocument_OleObj_Init(HTMLDocument*);
469 void HTMLDocument_View_Init(HTMLDocument*);
470 void HTMLDocument_Window_Init(HTMLDocument*);
471 void HTMLDocument_Service_Init(HTMLDocument*);
472 void HTMLDocument_Hlink_Init(HTMLDocument*);
474 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
475 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
476 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
478 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
479 void NSContainer_Release(NSContainer*);
481 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
482 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
483 void notif_focus(HTMLDocument*);
485 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
486 void hide_tooltip(HTMLDocument*);
487 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
489 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
491 BOOL load_gecko(BOOL);
492 void close_gecko(void);
493 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
494 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
495 BOOL install_wine_gecko(BOOL);
497 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
499 void call_property_onchanged(ConnectionPoint*,DISPID);
500 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
502 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
505 void nsACString_Init(nsACString*,const char*);
506 void nsACString_SetData(nsACString*,const char*);
507 PRUint32 nsACString_GetData(const nsACString*,const char**);
508 void nsACString_Finish(nsACString*);
510 void nsAString_Init(nsAString*,const PRUnichar*);
511 void nsAString_SetData(nsAString*,const PRUnichar*);
512 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
513 void nsAString_Finish(nsAString*);
515 nsIInputStream *create_nsstream(const char*,PRInt32);
516 nsICommandParams *create_nscommand_params(void);
517 nsIMutableArray *create_nsarray(void);
518 nsIWritableVariant *create_nsvariant(void);
519 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
520 void get_editor_controller(NSContainer*);
521 void init_nsevents(NSContainer*);
522 void add_nsevent_listener(NSContainer*,LPCWSTR);
523 nsresult get_nsinterface(nsISupports*,REFIID,void**);
525 void check_event_attr(HTMLDocument*,nsIDOMElement*);
526 void release_event_target(event_target_t*);
527 void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
528 HRESULT set_node_event(HTMLDOMNode*,eventid_t,VARIANT*);
529 eventid_t str_to_eid(LPCWSTR);
531 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
532 void set_current_mon(HTMLDocument*,IMoniker*);
533 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
535 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
537 nsChannelBSC *create_channelbsc(IMoniker*);
538 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
539 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
540 IMoniker *get_channelbsc_mon(nsChannelBSC*);
542 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
543 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
544 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
545 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
546 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
548 void detach_selection(HTMLDocument*);
549 void detach_ranges(HTMLDocument*);
551 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
553 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
554 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
555 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
556 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
557 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
558 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
559 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
560 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
561 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
562 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
563 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
564 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
565 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
567 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
568 void HTMLElement_Init(HTMLElement*);
569 void HTMLElement2_Init(HTMLElement*);
570 void HTMLTextContainer_Init(HTMLTextContainer*);
572 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
573 void HTMLDOMNode_destructor(HTMLDOMNode*);
575 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
576 void HTMLElement_destructor(HTMLDOMNode*);
578 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
579 void release_nodes(HTMLDocument*);
581 void release_script_hosts(HTMLDocument*);
582 void connect_scripts(HTMLDocument*);
583 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
584 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
585 void set_script_mode(HTMLDocument*,SCRIPTMODE);
587 IHTMLElementCollection *HTMLElementCollection_Create(IUnknown*,HTMLElement**,DWORD);
588 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
589 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
590 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
595 HRESULT (*query)(HTMLDocument*,OLECMD*);
596 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
599 extern const cmdtable_t editmode_cmds[];
601 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
604 #define UPDATE_UI 0x0001
605 #define UPDATE_TITLE 0x0002
607 void update_doc(HTMLDocument *This, DWORD flags);
608 void update_title(HTMLDocument*);
611 void init_editor(HTMLDocument*);
612 void set_ns_editmode(NSContainer*);
613 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
614 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
615 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
616 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
617 void handle_edit_load(HTMLDocument*);
618 HRESULT editor_is_dirty(HTMLDocument*);
619 void set_dirty(HTMLDocument*,VARIANT_BOOL);
621 extern DWORD mshtml_tls;
623 typedef struct task_t {
627 TASK_SETDOWNLOADSTATE,
633 nsChannelBSC *bscallback;
640 task_t *task_queue_head;
641 task_t *task_queue_tail;
642 struct list timer_list;
645 thread_data_t *get_thread_data(BOOL);
646 HWND get_thread_hwnd(void);
647 void push_task(task_t*);
648 void remove_doc_tasks(const HTMLDocument*);
649 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
650 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
652 HRESULT get_typeinfo(tid_t,ITypeInfo**);
653 void release_typelib(void);
654 void call_disp_func(HTMLDocument*,IDispatch*);
656 const char *debugstr_variant(const VARIANT*);
658 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
659 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
660 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
661 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
662 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
664 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
666 extern LONG module_ref;
667 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
668 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
670 /* memory allocation functions */
672 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
674 return HeapAlloc(GetProcessHeap(), 0, len);
677 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
679 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
682 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
684 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
687 static inline BOOL heap_free(void *mem)
689 return HeapFree(GetProcessHeap(), 0, mem);
692 static inline LPWSTR heap_strdupW(LPCWSTR str)
699 size = (strlenW(str)+1)*sizeof(WCHAR);
700 ret = heap_alloc(size);
701 memcpy(ret, str, size);
707 static inline char *heap_strdupA(const char *str)
714 size = strlen(str)+1;
715 ret = heap_alloc(size);
716 memcpy(ret, str, size);
722 static inline WCHAR *heap_strdupAtoW(const char *str)
729 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
730 ret = heap_alloc(len*sizeof(WCHAR));
731 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
737 static inline char *heap_strdupWtoA(LPCWSTR str)
742 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
743 ret = heap_alloc(size);
744 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
750 HINSTANCE get_shdoclc(void);
752 extern HINSTANCE hInst;