Jacek Caban : mshtml: Added IDM_BOLD implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 21 05:58:46 CDT 2006


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Aug 18 23:14:44 2006 +0200

mshtml: Added IDM_BOLD implementation.

---

 dlls/mshtml/nsiface.idl |   17 +++++++++++++++++
 dlls/mshtml/olecmd.c    |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index 46e0a23..5de6916 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -109,6 +109,7 @@ typedef nsISupports nsIDOMHTMLOptionsCol
 typedef nsISupports nsIDOMHTMLCollection;
 typedef nsISupports nsIDOMRange;
 typedef nsISupports nsIEditor;
+typedef nsISupports nsICommandParams;
 
 [
     object,
@@ -1174,6 +1175,22 @@ interface nsIEditingSession : nsISupport
     nsresult SetEditorOnControllers(nsIDOMWindow *aWindow, nsIEditor *aEditor);
 }
 
+[
+    object,
+    uuid(080d2001-f91e-11d4-a73c-f9242928207c)
+]
+interface nsICommandManager : nsISupports
+{
+    nsresult AddCommandObserver(nsIObserver *aCommandObserver, const char *aCommandToObserve);
+    nsresult RemoveCommandObserver(nsIObserver *aCommandObserver, const char *aCommandObserved);
+    nsresult IsCommandSupported(const char *aCommandName, nsIDOMWindow *aTargetWindow, PRBool *_retval);
+    nsresult IsCommandEnabled(const char *aCommandName, nsIDOMWindow *aTargetWindow, PRBool *_retval);
+    nsresult GetCommandState(const char *aCommandName, nsIDOMWindow *aTargetWindow,
+            nsICommandParams *aCommandParams);
+    nsresult DoCommand(const char *aCommandName, nsICommandParams *aCommandParams,
+            nsIDOMWindow *aTargetWindow);
+}
+
 /*
  * NOTE:
  * This is a private Wine interface that is implemented by our implementation
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index a95f5b1..ef0de64 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -238,6 +238,46 @@ static HRESULT exec_get_print_template(H
     return E_NOTIMPL;
 }
 
+static void do_ns_command(NSContainer *This, const char *cmd)
+{
+    nsICommandManager *cmdmgr;
+    nsIInterfaceRequestor *iface_req;
+    nsresult nsres;
+
+    FIXME("(%p)\n", This);
+
+    nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
+            &IID_nsIInterfaceRequestor, (void**)&iface_req);
+    if(NS_FAILED(nsres)) {
+        ERR("Could not get nsIInterfaceRequestor: %08lx\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: %08lx\n", nsres);
+        return;
+    }
+
+    nsres = nsICommandManager_DoCommand(cmdmgr, cmd, NULL, NULL);
+    if(NS_FAILED(nsres))
+        ERR("DoCommand(%s) failed: %08lx\n", debugstr_a(cmd), nsres);
+
+    nsICommandManager_Release(cmdmgr);
+}
+
+static HRESULT exec_bold(HTMLDocument *This)
+{
+    TRACE("(%p)\n", This);
+
+    if(This->nscontainer)
+        do_ns_command(This->nscontainer, "cmd_bold");
+
+    return S_OK;
+}
+
 static HRESULT exec_browsemode(HTMLDocument *This)
 {
     WARN("(%p)\n", This);
@@ -504,7 +544,13 @@ static HRESULT WINAPI OleCommandTarget_E
         return OLECMDERR_E_NOTSUPPORTED;
     }else if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
         switch(nCmdID) {
+        case IDM_BOLD:
+            if(pvaIn || pvaOut)
+                FIXME("unsupported arguments\n");
+            return exec_bold(This);
         case IDM_BROWSEMODE:
+            if(pvaIn || pvaOut)
+                FIXME("unsupported arguments\n");
             return exec_browsemode(This);
         case IDM_EDITMODE:
             if(pvaIn || pvaOut)




More information about the wine-cvs mailing list