From 58cac9c633a1509fee139c84ada3481db9d44996 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 24 Aug 2017 10:59:31 +0100 Subject: [PATCH] riched20: Remove the separate implementation of IOleWindow as IOleInPlaceSite inherits from IOleWindow. Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/riched20/richole.c | 77 ++++++++--------------------------------- 1 file changed, 15 insertions(+), 62 deletions(-) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index c5f04412e26..dbb21b27b8b 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -258,7 +258,6 @@ typedef struct ITextParaImpl { struct IOleClientSiteImpl { struct reole_child child; IOleClientSite IOleClientSite_iface; - IOleWindow IOleWindow_iface; IOleInPlaceSite IOleInPlaceSite_iface; LONG ref; }; @@ -278,11 +277,6 @@ static inline IRichEditOleImpl *impl_from_IUnknown(IUnknown *iface) return CONTAINING_RECORD(iface, IRichEditOleImpl, IUnknown_inner); } -static inline IOleClientSiteImpl *impl_from_IOleWindow(IOleWindow *iface) -{ - return CONTAINING_RECORD(iface, IOleClientSiteImpl, IOleWindow_iface); -} - static inline IOleClientSiteImpl *impl_from_IOleInPlaceSite(IOleInPlaceSite *iface) { return CONTAINING_RECORD(iface, IOleClientSiteImpl, IOleInPlaceSite_iface); @@ -1068,9 +1062,8 @@ IOleClientSite_fnQueryInterface(IOleClientSite *me, REFIID riid, LPVOID *ppvObj) if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IOleClientSite)) *ppvObj = me; - else if (IsEqualGUID(riid, &IID_IOleWindow)) - *ppvObj = &This->IOleWindow_iface; - else if (IsEqualGUID(riid, &IID_IOleInPlaceSite)) + else if (IsEqualGUID(riid, &IID_IOleWindow) || + IsEqualGUID(riid, &IID_IOleInPlaceSite)) *ppvObj = &This->IOleInPlaceSite_iface; if (*ppvObj) { @@ -1181,56 +1174,6 @@ static const IOleClientSiteVtbl ocst = { IOleClientSite_fnRequestNewObjectLayout }; -/* IOleWindow interface */ -static HRESULT WINAPI IOleWindow_fnQueryInterface(IOleWindow *iface, REFIID riid, void **ppvObj) -{ - IOleClientSiteImpl *This = impl_from_IOleWindow(iface); - return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppvObj); -} - -static ULONG WINAPI IOleWindow_fnAddRef(IOleWindow *iface) -{ - IOleClientSiteImpl *This = impl_from_IOleWindow(iface); - return IOleClientSite_AddRef(&This->IOleClientSite_iface); -} - -static ULONG WINAPI IOleWindow_fnRelease(IOleWindow *iface) -{ - IOleClientSiteImpl *This = impl_from_IOleWindow(iface); - return IOleClientSite_Release(&This->IOleClientSite_iface); -} - -static HRESULT WINAPI IOleWindow_fnContextSensitiveHelp(IOleWindow *iface, BOOL fEnterMode) -{ - IOleClientSiteImpl *This = impl_from_IOleWindow(iface); - FIXME("not implemented: (%p)->(%d)\n", This, fEnterMode); - return E_NOTIMPL; -} - -static HRESULT WINAPI IOleWindow_fnGetWindow(IOleWindow *iface, HWND *phwnd) -{ - IOleClientSiteImpl *This = impl_from_IOleWindow(iface); - - TRACE("(%p)->(%p)\n", This, phwnd); - - if (!This->child.reole) - return CO_E_RELEASED; - - if (!phwnd) - return E_INVALIDARG; - - *phwnd = This->child.reole->editor->hWnd; - return S_OK; -} - -static const IOleWindowVtbl olewinvt = { - IOleWindow_fnQueryInterface, - IOleWindow_fnAddRef, - IOleWindow_fnRelease, - IOleWindow_fnGetWindow, - IOleWindow_fnContextSensitiveHelp -}; - /* IOleInPlaceSite interface */ static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnQueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppvObj) { @@ -1253,13 +1196,24 @@ static ULONG STDMETHODCALLTYPE IOleInPlaceSite_fnRelease(IOleInPlaceSite *iface) static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnGetWindow(IOleInPlaceSite *iface, HWND *phwnd) { IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface); - return IOleWindow_GetWindow(&This->IOleWindow_iface, phwnd); + + TRACE("(%p)->(%p)\n", This, phwnd); + + if (!This->child.reole) + return CO_E_RELEASED; + + if (!phwnd) + return E_INVALIDARG; + + *phwnd = This->child.reole->editor->hWnd; + return S_OK; } static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode) { IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface); - return IOleWindow_ContextSensitiveHelp(&This->IOleWindow_iface, fEnterMode); + FIXME("not implemented: (%p)->(%d)\n", This, fEnterMode); + return E_NOTIMPL; } static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnCanInPlaceActivate(IOleInPlaceSite *iface) @@ -1361,7 +1315,6 @@ static HRESULT CreateOleClientSite(IRichEditOleImpl *reOle, IOleClientSite **ret return E_OUTOFMEMORY; clientSite->IOleClientSite_iface.lpVtbl = &ocst; - clientSite->IOleWindow_iface.lpVtbl = &olewinvt; clientSite->IOleInPlaceSite_iface.lpVtbl = &olestvt; clientSite->ref = 1; clientSite->child.reole = reOle;