mshtml: COM cleanup for the IOleInPlaceActiveObject iface.

This commit is contained in:
Michael Stefaniuc 2010-12-23 02:20:05 +01:00 committed by Alexandre Julliard
parent 37c3091f27
commit b09dc2e5b1
5 changed files with 28 additions and 26 deletions

View File

@ -1752,7 +1752,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
*ppv = &This->IOleDocumentView_iface; *ppv = &This->IOleDocumentView_iface;
}else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) { }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppv); TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppv);
*ppv = ACTOBJ(This); *ppv = &This->IOleInPlaceActiveObject_iface;
}else if(IsEqualGUID(&IID_IViewObject, riid)) { }else if(IsEqualGUID(&IID_IViewObject, riid)) {
TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppv); TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppv);
*ppv = VIEWOBJ(This); *ppv = VIEWOBJ(This);
@ -1764,7 +1764,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
*ppv = VIEWOBJEX(This); *ppv = VIEWOBJEX(This);
}else if(IsEqualGUID(&IID_IOleWindow, riid)) { }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppv); TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppv);
*ppv = OLEWIN(This); *ppv = &This->IOleInPlaceActiveObject_iface;
}else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) { }else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) {
TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppv); TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppv);
*ppv = INPLACEOBJ(This); *ppv = INPLACEOBJ(This);

View File

@ -354,7 +354,7 @@ struct HTMLDocument {
IOleObject IOleObject_iface; IOleObject IOleObject_iface;
IOleDocument IOleDocument_iface; IOleDocument IOleDocument_iface;
IOleDocumentView IOleDocumentView_iface; IOleDocumentView IOleDocumentView_iface;
const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl; IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
const IViewObjectExVtbl *lpViewObjectExVtbl; const IViewObjectExVtbl *lpViewObjectExVtbl;
const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl; const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
const IServiceProviderVtbl *lpServiceProviderVtbl; const IServiceProviderVtbl *lpServiceProviderVtbl;
@ -625,8 +625,6 @@ struct HTMLDocumentNode {
#define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl) #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
#define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl) #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
#define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl) #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
#define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
#define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
#define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl) #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
#define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl) #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
#define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl) #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)

View File

@ -620,11 +620,12 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
RECT rcBorderWidths; RECT rcBorderWidths;
if(This->doc_obj->hostui) if(This->doc_obj->hostui)
IDocHostUIHandler_ShowUI(This->doc_obj->hostui, DOCHOSTUITYPE_AUTHOR, ACTOBJ(This), CMDTARGET(This), IDocHostUIHandler_ShowUI(This->doc_obj->hostui, DOCHOSTUITYPE_AUTHOR,
&This->IOleInPlaceActiveObject_iface, CMDTARGET(This),
This->doc_obj->frame, This->doc_obj->ip_window); This->doc_obj->frame, This->doc_obj->ip_window);
if(This->doc_obj->ip_window) if(This->doc_obj->ip_window)
call_set_active_object(This->doc_obj->ip_window, ACTOBJ(This)); call_set_active_object(This->doc_obj->ip_window, &This->IOleInPlaceActiveObject_iface);
memset(&rcBorderWidths, 0, sizeof(rcBorderWidths)); memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
if(This->doc_obj->frame) if(This->doc_obj->frame)

View File

@ -39,29 +39,32 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
* IOleInPlaceActiveObject implementation * IOleInPlaceActiveObject implementation
*/ */
#define ACTOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceActiveObject, iface) static inline HTMLDocument *impl_from_IOleInPlaceActiveObject(IOleInPlaceActiveObject *iface)
{
return CONTAINING_RECORD(iface, HTMLDocument, IOleInPlaceActiveObject_iface);
}
static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppv) static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppv)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
return htmldoc_query_interface(This, riid, ppv); return htmldoc_query_interface(This, riid, ppv);
} }
static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface) static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
return htmldoc_addref(This); return htmldoc_addref(This);
} }
static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface) static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
return htmldoc_release(This); return htmldoc_release(This);
} }
static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd) static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
TRACE("(%p)->(%p)\n", This, phwnd); TRACE("(%p)->(%p)\n", This, phwnd);
@ -79,14 +82,14 @@ static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *
static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode) static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
FIXME("(%p)->(%x)\n", This, fEnterMode); FIXME("(%p)->(%x)\n", This, fEnterMode);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg) static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
FIXME("(%p)->(%p)\n", This, lpmsg); FIXME("(%p)->(%p)\n", This, lpmsg);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -94,7 +97,7 @@ static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceAct
static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface, static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface,
BOOL fActivate) BOOL fActivate)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
TRACE("(%p)->(%x)\n", This, fActivate); TRACE("(%p)->(%x)\n", This, fActivate);
@ -106,7 +109,7 @@ static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceAc
static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate) static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
FIXME("(%p)->(%x)\n", This, fActivate); FIXME("(%p)->(%x)\n", This, fActivate);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -114,14 +117,14 @@ static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActi
static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder, static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow) IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow); FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable) static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
{ {
HTMLDocument *This = ACTOBJ_THIS(iface); HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
FIXME("(%p)->(%x)\n", This, fEnable); FIXME("(%p)->(%x)\n", This, fEnable);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -139,8 +142,6 @@ static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
OleInPlaceActiveObject_EnableModeless OleInPlaceActiveObject_EnableModeless
}; };
#undef ACTOBJ_THIS
/********************************************************** /**********************************************************
* IOleInPlaceObjectWindowless implementation * IOleInPlaceObjectWindowless implementation
*/ */
@ -170,14 +171,14 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWind
HWND *phwnd) HWND *phwnd)
{ {
HTMLDocument *This = OLEINPLACEWND_THIS(iface); HTMLDocument *This = OLEINPLACEWND_THIS(iface);
return IOleWindow_GetWindow(OLEWIN(This), phwnd); return IOleWindow_GetWindow(&This->IOleInPlaceActiveObject_iface, phwnd);
} }
static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface, static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface,
BOOL fEnterMode) BOOL fEnterMode)
{ {
HTMLDocument *This = OLEINPLACEWND_THIS(iface); HTMLDocument *This = OLEINPLACEWND_THIS(iface);
return IOleWindow_ContextSensitiveHelp(OLEWIN(This), fEnterMode); return IOleWindow_ContextSensitiveHelp(&This->IOleInPlaceActiveObject_iface, fEnterMode);
} }
static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface) static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface)
@ -277,6 +278,6 @@ static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
void HTMLDocument_Window_Init(HTMLDocument *This) void HTMLDocument_Window_Init(HTMLDocument *This)
{ {
This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl; This->IOleInPlaceActiveObject_iface.lpVtbl = &OleInPlaceActiveObjectVtbl;
This->lpOleInPlaceObjectWindowlessVtbl = &OleInPlaceObjectWindowlessVtbl; This->lpOleInPlaceObjectWindowlessVtbl = &OleInPlaceObjectWindowlessVtbl;
} }

