mshtml: Added semi-stub createStyleSheet implementation.
[wine/gsoc_dplay.git] / dlls / mshtml / mshtml_private.h
blob452a53cb044fbdf1d0db3ff8f8a351885bc830ea
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 #ifdef INIT_GUID
25 #include "initguid.h"
26 #endif
28 #include "nsiface.h"
30 #define GENERATE_MSHTML_NS_FAILURE(code) \
31 ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
33 #define NS_OK ((nsresult)0x00000000L)
34 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
35 #define NS_NOINTERFACE ((nsresult)0x80004002L)
36 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
37 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
38 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
39 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
41 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
43 #define NS_FAILED(res) ((res) & 0x80000000)
44 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
46 #define NSAPI WINAPI
48 #define NS_ELEMENT_NODE 1
49 #define NS_DOCUMENT_NODE 9
51 typedef struct HTMLDOMNode HTMLDOMNode;
52 typedef struct ConnectionPoint ConnectionPoint;
53 typedef struct BSCallback BSCallback;
55 typedef enum {
56 UNKNOWN_USERMODE,
57 BROWSEMODE,
58 EDITMODE
59 } USERMODE;
61 struct HTMLDocument {
62 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
63 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
64 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
65 const IPersistFileVtbl *lpPersistFileVtbl;
66 const IMonikerPropVtbl *lpMonikerPropVtbl;
67 const IOleObjectVtbl *lpOleObjectVtbl;
68 const IOleDocumentVtbl *lpOleDocumentVtbl;
69 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
70 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
71 const IViewObject2Vtbl *lpViewObject2Vtbl;
72 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
73 const IServiceProviderVtbl *lpServiceProviderVtbl;
74 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
75 const IOleControlVtbl *lpOleControlVtbl;
76 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
77 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
78 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
80 LONG ref;
82 NSContainer *nscontainer;
84 IOleClientSite *client;
85 IDocHostUIHandler *hostui;
86 IOleInPlaceSite *ipsite;
87 IOleInPlaceFrame *frame;
89 BSCallback *bscallback;
91 HWND hwnd;
92 HWND tooltips_hwnd;
94 DOCHOSTUIINFO hostinfo;
96 USERMODE usermode;
97 READYSTATE readystate;
98 BOOL in_place_active;
99 BOOL ui_active;
100 BOOL window_active;
101 BOOL has_key_path;
102 BOOL container_locked;
104 ConnectionPoint *cp_htmldocevents;
105 ConnectionPoint *cp_htmldocevents2;
106 ConnectionPoint *cp_propnotif;
108 HTMLDOMNode *nodes;
111 struct NSContainer {
112 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
113 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
114 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
115 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
116 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
117 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
118 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
119 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
121 nsIWebBrowser *webbrowser;
122 nsIWebNavigation *navigation;
123 nsIBaseWindow *window;
124 nsIWebBrowserFocus *focus;
126 LONG ref;
128 NSContainer *parent;
129 HTMLDocument *doc;
131 nsIURIContentListener *content_listener;
133 HWND hwnd;
135 BSCallback *bscallback; /* hack */
138 typedef struct {
139 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
140 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
142 LONG ref;
144 nsIChannel *channel;
145 nsIHttpChannel *http_channel;
146 nsIWineURI *uri;
147 nsIInputStream *post_data_stream;
148 nsILoadGroup *load_group;
149 nsIInterfaceRequestor *notif_callback;
150 nsLoadFlags load_flags;
151 nsIURI *original_uri;
152 char *content;
153 } nsChannel;
155 typedef struct {
156 const nsIInputStreamVtbl *lpInputStreamVtbl;
158 LONG ref;
160 char buf[1024];
161 DWORD buf_size;
162 } nsProtocolStream;
164 struct BSCallback {
165 const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
166 const IServiceProviderVtbl *lpServiceProviderVtbl;
167 const IHttpNegotiate2Vtbl *lpHttpNegotiate2Vtbl;
168 const IInternetBindInfoVtbl *lpInternetBindInfoVtbl;
170 LONG ref;
172 LPWSTR headers;
173 HGLOBAL post_data;
174 ULONG post_data_len;
175 ULONG readed;
177 nsChannel *nschannel;
178 nsIStreamListener *nslistener;
179 nsISupports *nscontext;
181 IMoniker *mon;
182 IBinding *binding;
184 HTMLDocument *doc;
186 nsProtocolStream *nsstream;
189 struct HTMLDOMNode {
190 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
192 void (*destructor)(IUnknown*);
194 enum {
195 NT_UNKNOWN,
196 NT_HTMLELEM
197 } node_type;
199 union {
200 IUnknown *unk;
201 IHTMLElement *elem;
202 } impl;
204 nsIDOMNode *nsnode;
205 HTMLDocument *doc;
207 HTMLDOMNode *next;
210 typedef struct {
211 const IHTMLElementVtbl *lpHTMLElementVtbl;
212 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
214 void (*destructor)(IUnknown*);
216 nsIDOMHTMLElement *nselem;
217 HTMLDOMNode *node;
219 IUnknown *impl;
220 } HTMLElement;
222 typedef struct {
223 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
225 HTMLElement *element;
226 } HTMLTextContainer;
228 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
229 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
230 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
231 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
232 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
233 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
234 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
235 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
236 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
237 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
238 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
239 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
240 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
241 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
242 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
243 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
244 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
245 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
246 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
247 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
248 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
250 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
251 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
252 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
253 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
254 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
255 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
256 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
257 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
259 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
260 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
261 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
263 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
264 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
265 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
267 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
268 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
269 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
271 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
273 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
275 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
276 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
278 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
279 void HTMLDocument_Persist_Init(HTMLDocument*);
280 void HTMLDocument_OleCmd_Init(HTMLDocument*);
281 void HTMLDocument_OleObj_Init(HTMLDocument*);
282 void HTMLDocument_View_Init(HTMLDocument*);
283 void HTMLDocument_Window_Init(HTMLDocument*);
284 void HTMLDocument_Service_Init(HTMLDocument*);
285 void HTMLDocument_Hlink_Init(HTMLDocument*);
286 void HTMLDocument_ConnectionPoints_Init(HTMLDocument*);
288 void HTMLDocument_ConnectionPoints_Destroy(HTMLDocument*);
290 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
291 void NSContainer_Release(NSContainer*);
293 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
294 void HTMLDocument_ShowContextMenu(HTMLDocument*,DWORD,POINT*);
296 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
297 void hide_tooltip(HTMLDocument*);
298 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
300 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
302 void close_gecko(void);
303 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
304 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
306 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
308 void call_property_onchanged(ConnectionPoint*,DISPID);
310 void *nsalloc(size_t);
311 void nsfree(void*);
313 void nsACString_Init(nsACString*,const char*);
314 PRUint32 nsACString_GetData(const nsACString*,const char**,PRBool*);
315 void nsACString_Finish(nsACString*);
317 void nsAString_Init(nsAString*,const PRUnichar*);
318 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**,PRBool*);
319 void nsAString_Finish(nsAString*);
321 nsIInputStream *create_nsstream(const char*,PRInt32);
322 nsICommandParams *create_nscommand_params(void);
323 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
325 BSCallback *create_bscallback(IMoniker*);
326 HRESULT start_binding(BSCallback*);
327 void set_document_bscallback(HTMLDocument*,BSCallback*);
329 IHlink *Hlink_Create(void);
330 IHTMLSelectionObject *HTMLSelectionObject_Create(nsISelection*);
331 IHTMLTxtRange *HTMLTxtRange_Create(nsISelection*);
332 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
333 IHTMLStyleSheet *HTMLStyleSheet_Create(void);
335 void HTMLElement_Create(HTMLDOMNode*);
336 void HTMLBodyElement_Create(HTMLElement*);
337 void HTMLInputElement_Create(HTMLElement*);
338 void HTMLSelectElement_Create(HTMLElement*);
339 void HTMLTextAreaElement_Create(HTMLElement*);
341 void HTMLElement2_Init(HTMLElement*);
343 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLElement*);
345 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
346 HRESULT HTMLElement_QI(HTMLElement*,REFIID,void**);
348 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
349 void release_nodes(HTMLDocument*);
351 void install_wine_gecko(void);
353 extern DWORD mshtml_tls;
355 typedef struct task_t {
356 HTMLDocument *doc;
358 enum {
359 TASK_SETDOWNLOADSTATE,
360 TASK_PARSECOMPLETE,
361 TASK_SETPROGRESS
362 } task_id;
364 struct task_t *next;
365 } task_t;
367 typedef struct {
368 HWND thread_hwnd;
369 task_t *task_queue_head;
370 task_t *task_queue_tail;
371 } thread_data_t;
373 thread_data_t *get_thread_data(BOOL);
374 HWND get_thread_hwnd(void);
375 void push_task(task_t*);
376 void remove_doc_tasks(HTMLDocument*);
378 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
379 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
380 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
381 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
382 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
384 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
386 extern LONG module_ref;
387 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
388 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
390 /* memory allocation functions */
392 static inline void *mshtml_alloc(size_t len)
394 return HeapAlloc(GetProcessHeap(), 0, len);
397 static inline void *mshtml_alloc_zero(size_t len)
399 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
402 static inline void *mshtml_realloc(void *mem, size_t len)
404 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
407 static inline BOOL mshtml_free(void *mem)
409 return HeapFree(GetProcessHeap(), 0, mem);
412 HINSTANCE get_shdoclc(void);
414 extern HINSTANCE hInst;