shdocvw: Add DocHostContainer interface to interact with WB2/IE.
authorAlexander Nicolaysen Sørnes <alex@thehandofagony.com>
Thu, 29 Jul 2010 08:28:02 +0000 (10:28 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 29 Jul 2010 15:42:36 +0000 (17:42 +0200)
dlls/shdocvw/dochost.c
dlls/shdocvw/frame.c
dlls/shdocvw/iexplore.c
dlls/shdocvw/navigate.c
dlls/shdocvw/shdocvw.h
dlls/shdocvw/webbrowser.c

index 4978989740c223d6039c9ccb48bc5f417b3ddf55..edf569e99d05c9b4b3f02382ea1ed45d4aca2f6d 100644 (file)
@@ -311,8 +311,7 @@ void create_doc_view_hwnd(DocHost *This)
         doc_view_atom = RegisterClassExW(&wndclass);
     }
 
-    GetClientRect(This->frame_hwnd, &rect);
-    adjust_ie_docobj_rect(This->frame_hwnd, &rect);
+    This->container_vtbl->GetDocObjRect(This, &rect);
     This->hwnd = CreateWindowExW(0, wszShell_DocObject_View,
          wszShell_DocObject_View,
          WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP,
@@ -784,7 +783,7 @@ static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
     PropertyNotifySink_OnRequestEdit
 };
 
-void DocHost_Init(DocHost *This, IDispatch *disp)
+void DocHost_Init(DocHost *This, IDispatch *disp, const IDocHostContainerVtbl* container)
 {
     This->lpDocHostUIHandlerVtbl = &DocHostUIHandler2Vtbl;
     This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
@@ -792,6 +791,8 @@ void DocHost_Init(DocHost *This, IDispatch *disp)
 
     This->disp = disp;
 
+    This->container_vtbl = container;
+
     This->client_disp = NULL;
 
     This->document = NULL;
index eeff20adcb36cc1483b4b28d9ebe54f4bf254bb3..150ca937fd6ce9c0f6e1fd647ed5ea60b2bb61f8 100644 (file)
@@ -135,8 +135,8 @@ static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface,
                                                  LPCOLESTR pszStatusText)
 {
     DocHost *This = INPLACEFRAME_THIS(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(pszStatusText));
-    return E_NOTIMPL;
+    TRACE("(%p)->(%s)\n", This, debugstr_w(pszStatusText));
+    return This->container_vtbl->SetStatusText(This, pszStatusText);
 }
 
 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
index d81e8f17afd0bb51715d6752b4ccf24f10e22803..e98b74ca2eb610b39b4c08556531c19fa739dd68 100644 (file)
@@ -344,6 +344,30 @@ static IWebBrowser2 *create_ie_window(LPCSTR cmdline)
     return wb;
 }
 
+static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc)
+{
+    GetClientRect(This->frame_hwnd, rc);
+    adjust_ie_docobj_rect(This->frame_hwnd, rc);
+}
+
+static HRESULT WINAPI DocHostContainer_SetStatusText(DocHost* This, LPCWSTR text)
+{
+    FIXME("(%p)->(%s)\n", This, debugstr_w(text));
+
+    return E_NOTIMPL;
+}
+
+static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url)
+{
+
+}
+
+static const IDocHostContainerVtbl DocHostContainerVtbl = {
+    DocHostContainer_GetDocObjRect,
+    DocHostContainer_SetStatusText,
+    DocHostContainer_SetURL
+};
+
 HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **ppv)
 {
     InternetExplorer *ret;
@@ -355,7 +379,7 @@ HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **ppv)
     ret->ref = 0;
 
     ret->doc_host.disp = (IDispatch*)WEBBROWSER2(ret);
-    DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
+    DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret), &DocHostContainerVtbl);
 
     InternetExplorer_WebBrowser_Init(ret);
 
index 5550387838c3b2473ca01cc157d754fd0d25f5bc..368a3c361272f435f59c213f7d0510b37ccc4926 100644 (file)
@@ -125,6 +125,8 @@ static HRESULT set_dochost_url(DocHost *This, const WCHAR *url)
 
     heap_free(This->url);
     This->url = new_url;
+
+    This->container_vtbl->SetURL(This, This->url);
     return S_OK;
 }
 
index 44919a5c3d72a0cb52c19b9aa7ee01f679c6f37e..2d7f03bd6ea9b224ad3b3bdd232a1fb7447abcbd 100644 (file)
@@ -82,6 +82,13 @@ typedef struct _task_header_t {
     task_proc_t proc;
 } task_header_t;
 
+typedef struct _IDocHostContainerVtbl
+{
+    void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
+    HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
+    void (WINAPI* SetURL)(DocHost*,LPCWSTR);
+} IDocHostContainerVtbl;
+
 struct DocHost {
     const IOleClientSiteVtbl      *lpOleClientSiteVtbl;
     const IOleInPlaceSiteVtbl     *lpOleInPlaceSiteVtbl;
@@ -105,6 +112,8 @@ struct DocHost {
     IOleDocumentView *view;
     IUnknown *doc_navigate;
 
+    const IDocHostContainerVtbl *container_vtbl;
+
     HWND hwnd;
     HWND frame_hwnd;
 
@@ -220,7 +229,7 @@ void WebBrowser_ClassInfo_Init(WebBrowser*);
 
 void WebBrowser_OleObject_Destroy(WebBrowser*);
 
-void DocHost_Init(DocHost*,IDispatch*);
+void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*);
 void DocHost_ClientSite_Init(DocHost*);
 void DocHost_Frame_Init(DocHost*);
 void release_dochost_client(DocHost*);
index 217c9dab4ef0dff5cd61ec7b127227ba830d0a51..5115de7b34428843377f6403965089aaa4f4c61d 100644 (file)
@@ -1126,6 +1126,27 @@ static const IServiceProviderVtbl ServiceProviderVtbl =
     WebBrowser_IServiceProvider_QueryService
 };
 
+static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc)
+{
+    GetClientRect(This->frame_hwnd, rc);
+}
+
+static HRESULT WINAPI DocHostContainer_SetStatusText(DocHost* This, LPCWSTR text)
+{
+    return E_NOTIMPL;
+}
+
+static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url)
+{
+
+}
+
+static const IDocHostContainerVtbl DocHostContainerVtbl = {
+    DocHostContainer_GetDocObjRect,
+    DocHostContainer_SetStatusText,
+    DocHostContainer_SetURL
+};
+
 static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv)
 {
     WebBrowser *ret;
@@ -1140,7 +1161,7 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi
     ret->ref = 1;
     ret->version = version;
 
-    DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
+    DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret), &DocHostContainerVtbl);
 
     ret->visible = VARIANT_TRUE;
     ret->menu_bar = VARIANT_TRUE;