[Wine-patches] mshtml: Add IHTMLEditServices interface

Konstantin Kondratyuk =?iso-8859-1?q?kondratyuk_=CE=C1_etersoft=2Eru?=
Ср Дек 3 20:26:59 MSK 2008


-- 
Best regards,
Konstantin Kondratyuk.
----------- следующая часть -----------
From 35bb9ceace35c577aad7e160bc44e3b827a27b84 Mon Sep 17 00:00:00 2001
From: Konstantin Kondratyuk <kondratyuk на etersoft.ru>
Date: Sun, 23 Nov 2008 20:32:48 +0300
Subject: [PATCH] mshtml: Add IHTMLEditServices interface

---
 dlls/mshtml/mshtml_private.h |    1 +
 dlls/mshtml/service.c        |  140 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 140 insertions(+), 1 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index ad27585..19c137c 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -252,6 +252,7 @@ struct HTMLDocument {
     IOleInPlaceUIWindow *ip_window;
 
     IOleUndoManager *undomgr;
+    IHTMLEditServices *htmleditsrv;
 
     nsChannelBSC *bscallback;
     IMoniker *mon;
diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c
index f2d619e..76b86c3 100644
--- a/dlls/mshtml/service.c
+++ b/dlls/mshtml/service.c
@@ -1,5 +1,6 @@
 /*
  * Copyright 2005 Jacek Caban
+ * Copyright 2008 Konstantin Kondratyuk (Etersoft)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -31,6 +32,7 @@
 #include "wine/debug.h"
 
 #include "mshtml_private.h"
+#include "mshtml.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
@@ -204,6 +206,130 @@ static IOleUndoManager *create_undomgr(void)
 }
 
 /**********************************************************
+ * IHTMLEditServices implementation
+ *
+ * TODO:    Declare IMarkupContainer, ISelectionServices, IMarkupPointer
+ *          in mshtml.idl and correct methods.
+ *
+ */
+
+typedef struct {
+    const IHTMLEditServicesVtbl  *lpHTMLEditServicesVtbl;
+
+    LONG ref;
+} HTMLEditServices;
+
+#define HTMLEDITSRV(x)  ((IHTMLEditServices*)  &(x)->lpHTMLEditServicesVtbl)
+
+#define HTMLEDITSRV_THIS(iface) DEFINE_THIS(HTMLEditServices, HTMLEditServices, iface)
+
+static HRESULT WINAPI HTMLEditServices_QueryInterface(IHTMLEditServices *iface, REFIID riid, void **ppv)
+{
+    HTMLEditServices *This = HTMLEDITSRV_THIS(iface);
+
+    *ppv = NULL;
+
+    if(IsEqualGUID(riid, &IID_IUnknown)) {
+        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+        *ppv = HTMLEDITSRV_THIS(This);
+    }else if(IsEqualGUID(riid, &IID_IHTMLEditServices)) {
+        TRACE("(%p)->(IID_HTMLEditServices %p)\n", This, ppv);
+        *ppv = HTMLEDITSRV(This);
+    }
+
+
+    FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI HTMLEditServices_AddRef(IHTMLEditServices *iface)
+{
+    HTMLEditServices *This = HTMLEDITSRV_THIS(iface);
+    LONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI HTMLEditServices_Release(IHTMLEditServices *iface)
+{
+    HTMLEditServices *This = HTMLEDITSRV_THIS(iface);
+    LONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    if(!ref)
+        heap_free(This);
+
+    return ref;
+}
+
+static HRESULT WINAPI HTMLEditServices_AddDesigner(
+        IHTMLEditServices* iface,
+        IHTMLEditDesigner *pIDesigner)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLEditServices_GetSelectionServices(
+        IHTMLEditServices* iface,
+        IMarkupContainer *pIContainer,
+        ISelectionServices **ppSelSvc)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLEditServices_MoveToSelectionAnchor(
+        IHTMLEditServices* iface,
+        IMarkupPointer *pIStartAnchor)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLEditServices_MoveToSelectionEnd(
+        IHTMLEditServices* iface,
+        IMarkupPointer *pIEndAnchor)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLEditServices_RemoveDesigner(
+        IHTMLEditServices* iface,
+        IHTMLEditDesigner *pIDesigner)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+#undef HTMLEDITSRV_THIS
+
+static const IHTMLEditServicesVtbl HTMLEditServicesVtbl = {
+    HTMLEditServices_QueryInterface,
+    HTMLEditServices_AddRef,
+    HTMLEditServices_Release,
+    HTMLEditServices_AddDesigner,
+    HTMLEditServices_GetSelectionServices,
+    HTMLEditServices_MoveToSelectionAnchor,
+    HTMLEditServices_MoveToSelectionEnd,
+    HTMLEditServices_RemoveDesigner
+};
+
+static IHTMLEditServices *create_htmleditsrv(void)
+{
+    HTMLEditServices *ret = heap_alloc(sizeof(HTMLEditServices));
+
+    ret->lpHTMLEditServicesVtbl = &HTMLEditServicesVtbl;
+    ret->ref = 1;
+
+    return HTMLEDITSRV(ret);
+}
+
+/**********************************************************
  * IServiceProvider implementation
  */
 
@@ -248,8 +374,19 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG
         return S_OK;
     }
 
+    if(IsEqualGUID(&IID_IHTMLEditServices, riid)) {
+        TRACE("(%p)->(IID_IHTMLEditServices %p)\n", This, ppv);
+
+        if(!This->htmleditsrv)
+            This->htmleditsrv = create_htmleditsrv();
+
+        IHTMLEditServices_AddRef(This->htmleditsrv);
+        *ppv = This->htmleditsrv;
+        return S_OK;
+    }
+
     FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
-    
+
     return E_UNEXPECTED;
 }
 
@@ -265,4 +402,5 @@ void HTMLDocument_Service_Init(HTMLDocument *This)
     This->lpServiceProviderVtbl = &ServiceProviderVtbl;
 
     This->undomgr = NULL;
+    This->htmleditsrv = NULL;
 }
-- 
1.6.0.2.GIT



Подробная информация о списке рассылки Wine-patches