mshtml: Move justify queries to command table.
This commit is contained in:
parent
7d336240d4
commit
ca82a1eb0e
|
@ -136,6 +136,29 @@ static void set_ns_align(HTMLDocument *This, const char *align_str)
|
||||||
|
|
||||||
nsICommandParams_Release(nsparam);
|
nsICommandParams_Release(nsparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD query_align_status(HTMLDocument *This, const char *align_str)
|
||||||
|
{
|
||||||
|
nsICommandParams *nsparam;
|
||||||
|
char *align = NULL;
|
||||||
|
|
||||||
|
if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
|
||||||
|
return OLECMDF_SUPPORTED;
|
||||||
|
|
||||||
|
if(This->nscontainer) {
|
||||||
|
nsparam = create_nscommand_params();
|
||||||
|
get_ns_command_state(This->nscontainer, NSCMD_ALIGN, nsparam);
|
||||||
|
|
||||||
|
nsICommandParams_GetCStringValue(nsparam, NSSTATE_ATTRIBUTE, &align);
|
||||||
|
|
||||||
|
nsICommandParams_Release(nsparam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return OLECMDF_SUPPORTED | OLECMDF_ENABLED
|
||||||
|
| (align && !strcmp(align_str, align) ? OLECMDF_LATCHED : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static nsISelection *get_ns_selection(HTMLDocument *This)
|
static nsISelection *get_ns_selection(HTMLDocument *This)
|
||||||
{
|
{
|
||||||
nsIDOMWindow *dom_window;
|
nsIDOMWindow *dom_window;
|
||||||
|
@ -685,6 +708,26 @@ static HRESULT exec_italic(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VA
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT query_justify(HTMLDocument *This, OLECMD *cmd)
|
||||||
|
{
|
||||||
|
switch(cmd->cmdID) {
|
||||||
|
case IDM_JUSTIFYCENTER:
|
||||||
|
TRACE("(%p) IDM_JUSTIFYCENTER\n", This);
|
||||||
|
cmd->cmdf = query_align_status(This, NSALIGN_CENTER);
|
||||||
|
break;
|
||||||
|
case IDM_JUSTIFYLEFT:
|
||||||
|
TRACE("(%p) IDM_JUSTIFYLEFT\n", This);
|
||||||
|
cmd->cmdf = query_align_status(This, NSALIGN_LEFT);
|
||||||
|
break;
|
||||||
|
case IDM_JUSTIFYRIGHT:
|
||||||
|
TRACE("(%p) IDM_JUSTIFYRIGHT\n", This);
|
||||||
|
cmd->cmdf = query_align_status(This, NSALIGN_RIGHT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT exec_justifycenter(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
|
static HRESULT exec_justifycenter(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
|
||||||
{
|
{
|
||||||
TRACE("(%p)\n", This);
|
TRACE("(%p)\n", This);
|
||||||
|
@ -810,9 +853,9 @@ const cmdtable_t editmode_cmds[] = {
|
||||||
{IDM_FORECOLOR, NULL, exec_forecolor},
|
{IDM_FORECOLOR, NULL, exec_forecolor},
|
||||||
{IDM_BOLD, NULL, exec_bold},
|
{IDM_BOLD, NULL, exec_bold},
|
||||||
{IDM_ITALIC, NULL, exec_italic},
|
{IDM_ITALIC, NULL, exec_italic},
|
||||||
{IDM_JUSTIFYCENTER, NULL, exec_justifycenter},
|
{IDM_JUSTIFYCENTER, query_justify, exec_justifycenter},
|
||||||
{IDM_JUSTIFYRIGHT, NULL, exec_justifyright},
|
{IDM_JUSTIFYRIGHT, query_justify, exec_justifyright},
|
||||||
{IDM_JUSTIFYLEFT, NULL, exec_justifyleft},
|
{IDM_JUSTIFYLEFT, query_justify, exec_justifyleft},
|
||||||
{IDM_UNDERLINE, NULL, exec_underline},
|
{IDM_UNDERLINE, NULL, exec_underline},
|
||||||
{IDM_HORIZONTALLINE, NULL, exec_horizontalline},
|
{IDM_HORIZONTALLINE, NULL, exec_horizontalline},
|
||||||
{IDM_ORDERLIST, NULL, exec_orderlist},
|
{IDM_ORDERLIST, NULL, exec_orderlist},
|
||||||
|
|
|
@ -510,26 +510,6 @@ static DWORD query_edit_status(HTMLDocument *This, const char *nscmd)
|
||||||
return OLECMDF_SUPPORTED | OLECMDF_ENABLED | (b ? OLECMDF_LATCHED : 0);
|
return OLECMDF_SUPPORTED | OLECMDF_ENABLED | (b ? OLECMDF_LATCHED : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD query_align_status(HTMLDocument *This, const char *align_str)
|
|
||||||
{
|
|
||||||
nsICommandParams *nsparam;
|
|
||||||
char *align = NULL;
|
|
||||||
|
|
||||||
if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
|
|
||||||
return OLECMDF_SUPPORTED;
|
|
||||||
|
|
||||||
if(This->nscontainer) {
|
|
||||||
nsparam = create_nscommand_params();
|
|
||||||
get_ns_command_state(This->nscontainer, NSCMD_ALIGN, nsparam);
|
|
||||||
|
|
||||||
nsICommandParams_GetCStringValue(nsparam, NSSTATE_ATTRIBUTE, &align);
|
|
||||||
|
|
||||||
nsICommandParams_Release(nsparam);
|
|
||||||
}
|
|
||||||
|
|
||||||
return OLECMDF_SUPPORTED | OLECMDF_ENABLED | (align && !strcmp(align_str, align) ? OLECMDF_LATCHED : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT query_mshtml_copy(HTMLDocument *This, OLECMD *cmd)
|
static HRESULT query_mshtml_copy(HTMLDocument *This, OLECMD *cmd)
|
||||||
{
|
{
|
||||||
FIXME("(%p)\n", This);
|
FIXME("(%p)\n", This);
|
||||||
|
@ -861,18 +841,6 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
|
||||||
TRACE("CGID_MSHTML: IDM_ITALIC\n");
|
TRACE("CGID_MSHTML: IDM_ITALIC\n");
|
||||||
prgCmds[i].cmdf = query_edit_status(This, NSCMD_ITALIC);
|
prgCmds[i].cmdf = query_edit_status(This, NSCMD_ITALIC);
|
||||||
break;
|
break;
|
||||||
case IDM_JUSTIFYCENTER:
|
|
||||||
TRACE("CGID_MSHTML: IDM_JUSTIFYCENTER\n");
|
|
||||||
prgCmds[i].cmdf = query_align_status(This, NSALIGN_CENTER);
|
|
||||||
break;
|
|
||||||
case IDM_JUSTIFYLEFT:
|
|
||||||
TRACE("CGID_MSHTML: IDM_JUSTIFYLEFT\n");
|
|
||||||
prgCmds[i].cmdf = query_align_status(This, NSALIGN_LEFT);
|
|
||||||
break;
|
|
||||||
case IDM_JUSTIFYRIGHT:
|
|
||||||
TRACE("CGID_MSHTML: IDM_JUSTIFYRIGHT\n");
|
|
||||||
prgCmds[i].cmdf = query_align_status(This, NSALIGN_RIGHT);
|
|
||||||
break;
|
|
||||||
case IDM_UNDERLINE:
|
case IDM_UNDERLINE:
|
||||||
TRACE("CGID_MSHTML: IDM_UNDERLINE\n");
|
TRACE("CGID_MSHTML: IDM_UNDERLINE\n");
|
||||||
prgCmds[i].cmdf = query_edit_status(This, NSCMD_UNDERLINE);
|
prgCmds[i].cmdf = query_edit_status(This, NSCMD_UNDERLINE);
|
||||||
|
|
Loading…
Reference in New Issue