[PATCH 7/7] mshtml: COM cleanup for the IOleInPlaceObjectWindowless iface.

Michael Stefaniuc mstefani at redhat.de
Wed Dec 22 19:22:21 CST 2010


---
 dlls/mshtml/htmldoc.c        |    6 +++---
 dlls/mshtml/mshtml_private.h |    4 +---
 dlls/mshtml/oleobj.c         |    2 +-
 dlls/mshtml/olewnd.c         |   31 ++++++++++++++++---------------
 dlls/mshtml/view.c           |    2 +-
 5 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 15240de..4898fc6 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1767,10 +1767,10 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
         *ppv = &This->IOleInPlaceActiveObject_iface;
     }else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) {
         TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppv);
-        *ppv = INPLACEOBJ(This);
+        *ppv = &This->IOleInPlaceObjectWindowless_iface;
     }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid)) {
         TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This, ppv);
-        *ppv = INPLACEWIN(This);
+        *ppv = &This->IOleInPlaceObjectWindowless_iface;
     }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
         TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppv);
         *ppv = SERVPROV(This);
@@ -2106,7 +2106,7 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
         if(This->hostui)
             ICustomDoc_SetUIHandler(CUSTOMDOC(This), NULL);
         if(This->in_place_active)
-            IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(&This->basedoc));
+            IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->basedoc.IOleInPlaceObjectWindowless_iface);
         if(This->ipsite)
             IOleDocumentView_SetInPlaceSite(&This->basedoc.IOleDocumentView_iface, NULL);
         if(This->undomgr)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 703d5ff..2ef0d62 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -356,7 +356,7 @@ struct HTMLDocument {
     IOleDocumentView            IOleDocumentView_iface;
     IOleInPlaceActiveObject     IOleInPlaceActiveObject_iface;
     IViewObjectEx               IViewObjectEx_iface;
-    const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
+    IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
     const IServiceProviderVtbl            *lpServiceProviderVtbl;
     const IOleCommandTargetVtbl           *lpOleCommandTargetVtbl;
     const IOleControlVtbl                 *lpOleControlVtbl;
@@ -625,8 +625,6 @@ struct HTMLDocumentNode {
 #define HTMLWINDOW2(x)   ((IHTMLWindow2*)                 &(x)->lpHTMLWindow2Vtbl)
 #define HTMLWINDOW3(x)   ((IHTMLWindow3*)                 &(x)->lpHTMLWindow3Vtbl)
 #define HTMLWINDOW4(x)   ((IHTMLWindow4*)                 &(x)->lpHTMLWindow4Vtbl)
-#define INPLACEOBJ(x)    ((IOleInPlaceObject*)            &(x)->lpOleInPlaceObjectWindowlessVtbl)
-#define INPLACEWIN(x)    ((IOleInPlaceObjectWindowless*)  &(x)->lpOleInPlaceObjectWindowlessVtbl)
 #define SERVPROV(x)      ((IServiceProvider*)             &(x)->lpServiceProviderVtbl)
 #define CMDTARGET(x)     ((IOleCommandTarget*)            &(x)->lpOleCommandTargetVtbl)
 #define CONTROL(x)       ((IOleControl*)                  &(x)->lpOleControlVtbl)
diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index 8f49a28..166af0c 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -267,7 +267,7 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
         FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
 
     if(This->doc_obj->in_place_active)
-        IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This));
+        IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->IOleInPlaceObjectWindowless_iface);
 
     HTMLDocument_LockContainer(This->doc_obj, FALSE);
 
diff --git a/dlls/mshtml/olewnd.c b/dlls/mshtml/olewnd.c
index 99d9b9e..18b98f6 100644
--- a/dlls/mshtml/olewnd.c
+++ b/dlls/mshtml/olewnd.c
@@ -146,44 +146,47 @@ static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
  * IOleInPlaceObjectWindowless implementation
  */
 
-#define OLEINPLACEWND_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceObjectWindowless, iface)
+static inline HTMLDocument *impl_from_IOleInPlaceObjectWindowless(IOleInPlaceObjectWindowless *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLDocument, IOleInPlaceObjectWindowless_iface);
+}
 
 static HRESULT WINAPI OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless *iface,
         REFIID riid, void **ppv)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     return htmldoc_query_interface(This, riid, ppv);
 }
 
 static ULONG WINAPI OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless *iface)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     return htmldoc_addref(This);
 }
 
 static ULONG WINAPI OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless *iface)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     return htmldoc_release(This);
 }
 
 static HRESULT WINAPI OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless *iface,
         HWND *phwnd)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     return IOleWindow_GetWindow(&This->IOleInPlaceActiveObject_iface, phwnd);
 }
 
 static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface,
         BOOL fEnterMode)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     return IOleWindow_ContextSensitiveHelp(&This->IOleInPlaceActiveObject_iface, fEnterMode);
 }
 
 static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
 
     TRACE("(%p)\n", This);
 
@@ -224,7 +227,7 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceOb
 
 static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless *iface)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
@@ -232,14 +235,14 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectW
 static HRESULT WINAPI OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless *iface,
         LPCRECT lprcPosRect, LPCRECT lprcClipRect)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
@@ -247,7 +250,7 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceOb
 static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless *iface,
         UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     FIXME("(%p)->(%u %lu %lu %p)\n", This, msg, wParam, lParam, lpResult);
     return E_NOTIMPL;
 }
@@ -255,7 +258,7 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObje
 static HRESULT WINAPI OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless *iface,
         IDropTarget **ppDropTarget)
 {
-    HTMLDocument *This = OLEINPLACEWND_THIS(iface);
+    HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
     FIXME("(%p)->(%p)\n", This, ppDropTarget);
     return E_NOTIMPL;
 }
@@ -274,10 +277,8 @@ static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
     OleInPlaceObjectWindowless_GetDropTarget
 };
 
-#undef INPLACEWIN_THIS
-
 void HTMLDocument_Window_Init(HTMLDocument *This)
 {
     This->IOleInPlaceActiveObject_iface.lpVtbl = &OleInPlaceActiveObjectVtbl;
-    This->lpOleInPlaceObjectWindowlessVtbl = &OleInPlaceObjectWindowlessVtbl;
+    This->IOleInPlaceObjectWindowless_iface.lpVtbl = &OleInPlaceObjectWindowlessVtbl;
 }
diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c
index 1b6a32f..1878e15 100644
--- a/dlls/mshtml/view.c
+++ b/dlls/mshtml/view.c
@@ -574,7 +574,7 @@ static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
         ShowWindow(This->doc_obj->hwnd, SW_HIDE);
 
         if(This->doc_obj->in_place_active)
-            IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This));
+            IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->IOleInPlaceObjectWindowless_iface);
 
         if(This->doc_obj->ip_window) {
             IOleInPlaceUIWindow_Release(This->doc_obj->ip_window);
-- 
1.7.3.2



More information about the wine-patches mailing list