[PATCH 4/7] mshtml: COM cleanup for the IOleDocumentView iface.
Michael Stefaniuc
mstefani at redhat.de
Wed Dec 22 19:19:14 CST 2010
---
dlls/mshtml/htmldoc.c | 4 ++--
dlls/mshtml/mshtml_private.h | 4 +---
dlls/mshtml/oleobj.c | 14 +++++++-------
dlls/mshtml/olewnd.c | 2 +-
dlls/mshtml/view.c | 41 +++++++++++++++++++++--------------------
5 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index c0aef86..eae9eff 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1749,7 +1749,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
*ppv = &This->IOleDocument_iface;
}else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppv);
- *ppv = DOCVIEW(This);
+ *ppv = &This->IOleDocumentView_iface;
}else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppv);
*ppv = ACTOBJ(This);
@@ -2108,7 +2108,7 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
if(This->in_place_active)
IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(&This->basedoc));
if(This->ipsite)
- IOleDocumentView_SetInPlaceSite(DOCVIEW(&This->basedoc), NULL);
+ IOleDocumentView_SetInPlaceSite(&This->basedoc.IOleDocumentView_iface, NULL);
if(This->undomgr)
IOleUndoManager_Release(This->undomgr);
if(This->tooltips_hwnd)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index fa92722..7c3fbbd 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -353,7 +353,7 @@ struct HTMLDocument {
IMonikerProp IMonikerProp_iface;
IOleObject IOleObject_iface;
IOleDocument IOleDocument_iface;
- const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
+ IOleDocumentView IOleDocumentView_iface;
const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
const IViewObjectExVtbl *lpViewObjectExVtbl;
const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
@@ -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 DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
#define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
#define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
#define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index 7d63f5d..8f49a28 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -328,17 +328,17 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpms
HTMLDocument_LockContainer(This->doc_obj, TRUE);
/* FIXME: Create new IOleDocumentView. See CreateView for more info. */
- hres = IOleDocumentSite_ActivateMe(pDocSite, DOCVIEW(This));
+ hres = IOleDocumentSite_ActivateMe(pDocSite, &This->IOleDocumentView_iface);
IOleDocumentSite_Release(pDocSite);
}else {
- hres = IOleDocumentView_UIActivate(DOCVIEW(This), TRUE);
+ hres = IOleDocumentView_UIActivate(&This->IOleDocumentView_iface, TRUE);
if(SUCCEEDED(hres)) {
if(lprcPosRect) {
RECT rect; /* We need to pass rect as not const pointer */
rect = *lprcPosRect;
- IOleDocumentView_SetRect(DOCVIEW(This), &rect);
+ IOleDocumentView_SetRect(&This->IOleDocumentView_iface, &rect);
}
- IOleDocumentView_Show(DOCVIEW(This), TRUE);
+ IOleDocumentView_Show(&This->IOleDocumentView_iface, TRUE);
}
}
@@ -532,7 +532,7 @@ static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSit
*/
if(pIPSite) {
- hres = IOleDocumentView_SetInPlaceSite(DOCVIEW(This), pIPSite);
+ hres = IOleDocumentView_SetInPlaceSite(&This->IOleDocumentView_iface, pIPSite);
if(FAILED(hres))
return hres;
}
@@ -540,8 +540,8 @@ static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSit
if(pstm)
FIXME("pstm is not supported\n");
- IOleDocumentView_AddRef(DOCVIEW(This));
- *ppView = DOCVIEW(This);
+ IOleDocumentView_AddRef(&This->IOleDocumentView_iface);
+ *ppView = &This->IOleDocumentView_iface;
return S_OK;
}
diff --git a/dlls/mshtml/olewnd.c b/dlls/mshtml/olewnd.c
index 8285589..d6913b2 100644
--- a/dlls/mshtml/olewnd.c
+++ b/dlls/mshtml/olewnd.c
@@ -187,7 +187,7 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceOb
TRACE("(%p)\n", This);
if(This->doc_obj->ui_active)
- IOleDocumentView_UIActivate(DOCVIEW(This), FALSE);
+ IOleDocumentView_UIActivate(&This->IOleDocumentView_iface, FALSE);
This->doc_obj->window_active = FALSE;
if(!This->doc_obj->in_place_active)
diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c
index 657adee..a395e89 100644
--- a/dlls/mshtml/view.c
+++ b/dlls/mshtml/view.c
@@ -445,29 +445,32 @@ HRESULT call_set_active_object(IOleInPlaceUIWindow *window, IOleInPlaceActiveObj
* IOleDocumentView implementation
*/
-#define DOCVIEW_THIS(iface) DEFINE_THIS(HTMLDocument, OleDocumentView, iface)
+static inline HTMLDocument *impl_from_IOleDocumentView(IOleDocumentView *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLDocument, IOleDocumentView_iface);
+}
static HRESULT WINAPI OleDocumentView_QueryInterface(IOleDocumentView *iface, REFIID riid, void **ppvObject)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
return htmldoc_query_interface(This, riid, ppvObject);
}
static ULONG WINAPI OleDocumentView_AddRef(IOleDocumentView *iface)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
return htmldoc_addref(This);
}
static ULONG WINAPI OleDocumentView_Release(IOleDocumentView *iface)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
return htmldoc_release(This);
}
static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite *pIPSite)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
TRACE("(%p)->(%p)\n", This, pIPSite);
if(pIPSite)
@@ -483,7 +486,7 @@ static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IO
static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite **ppIPSite)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
TRACE("(%p)->(%p)\n", This, ppIPSite);
if(!ppIPSite)
@@ -498,7 +501,7 @@ static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IO
static HRESULT WINAPI OleDocumentView_GetDocument(IOleDocumentView *iface, IUnknown **ppunk)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
TRACE("(%p)->(%p)\n", This, ppunk);
if(!ppunk)
@@ -511,7 +514,7 @@ static HRESULT WINAPI OleDocumentView_GetDocument(IOleDocumentView *iface, IUnkn
static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT prcView)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
RECT rect;
TRACE("(%p)->(%p)\n", This, prcView);
@@ -533,7 +536,7 @@ static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT pr
static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT prcView)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
TRACE("(%p)->(%p)\n", This, prcView);
@@ -547,14 +550,14 @@ static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT pr
static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LPRECT prcView,
LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
FIXME("(%p)->(%p %p %p %p)\n", This, prcView, prcHScroll, prcVScroll, prcSizeBox);
return E_NOTIMPL;
}
static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
HRESULT hres;
TRACE("(%p)->(%x)\n", This, fShow);
@@ -584,7 +587,7 @@ static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
HRESULT hres;
TRACE("(%p)->(%x)\n", This, fUIActivate);
@@ -686,14 +689,14 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
TRACE("(%p)->(%x)\n", This, dwReserved);
if(dwReserved)
@@ -711,14 +714,14 @@ static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD d
static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, LPSTREAM pstm)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
FIXME("(%p)->(%p)\n", This, pstm);
return E_NOTIMPL;
}
static HRESULT WINAPI OleDocumentView_ApplyViewState(IOleDocumentView *iface, LPSTREAM pstm)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
FIXME("(%p)->(%p)\n", This, pstm);
return E_NOTIMPL;
}
@@ -726,13 +729,11 @@ static HRESULT WINAPI OleDocumentView_ApplyViewState(IOleDocumentView *iface, LP
static HRESULT WINAPI OleDocumentView_Clone(IOleDocumentView *iface, IOleInPlaceSite *pIPSiteNew,
IOleDocumentView **ppViewNew)
{
- HTMLDocument *This = DOCVIEW_THIS(iface);
+ HTMLDocument *This = impl_from_IOleDocumentView(iface);
FIXME("(%p)->(%p %p)\n", This, pIPSiteNew, ppViewNew);
return E_NOTIMPL;
}
-#undef DOCVIEW_THIS
-
static const IOleDocumentViewVtbl OleDocumentViewVtbl = {
OleDocumentView_QueryInterface,
OleDocumentView_AddRef,
@@ -904,6 +905,6 @@ static const IViewObjectExVtbl ViewObjectVtbl = {
void HTMLDocument_View_Init(HTMLDocument *This)
{
- This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
+ This->IOleDocumentView_iface.lpVtbl = &OleDocumentViewVtbl;
This->lpViewObjectExVtbl = &ViewObjectVtbl;
}
--
1.7.3.2
More information about the wine-patches
mailing list