Changes in crossover-wine-src-6.1.0 except for configure
[wine/hacks.git] / dlls / mshtml / mshtml_private.h
blob6d8e1546bfc823ed01a29d63ae37544173434b8e
1 /*
2 * Copyright 2005-2006 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
19 #include "docobj.h"
20 #include "mshtml.h"
21 #include "mshtmhst.h"
22 #include "hlink.h"
24 #include "wine/list.h"
26 #ifdef INIT_GUID
27 #include "initguid.h"
28 #endif
30 #include "nsiface.h"
32 #define GENERATE_MSHTML_NS_FAILURE(code) \
33 ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
35 #define NS_OK ((nsresult)0x00000000L)
36 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
37 #define NS_NOINTERFACE ((nsresult)0x80004002L)
38 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
39 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
40 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
41 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
43 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
45 #define NS_FAILED(res) ((res) & 0x80000000)
46 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
48 #define NSAPI WINAPI
50 #define NS_ELEMENT_NODE 1
51 #define NS_DOCUMENT_NODE 9
53 typedef struct HTMLDOMNode HTMLDOMNode;
54 typedef struct ConnectionPoint ConnectionPoint;
55 typedef struct BSCallback BSCallback;
57 typedef struct {
58 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
60 LONG ref;
62 HTMLDocument *doc;
63 nsIDOMWindow *nswindow;
65 struct list entry;
66 } HTMLWindow;
68 typedef enum {
69 UNKNOWN_USERMODE,
70 BROWSEMODE,
71 EDITMODE
72 } USERMODE;
74 struct HTMLDocument {
75 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
76 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
77 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
78 const IPersistFileVtbl *lpPersistFileVtbl;
79 const IMonikerPropVtbl *lpMonikerPropVtbl;
80 const IOleObjectVtbl *lpOleObjectVtbl;
81 const IOleDocumentVtbl *lpOleDocumentVtbl;
82 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
83 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
84 const IViewObject2Vtbl *lpViewObject2Vtbl;
85 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
86 const IServiceProviderVtbl *lpServiceProviderVtbl;
87 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
88 const IOleControlVtbl *lpOleControlVtbl;
89 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
90 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
91 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
93 LONG ref;
95 NSContainer *nscontainer;
96 HTMLWindow *window;
98 IOleClientSite *client;
99 IDocHostUIHandler *hostui;
100 IOleInPlaceSite *ipsite;
101 IOleInPlaceFrame *frame;
103 BSCallback *bscallback;
105 HWND hwnd;
106 HWND tooltips_hwnd;
108 DOCHOSTUIINFO hostinfo;
110 USERMODE usermode;
111 READYSTATE readystate;
112 BOOL in_place_active;
113 BOOL ui_active;
114 BOOL window_active;
115 BOOL has_key_path;
116 BOOL container_locked;
118 ConnectionPoint *cp_htmldocevents;
119 ConnectionPoint *cp_htmldocevents2;
120 ConnectionPoint *cp_propnotif;
122 HTMLDOMNode *nodes;
125 struct NSContainer {
126 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
127 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
128 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
129 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
130 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
131 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
132 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
133 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
134 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
136 nsIWebBrowser *webbrowser;
137 nsIWebNavigation *navigation;
138 nsIBaseWindow *window;
139 nsIWebBrowserFocus *focus;
141 LONG ref;
143 NSContainer *parent;
144 HTMLDocument *doc;
146 nsIURIContentListener *content_listener;
148 HWND hwnd;
150 BSCallback *bscallback; /* hack */
153 typedef struct {
154 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
155 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
157 LONG ref;
159 nsIChannel *channel;
160 nsIHttpChannel *http_channel;
161 nsIWineURI *uri;
162 nsIInputStream *post_data_stream;
163 nsILoadGroup *load_group;
164 nsIInterfaceRequestor *notif_callback;
165 nsLoadFlags load_flags;
166 nsIURI *original_uri;
167 char *content;
168 char *charset;
169 } nsChannel;
171 typedef struct {
172 const nsIInputStreamVtbl *lpInputStreamVtbl;
174 LONG ref;
176 char buf[1024];
177 DWORD buf_size;
178 } nsProtocolStream;
180 struct BSCallback {
181 const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
182 const IServiceProviderVtbl *lpServiceProviderVtbl;
183 const IHttpNegotiate2Vtbl *lpHttpNegotiate2Vtbl;
184 const IInternetBindInfoVtbl *lpInternetBindInfoVtbl;
186 LONG ref;
188 LPWSTR headers;
189 HGLOBAL post_data;
190 ULONG post_data_len;
191 ULONG readed;
193 nsChannel *nschannel;
194 nsIStreamListener *nslistener;
195 nsISupports *nscontext;
197 IMoniker *mon;
198 IBinding *binding;
200 HTMLDocument *doc;
202 nsProtocolStream *nsstream;
205 struct HTMLDOMNode {
206 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
208 void (*destructor)(IUnknown*);
210 enum {
211 NT_UNKNOWN,
212 NT_HTMLELEM
213 } node_type;
215 union {
216 IUnknown *unk;
217 IHTMLElement *elem;
218 } impl;
220 nsIDOMNode *nsnode;
221 HTMLDocument *doc;
223 HTMLDOMNode *next;
226 typedef struct {
227 const IHTMLElementVtbl *lpHTMLElementVtbl;
228 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
230 void (*destructor)(IUnknown*);
232 nsIDOMHTMLElement *nselem;
233 HTMLDOMNode *node;
235 IUnknown *impl;
236 } HTMLElement;
238 typedef struct {
239 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
241 HTMLElement *element;
242 } HTMLTextContainer;
244 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
246 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
247 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
248 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
249 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
250 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
251 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
252 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
253 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
254 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
255 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
256 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
257 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
258 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
259 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
260 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
261 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
262 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
263 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
264 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
265 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
266 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
268 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
269 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
270 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
271 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
272 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
273 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
274 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
275 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
276 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
278 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
279 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
280 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
282 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
283 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
284 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
286 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
287 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
288 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
290 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
292 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
294 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
295 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
297 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
298 HTMLWindow *nswindow_to_window(nsIDOMWindow*);
300 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
301 void HTMLDocument_Persist_Init(HTMLDocument*);
302 void HTMLDocument_OleCmd_Init(HTMLDocument*);
303 void HTMLDocument_OleObj_Init(HTMLDocument*);
304 void HTMLDocument_View_Init(HTMLDocument*);
305 void HTMLDocument_Window_Init(HTMLDocument*);
306 void HTMLDocument_Service_Init(HTMLDocument*);
307 void HTMLDocument_Hlink_Init(HTMLDocument*);
308 void HTMLDocument_ConnectionPoints_Init(HTMLDocument*);
310 void HTMLDocument_ConnectionPoints_Destroy(HTMLDocument*);
312 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
313 void NSContainer_Release(NSContainer*);
315 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
316 void HTMLDocument_ShowContextMenu(HTMLDocument*,DWORD,POINT*);
318 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
319 void hide_tooltip(HTMLDocument*);
320 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
322 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
324 void close_gecko(void);
325 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
326 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
328 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
330 void call_property_onchanged(ConnectionPoint*,DISPID);
332 void *nsalloc(size_t);
333 void nsfree(void*);
335 void nsACString_Init(nsACString*,const char*);
336 void nsACString_SetData(nsACString*,const char*);
337 PRUint32 nsACString_GetData(const nsACString*,const char**,PRBool*);
338 void nsACString_Finish(nsACString*);
340 void nsAString_Init(nsAString*,const PRUnichar*);
341 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**,PRBool*);
342 void nsAString_Finish(nsAString*);
344 nsIInputStream *create_nsstream(const char*,PRInt32);
345 nsICommandParams *create_nscommand_params(void);
346 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
348 BSCallback *create_bscallback(IMoniker*);
349 HRESULT start_binding(BSCallback*);
350 void set_document_bscallback(HTMLDocument*,BSCallback*);
352 IHlink *Hlink_Create(void);
353 IHTMLSelectionObject *HTMLSelectionObject_Create(nsISelection*);
354 IHTMLTxtRange *HTMLTxtRange_Create(nsISelection*);
355 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
356 IHTMLStyleSheet *HTMLStyleSheet_Create(void);
358 void HTMLElement_Create(HTMLDOMNode*);
359 void HTMLBodyElement_Create(HTMLElement*);
360 void HTMLInputElement_Create(HTMLElement*);
361 void HTMLSelectElement_Create(HTMLElement*);
362 void HTMLTextAreaElement_Create(HTMLElement*);
364 void HTMLElement2_Init(HTMLElement*);
366 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLElement*);
368 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
369 HRESULT HTMLElement_QI(HTMLElement*,REFIID,void**);
371 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
372 void release_nodes(HTMLDocument*);
374 BOOL install_wine_gecko(void);
376 /* editor */
377 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
379 void get_font_size(HTMLDocument*,WCHAR*);
380 void set_font_size(HTMLDocument*,LPCWSTR);
382 extern DWORD mshtml_tls;
384 typedef struct task_t {
385 HTMLDocument *doc;
387 enum {
388 TASK_SETDOWNLOADSTATE,
389 TASK_PARSECOMPLETE,
390 TASK_SETPROGRESS,
391 TASK_START_BINDING
392 } task_id;
394 BSCallback *bscallback;
396 struct task_t *next;
397 } task_t;
399 typedef struct {
400 HWND thread_hwnd;
401 task_t *task_queue_head;
402 task_t *task_queue_tail;
403 } thread_data_t;
405 thread_data_t *get_thread_data(BOOL);
406 HWND get_thread_hwnd(void);
407 void push_task(task_t*);
408 void remove_doc_tasks(HTMLDocument*);
410 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
411 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
412 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
413 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
414 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
416 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
418 extern LONG module_ref;
419 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
420 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
422 /* memory allocation functions */
424 static inline void *mshtml_alloc(size_t len)
426 return HeapAlloc(GetProcessHeap(), 0, len);
429 static inline void *mshtml_alloc_zero(size_t len)
431 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
434 static inline void *mshtml_realloc(void *mem, size_t len)
436 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
439 static inline BOOL mshtml_free(void *mem)
441 return HeapFree(GetProcessHeap(), 0, mem);
444 HINSTANCE get_shdoclc(void);
446 extern HINSTANCE hInst;