shdocvw: Move IServiceProvider to DocHost object.
[wine] / dlls / shdocvw / shdocvw.h
1 /*
2  * Header includes for shdocvw.dll
3  *
4  * Copyright 2001 John R. Sheets (for CodeWeavers)
5  * Copyright 2005-2006 Jacek Caban for CodeWeavers
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #ifndef __WINE_SHDOCVW_H
23 #define __WINE_SHDOCVW_H
24
25 #define COM_NO_WINDOWS_H
26 #define COBJMACROS
27
28 #include <stdarg.h>
29
30 #include "windef.h"
31 #include "winbase.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34
35 #include "ole2.h"
36 #include "olectl.h"
37 #include "shlobj.h"
38 #include "exdisp.h"
39 #include "mshtmhst.h"
40 #include "hlink.h"
41
42 /**********************************************************************
43  * Shell Instance Objects
44  */
45 extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid, 
46     REFIID riid, LPVOID *ppvClassObj);
47
48 /**********************************************************************
49  * WebBrowser declaration for SHDOCVW.DLL
50  */
51
52 typedef struct ConnectionPoint ConnectionPoint;
53
54 struct WebBrowser;
55
56 typedef struct {
57     const IOleClientSiteVtbl      *lpOleClientSiteVtbl;
58     const IOleInPlaceSiteVtbl     *lpOleInPlaceSiteVtbl;
59     const IDocHostUIHandler2Vtbl  *lpDocHostUIHandlerVtbl;
60     const IOleDocumentSiteVtbl    *lpOleDocumentSiteVtbl;
61     const IOleCommandTargetVtbl   *lpOleCommandTargetVtbl;
62     const IDispatchVtbl           *lpDispatchVtbl;
63     const IServiceProviderVtbl    *lpServiceProviderVtbl;
64
65     IDispatch *disp;
66
67     IUnknown *document;
68     IOleDocumentView *view;
69     IDocHostUIHandler *hostui;
70
71     HWND hwnd;
72     HWND frame_hwnd;
73
74     struct WebBrowser *wb; /* FIXME */
75 } DocHost;
76
77 typedef struct WebBrowser {
78     /* Interfaces available via WebBrowser object */
79
80     const IWebBrowser2Vtbl              *lpWebBrowser2Vtbl;
81     const IOleObjectVtbl                *lpOleObjectVtbl;
82     const IOleInPlaceObjectVtbl         *lpOleInPlaceObjectVtbl;
83     const IOleControlVtbl               *lpOleControlVtbl;
84     const IPersistStorageVtbl           *lpPersistStorageVtbl;
85     const IPersistStreamInitVtbl        *lpPersistStreamInitVtbl;
86     const IProvideClassInfo2Vtbl        *lpProvideClassInfoVtbl;
87     const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
88     const IViewObject2Vtbl              *lpViewObjectVtbl;
89     const IOleInPlaceActiveObjectVtbl   *lpOleInPlaceActiveObjectVtbl;
90     const IOleCommandTargetVtbl         *lpWBOleCommandTargetVtbl;
91     const IHlinkFrameVtbl               *lpHlinkFrameVtbl;
92
93     /* Interfaces of InPlaceFrame object */
94
95     const IOleInPlaceFrameVtbl          *lpOleInPlaceFrameVtbl;
96
97     LONG ref;
98
99     IOleClientSite *client;
100     IOleContainer *container;
101     IOleInPlaceSite *inplace;
102
103     LPOLESTR url;
104
105     /* window context */
106
107     HWND iphwnd;
108     HWND frame_hwnd;
109     IOleInPlaceFrame *frame;
110     IOleInPlaceUIWindow *uiwindow;
111     RECT pos_rect;
112     RECT clip_rect;
113     OLEINPLACEFRAMEINFO frameinfo;
114
115     HWND shell_embedding_hwnd;
116
117     /* Connection points */
118
119     ConnectionPoint *cp_wbe2;
120     ConnectionPoint *cp_wbe;
121     ConnectionPoint *cp_pns;
122
123     DocHost doc_host;
124 } WebBrowser;
125
126 #define WEBBROWSER(x)   ((IWebBrowser*)                 &(x)->lpWebBrowser2Vtbl)
127 #define WEBBROWSER2(x)  ((IWebBrowser2*)                &(x)->lpWebBrowser2Vtbl)
128 #define OLEOBJ(x)       ((IOleObject*)                  &(x)->lpOleObjectVtbl)
129 #define INPLACEOBJ(x)   ((IOleInPlaceObject*)           &(x)->lpOleInPlaceObjectVtbl)
130 #define CONTROL(x)      ((IOleControl*)                 &(x)->lpOleControlVtbl)
131 #define PERSTORAGE(x)   ((IPersistStorage*)             &(x)->lpPersistStorageVtbl)
132 #define PERSTRINIT(x)   ((IPersistStreamInit*)          &(x)->lpPersistStreamInitVtbl)
133 #define CLASSINFO(x)    ((IProvideClassInfo2*)          &(x)->lpProvideClassInfoVtbl)
134 #define CONPTCONT(x)    ((IConnectionPointContainer*)   &(x)->lpConnectionPointContainerVtbl)
135 #define VIEWOBJ(x)      ((IViewObject*)                 &(x)->lpViewObjectVtbl);
136 #define VIEWOBJ2(x)     ((IViewObject2*)                &(x)->lpViewObjectVtbl);
137 #define ACTIVEOBJ(x)    ((IOleInPlaceActiveObject*)     &(x)->lpOleInPlaceActiveObjectVtbl)
138 #define WBOLECMD(x)     ((IOleCommandTarget*)           &(x)->lpWBOleCommandTargetVtbl)
139 #define HLINKFRAME(x)   ((IHlinkFrame*)                 &(x)->lpHlinkFrameVtbl)
140
141 #define CLIENTSITE(x)   ((IOleClientSite*)              &(x)->lpOleClientSiteVtbl)
142 #define INPLACESITE(x)  ((IOleInPlaceSite*)             &(x)->lpOleInPlaceSiteVtbl)
143 #define DOCHOSTUI(x)    ((IDocHostUIHandler*)           &(x)->lpDocHostUIHandlerVtbl)
144 #define DOCHOSTUI2(x)   ((IDocHostUIHandler2*)          &(x)->lpDocHostUIHandlerVtbl)
145 #define DOCSITE(x)      ((IOleDocumentSite*)            &(x)->lpOleDocumentSiteVtbl)
146 #define CLOLECMD(x)     ((IOleCommandTarget*)           &(x)->lpOleCommandTargetVtbl)
147 #define CLDISP(x)       ((IDispatch*)                   &(x)->lpDispatchVtbl)
148 #define SERVPROV(x)     ((IServiceProvider*)            &(x)->lpServiceProviderVtbl)
149
150 #define INPLACEFRAME(x) ((IOleInPlaceFrame*)            &(x)->lpOleInPlaceFrameVtbl)
151
152 void WebBrowser_OleObject_Init(WebBrowser*);
153 void WebBrowser_ViewObject_Init(WebBrowser*);
154 void WebBrowser_Persist_Init(WebBrowser*);
155 void WebBrowser_ClassInfo_Init(WebBrowser*);
156 void WebBrowser_Events_Init(WebBrowser*);
157 void WebBrowser_HlinkFrame_Init(WebBrowser*);
158
159 void WebBrowser_ClientSite_Init(WebBrowser*);
160 void WebBrowser_DocHost_Init(WebBrowser*);
161
162 void WebBrowser_Frame_Init(WebBrowser*);
163
164 void WebBrowser_OleObject_Destroy(WebBrowser*);
165 void WebBrowser_Events_Destroy(WebBrowser*);
166 void WebBrowser_ClientSite_Destroy(WebBrowser*);
167
168 HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
169
170 void create_doc_view_hwnd(WebBrowser *This);
171 void deactivate_document(WebBrowser*);
172 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
173 HRESULT navigate_url(WebBrowser*,LPCWSTR,PBYTE,ULONG,LPWSTR);
174
175 #define WB_WM_NAVIGATE2 (WM_USER+100)
176
177 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
178
179 /**********************************************************************
180  * Dll lifetime tracking declaration for shdocvw.dll
181  */
182 extern LONG SHDOCVW_refCount;
183 static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_refCount ); }
184 static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
185
186 extern HINSTANCE shdocvw_hinstance;
187 extern void register_iewindow_class(void);
188 extern void unregister_iewindow_class(void);
189 extern BOOL create_ie_window(LPCWSTR url);
190 extern IClassFactory *get_class_factory(void);
191
192 #endif /* __WINE_SHDOCVW_H */