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