Michael Stefaniuc : mshtml: COM cleanup for the IViewObjectEx iface.

Alexandre Julliard julliard at winehq.org
Thu Dec 23 11:28:05 CST 2010


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Thu Dec 23 02:21:09 2010 +0100

mshtml: COM cleanup for the IViewObjectEx iface.

---

 dlls/mshtml/htmldoc.c        |    6 +++---
 dlls/mshtml/mshtml_private.h |    5 +----
 dlls/mshtml/view.c           |   39 ++++++++++++++++++++-------------------
 3 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 5fa5adf..15240de 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1755,13 +1755,13 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
         *ppv = &This->IOleInPlaceActiveObject_iface;
     }else if(IsEqualGUID(&IID_IViewObject, riid)) {
         TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppv);
-        *ppv = VIEWOBJ(This);
+        *ppv = &This->IViewObjectEx_iface;
     }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
         TRACE("(%p)->(IID_IViewObject2, %p)\n", This, ppv);
-        *ppv = VIEWOBJ2(This);
+        *ppv = &This->IViewObjectEx_iface;
     }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
         TRACE("(%p)->(IID_IViewObjectEx, %p)\n", This, ppv);
-        *ppv = VIEWOBJEX(This);
+        *ppv = &This->IViewObjectEx_iface;
     }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
         TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppv);
         *ppv = &This->IOleInPlaceActiveObject_iface;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index f8e808a..703d5ff 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -355,7 +355,7 @@ struct HTMLDocument {
     IOleDocument                IOleDocument_iface;
     IOleDocumentView            IOleDocumentView_iface;
     IOleInPlaceActiveObject     IOleInPlaceActiveObject_iface;
-    const IViewObjectExVtbl               *lpViewObjectExVtbl;
+    IViewObjectEx               IViewObjectEx_iface;
     const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
     const IServiceProviderVtbl            *lpServiceProviderVtbl;
     const IOleCommandTargetVtbl           *lpOleCommandTargetVtbl;
@@ -625,9 +625,6 @@ struct HTMLDocumentNode {
 #define HTMLWINDOW2(x)   ((IHTMLWindow2*)                 &(x)->lpHTMLWindow2Vtbl)
 #define HTMLWINDOW3(x)   ((IHTMLWindow3*)                 &(x)->lpHTMLWindow3Vtbl)
 #define HTMLWINDOW4(x)   ((IHTMLWindow4*)                 &(x)->lpHTMLWindow4Vtbl)
-#define VIEWOBJ(x)       ((IViewObject*)                  &(x)->lpViewObjectExVtbl)
-#define VIEWOBJ2(x)      ((IViewObject2*)                 &(x)->lpViewObjectExVtbl)
-#define VIEWOBJEX(x)      ((IViewObjectEx*)               &(x)->lpViewObjectExVtbl)
 #define INPLACEOBJ(x)    ((IOleInPlaceObject*)            &(x)->lpOleInPlaceObjectWindowlessVtbl)
 #define INPLACEWIN(x)    ((IOleInPlaceObjectWindowless*)  &(x)->lpOleInPlaceObjectWindowlessVtbl)
 #define SERVPROV(x)      ((IServiceProvider*)             &(x)->lpServiceProviderVtbl)
diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c
index cd716db..1b6a32f 100644
--- a/dlls/mshtml/view.c
+++ b/dlls/mshtml/view.c
@@ -759,23 +759,26 @@ static const IOleDocumentViewVtbl OleDocumentViewVtbl = {
  * IViewObject implementation
  */
 
-#define VIEWOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, ViewObjectEx, iface)
+static inline HTMLDocument *impl_from_IViewObjectEx(IViewObjectEx *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLDocument, IViewObjectEx_iface);
+}
 
 static HRESULT WINAPI ViewObject_QueryInterface(IViewObjectEx *iface, REFIID riid, void **ppv)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     return htmldoc_query_interface(This, riid, ppv);
 }
 
 static ULONG WINAPI ViewObject_AddRef(IViewObjectEx *iface)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     return htmldoc_addref(This);
 }
 
 static ULONG WINAPI ViewObject_Release(IViewObjectEx *iface)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     return htmldoc_release(This);
 }
 
@@ -783,7 +786,7 @@ static HRESULT WINAPI ViewObject_Draw(IViewObjectEx *iface, DWORD dwDrawAspect,
         DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
         LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %ld)\n", This, dwDrawAspect, lindex, pvAspect,
             ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue);
     return E_NOTIMPL;
