2006-06-20 19:02:48 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2005-2006 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2006-08-27 16:01:06 +02:00
|
|
|
#include "winnls.h"
|
2006-06-20 19:02:48 +02:00
|
|
|
#include "ole2.h"
|
|
|
|
#include "shlguid.h"
|
|
|
|
#include "mshtmdid.h"
|
|
|
|
#include "idispids.h"
|
2006-06-30 23:44:04 +02:00
|
|
|
#include "mshtmcid.h"
|
2006-06-20 19:02:48 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2006-11-24 10:17:54 +01:00
|
|
|
#include "wine/unicode.h"
|
2006-06-20 19:02:48 +02:00
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
2006-12-14 00:21:50 +01:00
|
|
|
#include "resource.h"
|
2006-06-20 19:02:48 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
2006-11-02 17:34:17 +01:00
|
|
|
#define NSCMD_BOLD "cmd_bold"
|
2006-11-02 17:34:44 +01:00
|
|
|
#define NSCMD_ITALIC "cmd_italic"
|
2006-11-02 17:34:57 +01:00
|
|
|
#define NSCMD_UNDERLINE "cmd_underline"
|
2006-11-09 10:47:10 +01:00
|
|
|
#define NSCMD_FONTCOLOR "cmd_fontColor"
|
2006-11-09 10:48:07 +01:00
|
|
|
#define NSCMD_ALIGN "cmd_align"
|
2006-11-09 10:49:53 +01:00
|
|
|
#define NSCMD_FONTFACE "cmd_fontFace"
|
2006-11-11 15:30:08 +01:00
|
|
|
#define NSCMD_INDENT "cmd_indent"
|
|
|
|
#define NSCMD_OUTDENT "cmd_outdent"
|
2006-11-11 15:31:00 +01:00
|
|
|
#define NSCMD_INSERTHR "cmd_insertHR"
|
2006-11-11 15:31:55 +01:00
|
|
|
#define NSCMD_UL "cmd_ul"
|
2006-11-11 15:32:49 +01:00
|
|
|
#define NSCMD_OL "cmd_ol"
|
2006-11-09 10:47:10 +01:00
|
|
|
|
|
|
|
#define NSSTATE_ATTRIBUTE "state_attribute"
|
2006-11-09 10:49:53 +01:00
|
|
|
#define NSSTATE_ALL "state_all"
|
2006-11-02 17:34:17 +01:00
|
|
|
|
2006-11-09 10:50:51 +01:00
|
|
|
#define NSALIGN_CENTER "center"
|
|
|
|
#define NSALIGN_LEFT "left"
|
|
|
|
#define NSALIGN_RIGHT "right"
|
|
|
|
|
2006-06-20 19:02:48 +02:00
|
|
|
/**********************************************************
|
|
|
|
* IOleCommandTarget implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define CMDTARGET_THIS(iface) DEFINE_THIS(HTMLDocument, OleCommandTarget, iface)
|
|
|
|
|
|
|
|
static HRESULT exec_open(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_new(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_save(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_save_as(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_save_copy_as(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2006-12-14 00:21:50 +01:00
|
|
|
static nsresult set_head_text(nsIPrintSettings *settings, LPCWSTR template, BOOL head, int pos)
|
|
|
|
{
|
|
|
|
if(head) {
|
|
|
|
switch(pos) {
|
|
|
|
case 0:
|
|
|
|
return nsIPrintSettings_SetHeaderStrLeft(settings, template);
|
|
|
|
case 1:
|
|
|
|
return nsIPrintSettings_SetHeaderStrRight(settings, template);
|
|
|
|
case 2:
|
|
|
|
return nsIPrintSettings_SetHeaderStrCenter(settings, template);
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
switch(pos) {
|
|
|
|
case 0:
|
|
|
|
return nsIPrintSettings_SetFooterStrLeft(settings, template);
|
|
|
|
case 1:
|
|
|
|
return nsIPrintSettings_SetFooterStrRight(settings, template);
|
|
|
|
case 2:
|
|
|
|
return nsIPrintSettings_SetFooterStrCenter(settings, template);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_print_template(nsIPrintSettings *settings, LPCWSTR template, BOOL head)
|
|
|
|
{
|
|
|
|
PRUnichar nstemplate[200]; /* FIXME: Use dynamic allocation */
|
|
|
|
PRUnichar *p = nstemplate;
|
|
|
|
LPCWSTR ptr=template;
|
|
|
|
int pos=0;
|
|
|
|
|
|
|
|
while(*ptr) {
|
|
|
|
if(*ptr != '&') {
|
|
|
|
*p++ = *ptr++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(*++ptr) {
|
|
|
|
case '&':
|
|
|
|
*p++ = '&';
|
|
|
|
*p++ = '&';
|
|
|
|
ptr++;
|
|
|
|
break;
|
|
|
|
case 'b': /* change align */
|
|
|
|
ptr++;
|
|
|
|
*p = 0;
|
|
|
|
set_head_text(settings, nstemplate, head, pos);
|
|
|
|
p = nstemplate;
|
|
|
|
pos++;
|
|
|
|
break;
|
|
|
|
case 'd': { /* short date */
|
|
|
|
SYSTEMTIME systime;
|
|
|
|
GetLocalTime(&systime);
|
|
|
|
GetDateFormatW(LOCALE_SYSTEM_DEFAULT, 0, &systime, NULL, p,
|
|
|
|
sizeof(nstemplate)-(p-nstemplate)*sizeof(WCHAR));
|
|
|
|
p += strlenW(p);
|
|
|
|
ptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'p': /* page number */
|
|
|
|
*p++ = '&';
|
|
|
|
*p++ = 'P';
|
|
|
|
ptr++;
|
|
|
|
break;
|
|
|
|
case 'P': /* page count */
|
|
|
|
*p++ = '?'; /* FIXME */
|
|
|
|
ptr++;
|
|
|
|
break;
|
|
|
|
case 'u':
|
|
|
|
*p++ = '&';
|
|
|
|
*p++ = 'U';
|
|
|
|
ptr++;
|
|
|
|
break;
|
|
|
|
case 'w':
|
|
|
|
/* FIXME: set window title */
|
|
|
|
ptr++;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*p++ = '&';
|
|
|
|
*p++ = *ptr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = 0;
|
|
|
|
set_head_text(settings, nstemplate, head, pos);
|
|
|
|
|
|
|
|
while(++pos < 3)
|
|
|
|
set_head_text(settings, p, head, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_default_templates(nsIPrintSettings *settings)
|
|
|
|
{
|
|
|
|
WCHAR buf[64];
|
|
|
|
|
|
|
|
static const PRUnichar empty[] = {0};
|
|
|
|
|
|
|
|
nsIPrintSettings_SetHeaderStrLeft(settings, empty);
|
|
|
|
nsIPrintSettings_SetHeaderStrRight(settings, empty);
|
|
|
|
nsIPrintSettings_SetHeaderStrCenter(settings, empty);
|
|
|
|
nsIPrintSettings_SetFooterStrLeft(settings, empty);
|
|
|
|
nsIPrintSettings_SetFooterStrRight(settings, empty);
|
|
|
|
nsIPrintSettings_SetFooterStrCenter(settings, empty);
|
|
|
|
|
|
|
|
if(LoadStringW(get_shdoclc(), IDS_PRINT_HEADER_TEMPLATE, buf,
|
|
|
|
sizeof(buf)/sizeof(WCHAR)))
|
|
|
|
set_print_template(settings, buf, TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
if(LoadStringW(get_shdoclc(), IDS_PRINT_FOOTER_TEMPLATE, buf,
|
|
|
|
sizeof(buf)/sizeof(WCHAR)))
|
|
|
|
set_print_template(settings, buf, FALSE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-06-20 19:02:48 +02:00
|
|
|
static HRESULT exec_print(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-12-12 21:56:37 +01:00
|
|
|
nsIInterfaceRequestor *iface_req;
|
|
|
|
nsIWebBrowserPrint *nsprint;
|
2006-12-14 00:21:50 +01:00
|
|
|
nsIPrintSettings *settings;
|
2006-12-12 21:56:37 +01:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
|
|
|
|
|
|
|
if(pvaOut)
|
|
|
|
FIXME("unsupported pvaOut\n");
|
|
|
|
|
|
|
|
if(!This->nscontainer)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
nsres = nsIWebBrowser_QueryInterface(This->nscontainer->webbrowser,
|
|
|
|
&IID_nsIInterfaceRequestor, (void**)&iface_req);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsIWebBrowserPrint,
|
|
|
|
(void**)&nsprint);
|
|
|
|
nsIInterfaceRequestor_Release(iface_req);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIWebBrowserPrint: %08x\n", nsres);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-12-14 00:21:50 +01:00
|
|
|
nsres = nsIWebBrowserPrint_GetGlobalPrintSettings(nsprint, &settings);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("GetCurrentPrintSettings failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
set_default_templates(settings);
|
|
|
|
|
2006-12-14 20:39:21 +01:00
|
|
|
if(pvaIn) {
|
|
|
|
switch(V_VT(pvaIn)) {
|
|
|
|
case VT_BYREF|VT_ARRAY: {
|
|
|
|
VARIANT *opts;
|
|
|
|
DWORD opts_cnt;
|
|
|
|
|
|
|
|
if(V_ARRAY(pvaIn)->cDims != 1)
|
|
|
|
WARN("cDims = %d\n", V_ARRAY(pvaIn)->cDims);
|
|
|
|
|
|
|
|
SafeArrayAccessData(V_ARRAY(pvaIn), (void**)&opts);
|
|
|
|
opts_cnt = V_ARRAY(pvaIn)->rgsabound[0].cElements;
|
|
|
|
|
|
|
|
if(opts_cnt >= 1) {
|
|
|
|
switch(V_VT(opts)) {
|
|
|
|
case VT_BSTR:
|
|
|
|
TRACE("setting footer %s\n", debugstr_w(V_BSTR(opts)));
|
|
|
|
set_print_template(settings, V_BSTR(opts), TRUE);
|
|
|
|
break;
|
|
|
|
case VT_NULL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
WARN("V_VT(opts) = %d\n", V_VT(opts));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(opts_cnt >= 2) {
|
|
|
|
switch(V_VT(opts+1)) {
|
|
|
|
case VT_BSTR:
|
|
|
|
TRACE("setting footer %s\n", debugstr_w(V_BSTR(opts+1)));
|
|
|
|
set_print_template(settings, V_BSTR(opts+1), FALSE);
|
|
|
|
break;
|
|
|
|
case VT_NULL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
WARN("V_VT(opts) = %d\n", V_VT(opts+1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(opts_cnt >= 3)
|
2007-01-04 10:47:11 +01:00
|
|
|
FIXME("Unsupported opts_cnt %d\n", opts_cnt);
|
2006-12-14 20:39:21 +01:00
|
|
|
|
|
|
|
SafeArrayUnaccessData(V_ARRAY(pvaIn));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
FIXME("unsupported vt %x\n", V_VT(pvaIn));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-14 00:21:50 +01:00
|
|
|
nsres = nsIWebBrowserPrint_Print(nsprint, settings, NULL);
|
2006-12-12 21:56:37 +01:00
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("Print failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
nsIWebBrowserPrint_Release(nsprint);
|
|
|
|
|
|
|
|
return S_OK;
|
2006-06-20 19:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_print_preview(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_page_setup(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_spell(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_properties(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_cut(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_copy(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_paste(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_paste_special(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_undo(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_rendo(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_select_all(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_clear_selection(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_zoom(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_get_zoom_range(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_refresh(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_stop(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_stop_download(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_delete(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_enable_interaction(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_on_unload(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
TRACE("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
|
|
|
|
/* Tests show that we have nothing more to do here */
|
|
|
|
|
|
|
|
if(pvaOut) {
|
|
|
|
V_VT(pvaOut) = VT_BOOL;
|
|
|
|
V_BOOL(pvaOut) = VARIANT_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_show_page_setup(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_show_print(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_close(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_set_print_template(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_get_print_template(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
|
2006-06-20 19:02:48 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2006-08-26 16:41:20 +02:00
|
|
|
static void do_ns_command(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
|
2006-08-18 23:14:44 +02:00
|
|
|
{
|
|
|
|
nsICommandManager *cmdmgr;
|
|
|
|
nsIInterfaceRequestor *iface_req;
|
|
|
|
nsresult nsres;
|
|
|
|
|
2006-11-02 17:34:17 +01:00
|
|
|
TRACE("(%p)\n", This);
|
2006-08-18 23:14:44 +02:00
|
|
|
|
|
|
|
nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
|
|
|
|
&IID_nsIInterfaceRequestor, (void**)&iface_req);
|
|
|
|
if(NS_FAILED(nsres)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
|
2006-08-18 23:14:44 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsICommandManager,
|
|
|
|
(void**)&cmdmgr);
|
|
|
|
nsIInterfaceRequestor_Release(iface_req);
|
|
|
|
if(NS_FAILED(nsres)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("Could not get nsICommandManager: %08x\n", nsres);
|
2006-08-18 23:14:44 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-08-26 16:41:20 +02:00
|
|
|
nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, NULL);
|
2006-08-18 23:14:44 +02:00
|
|
|
if(NS_FAILED(nsres))
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres);
|
2006-08-18 23:14:44 +02:00
|
|
|
|
|
|
|
nsICommandManager_Release(cmdmgr);
|
|
|
|
}
|
|
|
|
|
2006-08-27 16:01:06 +02:00
|
|
|
static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
|
|
|
|
{
|
|
|
|
nsICommandManager *cmdmgr;
|
|
|
|
nsIInterfaceRequestor *iface_req;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
|
|
|
|
&IID_nsIInterfaceRequestor, (void**)&iface_req);
|
|
|
|
if(NS_FAILED(nsres)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
|
2006-08-27 16:01:06 +02:00
|
|
|
return nsres;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsICommandManager,
|
|
|
|
(void**)&cmdmgr);
|
|
|
|
nsIInterfaceRequestor_Release(iface_req);
|
|
|
|
if(NS_FAILED(nsres)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("Could not get nsICommandManager: %08x\n", nsres);
|
2006-08-27 16:01:06 +02:00
|
|
|
return nsres;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsICommandManager_GetCommandState(cmdmgr, cmd, NULL, nsparam);
|
|
|
|
if(NS_FAILED(nsres))
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("GetCommandState(%s) failed: %08x\n", debugstr_a(cmd), nsres);
|
2006-08-27 16:01:06 +02:00
|
|
|
|
|
|
|
nsICommandManager_Release(cmdmgr);
|
|
|
|
return nsres;
|
|
|
|
}
|
|
|
|
|
2006-11-02 17:34:17 +01:00
|
|
|
static DWORD query_edit_status(HTMLDocument *This, const char *nscmd)
|
|
|
|
{
|
|
|
|
nsICommandParams *nsparam;
|
|
|
|
PRBool b = FALSE;
|
|
|
|
|
|
|
|
if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
|
|
|
|
return OLECMDF_SUPPORTED;
|
|
|
|
|
2006-11-09 10:44:15 +01:00
|
|
|
if(This->nscontainer && nscmd) {
|
2006-11-05 13:52:34 +01:00
|
|
|
nsparam = create_nscommand_params();
|
|
|
|
get_ns_command_state(This->nscontainer, nscmd, nsparam);
|
2006-11-02 17:34:17 +01:00
|
|
|
|
2006-11-09 10:49:53 +01:00
|
|
|
nsICommandParams_GetBooleanValue(nsparam, NSSTATE_ALL, &b);
|
2006-11-09 10:50:51 +01:00
|
|
|
|
|
|
|
nsICommandParams_Release(nsparam);
|
2006-11-05 13:52:34 +01:00
|
|
|
}
|
2006-11-02 17:34:17 +01:00
|
|
|
|
|
|
|
return OLECMDF_SUPPORTED | OLECMDF_ENABLED | (b ? OLECMDF_LATCHED : 0);
|
|
|
|
}
|
|
|
|
|
2006-11-09 10:50:51 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-11-09 10:48:07 +01:00
|
|
|
static void set_ns_align(HTMLDocument *This, const char *align_str)
|
|
|
|
{
|
|
|
|
nsICommandParams *nsparam;
|
|
|
|
|
|
|
|
if(!This->nscontainer)
|
|
|
|
return;
|
|
|
|
|
|
|
|
nsparam = create_nscommand_params();
|
|
|
|
nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, align_str);
|
|
|
|
|
|
|
|
do_ns_command(This->nscontainer, NSCMD_ALIGN, nsparam);
|
|
|
|
|
|
|
|
nsICommandParams_Release(nsparam);
|
|
|
|
}
|
|
|
|
|
2006-08-27 16:01:06 +02:00
|
|
|
static HRESULT exec_fontname(HTMLDocument *This, VARIANT *in, VARIANT *out)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%p %p)\n", This, in, out);
|
|
|
|
|
|
|
|
if(!This->nscontainer)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
if(in) {
|
|
|
|
nsICommandParams *nsparam = create_nscommand_params();
|
|
|
|
char *stra;
|
|
|
|
DWORD len;
|
|
|
|
|
|
|
|
if(V_VT(in) != VT_BSTR) {
|
|
|
|
FIXME("Unsupported vt=%d\n", V_VT(out));
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, NULL, 0, NULL, NULL);
|
|
|
|
stra = mshtml_alloc(len);
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, stra, -1, NULL, NULL);
|
2006-11-09 10:49:53 +01:00
|
|
|
nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, stra);
|
2006-08-27 16:01:06 +02:00
|
|
|
mshtml_free(stra);
|
|
|
|
|
2006-11-09 10:49:53 +01:00
|
|
|
do_ns_command(This->nscontainer, NSCMD_FONTFACE, nsparam);
|
2006-08-27 16:01:06 +02:00
|
|
|
|
|
|
|
nsICommandParams_Release(nsparam);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(out) {
|
|
|
|
nsICommandParams *nsparam;
|
|
|
|
LPWSTR strw;
|
|
|
|
char *stra;
|
|
|
|
DWORD len;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
if(V_VT(out) != VT_BSTR) {
|
|
|
|
FIXME("Unsupported vt=%d\n", V_VT(out));
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsparam = create_nscommand_params();
|
|
|
|
|
2006-11-09 10:49:53 +01:00
|
|
|
nsres = get_ns_command_state(This->nscontainer, NSCMD_FONTFACE, nsparam);
|
2006-08-27 16:01:06 +02:00
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return S_OK;
|
|
|
|
|
2006-11-09 10:49:53 +01:00
|
|
|
nsICommandParams_GetCStringValue(nsparam, NSSTATE_ATTRIBUTE, &stra);
|
2006-08-27 16:01:06 +02:00
|
|
|
nsICommandParams_Release(nsparam);
|
|
|
|
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, stra, -1, NULL, 0);
|
|
|
|
strw = mshtml_alloc(len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, stra, -1, strw, -1);
|
|
|
|
nsfree(stra);
|
|
|
|
|
|
|
|
V_BSTR(out) = SysAllocString(strw);
|
|
|
|
mshtml_free(strw);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-09 10:47:10 +01:00
|
|
|
static HRESULT exec_forecolor(HTMLDocument *This, 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->nscontainer, NSCMD_FONTCOLOR, nsparam);
|
|
|
|
|
|
|
|
nsICommandParams_Release(nsparam);
|
|
|
|
}else {
|
|
|
|
FIXME("unsupported in vt=%d\n", V_VT(in));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(out) {
|
|
|
|
FIXME("unsupported out\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-09 10:46:11 +01:00
|
|
|
static HRESULT exec_fontsize(HTMLDocument *This, VARIANT *in, VARIANT *out)
|
|
|
|
{
|
2006-11-24 10:17:54 +01:00
|
|
|
TRACE("(%p)->(%p %p)\n", This, in, out);
|
|
|
|
|
|
|
|
if(out) {
|
|
|
|
WCHAR val[10] = {0};
|
|
|
|
|
|
|
|
switch(V_VT(out)) {
|
|
|
|
case VT_I4:
|
|
|
|
get_font_size(This, val);
|
|
|
|
V_I4(out) = strtolW(val, NULL, 10);
|
|
|
|
break;
|
|
|
|
case VT_BSTR:
|
|
|
|
get_font_size(This, val);
|
|
|
|
V_BSTR(out) = SysAllocString(val);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("unsupported vt %d\n", V_VT(out));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(in) {
|
|
|
|
switch(V_VT(in)) {
|
|
|
|
case VT_I4: {
|
|
|
|
WCHAR size[10];
|
|
|
|
static const WCHAR format[] = {'%','d',0};
|
|
|
|
wsprintfW(size, format, V_I4(in));
|
|
|
|
set_font_size(This, size);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VT_BSTR:
|
|
|
|
set_font_size(This, V_BSTR(in));
|
|
|
|
break;
|
|
|
|
default:
|
2007-01-11 10:56:55 +01:00
|
|
|
FIXME("unsupported vt %d\n", V_VT(in));
|
2006-11-24 10:17:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2006-11-09 10:46:11 +01:00
|
|
|
}
|
|
|
|
|
2006-08-18 23:14:44 +02:00
|
|
|
static HRESULT exec_bold(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if(This->nscontainer)
|
2006-11-02 17:34:17 +01:00
|
|
|
do_ns_command(This->nscontainer, NSCMD_BOLD, NULL);
|
2006-08-18 23:14:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-08-27 16:01:25 +02:00
|
|
|
static HRESULT exec_italic(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if(This->nscontainer)
|
2006-11-02 17:34:44 +01:00
|
|
|
do_ns_command(This->nscontainer, NSCMD_ITALIC, NULL);
|
2006-08-27 16:01:25 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-09 10:48:07 +01:00
|
|
|
static HRESULT exec_justifycenter(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
2006-11-09 10:50:51 +01:00
|
|
|
set_ns_align(This, NSALIGN_CENTER);
|
2006-11-09 10:48:07 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-09 10:49:00 +01:00
|
|
|
static HRESULT exec_justifyleft(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
2006-11-09 10:50:51 +01:00
|
|
|
set_ns_align(This, NSALIGN_LEFT);
|
2006-11-09 10:49:00 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_justifyright(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
2006-11-09 10:50:51 +01:00
|
|
|
set_ns_align(This, NSALIGN_RIGHT);
|
2006-11-09 10:49:00 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-08-27 16:01:45 +02:00
|
|
|
static HRESULT exec_underline(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if(This->nscontainer)
|
2006-11-02 17:34:57 +01:00
|
|
|
do_ns_command(This->nscontainer, NSCMD_UNDERLINE, NULL);
|
2006-08-27 16:01:45 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-30 23:44:04 +02:00
|
|
|
static HRESULT exec_browsemode(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
WARN("(%p)\n", This);
|
|
|
|
|
|
|
|
This->usermode = BROWSEMODE;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-08-17 21:00:55 +02:00
|
|
|
static void setup_ns_editing(NSContainer *This)
|
|
|
|
{
|
|
|
|
nsIInterfaceRequestor *iface_req;
|
|
|
|
nsIEditingSession *editing_session = NULL;
|
|
|
|
nsIURIContentListener *listener = NULL;
|
|
|
|
nsIDOMWindow *dom_window = NULL;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
|
|
|
|
&IID_nsIInterfaceRequestor, (void**)&iface_req);
|
|
|
|
if(NS_FAILED(nsres)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
|
2006-08-17 21:00:55 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsIEditingSession,
|
|
|
|
(void**)&editing_session);
|
|
|
|
nsIInterfaceRequestor_Release(iface_req);
|
|
|
|
if(NS_FAILED(nsres)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("Could not get nsIEditingSession: %08x\n", nsres);
|
2006-08-17 21:00:55 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIWebBrowser_GetContentDOMWindow(This->webbrowser, &dom_window);
|
|
|
|
if(NS_FAILED(nsres)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("Could not get content DOM window: %08x\n", nsres);
|
2006-08-17 21:00:55 +02:00
|
|
|
nsIEditingSession_Release(editing_session);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIEditingSession_MakeWindowEditable(editing_session, dom_window, NULL, FALSE);
|
|
|
|
nsIEditingSession_Release(editing_session);
|
2006-10-26 08:14:01 +02:00
|
|
|
nsIDOMWindow_Release(dom_window);
|
2006-08-17 21:00:55 +02:00
|
|
|
if(NS_FAILED(nsres)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
ERR("MakeWindowEditable failed: %08x\n", nsres);
|
2006-08-17 21:00:55 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* MakeWindowEditable changes WebBrowser's parent URI content listener.
|
|
|
|
* It seams to be a bug in Gecko. To workaround it we set our content
|
|
|
|
* listener again and Gecko's one as its parent.
|
|
|
|
*/
|
|
|
|
nsIWebBrowser_GetParentURIContentListener(This->webbrowser, &listener);
|
|
|
|
nsIURIContentListener_SetParentContentListener(NSURICL(This), listener);
|
|
|
|
nsIURIContentListener_Release(listener);
|
|
|
|
nsIWebBrowser_SetParentURIContentListener(This->webbrowser, NSURICL(This));
|
|
|
|
}
|
|
|
|
|
2006-08-17 03:35:18 +02:00
|
|
|
static HRESULT exec_editmode(HTMLDocument *This)
|
|
|
|
{
|
2006-11-02 17:34:06 +01:00
|
|
|
IMoniker *mon;
|
2006-08-17 03:35:18 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
2006-11-02 17:34:06 +01:00
|
|
|
static const WCHAR wszAboutBlank[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
|
|
|
|
|
2006-08-17 21:00:55 +02:00
|
|
|
TRACE("(%p)\n", This);
|
2006-08-17 03:35:18 +02:00
|
|
|
|
|
|
|
This->usermode = EDITMODE;
|
|
|
|
|
|
|
|
if(This->frame)
|
|
|
|
IOleInPlaceFrame_SetStatusText(This->frame, NULL);
|
|
|
|
|
|
|
|
if(This->hostui) {
|
|
|
|
DOCHOSTUIINFO hostinfo;
|
|
|
|
|
|
|
|
memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
|
|
|
hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
|
|
|
|
hres = IDocHostUIHandler_GetHostInfo(This->hostui, &hostinfo);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
/* FIXME: use hostinfo */
|
2006-10-05 23:50:39 +02:00
|
|
|
TRACE("hostinfo = {%u %08x %08x %s %s}\n",
|
2006-08-17 03:35:18 +02:00
|
|
|
hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
|
|
|
|
debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
|
|
|
|
}
|
|
|
|
|
2006-08-17 21:00:55 +02:00
|
|
|
if(This->nscontainer)
|
|
|
|
setup_ns_editing(This->nscontainer);
|
|
|
|
|
2006-11-02 17:34:06 +01:00
|
|
|
hres = CreateURLMoniker(NULL, wszAboutBlank, &mon);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
FIXME("CreateURLMoniker failed: %08x\n", hres);
|
|
|
|
return hres;
|
|
|
|
}
|
2006-08-22 16:15:09 +02:00
|
|
|
|
2006-11-02 17:34:06 +01:00
|
|
|
return IPersistMoniker_Load(PERSISTMON(This), TRUE, mon, NULL, 0);
|
2006-08-17 03:35:18 +02:00
|
|
|
}
|
|
|
|
|
2006-07-05 22:37:16 +02:00
|
|
|
static HRESULT exec_baselinefont3(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-11 15:31:00 +01:00
|
|
|
static HRESULT exec_horizontalline(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if(This->nscontainer)
|
|
|
|
do_ns_command(This->nscontainer, NSCMD_INSERTHR, NULL);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-11 15:32:49 +01:00
|
|
|
static HRESULT exec_orderlist(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if(This->nscontainer)
|
|
|
|
do_ns_command(This->nscontainer, NSCMD_OL, NULL);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-11 15:31:55 +01:00
|
|
|
static HRESULT exec_unorderlist(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if(This->nscontainer)
|
|
|
|
do_ns_command(This->nscontainer, NSCMD_UL, NULL);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-11 15:30:08 +01:00
|
|
|
static HRESULT exec_indent(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if(This->nscontainer)
|
|
|
|
do_ns_command(This->nscontainer, NSCMD_INDENT, NULL);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT exec_outdent(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if(This->nscontainer)
|
|
|
|
do_ns_command(This->nscontainer, NSCMD_OUTDENT, NULL);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-06-20 19:02:48 +02:00
|
|
|
static const struct {
|
|
|
|
OLECMDF cmdf;
|
|
|
|
HRESULT (*func)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
|
|
|
|
} exec_table[OLECMDID_GETPRINTTEMPLATE+1] = {
|
|
|
|
{0},
|
|
|
|
{ OLECMDF_SUPPORTED, exec_open }, /* OLECMDID_OPEN */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_new }, /* OLECMDID_NEW */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_save }, /* OLECMDID_SAVE */
|
|
|
|
{ OLECMDF_SUPPORTED|OLECMDF_ENABLED, exec_save_as }, /* OLECMDID_SAVEAS */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_save_copy_as }, /* OLECMDID_SAVECOPYAS */
|
|
|
|
{ OLECMDF_SUPPORTED|OLECMDF_ENABLED, exec_print }, /* OLECMDID_PRINT */
|
|
|
|
{ OLECMDF_SUPPORTED|OLECMDF_ENABLED, exec_print_preview }, /* OLECMDID_PRINTPREVIEW */
|
|
|
|
{ OLECMDF_SUPPORTED|OLECMDF_ENABLED, exec_page_setup }, /* OLECMDID_PAGESETUP */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_spell }, /* OLECMDID_SPELL */
|
|
|
|
{ OLECMDF_SUPPORTED|OLECMDF_ENABLED, exec_properties }, /* OLECMDID_PROPERTIES */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_cut }, /* OLECMDID_CUT */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_copy }, /* OLECMDID_COPY */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_paste }, /* OLECMDID_PASTE */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_paste_special }, /* OLECMDID_PASTESPECIAL */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_undo }, /* OLECMDID_UNDO */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_rendo }, /* OLECMDID_REDO */
|
|
|
|
{ OLECMDF_SUPPORTED|OLECMDF_ENABLED, exec_select_all }, /* OLECMDID_SELECTALL */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_clear_selection }, /* OLECMDID_CLEARSELECTION */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_zoom }, /* OLECMDID_ZOOM */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_get_zoom_range }, /* OLECMDID_GETZOOMRANGE */
|
|
|
|
{0},
|
|
|
|
{ OLECMDF_SUPPORTED|OLECMDF_ENABLED, exec_refresh }, /* OLECMDID_REFRESH */
|
|
|
|
{ OLECMDF_SUPPORTED|OLECMDF_ENABLED, exec_stop }, /* OLECMDID_STOP */
|
|
|
|
{0},{0},{0},{0},{0},{0},
|
|
|
|
{ OLECMDF_SUPPORTED, exec_stop_download }, /* OLECMDID_STOPDOWNLOAD */
|
|
|
|
{0},{0},
|
|
|
|
{ OLECMDF_SUPPORTED, exec_delete }, /* OLECMDID_DELETE */
|
|
|
|
{0},{0},
|
|
|
|
{ OLECMDF_SUPPORTED, exec_enable_interaction }, /* OLECMDID_ENABLE_INTERACTION */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_on_unload }, /* OLECMDID_ONUNLOAD */
|
|
|
|
{0},{0},{0},{0},{0},
|
|
|
|
{ OLECMDF_SUPPORTED, exec_show_page_setup }, /* OLECMDID_SHOWPAGESETUP */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_show_print }, /* OLECMDID_SHOWPRINT */
|
|
|
|
{0},{0},
|
|
|
|
{ OLECMDF_SUPPORTED, exec_close }, /* OLECMDID_CLOSE */
|
|
|
|
{0},{0},{0},
|
|
|
|
{ OLECMDF_SUPPORTED, exec_set_print_template }, /* OLECMDID_SETPRINTTEMPLATE */
|
|
|
|
{ OLECMDF_SUPPORTED, exec_get_print_template } /* OLECMDID_GETPRINTTEMPLATE */
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = CMDTARGET_THIS(iface);
|
|
|
|
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = CMDTARGET_THIS(iface);
|
|
|
|
return IHTMLDocument2_AddRef(HTMLDOC(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = CMDTARGET_THIS(iface);
|
|
|
|
return IHTMLDocument_Release(HTMLDOC(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
|
|
|
|
ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = CMDTARGET_THIS(iface);
|
|
|
|
HRESULT hres = S_OK, hr;
|
|
|
|
|
2006-10-05 23:50:39 +02:00
|
|
|
TRACE("(%p)->(%s %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
|
2006-06-20 19:02:48 +02:00
|
|
|
|
|
|
|
if(!pguidCmdGroup) {
|
|
|
|
ULONG i;
|
|
|
|
|
|
|
|
for(i=0; i<cCmds; i++) {
|
|
|
|
if(prgCmds[i].cmdID<OLECMDID_OPEN || prgCmds[i].cmdID>OLECMDID_GETPRINTTEMPLATE) {
|
2006-10-05 23:50:39 +02:00
|
|
|
WARN("Unsupported cmdID = %d\n", prgCmds[i].cmdID);
|
2006-06-20 19:02:48 +02:00
|
|
|
prgCmds[i].cmdf = 0;
|
|
|
|
hres = OLECMDERR_E_NOTSUPPORTED;
|
|
|
|
}else {
|
|
|
|
if(prgCmds[i].cmdID == OLECMDID_OPEN || prgCmds[i].cmdID == OLECMDID_NEW) {
|
|
|
|
IOleCommandTarget *cmdtrg = NULL;
|
|
|
|
OLECMD olecmd;
|
|
|
|
|
|
|
|
prgCmds[i].cmdf = OLECMDF_SUPPORTED;
|
|
|
|
if(This->client) {
|
|
|
|
hr = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget,
|
|
|
|
(void**)&cmdtrg);
|
|
|
|
if(SUCCEEDED(hr)) {
|
|
|
|
olecmd.cmdID = prgCmds[i].cmdID;
|
|
|
|
olecmd.cmdf = 0;
|
|
|
|
|
|
|
|
hr = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 1, &olecmd, NULL);
|
|
|
|
if(SUCCEEDED(hr) && olecmd.cmdf)
|
|
|
|
prgCmds[i].cmdf = olecmd.cmdf;
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
ERR("This->client == NULL, native would crash\n");
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
prgCmds[i].cmdf = exec_table[prgCmds[i].cmdID].cmdf;
|
2006-10-05 23:50:39 +02:00
|
|
|
TRACE("cmdID = %d returning %x\n", prgCmds[i].cmdID, prgCmds[i].cmdf);
|
2006-06-20 19:02:48 +02:00
|
|
|
}
|
|
|
|
hres = S_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-26 17:41:55 +02:00
|
|
|
if(pCmdText)
|
|
|
|
FIXME("Set pCmdText\n");
|
|
|
|
}else if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
|
|
|
|
ULONG i;
|
|
|
|
|
|
|
|
for(i=0; i<cCmds; i++) {
|
|
|
|
switch(prgCmds[i].cmdID) {
|
|
|
|
case IDM_COPY:
|
|
|
|
FIXME("CGID_MSHTML: IDM_COPY\n");
|
|
|
|
prgCmds[i].cmdf = OLECMDF_SUPPORTED|OLECMDF_ENABLED;
|
|
|
|
break;
|
|
|
|
case IDM_CUT:
|
|
|
|
FIXME("CGID_MSHTML: IDM_CUT\n");
|
|
|
|
prgCmds[i].cmdf = OLECMDF_SUPPORTED|OLECMDF_ENABLED;
|
|
|
|
break;
|
|
|
|
case IDM_FONTNAME:
|
2006-11-09 10:44:15 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_FONTNAME\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NULL);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_FONTSIZE:
|
2006-11-09 10:45:05 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_FONTSIZE\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NULL);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
2006-12-12 21:56:37 +01:00
|
|
|
case IDM_PRINT:
|
|
|
|
FIXME("CGID_MSHTML: IDM_PRINT\n");
|
|
|
|
prgCmds[i].cmdf = OLECMDF_SUPPORTED|OLECMDF_ENABLED;
|
|
|
|
break;
|
2006-08-26 17:41:55 +02:00
|
|
|
case IDM_PASTE:
|
|
|
|
FIXME("CGID_MSHTML: IDM_PASTE\n");
|
|
|
|
prgCmds[i].cmdf = OLECMDF_SUPPORTED|OLECMDF_ENABLED;
|
|
|
|
break;
|
|
|
|
case IDM_BOLD:
|
2006-11-02 17:34:17 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_BOLD\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NSCMD_BOLD);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_FORECOLOR:
|
2006-11-09 10:47:10 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_FORECOLOR\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NULL);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_ITALIC:
|
2006-11-02 17:34:44 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_ITALIC\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NSCMD_ITALIC);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_JUSTIFYCENTER:
|
2006-11-09 10:50:51 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_JUSTIFYCENTER\n");
|
|
|
|
prgCmds[i].cmdf = query_align_status(This, NSALIGN_CENTER);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_JUSTIFYLEFT:
|
2006-11-09 10:50:51 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_JUSTIFYLEFT\n");
|
|
|
|
prgCmds[i].cmdf = query_align_status(This, NSALIGN_LEFT);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_JUSTIFYRIGHT:
|
2006-11-09 10:50:51 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_JUSTIFYRIGHT\n");
|
|
|
|
prgCmds[i].cmdf = query_align_status(This, NSALIGN_RIGHT);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_UNDERLINE:
|
2006-11-02 17:34:57 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_UNDERLINE\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NSCMD_UNDERLINE);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_HORIZONTALLINE:
|
2006-11-11 15:31:00 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_HORIZONTALLINE\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NULL);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_ORDERLIST:
|
2006-11-11 15:32:49 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_ORDERLIST\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NSCMD_OL);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_UNORDERLIST:
|
2006-11-11 15:31:55 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_HORIZONTALLINE\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NSCMD_UL);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_INDENT:
|
2006-11-11 15:30:08 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_INDENT\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NULL);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_OUTDENT:
|
2006-11-11 15:30:08 +01:00
|
|
|
TRACE("CGID_MSHTML: IDM_OUTDENT\n");
|
|
|
|
prgCmds[i].cmdf = query_edit_status(This, NULL);
|
2006-08-26 17:41:55 +02:00
|
|
|
break;
|
|
|
|
case IDM_BLOCKDIRLTR:
|
|
|
|
FIXME("CGID_MSHTML: IDM_BLOCKDIRLTR\n");
|
|
|
|
prgCmds[i].cmdf = OLECMDF_SUPPORTED|OLECMDF_ENABLED;
|
|
|
|
break;
|
|
|
|
case IDM_BLOCKDIRRTL:
|
|
|
|
FIXME("CGID_MSHTML: IDM_BLOCKDIRRTL\n");
|
|
|
|
prgCmds[i].cmdf = OLECMDF_SUPPORTED|OLECMDF_ENABLED;
|
|
|
|
break;
|
|
|
|
default:
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("CGID_MSHTML: unsupported cmdID %d\n", prgCmds[i].cmdID);
|
2006-08-26 17:41:55 +02:00
|
|
|
prgCmds[i].cmdf = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = prgCmds[i-1].cmdf ? S_OK : OLECMDERR_E_NOTSUPPORTED;
|
|
|
|
|
2006-06-20 19:02:48 +02:00
|
|
|
if(pCmdText)
|
|
|
|
FIXME("Set pCmdText\n");
|
|
|
|
}else {
|
|
|
|
FIXME("Unsupported pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup));
|
|
|
|
hres = OLECMDERR_E_UNKNOWNGROUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
|
|
|
|
DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = CMDTARGET_THIS(iface);
|
|
|
|
|
|
|
|
if(!pguidCmdGroup) {
|
|
|
|
if(nCmdID<OLECMDID_OPEN || nCmdID>OLECMDID_GETPRINTTEMPLATE || !exec_table[nCmdID].func) {
|
2006-10-05 23:50:39 +02:00
|
|
|
WARN("Unsupported cmdID = %d\n", nCmdID);
|
2006-06-20 19:02:48 +02:00
|
|
|
return OLECMDERR_E_NOTSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return exec_table[nCmdID].func(This, nCmdexecopt, pvaIn, pvaOut);
|
|
|
|
}else if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("unsupported nCmdID %d of CGID_Explorer group\n", nCmdID);
|
2006-06-20 19:02:48 +02:00
|
|
|
TRACE("%p %p\n", pvaIn, pvaOut);
|
|
|
|
return OLECMDERR_E_NOTSUPPORTED;
|
|
|
|
}else if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("unsupported nCmdID %d of CGID_ShellDocView group\n", nCmdID);
|
2006-06-20 19:02:48 +02:00
|
|
|
return OLECMDERR_E_NOTSUPPORTED;
|
2006-06-22 16:07:52 +02:00
|
|
|
}else if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
|
2006-06-30 23:44:04 +02:00
|
|
|
switch(nCmdID) {
|
2006-08-27 16:01:06 +02:00
|
|
|
case IDM_FONTNAME:
|
|
|
|
return exec_fontname(This, pvaIn, pvaOut);
|
2006-11-09 10:46:11 +01:00
|
|
|
case IDM_FONTSIZE:
|
|
|
|
return exec_fontsize(This, pvaIn, pvaOut);
|
2006-12-12 21:56:37 +01:00
|
|
|
case IDM_PRINT:
|
|
|
|
return exec_print(This, nCmdexecopt, pvaIn, pvaOut);
|
2006-08-18 23:14:44 +02:00
|
|
|
case IDM_BOLD:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_bold(This);
|
2006-11-09 10:47:10 +01:00
|
|
|
case IDM_FORECOLOR:
|
|
|
|
return exec_forecolor(This, pvaIn, pvaOut);
|
2006-08-27 16:01:25 +02:00
|
|
|
case IDM_ITALIC:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_italic(This);
|
2006-11-09 10:48:07 +01:00
|
|
|
case IDM_JUSTIFYCENTER:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_justifycenter(This);
|
2006-11-09 10:49:00 +01:00
|
|
|
case IDM_JUSTIFYLEFT:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_justifyleft(This);
|
|
|
|
case IDM_JUSTIFYRIGHT:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_justifyright(This);
|
2006-08-27 16:01:45 +02:00
|
|
|
case IDM_UNDERLINE:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_underline(This);
|
2006-06-30 23:44:04 +02:00
|
|
|
case IDM_BROWSEMODE:
|
2006-08-18 23:14:44 +02:00
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
2006-06-30 23:44:04 +02:00
|
|
|
return exec_browsemode(This);
|
2006-08-17 03:35:18 +02:00
|
|
|
case IDM_EDITMODE:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_editmode(This);
|
2006-07-05 22:37:16 +02:00
|
|
|
case IDM_BASELINEFONT3:
|
|
|
|
return exec_baselinefont3(This);
|
2006-11-11 15:31:00 +01:00
|
|
|
case IDM_HORIZONTALLINE:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_horizontalline(This);
|
2006-11-11 15:32:49 +01:00
|
|
|
case IDM_ORDERLIST:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_orderlist(This);
|
2006-11-11 15:31:55 +01:00
|
|
|
case IDM_UNORDERLIST:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_unorderlist(This);
|
2006-11-11 15:30:08 +01:00
|
|
|
case IDM_INDENT:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_indent(This);
|
|
|
|
case IDM_OUTDENT:
|
|
|
|
if(pvaIn || pvaOut)
|
|
|
|
FIXME("unsupported arguments\n");
|
|
|
|
return exec_outdent(This);
|
2006-06-30 23:44:04 +02:00
|
|
|
default:
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("unsupported nCmdID %d of CGID_MSHTML group\n", nCmdID);
|
2006-06-30 23:44:04 +02:00
|
|
|
return OLECMDERR_E_NOTSUPPORTED;
|
|
|
|
}
|
2006-06-20 19:02:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("Unsupported pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup));
|
|
|
|
return OLECMDERR_E_UNKNOWNGROUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef CMDTARGET_THIS
|
|
|
|
|
|
|
|
static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
|
|
|
|
OleCommandTarget_QueryInterface,
|
|
|
|
OleCommandTarget_AddRef,
|
|
|
|
OleCommandTarget_Release,
|
|
|
|
OleCommandTarget_QueryStatus,
|
|
|
|
OleCommandTarget_Exec
|
|
|
|
};
|
|
|
|
|
|
|
|
void HTMLDocument_OleCmd_Init(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
|
|
|
|
}
|