Commit 510481b7 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added command table for CGID_MSHTML commands.

parent 85f29f52
...@@ -374,6 +374,12 @@ void release_nodes(HTMLDocument*); ...@@ -374,6 +374,12 @@ void release_nodes(HTMLDocument*);
BOOL install_wine_gecko(void); BOOL install_wine_gecko(void);
typedef struct {
DWORD id;
HRESULT (*query)(HTMLDocument*,OLECMD*);
HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
} cmdtable_t;
/* editor */ /* editor */
void handle_edit_event(HTMLDocument*,nsIDOMEvent*); void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
......
...@@ -777,9 +777,12 @@ static HRESULT exec_underline(HTMLDocument *This) ...@@ -777,9 +777,12 @@ static HRESULT exec_underline(HTMLDocument *This)
return S_OK; return S_OK;
} }
static HRESULT exec_browsemode(HTMLDocument *This) static HRESULT exec_browsemode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
{ {
WARN("(%p)\n", This); WARN("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
if(in || out)
FIXME("unsupported args\n");
This->usermode = BROWSEMODE; This->usermode = BROWSEMODE;
...@@ -834,14 +837,17 @@ static void setup_ns_editing(NSContainer *This) ...@@ -834,14 +837,17 @@ static void setup_ns_editing(NSContainer *This)
nsIWebBrowser_SetParentURIContentListener(This->webbrowser, NSURICL(This)); nsIWebBrowser_SetParentURIContentListener(This->webbrowser, NSURICL(This));
} }
static HRESULT exec_editmode(HTMLDocument *This) static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
{ {
IMoniker *mon; IMoniker *mon;
HRESULT hres; HRESULT hres;
static const WCHAR wszAboutBlank[] = {'a','b','o','u','t',':','b','l','a','n','k',0}; static const WCHAR wszAboutBlank[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
TRACE("(%p)\n", This); TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
if(in || out)
FIXME("unsupported args\n");
This->usermode = EDITMODE; This->usermode = EDITMODE;
...@@ -998,6 +1004,12 @@ static const struct { ...@@ -998,6 +1004,12 @@ static const struct {
{ OLECMDF_SUPPORTED, exec_get_print_template } /* OLECMDID_GETPRINTTEMPLATE */ { OLECMDF_SUPPORTED, exec_get_print_template } /* OLECMDID_GETPRINTTEMPLATE */
}; };
static const cmdtable_t base_cmds[] = {
{IDM_BROWSEMODE, NULL, exec_browsemode},
{IDM_EDITMODE, NULL, exec_editmode},
{0,NULL,NULL}
};
static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv) static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv)
{ {
HTMLDocument *This = CMDTARGET_THIS(iface); HTMLDocument *This = CMDTARGET_THIS(iface);
...@@ -1165,6 +1177,20 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con ...@@ -1165,6 +1177,20 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
return hres; return hres;
} }
static HRESULT exec_from_table(HTMLDocument *This, const cmdtable_t *cmdtable, DWORD cmdid,
DWORD cmdexecopt, VARIANT *in, VARIANT *out)
{
const cmdtable_t *iter = cmdtable;
while(iter->id && iter->id != cmdid)
iter++;
if(!iter->id || !iter->exec)
return OLECMDERR_E_NOTSUPPORTED;
return iter->exec(This, cmdexecopt, in, out);
}
static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup, static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{ {
...@@ -1185,6 +1211,11 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID ...@@ -1185,6 +1211,11 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
FIXME("unsupported nCmdID %d of CGID_ShellDocView group\n", nCmdID); FIXME("unsupported nCmdID %d 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, base_cmds, nCmdID, nCmdexecopt, pvaIn, pvaOut);
if(hres != OLECMDERR_E_NOTSUPPORTED)
return hres;
switch(nCmdID) { switch(nCmdID) {
case IDM_COPY: case IDM_COPY:
if(pvaIn || pvaOut) if(pvaIn || pvaOut)
...@@ -1230,14 +1261,6 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID ...@@ -1230,14 +1261,6 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
if(pvaIn || pvaOut) if(pvaIn || pvaOut)
FIXME("unsupported arguments\n"); FIXME("unsupported arguments\n");
return exec_underline(This); return exec_underline(This);
case IDM_BROWSEMODE:
if(pvaIn || pvaOut)
FIXME("unsupported arguments\n");
return exec_browsemode(This);
case IDM_EDITMODE:
if(pvaIn || pvaOut)
FIXME("unsupported arguments\n");
return exec_editmode(This);
case IDM_BASELINEFONT3: case IDM_BASELINEFONT3:
return exec_baselinefont3(This); return exec_baselinefont3(This);
case IDM_HORIZONTALLINE: case IDM_HORIZONTALLINE:
......
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