static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out) { TRACE("(%p)->(%p %p)\n", This, in, out); if(!This->doc_obj->nscontainer) { update_doc(This, UPDATE_UI); return E_FAIL; } if(in) { char *stra; if(V_VT(in) != VT_BSTR) { FIXME("Unsupported vt=%d\n", V_VT(out)); return E_INVALIDARG; } TRACE("%s\n", debugstr_w(V_BSTR(in))); stra = heap_strdupWtoA(V_BSTR(in)); set_ns_fontname(This, stra); heap_free(stra); update_doc(This, UPDATE_UI); } if(out) { nsICommandParams *nsparam; LPWSTR strw; char *stra; DWORD len; nsresult nsres; V_VT(out) = VT_BSTR; V_BSTR(out) = NULL; nsparam = create_nscommand_params(); nsres = get_ns_command_state(This->doc_obj->nscontainer, NSCMD_FONTFACE, nsparam); if(NS_FAILED(nsres)) return S_OK; nsICommandParams_GetCStringValue(nsparam, NSSTATE_ATTRIBUTE, &stra); nsICommandParams_Release(nsparam); len = MultiByteToWideChar(CP_ACP, 0, stra, -1, NULL, 0); strw = heap_alloc(len*sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, stra, -1, strw, len); nsfree(stra); V_BSTR(out) = SysAllocString(strw); heap_free(strw); } return S_OK; }
static void set_ns_align(HTMLDocumentNode *doc, const char *align_str) { nsICommandParams *nsparam; nsparam = create_nscommand_params(); nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, align_str); do_ns_command(doc, NSCMD_ALIGN, nsparam); nsICommandParams_Release(nsparam); }
static void set_ns_align(HTMLDocument *This, const char *align_str) { nsICommandParams *nsparam; if(!This->doc_obj->nscontainer) return; nsparam = create_nscommand_params(); nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, align_str); do_ns_command(This, NSCMD_ALIGN, nsparam); nsICommandParams_Release(nsparam); }
static HRESULT exec_forecolor(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out) { TRACE("(%p)->(%p %p)\n", This, in, out); if(in) { if(V_VT(in) == VT_I4) { nsICommandParams *nsparam = create_nscommand_params(); char color_str[10]; sprintf(color_str, "#%02x%02x%02x", V_I4(in)&0xff, (V_I4(in)>>8)&0xff, (V_I4(in)>>16)&0xff); nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, color_str); do_ns_command(This, NSCMD_FONTCOLOR, nsparam); nsICommandParams_Release(nsparam); }else {
static DWORD query_ns_edit_status(HTMLDocument *This, const char *nscmd) { nsICommandParams *nsparam; cpp_bool b = FALSE; if(This->doc_obj->usermode != EDITMODE || This->window->readystate < READYSTATE_INTERACTIVE) return OLECMDF_SUPPORTED; if(This->doc_obj->nscontainer && nscmd) { nsparam = create_nscommand_params(); get_ns_command_state(This->doc_obj->nscontainer, nscmd, nsparam); nsICommandParams_GetBooleanValue(nsparam, NSSTATE_ALL, &b); nsICommandParams_Release(nsparam); } return OLECMDF_SUPPORTED | OLECMDF_ENABLED | (b ? OLECMDF_LATCHED : 0); }