dbghelp: Dwarf abbrev table is now a sparse array.
[wine] / dlls / mshtml / mshtml_private.h
1 /*
2  * Copyright 2005-2006 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include "docobj.h"
20 #include "mshtml.h"
21 #include "mshtmhst.h"
22 #include "hlink.h"
23
24 #ifdef INIT_GUID
25 #include "initguid.h"
26 #endif
27
28 #include "nsiface.h"
29
30 #define NS_OK                     ((nsresult)0x00000000L)
31 #define NS_ERROR_FAILURE          ((nsresult)0x80004005L)
32 #define NS_NOINTERFACE            ((nsresult)0x80004002L)
33 #define NS_ERROR_NOT_IMPLEMENTED  ((nsresult)0x80004001L)
34 #define NS_ERROR_INVALID_ARG      ((nsresult)0x80070057L) 
35 #define NS_ERROR_UNEXPECTED       ((nsresult)0x8000ffffL)
36 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
37
38 #define NS_FAILED(res) ((res) & 0x80000000)
39 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
40
41 #define NSAPI WINAPI
42
43 #define NS_ELEMENT_NODE   1
44 #define NS_DOCUMENT_NODE  9
45
46 typedef struct HTMLDOMNode HTMLDOMNode;
47 typedef struct ConnectionPoint ConnectionPoint;
48 typedef struct BSCallback BSCallback;
49
50 typedef struct {
51     const IHTMLDocument2Vtbl              *lpHTMLDocument2Vtbl;
52     const IHTMLDocument3Vtbl              *lpHTMLDocument3Vtbl;
53     const IPersistMonikerVtbl             *lpPersistMonikerVtbl;
54     const IPersistFileVtbl                *lpPersistFileVtbl;
55     const IMonikerPropVtbl                *lpMonikerPropVtbl;
56     const IOleObjectVtbl                  *lpOleObjectVtbl;
57     const IOleDocumentVtbl                *lpOleDocumentVtbl;
58     const IOleDocumentViewVtbl            *lpOleDocumentViewVtbl;
59     const IOleInPlaceActiveObjectVtbl     *lpOleInPlaceActiveObjectVtbl;
60     const IViewObject2Vtbl                *lpViewObject2Vtbl;
61     const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
62     const IServiceProviderVtbl            *lpServiceProviderVtbl;
63     const IOleCommandTargetVtbl           *lpOleCommandTargetVtbl;
64     const IOleControlVtbl                 *lpOleControlVtbl;
65     const IHlinkTargetVtbl                *lpHlinkTargetVtbl;
66     const IConnectionPointContainerVtbl   *lpConnectionPointContainerVtbl;
67     const IPersistStreamInitVtbl          *lpPersistStreamInitVtbl;
68
69     LONG ref;
70
71     NSContainer *nscontainer;
72
73     IOleClientSite *client;
74     IDocHostUIHandler *hostui;
75     IOleInPlaceSite *ipsite;
76     IOleInPlaceFrame *frame;
77
78     HWND hwnd;
79     HWND tooltips_hwnd;
80
81     BOOL in_place_active;
82     BOOL ui_active;
83     BOOL window_active;
84     BOOL has_key_path;
85     BOOL container_locked;
86
87     ConnectionPoint *cp_htmldocevents;
88     ConnectionPoint *cp_htmldocevents2;
89
90     HTMLDOMNode *nodes;
91 } HTMLDocument;
92
93 struct NSContainer {
94     const nsIWebBrowserChromeVtbl       *lpWebBrowserChromeVtbl;
95     const nsIContextMenuListenerVtbl    *lpContextMenuListenerVtbl;
96     const nsIURIContentListenerVtbl     *lpURIContentListenerVtbl;
97     const nsIEmbeddingSiteWindowVtbl    *lpEmbeddingSiteWindowVtbl;
98     const nsITooltipListenerVtbl        *lpTooltipListenerVtbl;
99     const nsIInterfaceRequestorVtbl     *lpInterfaceRequestorVtbl;
100     const nsIWeakReferenceVtbl          *lpWeakReferenceVtbl;
101     const nsISupportsWeakReferenceVtbl  *lpSupportsWeakReferenceVtbl;
102
103     nsIWebBrowser *webbrowser;
104     nsIWebNavigation *navigation;
105     nsIBaseWindow *window;
106     nsIWebBrowserFocus *focus;
107
108     LONG ref;
109
110     NSContainer *parent;
111     HTMLDocument *doc;
112
113     HWND hwnd;
114
115     BSCallback *bscallback; /* hack */
116 };
117
118 typedef struct {
119     const nsIHttpChannelVtbl *lpHttpChannelVtbl;
120     const nsIUploadChannelVtbl *lpUploadChannelVtbl;
121
122     LONG ref;
123
124     nsIChannel *channel;
125     nsIHttpChannel *http_channel;
126     nsIWineURI *uri;
127     nsIInputStream *post_data_stream;
128     nsILoadGroup *load_group;
129     nsIInterfaceRequestor *notif_callback;
130     nsLoadFlags load_flags;
131     nsIURI *original_uri;
132     char *content;
133 } nsChannel;
134
135 typedef struct {
136     const nsIInputStreamVtbl *lpInputStreamVtbl;
137
138     LONG ref;
139
140     char buf[1024];
141     DWORD buf_size;
142 } nsProtocolStream;
143
144 struct BSCallback {
145     const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
146     const IServiceProviderVtbl    *lpServiceProviderVtbl;
147     const IHttpNegotiate2Vtbl     *lpHttpNegotiate2Vtbl;
148     const IInternetBindInfoVtbl   *lpInternetBindInfoVtbl;
149
150     LONG ref;
151
152     LPWSTR headers;
153     HGLOBAL post_data;
154     ULONG post_data_len;
155
156     nsChannel *nschannel;
157     nsIStreamListener *nslistener;
158     nsISupports *nscontext;
159
160     nsProtocolStream *nsstream;
161 };
162
163 struct HTMLDOMNode {
164     const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
165
166     void (*destructor)(IUnknown*);
167
168     enum {
169         NT_UNKNOWN,
170         NT_HTMLELEM
171     } node_type;
172
173     union {
174         IUnknown *unk;
175         IHTMLElement *elem;
176     } impl;
177
178     nsIDOMNode *nsnode;
179     HTMLDocument *doc;
180
181     HTMLDOMNode *next;
182 };
183
184 typedef struct {
185     const IHTMLElementVtbl *lpHTMLElementVtbl;
186     const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
187
188     void (*destructor)(IUnknown*);
189
190     nsIDOMHTMLElement *nselem;
191     HTMLDOMNode *node;
192
193     IUnknown *impl;
194 } HTMLElement;
195
196 typedef struct {
197     const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
198
199     IUnknown *impl;
200 } HTMLTextContainer;
201
202 #define HTMLDOC(x)       ((IHTMLDocument2*)               &(x)->lpHTMLDocument2Vtbl)
203 #define HTMLDOC3(x)      ((IHTMLDocument3*)               &(x)->lpHTMLDocument3Vtbl)
204 #define PERSIST(x)       ((IPersist*)                     &(x)->lpPersistFileVtbl)
205 #define PERSISTMON(x)    ((IPersistMoniker*)              &(x)->lpPersistMonikerVtbl)
206 #define PERSISTFILE(x)   ((IPersistFile*)                 &(x)->lpPersistFileVtbl)
207 #define MONPROP(x)       ((IMonikerProp*)                 &(x)->lpMonikerPropVtbl)
208 #define OLEOBJ(x)        ((IOleObject*)                   &(x)->lpOleObjectVtbl)
209 #define OLEDOC(x)        ((IOleDocument*)                 &(x)->lpOleDocumentVtbl)
210 #define DOCVIEW(x)       ((IOleDocumentView*)             &(x)->lpOleDocumentViewVtbl)
211 #define OLEWIN(x)        ((IOleWindow*)                   &(x)->lpOleInPlaceActiveObjectVtbl)
212 #define ACTOBJ(x)        ((IOleInPlaceActiveObject*)      &(x)->lpOleInPlaceActiveObjectVtbl)
213 #define VIEWOBJ(x)       ((IViewObject*)                  &(x)->lpViewObject2Vtbl)
214 #define VIEWOBJ2(x)      ((IViewObject2*)                 &(x)->lpViewObject2Vtbl)
215 #define INPLACEOBJ(x)    ((IOleInPlaceObject*)            &(x)->lpOleInPlaceObjectWindowlessVtbl)
216 #define INPLACEWIN(x)    ((IOleInPlaceObjectWindowless*)  &(x)->lpOleInPlaceObjectWindowlessVtbl)
217 #define SERVPROV(x)      ((IServiceProvider*)             &(x)->lpServiceProviderVtbl)
218 #define CMDTARGET(x)     ((IOleCommandTarget*)            &(x)->lpOleCommandTargetVtbl)
219 #define CONTROL(x)       ((IOleControl*)                  &(x)->lpOleControlVtbl)
220 #define HLNKTARGET(x)    ((IHlinkTarget*)                 &(x)->lpHlinkTargetVtbl)
221 #define CONPTCONT(x)     ((IConnectionPointContainer*)    &(x)->lpConnectionPointContainerVtbl)
222 #define PERSTRINIT(x)    ((IPersistStreamInit*)           &(x)->lpPersistStreamInitVtbl)
223
224 #define NSWBCHROME(x)    ((nsIWebBrowserChrome*)          &(x)->lpWebBrowserChromeVtbl)
225 #define NSCML(x)         ((nsIContextMenuListener*)       &(x)->lpContextMenuListenerVtbl)
226 #define NSURICL(x)       ((nsIURIContentListener*)        &(x)->lpURIContentListenerVtbl)
227 #define NSEMBWNDS(x)     ((nsIEmbeddingSiteWindow*)       &(x)->lpEmbeddingSiteWindowVtbl)
228 #define NSIFACEREQ(x)    ((nsIInterfaceRequestor*)        &(x)->lpInterfaceRequestorVtbl)
229 #define NSTOOLTIP(x)     ((nsITooltipListener*)           &(x)->lpTooltipListenerVtbl)
230 #define NSWEAKREF(x)     ((nsIWeakReference*)             &(x)->lpWeakReferenceVtbl)
231 #define NSSUPWEAKREF(x)  ((nsISupportsWeakReference*)     &(x)->lpSupportsWeakReferenceVtbl)
232
233 #define NSCHANNEL(x)     ((nsIChannel*)        &(x)->lpHttpChannelVtbl)
234 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*)    &(x)->lpHttpChannelVtbl)
235 #define NSUPCHANNEL(x)   ((nsIUploadChannel*)  &(x)->lpUploadChannelVtbl)
236
237 #define HTTPNEG(x)       ((IHttpNegotiate2*)              &(x)->lpHttpNegotiate2Vtbl)
238 #define STATUSCLB(x)     ((IBindStatusCallback*)          &(x)->lpBindStatusCallbackVtbl)
239 #define BINDINFO(x)      ((IInternetBindInfo*)            &(x)->lpInternetBindInfoVtbl);
240
241 #define HTMLELEM(x)      ((IHTMLElement*)                 &(x)->lpHTMLElementVtbl)
242 #define HTMLELEM2(x)     ((IHTMLElement2*)                &(x)->lpHTMLElement2Vtbl)
243 #define HTMLDOMNODE(x)   ((IHTMLDOMNode*)                 &(x)->lpHTMLDOMNodeVtbl)
244
245 #define HTMLTEXTCONT(x)  ((IHTMLTextContainer*)           &(x)->lpHTMLTextContainerVtbl)
246
247 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
248
249 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
250
251 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
252 void HTMLDocument_Persist_Init(HTMLDocument*);
253 void HTMLDocument_OleObj_Init(HTMLDocument*);
254 void HTMLDocument_View_Init(HTMLDocument*);
255 void HTMLDocument_Window_Init(HTMLDocument*);
256 void HTMLDocument_Service_Init(HTMLDocument*);
257 void HTMLDocument_Hlink_Init(HTMLDocument*);
258 void HTMLDocument_ConnectionPoints_Init(HTMLDocument*);
259
260 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
261 void NSContainer_Release(NSContainer*);
262
263 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
264 void HTMLDocument_ShowContextMenu(HTMLDocument*,DWORD,POINT*);
265
266 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
267 void hide_tooltip(HTMLDocument*);
268
269 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
270
271 void close_gecko(void);
272 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
273 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
274
275 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
276
277 nsIURI *get_nsIURI(LPCWSTR);
278
279 void *nsalloc(size_t);
280 void nsfree(void*);
281
282 void nsACString_Init(nsACString*,const char*);
283 PRUint32 nsACString_GetData(const nsACString*,const char**,PRBool*);
284 void nsACString_Finish(nsACString*);
285
286 void nsAString_Init(nsAString*,const PRUnichar*);
287 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**,PRBool*);
288 void nsAString_Finish(nsAString*);
289
290 nsIInputStream *create_nsstream(const char*,PRInt32);
291
292 BSCallback *create_bscallback(HTMLDocument*,LPCOLESTR);
293 HRESULT start_binding(BSCallback*,IMoniker*);
294
295 IHlink *Hlink_Create(void);
296
297 void HTMLElement_Create(HTMLDOMNode*);
298 void HTMLBodyElement_Create(HTMLElement*);
299 void HTMLInputElement_Create(HTMLElement*);
300 void HTMLSelectElement_Create(HTMLElement*);
301 void HTMLTextAreaElement_Create(HTMLElement*);
302
303 void HTMLElement2_Init(HTMLElement*);
304
305 void HTMLTextContainer_Init(HTMLTextContainer*,IUnknown*);
306
307 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
308 HRESULT HTMLElement_QI(HTMLElement*,REFIID,void**);
309
310 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
311 void release_nodes(HTMLDocument*);
312
313 void install_wine_gecko(void);
314
315 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
316 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
317 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
318 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
319 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
320
321 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
322
323 extern LONG module_ref;
324 #define LOCK_MODULE()   InterlockedIncrement(&module_ref)
325 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
326
327 extern HINSTANCE hInst;