@@ -792,7 +795,7 @@ static HRESULT WINAPI ViewObject_Draw(IViewObjectEx *iface, DWORD dwDrawAspect,
 static HRESULT WINAPI ViewObject_GetColorSet(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
         DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%d %d %p %p %p %p)\n", This, dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
     return E_NOTIMPL;
 }
@@ -800,21 +803,21 @@ static HRESULT WINAPI ViewObject_GetColorSet(IViewObjectEx *iface, DWORD dwDrawA
 static HRESULT WINAPI ViewObject_Freeze(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex,
         void *pvAspect, DWORD *pdwFreeze)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ViewObject_Unfreeze(IViewObjectEx *iface, DWORD dwFreeze)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%d)\n", This, dwFreeze);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ViewObject_SetAdvise(IViewObjectEx *iface, DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
 
     TRACE("(%p)->(%d %d %p)\n", This, aspects, advf, pAdvSink);
 
@@ -832,7 +835,7 @@ static HRESULT WINAPI ViewObject_SetAdvise(IViewObjectEx *iface, DWORD aspects,
 
 static HRESULT WINAPI ViewObject_GetAdvise(IViewObjectEx *iface, DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%p %p %p)\n", This, pAspects, pAdvf, ppAdvSink);
     return E_NOTIMPL;
 }
@@ -840,21 +843,21 @@ static HRESULT WINAPI ViewObject_GetAdvise(IViewObjectEx *iface, DWORD *pAspects
 static HRESULT WINAPI ViewObject_GetExtent(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex,
                                 DVTARGETDEVICE* ptd, LPSIZEL lpsizel)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ViewObject_GetRect(IViewObjectEx *iface, DWORD dwAspect, LPRECTL pRect)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%d %p)\n", This, dwAspect, pRect);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ViewObject_GetViewStatus(IViewObjectEx *iface, DWORD *pdwStatus)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%p)\n", This, pdwStatus);
     return E_NOTIMPL;
 }
@@ -862,7 +865,7 @@ static HRESULT WINAPI ViewObject_GetViewStatus(IViewObjectEx *iface, DWORD *pdwS
 static HRESULT WINAPI ViewObject_QueryHitPoint(IViewObjectEx* iface, DWORD dwAspect,
         LPCRECT pRectBounds, POINT ptlLoc, LONG lCloseHint, DWORD *pHitResult)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%d %p (%d %d) %d %p)\n", This, dwAspect, pRectBounds, ptlLoc.x,
          ptlLoc.y, lCloseHint, pHitResult);
     return E_NOTIMPL;
@@ -871,7 +874,7 @@ static HRESULT WINAPI ViewObject_QueryHitPoint(IViewObjectEx* iface, DWORD dwAsp
 static HRESULT WINAPI ViewObject_QueryHitRect(IViewObjectEx *iface, DWORD dwAspect,
         LPCRECT pRectBounds, LPCRECT pRectLoc, LONG lCloseHint, DWORD *pHitResult)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%d %p %p %d %p)\n", This, dwAspect, pRectBounds, pRectLoc, lCloseHint, pHitResult);
     return E_NOTIMPL;
 }
@@ -879,14 +882,12 @@ static HRESULT WINAPI ViewObject_QueryHitRect(IViewObjectEx *iface, DWORD dwAspe
 static HRESULT WINAPI ViewObject_GetNaturalExtent(IViewObjectEx *iface, DWORD dwAspect, LONG lindex,
         DVTARGETDEVICE *ptd, HDC hicTargetDev, DVEXTENTINFO *pExtentInfo, LPSIZEL pSizel)
 {
-    HTMLDocument *This = VIEWOBJ_THIS(iface);
+    HTMLDocument *This = impl_from_IViewObjectEx(iface);
     FIXME("(%p)->(%d %d %p %p %p %p\n", This, dwAspect,lindex, ptd,
             hicTargetDev, pExtentInfo, pSizel);
     return E_NOTIMPL;
 }
 
-#undef VIEWOBJ_THIS
-
 static const IViewObjectExVtbl ViewObjectVtbl = {
     ViewObject_QueryInterface,
     ViewObject_AddRef,
@@ -908,5 +909,5 @@ static const IViewObjectExVtbl ViewObjectVtbl = {
 void HTMLDocument_View_Init(HTMLDocument *This)
 {
     This->IOleDocumentView_iface.lpVtbl = &OleDocumentViewVtbl;
-    This->lpViewObjectExVtbl = &ViewObjectVtbl;
+    This->IViewObjectEx_iface.lpVtbl = &ViewObjectVtbl;
 }




More information about the wine-cvs mailing list