Alexander Nicolaysen Sørnes : shdocvw: Add DocHostContainer interface to interact with WB2/IE.

Alexandre Julliard julliard at winehq.org
Thu Jul 29 12:08:43 CDT 2010


Module: wine
Branch: master
Commit: fbf91383336249494565f94d41b0623b7b804881
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fbf91383336249494565f94d41b0623b7b804881

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Thu Jul 29 10:28:02 2010 +0200

shdocvw: Add DocHostContainer interface to interact with WB2/IE.

---

 dlls/shdocvw/dochost.c    |    7 ++++---
 dlls/shdocvw/frame.c      |    4 ++--
 dlls/shdocvw/iexplore.c   |   26 +++++++++++++++++++++++++-
 dlls/shdocvw/navigate.c   |    2 ++
 dlls/shdocvw/shdocvw.h    |   11 ++++++++++-
 dlls/shdocvw/webbrowser.c |   23 ++++++++++++++++++++++-
 6 files changed, 65 insertions(+), 8 deletions(-)

diff --git a/dlls/shdocvw/dochost.c b/dlls/shdocvw/dochost.c
index 4978989..edf569e 100644
--- a/dlls/shdocvw/dochost.c
+++ b/dlls/shdocvw/dochost.c
@@ -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;
diff --git a/dlls/shdocvw/frame.c b/dlls/shdocvw/frame.c
index eeff20a..150ca93 100644
--- a/dlls/shdocvw/frame.c
+++ b/dlls/shdocvw/frame.c
@@ -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)
diff --git a/dlls/shdocvw/iexplore.c b/dlls/shdocvw/iexplore.c
index d81e8f1..e98b74c 100644
--- a/dlls/shdocvw/iexplore.c
+++ b/dlls/shdocvw/iexplore.c
@@ -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);
 
diff --git a/dlls/shdocvw/navigate.c b/dlls/shdocvw/navigate.c
index 5550387..368a3c3 100644
--- a/dlls/shdocvw/navigate.c
+++ b/dlls/shdocvw/navigate.c
@@ -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;
 }
 
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 44919a5..2d7f03b 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -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*);
diff --git a/dlls/shdocvw/webbrowser.c b/dlls/shdocvw/webbrowser.c
index 217c9da..5115de7 100644
--- a/dlls/shdocvw/webbrowser.c
+++ b/dlls/shdocvw/webbrowser.c
@@ -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;




More information about the wine-cvs mailing list