* Implement <autoregister>
[reactos.git] / reactos / lib / shdocvw / dochost.c
1 /*
2 * Copyright 2005 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 "wine/debug.h"
20 #include "shdocvw.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
23
24 #define DOCHOSTUI_THIS(iface) DEFINE_THIS(WebBrowser, DocHostUIHandler, iface)
25
26 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface,
27 REFIID riid, void **ppv)
28 {
29 WebBrowser *This = DOCHOSTUI_THIS(iface);
30 return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
31 }
32
33 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
34 {
35 WebBrowser *This = DOCHOSTUI_THIS(iface);
36 return IOleClientSite_AddRef(CLIENTSITE(This));
37 }
38
39 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
40 {
41 WebBrowser *This = DOCHOSTUI_THIS(iface);
42 return IOleClientSite_Release(CLIENTSITE(This));
43 }
44
45 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface,
46 DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved)
47 {
48 WebBrowser *This = DOCHOSTUI_THIS(iface);
49 FIXME("(%p)->(%ld %p %p %p)\n", This, dwID, ppt, pcmdtReserved, pdispReserved);
50 return E_NOTIMPL;
51 }
52
53 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface,
54 DOCHOSTUIINFO *pInfo)
55 {
56 WebBrowser *This = DOCHOSTUI_THIS(iface);
57 IDocHostUIHandler *handler;
58 HRESULT hres;
59
60 TRACE("(%p)->(%p)\n", This, pInfo);
61
62 if(This->client) {
63 hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler, (void**)&handler);
64 if(SUCCEEDED(hres)) {
65 hres = IDocHostUIHandler_GetHostInfo(handler, pInfo);
66 IDocHostUIHandler_Release(handler);
67 if(SUCCEEDED(hres))
68 return hres;
69 }
70 }
71
72 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_OPENNEWWIN
73 | DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
74 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
75 return S_OK;
76 }
77
78 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
79 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
80 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
81 {
82 WebBrowser *This = DOCHOSTUI_THIS(iface);
83 FIXME("(%p)->(%ld %p %p %p %p)\n", This, dwID, pActiveObject, pCommandTarget,
84 pFrame, pDoc);
85 return E_NOTIMPL;
86 }
87
88 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
89 {
90 WebBrowser *This = DOCHOSTUI_THIS(iface);
91 FIXME("(%p)\n", This);
92 return E_NOTIMPL;
93 }
94
95 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
96 {
97 WebBrowser *This = DOCHOSTUI_THIS(iface);
98 FIXME("(%p)\n", This);
99 return E_NOTIMPL;
100 }
101
102 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface,
103 BOOL fEnable)
104 {
105 WebBrowser *This = DOCHOSTUI_THIS(iface);
106 FIXME("(%p)->(%x)\n", This, fEnable);
107 return E_NOTIMPL;
108 }
109
110 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface,
111 BOOL fActivate)
112 {
113 WebBrowser *This = DOCHOSTUI_THIS(iface);
114 FIXME("(%p)->(%x)\n", This, fActivate);
115 return E_NOTIMPL;
116 }
117
118 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface,
119 BOOL fActivate)
120 {
121 WebBrowser *This = DOCHOSTUI_THIS(iface);
122 FIXME("(%p)->(%x)\n", This, fActivate);
123 return E_NOTIMPL;
124 }
125
126 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface,
127 LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
128 {
129 WebBrowser *This = DOCHOSTUI_THIS(iface);
130 FIXME("(%p)->(%p %p %X)\n", This, prcBorder, pUIWindow, fRameWindow);
131 return E_NOTIMPL;
132 }
133
134 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface,
135 LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID)
136 {
137 WebBrowser *This = DOCHOSTUI_THIS(iface);
138 FIXME("(%p)->(%p %p %ld)\n", This, lpMsg, pguidCmdGroup, nCmdID);
139 return E_NOTIMPL;
140 }
141
142 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
143 LPOLESTR *pchKey, DWORD dw)
144 {
145 WebBrowser *This = DOCHOSTUI_THIS(iface);
146 FIXME("(%p)->(%p %ld)\n", This, pchKey, dw);
147 return E_NOTIMPL;
148 }
149
150 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
151 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
152 {
153 WebBrowser *This = DOCHOSTUI_THIS(iface);
154 FIXME("(%p)\n", This);
155 return E_NOTIMPL;
156 }
157
158 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface,
159 IDispatch **ppDispatch)
160 {
161 WebBrowser *This = DOCHOSTUI_THIS(iface);
162 FIXME("(%p)->(%p)\n", This, ppDispatch);
163 return E_NOTIMPL;
164 }
165
166 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface,
167 DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
168 {
169 WebBrowser *This = DOCHOSTUI_THIS(iface);
170 FIXME("(%p)->(%ld %s %p)\n", This, dwTranslate, debugstr_w(pchURLIn), ppchURLOut);
171 return E_NOTIMPL;
172 }
173
174 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface,
175 IDataObject *pDO, IDataObject **ppDORet)
176 {
177 WebBrowser *This = DOCHOSTUI_THIS(iface);
178 FIXME("(%p)->(%p %p)\n", This, pDO, ppDORet);
179 return E_NOTIMPL;
180 }
181
182 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
183 LPOLESTR *pchKey, DWORD dw)
184 {
185 WebBrowser *This = DOCHOSTUI_THIS(iface);
186 FIXME("(%p)->(%p %ld)\n", This, pchKey, dw);
187 return E_NOTIMPL;
188 }
189
190 #undef DOCHOSTUI_THIS
191
192 static const IDocHostUIHandler2Vtbl DocHostUIHandler2Vtbl = {
193 DocHostUIHandler_QueryInterface,
194 DocHostUIHandler_AddRef,
195 DocHostUIHandler_Release,
196 DocHostUIHandler_ShowContextMenu,
197 DocHostUIHandler_GetHostInfo,
198 DocHostUIHandler_ShowUI,
199 DocHostUIHandler_HideUI,
200 DocHostUIHandler_UpdateUI,
201 DocHostUIHandler_EnableModeless,
202 DocHostUIHandler_OnDocWindowActivate,
203 DocHostUIHandler_OnFrameWindowActivate,
204 DocHostUIHandler_ResizeBorder,
205 DocHostUIHandler_TranslateAccelerator,
206 DocHostUIHandler_GetOptionKeyPath,
207 DocHostUIHandler_GetDropTarget,
208 DocHostUIHandler_GetExternal,
209 DocHostUIHandler_TranslateUrl,
210 DocHostUIHandler_FilterDataObject,
211 DocHostUIHandler_GetOverrideKeyPath
212 };
213
214 void WebBrowser_DocHost_Init(WebBrowser *This)
215 {
216 This->lpDocHostUIHandlerVtbl = &DocHostUIHandler2Vtbl;
217 }