winsock: Implement getnameinfo.
[wine] / dlls / mshtml / mshtml_private.h
1 /*
2  * Copyright 2005 Jacek Caban
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 typedef struct BindStatusCallback BindStatusCallback;
44
45 typedef struct {
46     const IHTMLDocument2Vtbl              *lpHTMLDocument2Vtbl;
47     const IHTMLDocument3Vtbl              *lpHTMLDocument3Vtbl;
48     const IPersistMonikerVtbl             *lpPersistMonikerVtbl;
49     const IPersistFileVtbl                *lpPersistFileVtbl;
50     const IMonikerPropVtbl                *lpMonikerPropVtbl;
51     const IOleObjectVtbl                  *lpOleObjectVtbl;
52     const IOleDocumentVtbl                *lpOleDocumentVtbl;
53     const IOleDocumentViewVtbl            *lpOleDocumentViewVtbl;
54     const IOleInPlaceActiveObjectVtbl     *lpOleInPlaceActiveObjectVtbl;
55     const IViewObject2Vtbl                *lpViewObject2Vtbl;
56     const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
57     const IServiceProviderVtbl            *lpServiceProviderVtbl;
58     const IOleCommandTargetVtbl           *lpOleCommandTargetVtbl;
59     const IOleControlVtbl                 *lpOleControlVtbl;
60     const IHlinkTargetVtbl                *lpHlinkTargetVtbl;
61
62     LONG ref;
63
64     NSContainer *nscontainer;
65
66     IOleClientSite *client;
67     IDocHostUIHandler *hostui;
68     IOleInPlaceSite *ipsite;
69     IOleInPlaceFrame *frame;
70
71     HWND hwnd;
72
73     BOOL in_place_active;
74     BOOL ui_active;
75     BOOL window_active;
76     BOOL has_key_path;
77     BOOL container_locked;
78
79     BindStatusCallback *status_callback;
80 } HTMLDocument;
81
82 struct NSContainer {
83     const nsIWebBrowserChromeVtbl     *lpWebBrowserChromeVtbl;
84     const nsIContextMenuListenerVtbl  *lpContextMenuListenerVtbl;
85     const nsIURIContentListenerVtbl   *lpURIContentListenerVtbl;
86     const nsIEmbeddingSiteWindowVtbl  *lpEmbeddingSiteWindowVtbl;
87
88     nsIWebBrowser *webbrowser;
89     nsIWebNavigation *navigation;
90     nsIBaseWindow *window;
91     nsIWebBrowserStream *stream;
92     nsIWebBrowserFocus *focus;
93
94     LONG ref;
95
96     HTMLDocument *doc;
97
98     HWND hwnd;
99
100     BOOL load_call; /* hack */
101 };
102
103 #define HTMLDOC(x)       ((IHTMLDocument2*)               &(x)->lpHTMLDocument2Vtbl)
104 #define HTMLDOC3(x)      ((IHTMLDocument3*)               &(x)->lpHTMLDocument3Vtbl)
105 #define PERSIST(x)       ((IPersist*)                     &(x)->lpPersistFileVtbl)
106 #define PERSISTMON(x)    ((IPersistMoniker*)              &(x)->lpPersistMonikerVtbl)
107 #define PERSISTFILE(x)   ((IPersistFile*)                 &(x)->lpPersistFileVtbl)
108 #define MONPROP(x)       ((IMonikerProp*)                 &(x)->lpMonikerPropVtbl)
109 #define OLEOBJ(x)        ((IOleObject*)                   &(x)->lpOleObjectVtbl)
110 #define OLEDOC(x)        ((IOleDocument*)                 &(x)->lpOleDocumentVtbl)
111 #define DOCVIEW(x)       ((IOleDocumentView*)             &(x)->lpOleDocumentViewVtbl)
112 #define OLEWIN(x)        ((IOleWindow*)                   &(x)->lpOleInPlaceActiveObjectVtbl)
113 #define ACTOBJ(x)        ((IOleInPlaceActiveObject*)      &(x)->lpOleInPlaceActiveObjectVtbl)
114 #define VIEWOBJ(x)       ((IViewObject*)                  &(x)->lpViewObject2Vtbl)
115 #define VIEWOBJ2(x)      ((IViewObject2*)                 &(x)->lpViewObject2Vtbl)
116 #define INPLACEOBJ(x)    ((IOleInPlaceObject*)            &(x)->lpOleInPlaceObjectWindowlessVtbl)
117 #define INPLACEWIN(x)    ((IOleInPlaceObjectWindowless*)  &(x)->lpOleInPlaceObjectWindowlessVtbl)
118 #define SERVPROV(x)      ((IServiceProvider*)             &(x)->lpServiceProviderVtbl)
119 #define CMDTARGET(x)     ((IOleCommandTarget*)            &(x)->lpOleCommandTargetVtbl)
120 #define CONTROL(x)       ((IOleControl*)                  &(x)->lpOleControlVtbl)
121 #define STATUSCLB(x)     ((IBindStatusCallback*)          &(x)->lpBindStatusCallbackVtbl)
122 #define HLNKTARGET(x)    ((IHlinkTarget*)                 &(x)->lpHlinkTargetVtbl)
123
124 #define NSWBCHROME(x)    ((nsIWebBrowserChrome*)          &(x)->lpWebBrowserChromeVtbl)
125 #define NSCML(x)         ((nsIContextMenuListener*)       &(x)->lpContextMenuListenerVtbl)
126 #define NSURICL(x)       ((nsIURIContentListener*)        &(x)->lpURIContentListenerVtbl)
127 #define NSEMBWNDS(x)     ((nsIEmbeddingSiteWindow*)       &(x)->lpEmbeddingSiteWindowVtbl)
128
129 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
130
131 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
132
133 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
134 void HTMLDocument_Persist_Init(HTMLDocument*);
135 void HTMLDocument_OleObj_Init(HTMLDocument*);
136 void HTMLDocument_View_Init(HTMLDocument*);
137 void HTMLDocument_Window_Init(HTMLDocument*);
138 void HTMLDocument_Service_Init(HTMLDocument*);
139 void HTMLDocument_Hlink_Init(HTMLDocument*);
140
141 void NSContainer_Create(HTMLDocument *doc);
142 void NSContainer_Release(NSContainer*);
143
144 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
145 void HTMLDocument_ShowContextMenu(HTMLDocument*,DWORD,POINT*);
146
147 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
148
149 void close_gecko(void);
150 void register_nsservice(nsIComponentRegistrar*);
151 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
152
153 void hlink_frame_navigate(NSContainer*,IHlinkFrame*,LPCWSTR,nsIInputStream*);
154
155 nsIURI *get_nsIURI(LPCWSTR);
156
157 nsACString *nsACString_Create(void);
158 PRUint32 nsACString_GetData(const nsACString*,const char**,PRBool*);
159 void nsACString_SetData(nsACString*,const char*);
160 void nsACString_Destroy(nsACString*);
161
162 nsIInputStream *create_nsstream(const char*,PRInt32);
163
164 IHlink *Hlink_Create(void);
165
166 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
167 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
168 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
169 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
170 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
171
172 extern LONG module_ref;
173 #define LOCK_MODULE()   InterlockedIncrement(&module_ref)
174 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
175
176 extern HINSTANCE hInst;