2 * Copyright 2005 Jacek Caban for CodeWeavers
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.
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.
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
19 #include "wine/debug.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
24 static ATOM doc_view_atom = 0;
26 static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
30 static const WCHAR wszTHIS[] = {'T','H','I','S',0};
32 if(msg == WM_CREATE) {
33 This = *(WebBrowser**)lParam;
34 ERR("create %p\n", This);
35 SetPropW(hwnd, wszTHIS, This);
37 This = GetPropW(hwnd, wszTHIS);
40 return DefWindowProcA(hwnd, msg, wParam, lParam);
43 void create_doc_view_hwnd(WebBrowser *This)
47 static const WCHAR wszShell_DocObject_View[] =
48 {'S','h','e','l','l',' ','D','o','c','O','b','j','e','c','t',' ','V','i','e','w',0};
51 static WNDCLASSEXW wndclass = {
55 0, 0 /* native uses 4*/, NULL, NULL, NULL,
56 (HBRUSH)COLOR_WINDOWFRAME, NULL,
57 wszShell_DocObject_View,
61 wndclass.hInstance = shdocvw_hinstance;
63 doc_view_atom = RegisterClassExW(&wndclass);
66 GetWindowRect(This->shell_embedding_hwnd, &rect);
67 This->doc_view_hwnd = CreateWindowExW(0, wszShell_DocObject_View,
68 wszShell_DocObject_View,
69 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP | WS_MAXIMIZEBOX,
70 rect.left, rect.top, rect.right, rect.bottom, This->shell_embedding_hwnd,
71 NULL, shdocvw_hinstance, This);
74 #define DOCHOSTUI_THIS(iface) DEFINE_THIS(WebBrowser, DocHostUIHandler, iface)
76 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface,
77 REFIID riid, void **ppv)
79 WebBrowser *This = DOCHOSTUI_THIS(iface);
80 return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
83 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
85 WebBrowser *This = DOCHOSTUI_THIS(iface);
86 return IOleClientSite_AddRef(CLIENTSITE(This));
89 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
91 WebBrowser *This = DOCHOSTUI_THIS(iface);
92 return IOleClientSite_Release(CLIENTSITE(This));
95 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface,
96 DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved)
98 WebBrowser *This = DOCHOSTUI_THIS(iface);
99 FIXME("(%p)->(%ld %p %p %p)\n", This, dwID, ppt, pcmdtReserved, pdispReserved);
103 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface,
104 DOCHOSTUIINFO *pInfo)
106 WebBrowser *This = DOCHOSTUI_THIS(iface);
107 IDocHostUIHandler *handler;
110 TRACE("(%p)->(%p)\n", This, pInfo);
113 hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler, (void**)&handler);
114 if(SUCCEEDED(hres)) {
115 hres = IDocHostUIHandler_GetHostInfo(handler, pInfo);
116 IDocHostUIHandler_Release(handler);
122 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_OPENNEWWIN
123 | DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
124 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
128 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
129 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
130 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
132 WebBrowser *This = DOCHOSTUI_THIS(iface);
133 FIXME("(%p)->(%ld %p %p %p %p)\n", This, dwID, pActiveObject, pCommandTarget,
138 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
140 WebBrowser *This = DOCHOSTUI_THIS(iface);
141 FIXME("(%p)\n", This);
145 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
147 WebBrowser *This = DOCHOSTUI_THIS(iface);
148 FIXME("(%p)\n", This);
152 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface,
155 WebBrowser *This = DOCHOSTUI_THIS(iface);
156 FIXME("(%p)->(%x)\n", This, fEnable);
160 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface,
163 WebBrowser *This = DOCHOSTUI_THIS(iface);
164 FIXME("(%p)->(%x)\n", This, fActivate);
168 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface,
171 WebBrowser *This = DOCHOSTUI_THIS(iface);
172 FIXME("(%p)->(%x)\n", This, fActivate);
176 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface,
177 LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
179 WebBrowser *This = DOCHOSTUI_THIS(iface);
180 FIXME("(%p)->(%p %p %X)\n", This, prcBorder, pUIWindow, fRameWindow);
184 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface,
185 LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID)
187 WebBrowser *This = DOCHOSTUI_THIS(iface);
188 FIXME("(%p)->(%p %p %ld)\n", This, lpMsg, pguidCmdGroup, nCmdID);
192 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
193 LPOLESTR *pchKey, DWORD dw)
195 WebBrowser *This = DOCHOSTUI_THIS(iface);
196 FIXME("(%p)->(%p %ld)\n", This, pchKey, dw);
200 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
201 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
203 WebBrowser *This = DOCHOSTUI_THIS(iface);
204 FIXME("(%p)\n", This);
208 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface,
209 IDispatch **ppDispatch)
211 WebBrowser *This = DOCHOSTUI_THIS(iface);
212 FIXME("(%p)->(%p)\n", This, ppDispatch);
216 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface,
217 DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
219 WebBrowser *This = DOCHOSTUI_THIS(iface);
220 FIXME("(%p)->(%ld %s %p)\n", This, dwTranslate, debugstr_w(pchURLIn), ppchURLOut);
224 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface,
225 IDataObject *pDO, IDataObject **ppDORet)
227 WebBrowser *This = DOCHOSTUI_THIS(iface);
228 FIXME("(%p)->(%p %p)\n", This, pDO, ppDORet);
232 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
233 LPOLESTR *pchKey, DWORD dw)
235 WebBrowser *This = DOCHOSTUI_THIS(iface);
236 FIXME("(%p)->(%p %ld)\n", This, pchKey, dw);
240 #undef DOCHOSTUI_THIS
242 static const IDocHostUIHandler2Vtbl DocHostUIHandler2Vtbl = {
243 DocHostUIHandler_QueryInterface,
244 DocHostUIHandler_AddRef,
245 DocHostUIHandler_Release,
246 DocHostUIHandler_ShowContextMenu,
247 DocHostUIHandler_GetHostInfo,
248 DocHostUIHandler_ShowUI,
249 DocHostUIHandler_HideUI,
250 DocHostUIHandler_UpdateUI,
251 DocHostUIHandler_EnableModeless,
252 DocHostUIHandler_OnDocWindowActivate,
253 DocHostUIHandler_OnFrameWindowActivate,
254 DocHostUIHandler_ResizeBorder,
255 DocHostUIHandler_TranslateAccelerator,
256 DocHostUIHandler_GetOptionKeyPath,
257 DocHostUIHandler_GetDropTarget,
258 DocHostUIHandler_GetExternal,
259 DocHostUIHandler_TranslateUrl,
260 DocHostUIHandler_FilterDataObject,
261 DocHostUIHandler_GetOverrideKeyPath
264 void WebBrowser_DocHost_Init(WebBrowser *This)
266 This->lpDocHostUIHandlerVtbl = &DocHostUIHandler2Vtbl;
268 This->doc_view_hwnd = NULL;