[Wine-patches] mshtml: Add IHTMLEditServices interface (fix eterbug #2105)

Konstantin Kondratyuk =?iso-8859-1?q?kondratyuk_=CE=C1_etersoft=2Eru?=
Пн Окт 20 16:26:43 MSD 2008


-- 
Best regards,
Konstantin Kondratyuk.
----------- следующая часть -----------
From 50a17130555c2c779ff7031609d39de26752930f Mon Sep 17 00:00:00 2001
From: Konstantin Kondratyuk <kondratyuk на etersoft.ru>
Date: Mon, 20 Oct 2008 16:20:31 +0400
Subject: [PATCH] mshtml: Add IHTMLEditServices interface (fix eterbug #2105)

---
 dlls/mshtml/mshtml_private.h |    1 +
 dlls/mshtml/oleobj.c         |   11 ++-
 dlls/mshtml/service.c        |  140 +++++++++++++++++++++++++++++++++++++++++-
 include/mshtmdid.h           |   15 +++++
 include/mshtml.idl           |   51 +++++++++++++++
 5 files changed, 213 insertions(+), 5 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 05e1afb..536f052 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 *htmledirsrv;
 
     nsChannelBSC *bscallback;
     IMoniker *mon;
diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index 6fd52e7..a29c04c 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -766,19 +766,22 @@ static ULONG WINAPI Info_Release(IProvideClassInfo* iface)
 static HRESULT WINAPI Info_GetClassInfo(IProvideClassInfo* iface, ITypeInfo **ppTI)
 {
     HTMLDocument *This = INFO_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, ppTI);
+    HRESULT hres;
 
- /*   HRESULT hres;
+    FIXME("(%p)->(%p)\n", This, ppTI);
 
     hres = IDispatchEx_GetTypeInfo(DISPATCHEX(This), 0, 0, ppTI);
     if (FAILED(hres)) {
         FIXME("ERROR hres = %08x", hres);
     }
-    ITypeInfo_AddRef(*ppTI);*/
+    TRACE("%p\n",*ppTI);
+    ITypeInfo_AddRef(*ppTI);/**/
 
-    /*WRONG, BUT FIX BUG #1994*/
+#if 0
+    /*WRONG, BUT FIX BUG #1994 - disable hack (patch for eterbug #2105)*/
     *ppTI = (ITypeInfo*)HTMLDOC(This);
     ITypeInfo_AddRef(*ppTI);
+#endif
 
     return S_OK;
 }
diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c
index f2d619e..2b007ab 100644
--- a/dlls/mshtml/service.c
+++ b/dlls/mshtml/service.c
@@ -31,6 +31,7 @@
 #include "wine/debug.h"
 
 #include "mshtml_private.h"
+#include "mshtml.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
@@ -203,6 +204,131 @@ static IOleUndoManager *create_undomgr(void)
     return UNDOMGR(ret);
 }
 
+
+/**********************************************************
+ * 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,
+        IUnknown *pIContainer,
+        IUnknown **ppSelSvc)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLEditServices_MoveToSelectionAnchor(
+        IHTMLEditServices* iface,
+        IUnknown *pIStartAnchor)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLEditServices_MoveToSelectionEnd(
+        IHTMLEditServices* iface,
+        IUnknown *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->htmledirsrv)
+            This->htmledirsrv = create_htmleditsrv();
+
+        IHTMLEditServices_AddRef(This->htmledirsrv);
+        *ppv = This->htmledirsrv;
+        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->htmledirsrv = NULL;
 }
diff --git a/include/mshtmdid.h b/include/mshtmdid.h
index d9c8f7c..2f39848 100644
--- a/include/mshtmdid.h
+++ b/include/mshtmdid.h
@@ -2414,4 +2414,19 @@
 #define DISPID_IHTMLCONTROLELEMENT_CLIENTTOP       (DISPID_SITE+21)
 #define DISPID_IHTMLCONTROLELEMENT_CLIENTLEFT      (DISPID_SITE+22)
 
+/* IHTMLEditDesigner */
+#define DISPID_IHTMLEDITDESIGNER_BASE               DISPID_SITE+25
+#define DISPID_IHTMLEDITDESIGNER_POST_EDITOR        DISPID_IHTMLEDITDESIGNER_BASE
+#define DISPID_IHTMLEDITDESIGNER_POST_HANDLE        DISPID_IHTMLEDITDESIGNER_BASE+1
+#define DISPID_IHTMLEDITDESIGNER_PRE_HANDLE         DISPID_IHTMLEDITDESIGNER_BASE+2
+#define DISPID_IHTMLEDITDESIGNER_TRANSLATE          DISPID_IHTMLEDITDESIGNER_BASE+3
+
+/* IHTMLEditServices */
+#define DISPID_IHTMLEDITSERVICES_BASE               DISPID_IHTMLEDITDESIGNER_BASE+4
+#define DISPID_IHTMLEDITSERVICES_ADDDESIGNER        DISPID_IHTMLEDITSERVICES_BASE
+#define DISPID_IHTMLEDITSERVICES_GETSELECTION       DISPID_IHTMLEDITSERVICES_BASE+1
+#define DISPID_IHTMLEDITSERVICES_SELANCHOR          DISPID_IHTMLEDITSERVICES_BASE+2
+#define DISPID_IHTMLEDITSERVICES_SELEND             DISPID_IHTMLEDITSERVICES_BASE+3
+#define DISPID_IHTMLEDITSERVICES_REMOVEDESIGNER     DISPID_IHTMLEDITSERVICES_BASE+4
+
 #endif /* __MSHTMDID_H__ */
