Jacek Caban : mshtml: Added stub implementation of connection points.

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 5 12:10:32 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 1cfcbb3010ca81ea21dffcd6a7d5c39ca9264a0a
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=1cfcbb3010ca81ea21dffcd6a7d5c39ca9264a0a

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Apr 28 20:01:07 2006 +0200

mshtml: Added stub implementation of connection points.

---

 dlls/mshtml/conpoint.c       |  125 +++++++++++++++++++++++++++++++++++++++++-
 dlls/mshtml/mshtml_private.h |    4 +
 2 files changed, 127 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/conpoint.c b/dlls/mshtml/conpoint.c
index 0436aa6..0ea47d0 100644
--- a/dlls/mshtml/conpoint.c
+++ b/dlls/mshtml/conpoint.c
@@ -38,8 +38,110 @@ #define CONPOINT(x) ((IConnectionPoint*)
 
 struct ConnectionPoint {
     const IConnectionPointVtbl *lpConnectionPointVtbl;
+
+    HTMLDocument *doc;
 };
 
+#define CONPOINT_THIS(iface) DEFINE_THIS(ConnectionPoint, ConnectionPoint, iface)
+
+static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface,
+                                                     REFIID riid, LPVOID *ppv)
+{
+    ConnectionPoint *This = CONPOINT_THIS(iface);
+
+    *ppv = NULL;
+
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+        *ppv = CONPOINT(This);
+    }else if(IsEqualGUID(&IID_IConnectionPoint, riid)) {
+        TRACE("(%p)->(IID_IConnectionPoint %p)\n", This, ppv);
+        *ppv = CONPOINT(This);
+    }
+
+    if(*ppv) {
+        IUnknown_AddRef((IUnknown*)*ppv);
+        return S_OK;
+    }
+
+    WARN("Unsupported interface %s\n", debugstr_guid(riid));
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
+{
+    ConnectionPoint *This = CONPOINT_THIS(iface);
+    return IHTMLDocument2_AddRef(HTMLDOC(This->doc));
+}
+
+static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
+{
+    ConnectionPoint *This = CONPOINT_THIS(iface);
+    return IHTMLDocument2_Release(HTMLDOC(This->doc));
+}
+
+static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID)
+{
+    ConnectionPoint *This = CONPOINT_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pIID);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface,
+        IConnectionPointContainer **ppCPC)
+{
+    ConnectionPoint *This = CONPOINT_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppCPC);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink,
+                                             DWORD *pdwCookie)
+{
+    ConnectionPoint *This = CONPOINT_THIS(iface);
+    FIXME("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
+{
+    ConnectionPoint *This = CONPOINT_THIS(iface);
+    FIXME("(%p)->(%ld)\n", This, dwCookie);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
+                                                      IEnumConnections **ppEnum)
+{
+    ConnectionPoint *This = CONPOINT_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppEnum);
+    return E_NOTIMPL;
+}
+
+#undef CONPOINT_THIS
+
+static const IConnectionPointVtbl ConnectionPointVtbl =
+{
+    ConnectionPoint_QueryInterface,
+    ConnectionPoint_AddRef,
+    ConnectionPoint_Release,
+    ConnectionPoint_GetConnectionInterface,
+    ConnectionPoint_GetConnectionPointContainer,
+    ConnectionPoint_Advise,
+    ConnectionPoint_Unadvise,
+    ConnectionPoint_EnumConnections
+};
+
+static void ConnectionPoint_Create(HTMLDocument *doc, REFIID riid, ConnectionPoint **cp)
+{
+    ConnectionPoint *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ConnectionPoint));
+
+    ret->lpConnectionPointVtbl = &ConnectionPointVtbl;
+    ret->doc = doc;
+
+    *cp = ret;
+}
+
 #define CONPTCONT_THIS(iface) DEFINE_THIS(HTMLDocument, ConnectionPointContainer, iface)
 
 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
@@ -73,8 +175,24 @@ static HRESULT WINAPI ConnectionPointCon
         REFIID riid, IConnectionPoint **ppCP)
 {
     HTMLDocument *This = CONPTCONT_THIS(iface);
-    FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppCP);
-    return E_NOTIMPL;
+
+    *ppCP = NULL;
+
+    if(IsEqualGUID(&DIID_HTMLDocumentEvents, riid)) {
+        TRACE("(%p)->(DIID_HTMLDocumentEvents %p)\n", This, ppCP);
+        *ppCP = CONPOINT(This->cp_htmldocevents);
+    }else if(IsEqualGUID(&DIID_HTMLDocumentEvents2, riid)) {
+        TRACE("(%p)->(DIID_HTMLDocumentEvents2 %p)\n", This, ppCP);
+        *ppCP = CONPOINT(This->cp_htmldocevents2);
+    }
+
+    if(*ppCP) {
+        IConnectionPoint_AddRef(*ppCP);
+        return S_OK;
+    }
+
+    FIXME("(%p)->(%s %p) unsupported riid\n", This, debugstr_guid(riid), ppCP);
+    return CONNECT_E_NOCONNECTION;
 }
 
 static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
@@ -90,4 +208,7 @@ #undef CONPTCONT_THIS
 void HTMLDocument_ConnectionPoints_Init(HTMLDocument *This)
 {
     This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
+
+    ConnectionPoint_Create(This, &DIID_HTMLDocumentEvents, &This->cp_htmldocevents);
+    ConnectionPoint_Create(This, &DIID_HTMLDocumentEvents2, &This->cp_htmldocevents2);
 }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 3ebe445..3124a96 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -45,6 +45,7 @@ #define NS_DOCUMENT_NODE  9
 
 typedef struct BindStatusCallback BindStatusCallback;
 typedef struct HTMLDOMNode HTMLDOMNode;
+typedef struct ConnectionPoint ConnectionPoint;
 
 typedef struct {
     const IHTMLDocument2Vtbl              *lpHTMLDocument2Vtbl;
@@ -84,6 +85,9 @@ typedef struct {
 
     BindStatusCallback *status_callback;
 
+    ConnectionPoint *cp_htmldocevents;
+    ConnectionPoint *cp_htmldocevents2;
+
     HTMLDOMNode *nodes;
 } HTMLDocument;
 




More information about the wine-cvs mailing list