mshtml: Added IDM_COPY in browse mode implementation.

This commit is contained in:
Jacek Caban 2007-09-26 20:45:31 +02:00 committed by Alexandre Julliard
parent 8966cfe42a
commit 124f0290e4
3 changed files with 35 additions and 32 deletions

View File

@ -99,36 +99,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static const WCHAR wszFont[] = {'f','o','n','t',0}; static const WCHAR wszFont[] = {'f','o','n','t',0};
static const WCHAR wszSize[] = {'s','i','z','e',0}; static const WCHAR wszSize[] = {'s','i','z','e',0};
static void do_ns_command(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
{
nsICommandManager *cmdmgr;
nsIInterfaceRequestor *iface_req;
nsresult nsres;
TRACE("(%p)\n", This);
nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
&IID_nsIInterfaceRequestor, (void**)&iface_req);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
return;
}
nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsICommandManager,
(void**)&cmdmgr);
nsIInterfaceRequestor_Release(iface_req);
if(NS_FAILED(nsres)) {
ERR("Could not get nsICommandManager: %08x\n", nsres);
return;
}
nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, NULL);
if(NS_FAILED(nsres))
ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres);
nsICommandManager_Release(cmdmgr);
}
static void do_ns_editor_command(NSContainer *This, const char *cmd) static void do_ns_editor_command(NSContainer *This, const char *cmd)
{ {
nsresult nsres; nsresult nsres;

View File

@ -441,6 +441,8 @@ typedef struct {
extern const cmdtable_t editmode_cmds[]; extern const cmdtable_t editmode_cmds[];
void do_ns_command(NSContainer*,const char*,nsICommandParams*);
/* timer */ /* timer */
#define UPDATE_UI 0x0001 #define UPDATE_UI 0x0001
#define UPDATE_TITLE 0x0002 #define UPDATE_TITLE 0x0002

View File

@ -42,6 +42,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml); WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define NSCMD_BOLD "cmd_bold" #define NSCMD_BOLD "cmd_bold"
#define NSCMD_COPY "cmd_copy"
#define NSCMD_ITALIC "cmd_italic" #define NSCMD_ITALIC "cmd_italic"
#define NSCMD_UNDERLINE "cmd_underline" #define NSCMD_UNDERLINE "cmd_underline"
#define NSCMD_ALIGN "cmd_align" #define NSCMD_ALIGN "cmd_align"
@ -57,6 +58,36 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define NSALIGN_LEFT "left" #define NSALIGN_LEFT "left"
#define NSALIGN_RIGHT "right" #define NSALIGN_RIGHT "right"
void do_ns_command(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
{
nsICommandManager *cmdmgr;
nsIInterfaceRequestor *iface_req;
nsresult nsres;
TRACE("(%p)\n", This);
nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
&IID_nsIInterfaceRequestor, (void**)&iface_req);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
return;
}
nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsICommandManager,
(void**)&cmdmgr);
nsIInterfaceRequestor_Release(iface_req);
if(NS_FAILED(nsres)) {
ERR("Could not get nsICommandManager: %08x\n", nsres);
return;
}
nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, NULL);
if(NS_FAILED(nsres))
ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres);
nsICommandManager_Release(cmdmgr);
}
/********************************************************** /**********************************************************
* IOleCommandTarget implementation * IOleCommandTarget implementation
*/ */
@ -474,8 +505,8 @@ static HRESULT exec_mshtml_copy(HTMLDocument *This, DWORD cmdexecopt, VARIANT *i
if(This->usermode == EDITMODE) if(This->usermode == EDITMODE)
return editor_exec_copy(This, cmdexecopt, in, out); return editor_exec_copy(This, cmdexecopt, in, out);
FIXME("Unimplemented in browse mode\n"); do_ns_command(This->nscontainer, NSCMD_COPY, NULL);
return E_NOTIMPL; return S_OK;
} }
static HRESULT query_mshtml_cut(HTMLDocument *This, OLECMD *cmd) static HRESULT query_mshtml_cut(HTMLDocument *This, OLECMD *cmd)