[Wine-patches] mshtml: Add ISelectionServices interface (part of fix eterbug #2105)

Konstantin Kondratyuk =?iso-8859-1?q?kondratyuk_=CE=C1_etersoft=2Eru?=
Вт Окт 21 13:15:02 MSD 2008


Прикладывать только поверх

commit 50a17130555c2c779ff7031609d39de26752930f
Author: Konstantin Kondratyuk <kondratyuk на etersoft.ru>
Date:   Mon Oct 20 16:20:31 2008 +0400

    mshtml: Add IHTMLEditServices interface (fix eterbug #2105)


-- 
Best regards,
Konstantin Kondratyuk.
----------- следующая часть -----------
From abee110452c350ea084219d7160a42bfc00b1f64 Mon Sep 17 00:00:00 2001
From: Konstantin Kondratyuk <kondratyuk на etersoft.ru>
Date: Tue, 21 Oct 2008 09:24:56 +0400
Subject: [PATCH] mshtml: Add ISelectionServices interface (part of fix eterbug #2105)

---
 dlls/mshtml/mshtml_private.h |    2 +-
 dlls/mshtml/service.c        |  166 ++++++++++++++++++++++++++++++++++++++++--
 include/mshtmdid.h           |    9 ++
 include/mshtml.idl           |   32 ++++++++-
 4 files changed, 199 insertions(+), 10 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 536f052..c9615ad 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -252,7 +252,7 @@ struct HTMLDocument {
     IOleInPlaceUIWindow *ip_window;
 
     IOleUndoManager *undomgr;
-    IHTMLEditServices *htmledirsrv;
+    IHTMLEditServices *htmleditsrv;
 
     nsChannelBSC *bscallback;
     IMoniker *mon;
diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c
index 2b007ab..46559b3 100644
--- a/dlls/mshtml/service.c
+++ b/dlls/mshtml/service.c
@@ -213,8 +213,11 @@ static IOleUndoManager *create_undomgr(void)
  *
  */
 
+static ISelectionServices *create_selectionsrv();
+
 typedef struct {
     const IHTMLEditServicesVtbl  *lpHTMLEditServicesVtbl;
+    ISelectionServices *selsrv;
 
     LONG ref;
 } HTMLEditServices;
@@ -276,10 +279,18 @@ static HRESULT WINAPI HTMLEditServices_AddDesigner(
 static HRESULT WINAPI HTMLEditServices_GetSelectionServices(
         IHTMLEditServices* iface,
         IUnknown *pIContainer,
-        IUnknown **ppSelSvc)
+        ISelectionServices **ppSelSvc)
 {
-    FIXME("is not implemented\n");
-    return E_NOTIMPL;
+    HTMLEditServices *This = HTMLEDITSRV_THIS(iface);
+
+    TRACE("\n");
+
+    if(!This->selsrv)
+        This->selsrv = create_selectionsrv();
+
+    ISelectionServices_AddRef(This->selsrv);
+    *ppSelSvc = This->selsrv;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLEditServices_MoveToSelectionAnchor(
@@ -324,11 +335,150 @@ static IHTMLEditServices *create_htmleditsrv(void)
     HTMLEditServices *ret = heap_alloc(sizeof(HTMLEditServices));
 
     ret->lpHTMLEditServicesVtbl = &HTMLEditServicesVtbl;
+    ret->selsrv = NULL;
     ret->ref = 1;
 
     return HTMLEDITSRV(ret);
 }
 
+
+
+/**********************************************************
+ * ISelectionServices implementation
+ *
+ * TODO:    Declare other interfaces
+ *
+ */
+
+typedef struct {
+    const ISelectionServicesVtbl  *lpSelectionServicesVtbl;
+
+    LONG ref;
+} SelectionServices;
+
+#define SELSRV(x)  ((ISelectionServices*)  &(x)->lpSelectionServicesVtbl)
+
+#define SELSRV_THIS(iface) DEFINE_THIS(SelectionServices, SelectionServices, iface)
+
+static HRESULT WINAPI SelectionServices_QueryInterface(ISelectionServices *iface, REFIID riid, void **ppv)
+{
+    SelectionServices *This = SELSRV_THIS(iface);
+
+    *ppv = NULL;
+
+    if(IsEqualGUID(riid, &IID_IUnknown)) {
+        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+        *ppv = SELSRV_THIS(This);
+    }else if(IsEqualGUID(riid, &IID_ISelectionServices)) {
+        TRACE("(%p)->(IID_ISelectionServices %p)\n", This, ppv);
+        *ppv = SELSRV(This);
+    }
+
+
+    FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI SelectionServices_AddRef(ISelectionServices *iface)
+{
+    SelectionServices *This = SELSRV_THIS(iface);
+    LONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI SelectionServices_Release(ISelectionServices *iface)
+{
+    SelectionServices *This = SELSRV_THIS(iface);
+    LONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    if(!ref)
+        heap_free(This);
+
+    return ref;
+}
+
+static HRESULT WINAPI SelectionServices_AddElementSegment(
+             ISelectionServices* iface,
+             IHTMLElement *pIElement,
+             IUnknown **ppISegmentAdded)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_AddSegment(
+             ISelectionServices* iface,
+             IUnknown *pIStart,
+             IUnknown *pIEnd,
+             IUnknown **ppISegmentAdded)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_GetMarkupContainer(
+             ISelectionServices* iface,
+             IUnknown **ppIContainer)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_GetSelectionServicesListener(
+             ISelectionServices* iface,
+             IUnknown **ppISelectionServicesListener)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_RemoveSegment(
+             ISelectionServices* iface,
+             IUnknown *pISegment)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_SetSelectionType(
+             ISelectionServices* iface,
+             IUnknown eType,
+             IUnknown *pIListener)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+#undef HTMLEDITSRV_THIS
+
+static const ISelectionServicesVtbl SelectionServicesVtbl = {
+    SelectionServices_QueryInterface,
+    SelectionServices_AddRef,
+    SelectionServices_Release,
+    SelectionServices_AddElementSegment,
+    SelectionServices_AddSegment,
+    SelectionServices_GetMarkupContainer,
+    SelectionServices_GetSelectionServicesListener,
+    SelectionServices_RemoveSegment,
+    SelectionServices_SetSelectionType
+};
+
+static ISelectionServices *create_selectionsrv(void)
+{
+    SelectionServices *ret = heap_alloc(sizeof(SelectionServices));
+
+    ret->lpSelectionServicesVtbl = &SelectionServicesVtbl;
+    ret->ref = 1;
+
+    return SELSRV(ret);
+}
+
+
 /**********************************************************
  * IServiceProvider implementation
  */
@@ -377,11 +527,11 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG
     if(IsEqualGUID(&IID_IHTMLEditServices, riid)) {
         TRACE("(%p)->(IID_IHTMLEditServices %p)\n", This, ppv);
 
-        if(!This->htmledirsrv)
-            This->htmledirsrv = create_htmleditsrv();
+        if(!This->htmleditsrv)
+            This->htmleditsrv = create_htmleditsrv();
 
-        IHTMLEditServices_AddRef(This->htmledirsrv);
-        *ppv = This->htmledirsrv;
+        IHTMLEditServices_AddRef(This->htmleditsrv);
+        *ppv = This->htmleditsrv;
         return S_OK;
     }
 
@@ -402,5 +552,5 @@ void HTMLDocument_Service_Init(HTMLDocument *This)
     This->lpServiceProviderVtbl = &ServiceProviderVtbl;
 
     This->undomgr = NULL;
-    This->htmledirsrv = NULL;
+    This->htmleditsrv = NULL;
 }
diff --git a/include/mshtmdid.h b/include/mshtmdid.h
index 2f39848..1e62736 100644
--- a/include/mshtmdid.h
+++ b/include/mshtmdid.h
@@ -2429,4 +2429,13 @@
 #define DISPID_IHTMLEDITSERVICES_SELEND             DISPID_IHTMLEDITSERVICES_BASE+3
 #define DISPID_IHTMLEDITSERVICES_REMOVEDESIGNER     DISPID_IHTMLEDITSERVICES_BASE+4
 
+/* ISelectionServices */
+#define DISPID_ISELECTIONSERVICES_BASE              DISPID_IHTMLEDITSERVICES_BASE+5
+#define DISPID_ISELECTIONSERVICES_ADDELEMENTSEGMENT DISPID_ISELECTIONSERVICES_BASE
+#define DISPID_ISELECTIONSERVICES_ADDSEGMENT        DISPID_ISELECTIONSERVICES_BASE+1
+#define DISPID_ISELECTIONSERVICES_GETMARKUP         DISPID_ISELECTIONSERVICES_BASE+2
+#define DISPID_ISELECTIONSERVICES_GETLISTENER       DISPID_ISELECTIONSERVICES_BASE+3
+#define DISPID_ISELECTIONSERVICES_REMOVESEGMENT     DISPID_ISELECTIONSERVICES_BASE+4
+#define DISPID_ISELECTIONSERVICES_SETSELECTIONTYPE  DISPID_ISELECTIONSERVICES_BASE+5
+
 #endif /* __MSHTMDID_H__ */
diff --git a/include/mshtml.idl b/include/mshtml.idl
index 11cffdc..a2f0b4a 100644
--- a/include/mshtml.idl
+++ b/include/mshtml.idl
@@ -20057,6 +20057,36 @@ interface IHTMLEditDesigner : IUnknown
 }
 
 /*****************************************************************************
+ *    ISelectionServices interface
+ */
+[
+    odl,
+    oleautomation,
+    dual,
+    uuid(3050f684-98b5-11cf-bb82-00aa00bdce0b)
+]
+interface ISelectionServices : IUnknown
+{
+    [id(DISPID_ISELECTIONSERVICES_ADDELEMENTSEGMENT)]
+    HRESULT AddElementSegment([in] IHTMLElement *pIElement, [retval, out] /*IElementSegment*/IUnknown **ppISegmentAdded);
+
+    [id(DISPID_ISELECTIONSERVICES_ADDSEGMENT)]
+    HRESULT AddSegment([in] /*IMarkupPointer*/ IUnknown *pIStart, [in] /*IMarkupPointer*/ IUnknown *pIEnd, [retval, out] /*ISegment*/ IUnknown **ppISegmentAdded);
+
+    [id(DISPID_ISELECTIONSERVICES_GETMARKUP)]
+    HRESULT GetMarkupContainer([retval, out] /*IMarkupContainer*/ IUnknown **ppIContainer);
+
+    [id(DISPID_ISELECTIONSERVICES_GETLISTENER)]
+    HRESULT GetSelectionServicesListener([retval, out] /*ISelectionServicesListener*/ IUnknown **ppISelectionServicesListener);
+
+    [id(DISPID_ISELECTIONSERVICES_REMOVESEGMENT)]
+    HRESULT RemoveSegment([in] /*ISegment*/ IUnknown *pISegment);
+
+    [id(DISPID_ISELECTIONSERVICES_SETSELECTIONTYPE)]
+    HRESULT SetSelectionType([in] /*SELECTION_TYPE*/ IUnknown eType, [in] /*ISelectionServicesListener*/ IUnknown *pIListener);
+}
+
+/*****************************************************************************
  *    IHTMLEditServices interface
  */
 [
@@ -20071,7 +20101,7 @@ interface IHTMLEditServices : IUnknown
     HRESULT AddDesigner([in] IHTMLEditDesigner *pIDesigner);
 
     [id(DISPID_IHTMLEDITSERVICES_GETSELECTION)]
-    HRESULT GetSelectionServices([in] /*IMarkupContainer*/ IUnknown *pIContainer, [retval, out] /*ISelectionServices*/ IUnknown **ppSelSvc);
+    HRESULT GetSelectionServices([in] /*IMarkupContainer*/ IUnknown *pIContainer, [retval, out] ISelectionServices **ppSelSvc);
 
     [id(DISPID_IHTMLEDITSERVICES_SELANCHOR)]
     HRESULT MoveToSelectionAnchor([in] /*IMarkupPointer*/ IUnknown *pIStartAnchor);
-- 
1.5.6.5.GIT



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