kernel: Remove no longer needed includes.
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 BindStatusCallback BindStatusCallback;
47 typedef struct HTMLDOMNode HTMLDOMNode;
48 typedef struct ConnectionPoint ConnectionPoint;
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
68     LONG ref;
69
70     NSContainer *nscontainer;
71
72     IOleClientSite *client;
73     IDocHostUIHandler *hostui;
74     IOleInPlaceSite *ipsite;
75     IOleInPlaceFrame *frame;
76
77     HWND hwnd;
78     HWND tooltips_hwnd;
79
80     BOOL in_place_active;
81     BOOL ui_active;
82     BOOL window_active;
83     BOOL has_key_path;
84     BOOL container_locked;
85
86     BindStatusCallback *status_callback;
87
88     ConnectionPoint *cp_htmldocevents;
89     ConnectionPoint *cp_htmldocevents2;
90
91     HTMLDOMNode *nodes;
92 } HTMLDocument;
93
94 struct NSContainer {
95     const nsIWebBrowserChromeVtbl       *lpWebBrowserChromeVtbl;
96     const nsIContextMenuListenerVtbl    *lpContextMenuListenerVtbl;
97     const nsIURIContentListenerVtbl     *lpURIContentListenerVtbl;
98     const nsIEmbeddingSiteWindowVtbl    *lpEmbeddingSiteWindowVtbl;
99     const nsITooltipListenerVtbl        *lpTooltipListenerVtbl;
100     const nsIInterfaceRequestorVtbl     *lpInterfaceRequestorVtbl;
101     const nsIWeakReferenceVtbl          *lpWeakReferenceVtbl;
102     const nsISupportsWeakReferenceVtbl  *lpSupportsWeakReferenceVtbl;
103
104     nsIWebBrowser *webbrowser;
105     nsIWebNavigation *navigation;
106     nsIBaseWindow *window;
107     nsIWebBrowserStream *stream;
108     nsIWebBrowserFocus *focus;
109
110     LONG ref;
111
112     NSContainer *parent;
113     HTMLDocument *doc;
114
115     HWND hwnd;
116
117     BOOL load_call; /* hack */
118 };
119
120 struct HTMLDOMNode {
121     const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
122
123     void (*destructor)(IUnknown*);
124
125     enum {
126         NT_UNKNOWN,
127         NT_HTMLELEM
128     } node_type;
129
130     union {
131         IUnknown *unk;
132         IHTMLElement *elem;
133     } impl;
134
135     nsIDOMNode *nsnode;
136     HTMLDocument *doc;
137
138     HTMLDOMNode *next;
139 };
140
141 typedef struct {
142     const IHTMLElementVtbl *lpHTMLElementVtbl;
143     const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
144
145     void (*destructor)(IUnknown*);
146
147     nsIDOMHTMLElement *nselem;
148     HTMLDOMNode *node;
149
150     IUnknown *impl;
151 } HTMLElement;
152
153 typedef struct {
154     const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
155
156     IUnknown *impl;
157 } HTMLTextContainer;
158
159 #define HTMLDOC(x)       ((IHTMLDocument2*)               &(x)->lpHTMLDocument2Vtbl)
160 #define HTMLDOC3(x)      ((IHTMLDocument3*)               &(x)->lpHTMLDocument3Vtbl)
161 #define PERSIST(x)       ((IPersist*)                     &(x)->lpPersistFileVtbl)
162 #define PERSISTMON(x)    ((IPersistMoniker*)              &(x)->lpPersistMonikerVtbl)
163 #define PERSISTFILE(x)   ((IPersistFile*)                 &(x)->lpPersistFileVtbl)
164 #define MONPROP(x)       ((IMonikerProp*)                 &(x)->lpMonikerPropVtbl)
165 #define OLEOBJ(x)        ((IOleObject*)                   &(x)->lpOleObjectVtbl)
166 #define OLEDOC(x)        ((IOleDocument*)                 &(x)->lpOleDocumentVtbl)
167 #define DOCVIEW(x)       ((IOleDocumentView*)             &(x)->lpOleDocumentViewVtbl)
168 #define OLEWIN(x)        ((IOleWindow*)                   &(x)->lpOleInPlaceActiveObjectVtbl)
169 #define ACTOBJ(x)        ((IOleInPlaceActiveObject*)      &(x)->lpOleInPlaceActiveObjectVtbl)
170 #define VIEWOBJ(x)       ((IViewObject*)                  &(x)->lpViewObject2Vtbl)
171 #define VIEWOBJ2(x)      ((IViewObject2*)                 &(x)->lpViewObject2Vtbl)
172 #define INPLACEOBJ(x)    ((IOleInPlaceObject*)            &(x)->lpOleInPlaceObjectWindowlessVtbl)
173 #define INPLACEWIN(x)    ((IOleInPlaceObjectWindowless*)  &(x)->lpOleInPlaceObjectWindowlessVtbl)
174 #define SERVPROV(x)      ((IServiceProvider*)             &(x)->lpServiceProviderVtbl)
175 #define CMDTARGET(x)     ((IOleCommandTarget*)            &(x)->lpOleCommandTargetVtbl)
176 #define CONTROL(x)       ((IOleControl*)                  &(x)->lpOleControlVtbl)
177 #define STATUSCLB(x)     ((IBindStatusCallback*)          &(x)->lpBindStatusCallbackVtbl)
178 #define HLNKTARGET(x)    ((IHlinkTarget*)                 &(x)->lpHlinkTargetVtbl)
179 #define CONPTCONT(x)     ((IConnectionPointContainer*)    &(x)->lpConnectionPointContainerVtbl)
180
181 #define NSWBCHROME(x)    ((nsIWebBrowserChrome*)          &(x)->lpWebBrowserChromeVtbl)
182 #define NSCML(x)         ((nsIContextMenuListener*)       &(x)->lpContextMenuListenerVtbl)
183 #define NSURICL(x)       ((nsIURIContentListener*)        &(x)->lpURIContentListenerVtbl)
184 #define NSEMBWNDS(x)     ((nsIEmbeddingSiteWindow*)       &(x)->lpEmbeddingSiteWindowVtbl)
185 #define NSIFACEREQ(x)    ((nsIInterfaceRequestor*)        &(x)->lpInterfaceRequestorVtbl)
186 #define NSTOOLTIP(x)     ((nsITooltipListener*)           &(x)->lpTooltipListenerVtbl)
187 #define NSWEAKREF(x)     ((nsIWeakReference*)             &(x)->lpWeakReferenceVtbl)
188 #define NSSUPWEAKREF(x)  ((nsISupportsWeakReference*)     &(x)->lpSupportsWeakReferenceVtbl)
189
190 #define HTMLELEM(x)      ((IHTMLElement*)                 &(x)->lpHTMLElementVtbl)
191 #define HTMLELEM2(x)     ((IHTMLElement2*)                &(x)->lpHTMLElement2Vtbl)
192 #define HTMLDOMNODE(x)   ((IHTMLDOMNode*)                 &(x)->lpHTMLDOMNodeVtbl)
193
194 #define HTMLTEXTCONT(x)  ((IHTMLTextContainer*)           &(x)->lpHTMLTextContainerVtbl)
195
196 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
197
198 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
199
200 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
201 void HTMLDocument_Persist_Init(HTMLDocument*);
202 void HTMLDocument_OleObj_Init(HTMLDocument*);
203 void HTMLDocument_View_Init(HTMLDocument*);
204 void HTMLDocument_Window_Init(HTMLDocument*);
205 void HTMLDocument_Service_Init(HTMLDocument*);
206 void HTMLDocument_Hlink_Init(HTMLDocument*);
207 void HTMLDocument_ConnectionPoints_Init(HTMLDocument*);
208
209 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
210 void NSContainer_Release(NSContainer*);
211
212 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
213 void HTMLDocument_ShowContextMenu(HTMLDocument*,DWORD,POINT*);
214
215 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
216 void hide_tooltip(HTMLDocument*);
217
218 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
219
220 void close_gecko(void);
221 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
222 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
223
224 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
225
226 nsIURI *get_nsIURI(LPCWSTR);
227
228 void *nsalloc(size_t);
229 void nsfree(void*);
230
231 void nsACString_Init(nsACString*,const char*);
232 PRUint32 nsACString_GetData(const nsACString*,const char**,PRBool*);
233 void nsACString_Finish(nsACString*);
234
235 void nsAString_Init(nsAString*,const PRUnichar*);
236 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**,PRBool*);
237 void nsAString_Finish(nsAString*);
238
239 nsIInputStream *create_nsstream(const char*,PRInt32);
240
241 IHlink *Hlink_Create(void);
242
243 void HTMLElement_Create(HTMLDOMNode*);
244 void HTMLBodyElement_Create(HTMLElement*);
245 void HTMLInputElement_Create(HTMLElement*);
246 void HTMLSelectElement_Create(HTMLElement*);
247 void HTMLTextAreaElement_Create(HTMLElement*);
248
249 void HTMLElement2_Init(HTMLElement*);
250
251 void HTMLTextContainer_Init(HTMLTextContainer*,IUnknown*);
252
253 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
254 HRESULT HTMLElement_QI(HTMLElement*,REFIID,void**);
255
256 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
257 void release_nodes(HTMLDocument*);
258
259 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
260 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
261 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
262 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
263 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
264
265 extern LONG module_ref;
266 #define LOCK_MODULE()   InterlockedIncrement(&module_ref)
267 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
268
269 extern HINSTANCE hInst;