Commit 6c706e02 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Move the IOleCommandTarget interface out of basedoc.

parent 07bf1d73
...@@ -1266,7 +1266,7 @@ HRESULT setup_edit_mode(HTMLDocumentObj *doc) ...@@ -1266,7 +1266,7 @@ HRESULT setup_edit_mode(HTMLDocumentObj *doc)
if(doc->hostui) if(doc->hostui)
IDocHostUIHandler_ShowUI(doc->hostui, DOCHOSTUITYPE_AUTHOR, IDocHostUIHandler_ShowUI(doc->hostui, DOCHOSTUITYPE_AUTHOR,
&doc->basedoc.IOleInPlaceActiveObject_iface, &doc->basedoc.IOleCommandTarget_iface, &doc->basedoc.IOleInPlaceActiveObject_iface, &doc->IOleCommandTarget_iface,
doc->frame, doc->ip_window); doc->frame, doc->ip_window);
if(doc->ip_window) if(doc->ip_window)
......
...@@ -1562,7 +1562,7 @@ static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID ...@@ -1562,7 +1562,7 @@ static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID
return OLECMDERR_E_NOTSUPPORTED; return OLECMDERR_E_NOTSUPPORTED;
V_VT(&ret) = VT_EMPTY; V_VT(&ret) = VT_EMPTY;
hres = IOleCommandTarget_Exec(&This->IOleCommandTarget_iface, &CGID_MSHTML, cmdid, hres = IOleCommandTarget_Exec(&This->doc_node->IOleCommandTarget_iface, &CGID_MSHTML, cmdid,
showUI ? 0 : OLECMDEXECOPT_DONTPROMPTUSER, &value, &ret); showUI ? 0 : OLECMDEXECOPT_DONTPROMPTUSER, &value, &ret);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -5625,8 +5625,6 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv) ...@@ -5625,8 +5625,6 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
*ppv = &This->IOleInPlaceObjectWindowless_iface; *ppv = &This->IOleInPlaceObjectWindowless_iface;
else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid)) else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid))
*ppv = &This->IOleInPlaceObjectWindowless_iface; *ppv = &This->IOleInPlaceObjectWindowless_iface;
else if(IsEqualGUID(&IID_IOleCommandTarget, riid))
*ppv = &This->IOleCommandTarget_iface;
else if(IsEqualGUID(&IID_IOleControl, riid)) else if(IsEqualGUID(&IID_IOleControl, riid))
*ppv = &This->IOleControl_iface; *ppv = &This->IOleControl_iface;
else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) else if(IsEqualGUID(&DIID_DispHTMLDocument, riid))
...@@ -5709,7 +5707,6 @@ static void init_doc(HTMLDocument *doc, IUnknown *outer, IDispatchEx *dispex) ...@@ -5709,7 +5707,6 @@ static void init_doc(HTMLDocument *doc, IUnknown *outer, IDispatchEx *dispex)
doc->outer_unk = outer; doc->outer_unk = outer;
doc->dispex = dispex; doc->dispex = dispex;
HTMLDocument_OleCmd_Init(doc);
HTMLDocument_OleObj_Init(doc); HTMLDocument_OleObj_Init(doc);
} }
...@@ -5743,6 +5740,8 @@ static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) ...@@ -5743,6 +5740,8 @@ static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
*ppv = &This->IPersistHistory_iface; *ppv = &This->IPersistHistory_iface;
else if(IsEqualGUID(&IID_IHlinkTarget, riid)) else if(IsEqualGUID(&IID_IHlinkTarget, riid))
*ppv = &This->IHlinkTarget_iface; *ppv = &This->IHlinkTarget_iface;
else if(IsEqualGUID(&IID_IOleCommandTarget, riid))
*ppv = &This->IOleCommandTarget_iface;
else if(IsEqualGUID(&IID_IServiceProvider, riid)) else if(IsEqualGUID(&IID_IServiceProvider, riid))
*ppv = &This->IServiceProvider_iface; *ppv = &This->IServiceProvider_iface;
else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) else if(IsEqualGUID(&IID_IConnectionPointContainer, riid))
...@@ -6136,6 +6135,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo ...@@ -6136,6 +6135,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo
ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->basedoc.IHTMLDocument2_iface, HTMLDocumentNode_cpc); ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->basedoc.IHTMLDocument2_iface, HTMLDocumentNode_cpc);
HTMLDocumentNode_Persist_Init(doc); HTMLDocumentNode_Persist_Init(doc);
HTMLDocumentNode_Service_Init(doc); HTMLDocumentNode_Service_Init(doc);
HTMLDocumentNode_OleCmd_Init(doc);
HTMLDocumentNode_SecMgr_Init(doc); HTMLDocumentNode_SecMgr_Init(doc);
list_init(&doc->selection_list); list_init(&doc->selection_list);
...@@ -6268,6 +6268,8 @@ static HRESULT WINAPI HTMLDocumentObj_QueryInterface(IUnknown *iface, REFIID rii ...@@ -6268,6 +6268,8 @@ static HRESULT WINAPI HTMLDocumentObj_QueryInterface(IUnknown *iface, REFIID rii
*ppv = &This->IPersistHistory_iface; *ppv = &This->IPersistHistory_iface;
}else if(IsEqualGUID(&IID_IHlinkTarget, riid)) { }else if(IsEqualGUID(&IID_IHlinkTarget, riid)) {
*ppv = &This->IHlinkTarget_iface; *ppv = &This->IHlinkTarget_iface;
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
*ppv = &This->IOleCommandTarget_iface;
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) { }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
*ppv = &This->IServiceProvider_iface; *ppv = &This->IServiceProvider_iface;
}else if(IsEqualGUID(&IID_ITargetContainer, riid)) { }else if(IsEqualGUID(&IID_ITargetContainer, riid)) {
...@@ -6498,6 +6500,7 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii ...@@ -6498,6 +6500,7 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii
ConnectionPointContainer_Init(&doc->cp_container, &doc->IUnknown_inner, HTMLDocumentObj_cpc); ConnectionPointContainer_Init(&doc->cp_container, &doc->IUnknown_inner, HTMLDocumentObj_cpc);
HTMLDocumentObj_Persist_Init(doc); HTMLDocumentObj_Persist_Init(doc);
HTMLDocumentObj_Service_Init(doc); HTMLDocumentObj_Service_Init(doc);
HTMLDocumentObj_OleCmd_Init(doc);
TargetContainer_Init(doc); TargetContainer_Init(doc);
doc->is_mhtml = is_mhtml; doc->is_mhtml = is_mhtml;
......
...@@ -652,7 +652,6 @@ struct HTMLDocument { ...@@ -652,7 +652,6 @@ struct HTMLDocument {
IOleDocument IOleDocument_iface; IOleDocument IOleDocument_iface;
IOleInPlaceActiveObject IOleInPlaceActiveObject_iface; IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface; IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
IOleCommandTarget IOleCommandTarget_iface;
IOleControl IOleControl_iface; IOleControl IOleControl_iface;
IDispatchEx IDispatchEx_iface; IDispatchEx IDispatchEx_iface;
ISupportErrorInfo ISupportErrorInfo_iface; ISupportErrorInfo ISupportErrorInfo_iface;
...@@ -702,6 +701,7 @@ struct HTMLDocumentObj { ...@@ -702,6 +701,7 @@ struct HTMLDocumentObj {
IPersistStreamInit IPersistStreamInit_iface; IPersistStreamInit IPersistStreamInit_iface;
IPersistHistory IPersistHistory_iface; IPersistHistory IPersistHistory_iface;
IHlinkTarget IHlinkTarget_iface; IHlinkTarget IHlinkTarget_iface;
IOleCommandTarget IOleCommandTarget_iface;
IServiceProvider IServiceProvider_iface; IServiceProvider IServiceProvider_iface;
ITargetContainer ITargetContainer_iface; ITargetContainer ITargetContainer_iface;
...@@ -902,6 +902,7 @@ struct HTMLDocumentNode { ...@@ -902,6 +902,7 @@ struct HTMLDocumentNode {
IPersistStreamInit IPersistStreamInit_iface; IPersistStreamInit IPersistStreamInit_iface;
IPersistHistory IPersistHistory_iface; IPersistHistory IPersistHistory_iface;
IHlinkTarget IHlinkTarget_iface; IHlinkTarget IHlinkTarget_iface;
IOleCommandTarget IOleCommandTarget_iface;
IServiceProvider IServiceProvider_iface; IServiceProvider IServiceProvider_iface;
IInternetHostSecurityManager IInternetHostSecurityManager_iface; IInternetHostSecurityManager IInternetHostSecurityManager_iface;
...@@ -969,16 +970,17 @@ void detach_dom_implementation(IHTMLDOMImplementation*) DECLSPEC_HIDDEN; ...@@ -969,16 +970,17 @@ void detach_dom_implementation(IHTMLDOMImplementation*) DECLSPEC_HIDDEN;
HRESULT create_html_storage(HTMLInnerWindow*,BOOL,IHTMLStorage**) DECLSPEC_HIDDEN; HRESULT create_html_storage(HTMLInnerWindow*,BOOL,IHTMLStorage**) DECLSPEC_HIDDEN;
void detach_html_storage(IHTMLStorage*) DECLSPEC_HIDDEN; void detach_html_storage(IHTMLStorage*) DECLSPEC_HIDDEN;
void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN; void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
void HTMLDocument_View_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN; void HTMLDocument_View_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void HTMLDocumentObj_Persist_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN; void HTMLDocumentObj_Persist_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void HTMLDocumentObj_Service_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN; void HTMLDocumentObj_Service_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void HTMLDocumentObj_OleCmd_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN; void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void HTMLDocumentNode_Persist_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN; void HTMLDocumentNode_Persist_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void HTMLDocumentNode_Service_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN; void HTMLDocumentNode_Service_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void HTMLDocumentNode_OleCmd_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN; void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN; HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
......
...@@ -89,9 +89,14 @@ static nsIClipboardCommands *get_clipboard_commands(HTMLDocumentNode *doc) ...@@ -89,9 +89,14 @@ static nsIClipboardCommands *get_clipboard_commands(HTMLDocumentNode *doc)
* IOleCommandTarget implementation * IOleCommandTarget implementation
*/ */
static inline HTMLDocument *impl_from_IOleCommandTarget(IOleCommandTarget *iface) static inline HTMLDocumentNode *HTMLDocumentNode_from_IOleCommandTarget(IOleCommandTarget *iface)
{ {
return CONTAINING_RECORD(iface, HTMLDocument, IOleCommandTarget_iface); return CONTAINING_RECORD(iface, HTMLDocumentNode, IOleCommandTarget_iface);
}
static inline HTMLDocumentObj *HTMLDocumentObj_from_IOleCommandTarget(IOleCommandTarget *iface)
{
return CONTAINING_RECORD(iface, HTMLDocumentObj, IOleCommandTarget_iface);
} }
static HRESULT exec_open(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) static HRESULT exec_open(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
...@@ -793,22 +798,22 @@ static const cmdtable_t base_cmds[] = { ...@@ -793,22 +798,22 @@ static const cmdtable_t base_cmds[] = {
{0,NULL,NULL} {0,NULL,NULL}
}; };
static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv) static HRESULT WINAPI DocNodeOleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv)
{ {
HTMLDocument *This = impl_from_IOleCommandTarget(iface); HTMLDocumentNode *This = HTMLDocumentNode_from_IOleCommandTarget(iface);
return htmldoc_query_interface(This, riid, ppv); return htmldoc_query_interface(&This->basedoc, riid, ppv);
} }
static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface) static ULONG WINAPI DocNodeOleCommandTarget_AddRef(IOleCommandTarget *iface)
{ {
HTMLDocument *This = impl_from_IOleCommandTarget(iface); HTMLDocumentNode *This = HTMLDocumentNode_from_IOleCommandTarget(iface);
return htmldoc_addref(This); return htmldoc_addref(&This->basedoc);
} }
static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface) static ULONG WINAPI DocNodeOleCommandTarget_Release(IOleCommandTarget *iface)
{ {
HTMLDocument *This = impl_from_IOleCommandTarget(iface); HTMLDocumentNode *This = HTMLDocumentNode_from_IOleCommandTarget(iface);
return htmldoc_release(This); return htmldoc_release(&This->basedoc);
} }
static HRESULT query_from_table(HTMLDocumentNode *doc, const cmdtable_t *cmdtable, OLECMD *cmd) static HRESULT query_from_table(HTMLDocumentNode *doc, const cmdtable_t *cmdtable, OLECMD *cmd)
...@@ -826,17 +831,17 @@ static HRESULT query_from_table(HTMLDocumentNode *doc, const cmdtable_t *cmdtabl ...@@ -826,17 +831,17 @@ static HRESULT query_from_table(HTMLDocumentNode *doc, const cmdtable_t *cmdtabl
return iter->query(doc, cmd); return iter->query(doc, cmd);
} }
static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup, static HRESULT WINAPI DocNodeOleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
{ {
HTMLDocument *This = impl_from_IOleCommandTarget(iface); HTMLDocumentNode *This = HTMLDocumentNode_from_IOleCommandTarget(iface);
HRESULT hres; HRESULT hres;
TRACE("(%p)->(%s %ld %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText); TRACE("(%p)->(%s %ld %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
if(pCmdText) if(pCmdText)
FIXME("Unsupported pCmdText\n"); FIXME("Unsupported pCmdText\n");
if(!This->doc_node->browser) if(!This->browser)
return E_UNEXPECTED; return E_UNEXPECTED;
if(!cCmds) if(!cCmds)
return S_OK; return S_OK;
...@@ -854,8 +859,8 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con ...@@ -854,8 +859,8 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
OLECMD olecmd; OLECMD olecmd;
prgCmds[i].cmdf = OLECMDF_SUPPORTED; prgCmds[i].cmdf = OLECMDF_SUPPORTED;
if(This->doc_obj->client) { if(This->basedoc.doc_obj->client) {
hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget, hres = IOleClientSite_QueryInterface(This->basedoc.doc_obj->client, &IID_IOleCommandTarget,
(void**)&cmdtrg); (void**)&cmdtrg);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
olecmd.cmdID = prgCmds[i].cmdID; olecmd.cmdID = prgCmds[i].cmdID;
...@@ -882,9 +887,9 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con ...@@ -882,9 +887,9 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
ULONG i; ULONG i;
for(i=0; i<cCmds; i++) { for(i=0; i<cCmds; i++) {
hres = query_from_table(This->doc_node, base_cmds, prgCmds+i); hres = query_from_table(This, base_cmds, prgCmds+i);
if(hres == OLECMDERR_E_NOTSUPPORTED) if(hres == OLECMDERR_E_NOTSUPPORTED)
hres = query_from_table(This->doc_node, editmode_cmds, prgCmds+i); hres = query_from_table(This, editmode_cmds, prgCmds+i);
if(hres == OLECMDERR_E_NOTSUPPORTED) if(hres == OLECMDERR_E_NOTSUPPORTED)
FIXME("CGID_MSHTML: unsupported cmdID %ld\n", prgCmds[i].cmdID); FIXME("CGID_MSHTML: unsupported cmdID %ld\n", prgCmds[i].cmdID);
} }
...@@ -910,14 +915,14 @@ static HRESULT exec_from_table(HTMLDocumentNode *doc, const cmdtable_t *cmdtable ...@@ -910,14 +915,14 @@ static HRESULT exec_from_table(HTMLDocumentNode *doc, const cmdtable_t *cmdtable
return iter->exec(doc, cmdexecopt, in, out); return iter->exec(doc, cmdexecopt, in, out);
} }
static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup, static HRESULT WINAPI DocNodeOleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{ {
HTMLDocument *This = impl_from_IOleCommandTarget(iface); HTMLDocumentNode *This = HTMLDocumentNode_from_IOleCommandTarget(iface);
TRACE("(%p)->(%s %ld %ld %s %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, wine_dbgstr_variant(pvaIn), pvaOut); TRACE("(%p)->(%s %ld %ld %s %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, wine_dbgstr_variant(pvaIn), pvaOut);
if(!This->doc_node->browser) if(!This->browser)
return E_UNEXPECTED; return E_UNEXPECTED;
if(!pguidCmdGroup) { if(!pguidCmdGroup) {
...@@ -926,7 +931,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID ...@@ -926,7 +931,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
return OLECMDERR_E_NOTSUPPORTED; return OLECMDERR_E_NOTSUPPORTED;
} }
return exec_table[nCmdID].func(This->doc_node, nCmdexecopt, pvaIn, pvaOut); return exec_table[nCmdID].func(This, nCmdexecopt, pvaIn, pvaOut);
}else if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) { }else if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
FIXME("unsupported nCmdID %ld of CGID_Explorer group\n", nCmdID); FIXME("unsupported nCmdID %ld of CGID_Explorer group\n", nCmdID);
TRACE("%p %p\n", pvaIn, pvaOut); TRACE("%p %p\n", pvaIn, pvaOut);
...@@ -935,9 +940,9 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID ...@@ -935,9 +940,9 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
FIXME("unsupported nCmdID %ld of CGID_ShellDocView group\n", nCmdID); FIXME("unsupported nCmdID %ld of CGID_ShellDocView group\n", nCmdID);
return OLECMDERR_E_NOTSUPPORTED; return OLECMDERR_E_NOTSUPPORTED;
}else if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) { }else if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
HRESULT hres = exec_from_table(This->doc_node, base_cmds, nCmdID, nCmdexecopt, pvaIn, pvaOut); HRESULT hres = exec_from_table(This, base_cmds, nCmdID, nCmdexecopt, pvaIn, pvaOut);
if(hres == OLECMDERR_E_NOTSUPPORTED) if(hres == OLECMDERR_E_NOTSUPPORTED)
hres = exec_from_table(This->doc_node, editmode_cmds, nCmdID, hres = exec_from_table(This, editmode_cmds, nCmdID,
nCmdexecopt, pvaIn, pvaOut); nCmdexecopt, pvaIn, pvaOut);
if(hres == OLECMDERR_E_NOTSUPPORTED) if(hres == OLECMDERR_E_NOTSUPPORTED)
FIXME("unsupported nCmdID %ld of CGID_MSHTML group\n", nCmdID); FIXME("unsupported nCmdID %ld of CGID_MSHTML group\n", nCmdID);
...@@ -949,12 +954,60 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID ...@@ -949,12 +954,60 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
return OLECMDERR_E_UNKNOWNGROUP; return OLECMDERR_E_UNKNOWNGROUP;
} }
static const IOleCommandTargetVtbl OleCommandTargetVtbl = { static const IOleCommandTargetVtbl DocNodeOleCommandTargetVtbl = {
OleCommandTarget_QueryInterface, DocNodeOleCommandTarget_QueryInterface,
OleCommandTarget_AddRef, DocNodeOleCommandTarget_AddRef,
OleCommandTarget_Release, DocNodeOleCommandTarget_Release,
OleCommandTarget_QueryStatus, DocNodeOleCommandTarget_QueryStatus,
OleCommandTarget_Exec DocNodeOleCommandTarget_Exec
};
static HRESULT WINAPI DocObjOleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv)
{
HTMLDocumentObj *This = HTMLDocumentObj_from_IOleCommandTarget(iface);
return htmldoc_query_interface(&This->basedoc, riid, ppv);
}
static ULONG WINAPI DocObjOleCommandTarget_AddRef(IOleCommandTarget *iface)
{
HTMLDocumentObj *This = HTMLDocumentObj_from_IOleCommandTarget(iface);
return htmldoc_addref(&This->basedoc);
}
static ULONG WINAPI DocObjOleCommandTarget_Release(IOleCommandTarget *iface)
{
HTMLDocumentObj *This = HTMLDocumentObj_from_IOleCommandTarget(iface);
return htmldoc_release(&This->basedoc);
}
static HRESULT WINAPI DocObjOleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
{
HTMLDocumentObj *This = HTMLDocumentObj_from_IOleCommandTarget(iface);
if(!This->basedoc.doc_node)
return E_UNEXPECTED;
return IOleCommandTarget_QueryStatus(&This->basedoc.doc_node->IOleCommandTarget_iface,
pguidCmdGroup, cCmds, prgCmds, pCmdText);
}
static HRESULT WINAPI DocObjOleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{
HTMLDocumentObj *This = HTMLDocumentObj_from_IOleCommandTarget(iface);
if(!This->basedoc.doc_node)
return E_UNEXPECTED;
return IOleCommandTarget_Exec(&This->basedoc.doc_node->IOleCommandTarget_iface,
pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
}
static const IOleCommandTargetVtbl DocObjOleCommandTargetVtbl = {
DocObjOleCommandTarget_QueryInterface,
DocObjOleCommandTarget_AddRef,
DocObjOleCommandTarget_Release,
DocObjOleCommandTarget_QueryStatus,
DocObjOleCommandTarget_Exec
}; };
void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch *elem) void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch *elem)
...@@ -963,7 +1016,7 @@ void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch ...@@ -963,7 +1016,7 @@ void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch
DWORD cmdid; DWORD cmdid;
if(This->hostui && S_OK == IDocHostUIHandler_ShowContextMenu(This->hostui, if(This->hostui && S_OK == IDocHostUIHandler_ShowContextMenu(This->hostui,
dwID, ppt, (IUnknown*)&This->basedoc.IOleCommandTarget_iface, elem)) dwID, ppt, (IUnknown*)&This->IOleCommandTarget_iface, elem))
return; return;
menu_res = LoadMenuW(get_shdoclc(), MAKEINTRESOURCEW(IDR_BROWSE_CONTEXT_MENU)); menu_res = LoadMenuW(get_shdoclc(), MAKEINTRESOURCEW(IDR_BROWSE_CONTEXT_MENU));
...@@ -974,11 +1027,16 @@ void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch ...@@ -974,11 +1027,16 @@ void show_context_menu(HTMLDocumentObj *This, DWORD dwID, POINT *ppt, IDispatch
DestroyMenu(menu_res); DestroyMenu(menu_res);
if(cmdid) if(cmdid)
IOleCommandTarget_Exec(&This->basedoc.IOleCommandTarget_iface, &CGID_MSHTML, cmdid, 0, IOleCommandTarget_Exec(&This->IOleCommandTarget_iface, &CGID_MSHTML, cmdid, 0,
NULL, NULL); NULL, NULL);
} }
void HTMLDocument_OleCmd_Init(HTMLDocument *This) void HTMLDocumentNode_OleCmd_Init(HTMLDocumentNode *This)
{
This->IOleCommandTarget_iface.lpVtbl = &DocNodeOleCommandTargetVtbl;
}
void HTMLDocumentObj_OleCmd_Init(HTMLDocumentObj *This)
{ {
This->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl; This->IOleCommandTarget_iface.lpVtbl = &DocObjOleCommandTargetVtbl;
} }
...@@ -625,7 +625,7 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f ...@@ -625,7 +625,7 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
if(This->hostui) { if(This->hostui) {
hres = IDocHostUIHandler_ShowUI(This->hostui, hres = IDocHostUIHandler_ShowUI(This->hostui,
This->nscontainer->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE, This->nscontainer->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
&This->basedoc.IOleInPlaceActiveObject_iface, &This->basedoc.IOleCommandTarget_iface, &This->basedoc.IOleInPlaceActiveObject_iface, &This->IOleCommandTarget_iface,
This->frame, This->ip_window); This->frame, This->ip_window);
if(FAILED(hres)) if(FAILED(hres))
IDocHostUIHandler_HideUI(This->hostui); IDocHostUIHandler_HideUI(This->hostui);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment