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