mshtml: Improved IOleCommandTarget::QueryStatus implementation.
This commit is contained in:
parent
48ea8a1cb4
commit
23d74d3b73
|
@ -790,18 +790,22 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
|
|||
ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
|
||||
{
|
||||
HTMLDocument *This = impl_from_IOleCommandTarget(iface);
|
||||
HRESULT hres = S_OK, hr;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
|
||||
|
||||
if(pCmdText)
|
||||
FIXME("Unsupported pCmdText\n");
|
||||
if(!cCmds)
|
||||
return S_OK;
|
||||
|
||||
if(!pguidCmdGroup) {
|
||||
ULONG i;
|
||||
|
||||
for(i=0; i<cCmds; i++) {
|
||||
if(prgCmds[i].cmdID<OLECMDID_OPEN || prgCmds[i].cmdID>OLECMDID_GETPRINTTEMPLATE) {
|
||||
if(prgCmds[i].cmdID < OLECMDID_OPEN || prgCmds[i].cmdID >= sizeof(exec_table)/sizeof(*exec_table)) {
|
||||
WARN("Unsupported cmdID = %d\n", prgCmds[i].cmdID);
|
||||
prgCmds[i].cmdf = 0;
|
||||
hres = OLECMDERR_E_NOTSUPPORTED;
|
||||
}else {
|
||||
if(prgCmds[i].cmdID == OLECMDID_OPEN || prgCmds[i].cmdID == OLECMDID_NEW) {
|
||||
IOleCommandTarget *cmdtrg = NULL;
|
||||
|
@ -809,14 +813,14 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
|
|||
|
||||
prgCmds[i].cmdf = OLECMDF_SUPPORTED;
|
||||
if(This->doc_obj->client) {
|
||||
hr = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
|
||||
hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
|
||||
(void**)&cmdtrg);
|
||||
if(SUCCEEDED(hr)) {
|
||||
if(SUCCEEDED(hres)) {
|
||||
olecmd.cmdID = prgCmds[i].cmdID;
|
||||
olecmd.cmdf = 0;
|
||||
|
||||
hr = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 1, &olecmd, NULL);
|
||||
if(SUCCEEDED(hr) && olecmd.cmdf)
|
||||
hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 1, &olecmd, NULL);
|
||||
if(SUCCEEDED(hres) && olecmd.cmdf)
|
||||
prgCmds[i].cmdf = olecmd.cmdf;
|
||||
}
|
||||
}else {
|
||||
|
@ -826,33 +830,28 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
|
|||
prgCmds[i].cmdf = exec_table[prgCmds[i].cmdID].cmdf;
|
||||
TRACE("cmdID = %d returning %x\n", prgCmds[i].cmdID, prgCmds[i].cmdf);
|
||||
}
|
||||
hres = S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if(pCmdText)
|
||||
FIXME("Set pCmdText\n");
|
||||
}else if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
|
||||
return (prgCmds[cCmds-1].cmdf & OLECMDF_SUPPORTED) ? S_OK : OLECMDERR_E_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
|
||||
ULONG i;
|
||||
|
||||
for(i=0; i<cCmds; i++) {
|
||||
HRESULT hres = query_from_table(This, base_cmds, prgCmds+i);
|
||||
hres = query_from_table(This, base_cmds, prgCmds+i);
|
||||
if(hres == OLECMDERR_E_NOTSUPPORTED)
|
||||
hres = query_from_table(This, editmode_cmds, prgCmds+i);
|
||||
if(hres == OLECMDERR_E_NOTSUPPORTED)
|
||||
FIXME("CGID_MSHTML: unsupported cmdID %d\n", prgCmds[i].cmdID);
|
||||
}
|
||||
|
||||
hres = prgCmds[i-1].cmdf ? S_OK : OLECMDERR_E_NOTSUPPORTED;
|
||||
|
||||
if(pCmdText)
|
||||
FIXME("Set pCmdText\n");
|
||||
}else {
|
||||
FIXME("Unsupported pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup));
|
||||
hres = OLECMDERR_E_UNKNOWNGROUP;
|
||||
return (prgCmds[cCmds-1].cmdf & OLECMDF_SUPPORTED) ? S_OK : OLECMDERR_E_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
return hres;
|
||||
FIXME("Unsupported pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup));
|
||||
return OLECMDERR_E_UNKNOWNGROUP;
|
||||
}
|
||||
|
||||
static HRESULT exec_from_table(HTMLDocument *This, const cmdtable_t *cmdtable, DWORD cmdid,
|
||||
|
|
Loading…
Reference in New Issue