diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index e83282a2ae7..f1cdd4fa799 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1776,7 +1776,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
*ppv = &This->IServiceProvider_iface;
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This, ppv);
- *ppv = CMDTARGET(This);
+ *ppv = &This->IOleCommandTarget_iface;
}else if(IsEqualGUID(&IID_IOleControl, riid)) {
TRACE("(%p)->(IID_IOleControl, %p)\n", This, ppv);
*ppv = CONTROL(This);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 404d1ab2156..7c99f36ff2d 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -358,7 +358,7 @@ struct HTMLDocument {
IViewObjectEx IViewObjectEx_iface;
IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
IServiceProvider IServiceProvider_iface;
- const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
+ IOleCommandTarget IOleCommandTarget_iface;
const IOleControlVtbl *lpOleControlVtbl;
const IHlinkTargetVtbl *lpHlinkTargetVtbl;
IPersistStreamInit IPersistStreamInit_iface;
@@ -625,7 +625,6 @@ struct HTMLDocumentNode {
#define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
#define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
#define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
-#define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
#define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
#define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
#define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index 5bcf1b727fe..d4f18631479 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -66,7 +66,10 @@ void do_ns_command(HTMLDocument *This, const char *cmd, nsICommandParams *nspara
* IOleCommandTarget implementation
*/
-#define CMDTARGET_THIS(iface) DEFINE_THIS(HTMLDocument, OleCommandTarget, iface)
+static inline HTMLDocument *impl_from_IOleCommandTarget(IOleCommandTarget *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLDocument, IOleCommandTarget_iface);
+}
static HRESULT exec_open(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{
@@ -621,8 +624,8 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
if(This->doc_obj->hostui)
IDocHostUIHandler_ShowUI(This->doc_obj->hostui, DOCHOSTUITYPE_AUTHOR,
- &This->IOleInPlaceActiveObject_iface, CMDTARGET(This),
- This->doc_obj->frame, This->doc_obj->ip_window);
+ &This->IOleInPlaceActiveObject_iface, &This->IOleCommandTarget_iface,
+ This->doc_obj->frame, This->doc_obj->ip_window);
if(This->doc_obj->ip_window)
call_set_active_object(This->doc_obj->ip_window, &This->IOleInPlaceActiveObject_iface);
@@ -737,19 +740,19 @@ static const cmdtable_t base_cmds[] = {
static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv)
{
- HTMLDocument *This = CMDTARGET_THIS(iface);
+ HTMLDocument *This = impl_from_IOleCommandTarget(iface);
return htmldoc_query_interface(This, riid, ppv);
}
static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
{
- HTMLDocument *This = CMDTARGET_THIS(iface);
+ HTMLDocument *This = impl_from_IOleCommandTarget(iface);
return htmldoc_addref(This);
}
static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
{
- HTMLDocument *This = CMDTARGET_THIS(iface);
+ HTMLDocument *This = impl_from_IOleCommandTarget(iface);
return htmldoc_release(This);
}
@@ -771,7 +774,7 @@ static HRESULT query_from_table(HTMLDocument *This, const cmdtable_t *cmdtable,
static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
{
- HTMLDocument *This = CMDTARGET_THIS(iface);
+ HTMLDocument *This = impl_from_IOleCommandTarget(iface);
HRESULT hres = S_OK, hr;
TRACE("(%p)->(%s %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
@@ -854,7 +857,7 @@ static HRESULT exec_from_table(HTMLDocument *This, const cmdtable_t *cmdtable, D
static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{
- HTMLDocument *This = CMDTARGET_THIS(iface);
+ HTMLDocument *This = impl_from_IOleCommandTarget(iface);
if(!pguidCmdGroup) {
if(nCmdIDOLECMDID_GETPRINTTEMPLATE || !exec_table[nCmdID].func) {
@@ -901,7 +904,7 @@ void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch
DWORD cmdid;
if(This->hostui && S_OK == IDocHostUIHandler_ShowContextMenu(This->hostui,
- dwID, ppt, (IUnknown*)CMDTARGET(&This->basedoc), elem))
+ dwID, ppt, (IUnknown*)&This->basedoc.IOleCommandTarget_iface, elem))
return;
menu_res = LoadMenuW(get_shdoclc(), MAKEINTRESOURCEW(IDR_BROWSE_CONTEXT_MENU));
@@ -912,10 +915,11 @@ void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch
DestroyMenu(menu_res);
if(cmdid)
- IOleCommandTarget_Exec(CMDTARGET(&This->basedoc), &CGID_MSHTML, cmdid, 0, NULL, NULL);
+ IOleCommandTarget_Exec(&This->basedoc.IOleCommandTarget_iface, &CGID_MSHTML, cmdid, 0,
+ NULL, NULL);
}
void HTMLDocument_OleCmd_Init(HTMLDocument *This)
{
- This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
+ This->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl;
}
diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index c5a104391f5..17ed555c530 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -38,7 +38,7 @@ static const WCHAR hrW[] = {'h','r',0};
typedef struct {
const IHTMLTxtRangeVtbl *lpHTMLTxtRangeVtbl;
- const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
+ IOleCommandTarget IOleCommandTarget_iface;
LONG ref;
@@ -1017,7 +1017,7 @@ static HRESULT WINAPI HTMLTxtRange_QueryInterface(IHTMLTxtRange *iface, REFIID r
*ppv = HTMLTXTRANGE(This);
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
- *ppv = CMDTARGET(This);
+ *ppv = &This->IOleCommandTarget_iface;
}
if(*ppv) {
@@ -1755,30 +1755,33 @@ static const IHTMLTxtRangeVtbl HTMLTxtRangeVtbl = {
HTMLTxtRange_execCommandShowHelp
};
-#define OLECMDTRG_THIS(iface) DEFINE_THIS(HTMLTxtRange, OleCommandTarget, iface)
+static inline HTMLTxtRange *impl_from_IOleCommandTarget(IOleCommandTarget *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLTxtRange, IOleCommandTarget_iface);
+}
static HRESULT WINAPI RangeCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv)
{
- HTMLTxtRange *This = OLECMDTRG_THIS(iface);
+ HTMLTxtRange *This = impl_from_IOleCommandTarget(iface);
return IHTMLTxtRange_QueryInterface(HTMLTXTRANGE(This), riid, ppv);
}
static ULONG WINAPI RangeCommandTarget_AddRef(IOleCommandTarget *iface)
{
- HTMLTxtRange *This = OLECMDTRG_THIS(iface);
+ HTMLTxtRange *This = impl_from_IOleCommandTarget(iface);
return IHTMLTxtRange_AddRef(HTMLTXTRANGE(This));
}
static ULONG WINAPI RangeCommandTarget_Release(IOleCommandTarget *iface)
{
- HTMLTxtRange *This = OLECMDTRG_THIS(iface);
+ HTMLTxtRange *This = impl_from_IOleCommandTarget(iface);
return IHTMLTxtRange_Release(HTMLTXTRANGE(This));
}
static HRESULT WINAPI RangeCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
{
- HTMLTxtRange *This = OLECMDTRG_THIS(iface);
+ HTMLTxtRange *This = impl_from_IOleCommandTarget(iface);
FIXME("(%p)->(%s %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
return E_NOTIMPL;
}
@@ -1820,7 +1823,7 @@ static HRESULT exec_indent(HTMLTxtRange *This, VARIANT *in, VARIANT *out)
static HRESULT WINAPI RangeCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{
- HTMLTxtRange *This = OLECMDTRG_THIS(iface);
+ HTMLTxtRange *This = impl_from_IOleCommandTarget(iface);
TRACE("(%p)->(%s %d %x %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID,
nCmdexecopt, pvaIn, pvaOut);
@@ -1858,7 +1861,7 @@ HRESULT HTMLTxtRange_Create(HTMLDocumentNode *doc, nsIDOMRange *nsrange, IHTMLTx
return E_OUTOFMEMORY;
ret->lpHTMLTxtRangeVtbl = &HTMLTxtRangeVtbl;
- ret->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
+ ret->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl;
ret->ref = 1;
if(nsrange)
diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c
index 1878e154c6e..fccbde896ae 100644
--- a/dlls/mshtml/view.c
+++ b/dlls/mshtml/view.c
@@ -658,8 +658,8 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
if(This->doc_obj->hostui) {
hres = IDocHostUIHandler_ShowUI(This->doc_obj->hostui,
This->doc_obj->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
- &This->IOleInPlaceActiveObject_iface, CMDTARGET(This), This->doc_obj->frame,
- This->doc_obj->ip_window);
+ &This->IOleInPlaceActiveObject_iface, &This->IOleCommandTarget_iface,
+ This->doc_obj->frame, This->doc_obj->ip_window);
if(FAILED(hres))
IDocHostUIHandler_HideUI(This->doc_obj->hostui);
}