From 9a7b9710c98208a1c7d2e6bee739967cd3215440 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek@codeweavers.com>
Date: Wed, 16 Nov 2005 11:21:00 +0000
Subject: [PATCH] Added IOleInPlaceSite stub implementation.

---
 dlls/shdocvw/client.c  | 137 ++++++++++++++++++++++++++++++++++++++++-
 dlls/shdocvw/shdocvw.h |   2 +
 2 files changed, 138 insertions(+), 1 deletion(-)

diff --git a/dlls/shdocvw/client.c b/dlls/shdocvw/client.c
index c99bd8bbee0..35c9a3b637a 100644
--- a/dlls/shdocvw/client.c
+++ b/dlls/shdocvw/client.c
@@ -35,6 +35,12 @@ static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID ri
     }else if(IsEqualGUID(&IID_IOleClientSite, riid)) {
         TRACE("(%p)->(IID_IOleClientSite %p)\n", This, ppv);
         *ppv = CLIENTSITE(This);
+    }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
+        TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
+        *ppv = INPLACESITE(This);
+    }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
+        TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This, ppv);
+        *ppv = INPLACESITE(This);
     }
 
     if(*ppv) {
@@ -116,7 +122,136 @@ static const IOleClientSiteVtbl OleClientSiteVtbl = {
     ClientSite_RequestNewObjectLayout
 };
 
+#define INPLACESITE_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceSite, iface)
+
+static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
+}
+
+static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    return IOleClientSite_AddRef(CLIENTSITE(This));
+}
+
+static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    return IOleClientSite_Release(CLIENTSITE(This));
+}
+
+static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, phwnd);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, fEnterMode);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSite *iface)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface,
+        IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
+        LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)->(%p %p %p %p %p)\n", This, ppFrame, ppDoc, lprcPosRect,
+          lprcClipRect, lpFrameInfo);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSite *iface, SIZE scrollExtent)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)->({%ld %ld})\n", This, scrollExtent.cx, scrollExtent.cy);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, fUndoable);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSite *iface)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSite *iface)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface,
+                                                  LPCRECT lprcPosRect)
+{
+    WebBrowser *This = INPLACESITE_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, lprcPosRect);
+    return E_NOTIMPL;
+}
+
+#undef INPLACESITE_THIS
+
+static const IOleInPlaceSiteVtbl OleInPlaceSiteVtbl = {
+    InPlaceSite_QueryInterface,
+    InPlaceSite_AddRef,
+    InPlaceSite_Release,
+    InPlaceSite_GetWindow,
+    InPlaceSite_ContextSensitiveHelp,
+    InPlaceSite_CanInPlaceActivate,
+    InPlaceSite_OnInPlaceActivate,
+    InPlaceSite_OnUIActivate,
+    InPlaceSite_GetWindowContext,
+    InPlaceSite_Scroll,
+    InPlaceSite_OnUIDeactivate,
+    InPlaceSite_OnInPlaceDeactivate,
+    InPlaceSite_DiscardUndoState,
+    InPlaceSite_DeactivateAndUndo,
+    InPlaceSite_OnPosRectChange
+};
+
 void WebBrowser_ClientSite_Init(WebBrowser *This)
 {
-    This->lpOleClientSiteVtbl = &OleClientSiteVtbl;
+    This->lpOleClientSiteVtbl   = &OleClientSiteVtbl;
+    This->lpOleInPlaceSiteVtbl  = &OleInPlaceSiteVtbl;
 }
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 594d1332744..f5e01a596f6 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -74,6 +74,7 @@ typedef struct {
     /* Interfaces available for embeded document */
 
     const IOleClientSiteVtbl            *lpOleClientSiteVtbl;
+    const IOleInPlaceSiteVtbl           *lpOleInPlaceSiteVtbl;
 
     LONG ref;
 
@@ -96,6 +97,7 @@ typedef struct {
 #define VIEWOBJ2(x)     ((IViewObject2*)                &(x)->lpViewObjectVtbl);
 
 #define CLIENTSITE(x)   ((IOleClientSite*)              &(x)->lpOleClientSiteVtbl)
+#define INPLACESITE(x)  ((IOleInPlaceSite*)             &(x)->lpOleInPlaceSiteVtbl)
 
 void WebBrowser_OleObject_Init(WebBrowser*);
 void WebBrowser_ViewObject_Init(WebBrowser*);
-- 
GitLab