Jacek Caban : mshtml: Added IDM_COPY in browse mode implementation.

Alexandre Julliard julliard at winehq.org
Thu Sep 27 09:27:25 CDT 2007


Module: wine
Branch: master
Commit: 124f0290e415fceae415d56f0d57431639a6d410
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=124f0290e415fceae415d56f0d57431639a6d410

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep 26 20:45:31 2007 +0200

mshtml: Added IDM_COPY in browse mode implementation.

---

 dlls/mshtml/editor.c         |   30 ------------------------------
 dlls/mshtml/mshtml_private.h |    2 ++
 dlls/mshtml/olecmd.c         |   35 +++++++++++++++++++++++++++++++++--
 3 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index 4dc4c08..6cfd20b 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -99,36 +99,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 static const WCHAR wszFont[] = {'f','o','n','t',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)
 {
     nsresult nsres;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 69fc70d..54eb810 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -441,6 +441,8 @@ typedef struct {
 
 extern const cmdtable_t editmode_cmds[];
 
+void do_ns_command(NSContainer*,const char*,nsICommandParams*);
+
 /* timer */
 #define UPDATE_UI       0x0001
 #define UPDATE_TITLE    0x0002
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index 88c456a..458209c 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -42,6 +42,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
 #define NSCMD_BOLD "cmd_bold"
+#define NSCMD_COPY "cmd_copy"
 #define NSCMD_ITALIC "cmd_italic"
 #define NSCMD_UNDERLINE "cmd_underline"
 #define NSCMD_ALIGN "cmd_align"
@@ -57,6 +58,36 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 #define NSALIGN_LEFT   "left"
 #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
  */
@@ -474,8 +505,8 @@ static HRESULT exec_mshtml_copy(HTMLDocument *This, DWORD cmdexecopt, VARIANT *i
     if(This->usermode == EDITMODE)
         return editor_exec_copy(This, cmdexecopt, in, out);
 
-    FIXME("Unimplemented in browse mode\n");
-    return E_NOTIMPL;
+    do_ns_command(This->nscontainer, NSCMD_COPY, NULL);
+    return S_OK;
 }
 
 static HRESULT query_mshtml_cut(HTMLDocument *This, OLECMD *cmd)




More information about the wine-cvs mailing list