Commit 935e7f05 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added support for IDM_PASTE command in browser mode.

parent 6b463d85
......@@ -3548,6 +3548,29 @@ interface nsIHTMLEditor : nsISupports
[
object,
uuid(b8100c90-73be-11d2-92a5-00105a1b0d64),
local
]
interface nsIClipboardCommands : nsISupports
{
nsresult CanCutSelection(bool *_retval);
nsresult CanCopySelection(bool *_retval);
nsresult CanCopyLinkLocation(bool *_retval);
nsresult CanCopyImageLocation(bool *_retval);
nsresult CanCopyImageContents(bool *_retval);
nsresult CanPaste(bool *_retval);
nsresult CutSelection();
nsresult CopySelection();
nsresult CopyLinkLocation();
nsresult CopyImageLocation();
nsresult CopyImageContents();
nsresult Paste();
nsresult SelectAll();
nsresult SelectNone();
}
[
object,
uuid(edb99640-8378-4106-8673-e701a086eb1c),
local
]
......
......@@ -62,6 +62,28 @@ void do_ns_command(HTMLDocument *This, const char *cmd, nsICommandParams *nspara
nsICommandManager_Release(cmdmgr);
}
static nsIClipboardCommands *get_clipboard_commands(HTMLDocument *doc)
{
nsIClipboardCommands *clipboard_commands;
nsIDocShell *doc_shell;
nsresult nsres;
nsres = get_nsinterface((nsISupports*)doc->window->nswindow, &IID_nsIDocShell, (void**)&doc_shell);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDocShell interface\n");
return NULL;
}
nsres = nsIDocShell_QueryInterface(doc_shell, &IID_nsIClipboardCommands, (void**)&clipboard_commands);
nsIDocShell_Release(doc_shell);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIClipboardCommands interface\n");
return NULL;
}
return clipboard_commands;
}
/**********************************************************
* IOleCommandTarget implementation
*/
......@@ -569,13 +591,26 @@ static HRESULT query_mshtml_paste(HTMLDocument *This, OLECMD *cmd)
static HRESULT exec_mshtml_paste(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
{
nsIClipboardCommands *clipboard_commands;
nsresult nsres;
TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
if(This->doc_obj->usermode == EDITMODE)
return editor_exec_paste(This, cmdexecopt, in, out);
FIXME("Unimplemented in browse mode\n");
return E_NOTIMPL;
clipboard_commands = get_clipboard_commands(This);
if(!clipboard_commands)
return E_UNEXPECTED;
nsres = nsIClipboardCommands_Paste(clipboard_commands);
nsIClipboardCommands_Release(clipboard_commands);
if(NS_FAILED(nsres)) {
ERR("Paste failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
static HRESULT exec_browsemode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
......
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