View File

@ -645,7 +645,8 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
hres = IOleInPlaceSite_OnUIActivate(This->doc_obj->ipsite); hres = IOleInPlaceSite_OnUIActivate(This->doc_obj->ipsite);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame, ACTOBJ(This)); call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame,
&This->IOleInPlaceActiveObject_iface);
}else { }else {
FIXME("OnUIActivate failed: %08x\n", hres); FIXME("OnUIActivate failed: %08x\n", hres);
IOleInPlaceFrame_Release(This->doc_obj->frame); IOleInPlaceFrame_Release(This->doc_obj->frame);
@ -657,13 +658,14 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
if(This->doc_obj->hostui) { if(This->doc_obj->hostui) {
hres = IDocHostUIHandler_ShowUI(This->doc_obj->hostui, hres = IDocHostUIHandler_ShowUI(This->doc_obj->hostui,
This->doc_obj->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE, This->doc_obj->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
ACTOBJ(This), CMDTARGET(This), This->doc_obj->frame, This->doc_obj->ip_window); &This->IOleInPlaceActiveObject_iface, CMDTARGET(This), This->doc_obj->frame,
This->doc_obj->ip_window);
if(FAILED(hres)) if(FAILED(hres))
IDocHostUIHandler_HideUI(This->doc_obj->hostui); IDocHostUIHandler_HideUI(This->doc_obj->hostui);
} }
if(This->doc_obj->ip_window) if(This->doc_obj->ip_window)
call_set_active_object(This->doc_obj->ip_window, ACTOBJ(This)); call_set_active_object(This->doc_obj->ip_window, &This->IOleInPlaceActiveObject_iface);
memset(&rcBorderWidths, 0, sizeof(rcBorderWidths)); memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
IOleInPlaceFrame_SetBorderSpace(This->doc_obj->frame, &rcBorderWidths); IOleInPlaceFrame_SetBorderSpace(This->doc_obj->frame, &rcBorderWidths);