diff --git a/include/mshtml.idl b/include/mshtml.idl
index 680748b..11cffdc 100644
--- a/include/mshtml.idl
+++ b/include/mshtml.idl
@@ -20032,4 +20032,55 @@ methods:
     VARIANT width();
 }
 
+/*****************************************************************************
+ *    IHTMLEditDesigner interface
+ */
+[
+    odl,
+    oleautomation,
+    dual,
+    uuid(3050f662-98b5-11cf-bb82-00aa00bdce0b)
+]
+interface IHTMLEditDesigner : IUnknown
+{
+    [id(DISPID_IHTMLEDITDESIGNER_POST_EDITOR)]
+    HRESULT PostEditorEventNotify([in] DISPID inEvtDispId, [in] IHTMLEventObj *pIEventObj);
+
+    [id(DISPID_IHTMLEDITDESIGNER_POST_HANDLE)]
+    HRESULT PostHandleEvent([in] DISPID inEvtDispId, [in] IHTMLEventObj *pIEventObj);
+
+    [id(DISPID_IHTMLEDITDESIGNER_PRE_HANDLE)]
+    HRESULT PreHandleEvent([in] DISPID inEvtDispId, [in] IHTMLEventObj *pIEventObj);
+
+    [id(DISPID_IHTMLEDITDESIGNER_TRANSLATE)]
+    HRESULT TranslateAccelerator([in] DISPID inEvtDispId, [in] IHTMLEventObj *pIEventObj);
+}
+
+/*****************************************************************************
+ *    IHTMLEditServices interface
+ */
+[
+    odl,
+    oleautomation,
+    dual,
+    uuid(3050f663-98b5-11cf-bb82-00aa00bdce0b)
+]
+interface IHTMLEditServices : IUnknown
+{
+    [id(DISPID_IHTMLEDITSERVICES_ADDDESIGNER)]
+    HRESULT AddDesigner([in] IHTMLEditDesigner *pIDesigner);
+
+    [id(DISPID_IHTMLEDITSERVICES_GETSELECTION)]
+    HRESULT GetSelectionServices([in] /*IMarkupContainer*/ IUnknown *pIContainer, [retval, out] /*ISelectionServices*/ IUnknown **ppSelSvc);
+
+    [id(DISPID_IHTMLEDITSERVICES_SELANCHOR)]
+    HRESULT MoveToSelectionAnchor([in] /*IMarkupPointer*/ IUnknown *pIStartAnchor);
+
+    [id(DISPID_IHTMLEDITSERVICES_SELEND)]
+    HRESULT MoveToSelectionEnd([in] /*IMarkupPointer*/ IUnknown *pIEndAnchor);
+
+    [id(DISPID_IHTMLEDITSERVICES_REMOVEDESIGNER)]
+    HRESULT RemoveDesigner([in] IHTMLEditDesigner *pIDesigner);
+}
+
 } /* library MSHTML */
-- 
1.5.6.5.GIT



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