[Wine-patches] mshtml: Add ISelectionServices interface

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


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

---
 dlls/mshtml/service.c |  151 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 149 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c
index 76b86c3..641ee90 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;
@@ -278,8 +281,16 @@ static HRESULT WINAPI HTMLEditServices_GetSelectionServices(
         IMarkupContainer *pIContainer,
         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,12 +335,148 @@ 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,
+             IElementSegment **ppISegmentAdded)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_AddSegment(
+             ISelectionServices* iface,
+             IMarkupPointer *pIStart,
+             IMarkupPointer *pIEnd,
+             ISegment **ppISegmentAdded)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_GetMarkupContainer(
+             ISelectionServices* iface,
+             IMarkupContainer **ppIContainer)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_GetSelectionServicesListener(
+             ISelectionServices* iface,
+             ISelectionServicesListener **ppISelectionServicesListener)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_RemoveSegment(
+             ISelectionServices* iface,
+             ISegment *pISegment)
+{
+    FIXME("is not implemented\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SelectionServices_SetSelectionType(
+             ISelectionServices* iface,
+             SELECTION_TYPE eType,
+             ISelectionServicesListener *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
  */
 
-- 
1.6.0.2.GIT



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