2001-01-11 23:32:44 +01:00
|
|
|
/*
|
2002-05-05 21:40:57 +02:00
|
|
|
* Implementation of event-related interfaces for IE Web Browser control:
|
|
|
|
*
|
|
|
|
* - IConnectionPointContainer
|
|
|
|
* - IConnectionPoint
|
2001-01-11 23:32:44 +01:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* Copyright 2001 John R. Sheets (for CodeWeavers)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2001-01-11 23:32:44 +01:00
|
|
|
*/
|
|
|
|
|
2001-01-26 21:43:40 +01:00
|
|
|
#include <string.h>
|
2002-03-20 02:02:15 +01:00
|
|
|
#include "wine/debug.h"
|
2002-05-05 21:40:57 +02:00
|
|
|
#include "shdocvw.h"
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
|
2001-01-11 23:32:44 +01:00
|
|
|
|
|
|
|
|
2003-09-09 21:39:31 +02:00
|
|
|
static const GUID IID_INotifyDBEvents =
|
|
|
|
{ 0xdb526cc0, 0xd188, 0x11cd, { 0xad, 0x48, 0x00, 0xaa, 0x00, 0x3c, 0x9c, 0xb6 } };
|
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
/**********************************************************************
|
|
|
|
* Implement the IConnectionPointContainer interface
|
|
|
|
*/
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface,
|
|
|
|
REFIID riid, LPVOID *ppobj)
|
2001-01-11 23:32:44 +01:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface;
|
2002-05-05 21:40:57 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface)
|
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
|
|
|
|
|
|
|
|
return refCount;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface)
|
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
/* static class, won't be freed */
|
2005-01-14 17:02:20 +01:00
|
|
|
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
|
|
|
|
|
|
|
|
return refCount;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
/* Get a list of connection points inside this container. */
|
|
|
|
static HRESULT WINAPI WBCPC_EnumConnectionPoints(LPCONNECTIONPOINTCONTAINER iface,
|
|
|
|
LPENUMCONNECTIONPOINTS *ppEnum)
|
2001-01-11 23:32:44 +01:00
|
|
|
{
|
2002-05-05 21:40:57 +02:00
|
|
|
FIXME("stub: IEnumConnectionPoints = %p\n", *ppEnum);
|
|
|
|
return S_OK;
|
|
|
|
}
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
/* Retrieve the connection point in this container associated with the
|
|
|
|
* riid interface. When events occur in the control, the control can
|
|
|
|
* call backwards into its embedding site, through these interfaces.
|
2002-03-20 02:02:15 +01:00
|
|
|
*/
|
2002-05-05 21:40:57 +02:00
|
|
|
static HRESULT WINAPI WBCPC_FindConnectionPoint(LPCONNECTIONPOINTCONTAINER iface,
|
|
|
|
REFIID riid, LPCONNECTIONPOINT *ppCP)
|
|
|
|
{
|
|
|
|
TRACE(": IID = %s, IConnectionPoint = %p\n", debugstr_guid(riid), *ppCP);
|
|
|
|
|
|
|
|
/* For now, return the same IConnectionPoint object for both
|
|
|
|
* event interface requests.
|
|
|
|
*/
|
|
|
|
if (IsEqualGUID (&IID_INotifyDBEvents, riid))
|
|
|
|
{
|
|
|
|
TRACE("Returning connection point %p for IID_INotifyDBEvents\n",
|
|
|
|
&SHDOCVW_ConnectionPoint);
|
|
|
|
*ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID (&IID_IPropertyNotifySink, riid))
|
|
|
|
{
|
|
|
|
TRACE("Returning connection point %p for IID_IPropertyNotifySink\n",
|
|
|
|
&SHDOCVW_ConnectionPoint);
|
|
|
|
*ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* IConnectionPointContainer virtual function table for IE Web Browser component
|
|
|
|
*/
|
|
|
|
|
2004-08-13 01:00:51 +02:00
|
|
|
static IConnectionPointContainerVtbl WBCPC_Vtbl =
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
|
|
|
WBCPC_QueryInterface,
|
|
|
|
WBCPC_AddRef,
|
|
|
|
WBCPC_Release,
|
|
|
|
WBCPC_EnumConnectionPoints,
|
|
|
|
WBCPC_FindConnectionPoint
|
|
|
|
};
|
|
|
|
|
|
|
|
IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = { &WBCPC_Vtbl, 1 };
|
|
|
|
|
2001-01-11 23:32:44 +01:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* Implement the IConnectionPoint interface
|
|
|
|
*/
|
|
|
|
|
|
|
|
static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface,
|
|
|
|
REFIID riid, LPVOID *ppobj)
|
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IConnectionPointImpl *This = (IConnectionPointImpl *)iface;
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
|
|
|
|
return E_NOINTERFACE;
|
2001-01-11 23:32:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface)
|
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IConnectionPointImpl *This = (IConnectionPointImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
|
|
|
|
|
|
|
|
return refCount;
|
2001-01-11 23:32:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface)
|
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IConnectionPointImpl *This = (IConnectionPointImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
2001-01-11 23:32:44 +01:00
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
/* static class, won't be freed */
|
2005-01-14 17:02:20 +01:00
|
|
|
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
|
|
|
|
|
|
|
|
return refCount;
|
2001-01-11 23:32:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId)
|
|
|
|
{
|
|
|
|
FIXME("stub: %s\n", debugstr_guid(pIId));
|
2002-05-05 21:40:57 +02:00
|
|
|
return S_OK;
|
2001-01-11 23:32:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get this connection point's owning container */
|
|
|
|
static HRESULT WINAPI
|
|
|
|
WBCP_GetConnectionPointContainer(LPCONNECTIONPOINT iface,
|
|
|
|
LPCONNECTIONPOINTCONTAINER *ppCPC)
|
|
|
|
{
|
|
|
|
FIXME("stub: IConnectionPointContainer = %p\n", *ppCPC);
|
2002-05-05 21:40:57 +02:00
|
|
|
return S_OK;
|
2001-01-11 23:32:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Connect the pUnkSink event-handling implementation (in the control site)
|
|
|
|
* to this connection point. Return a handle to this connection in
|
|
|
|
* pdwCookie (for later use in Unadvise()).
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI WBCP_Advise(LPCONNECTIONPOINT iface,
|
|
|
|
LPUNKNOWN pUnkSink, DWORD *pdwCookie)
|
|
|
|
{
|
|
|
|
static int new_cookie;
|
|
|
|
|
|
|
|
FIXME("stub: IUnknown = %p, connection cookie = %ld\n", pUnkSink, *pdwCookie);
|
2002-05-05 21:40:57 +02:00
|
|
|
|
2001-01-11 23:32:44 +01:00
|
|
|
*pdwCookie = ++new_cookie;
|
|
|
|
TRACE ("Returning cookie = %ld\n", *pdwCookie);
|
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
return S_OK;
|
2001-01-11 23:32:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Disconnect this implementation from the connection point. */
|
|
|
|
static HRESULT WINAPI WBCP_Unadvise(LPCONNECTIONPOINT iface,
|
|
|
|
DWORD dwCookie)
|
|
|
|
{
|
2003-04-02 03:23:43 +02:00
|
|
|
FIXME("stub: cookie to disconnect = %lx\n", dwCookie);
|
2002-05-05 21:40:57 +02:00
|
|
|
return S_OK;
|
2001-01-11 23:32:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get a list of connections in this connection point. */
|
|
|
|
static HRESULT WINAPI WBCP_EnumConnections(LPCONNECTIONPOINT iface,
|
|
|
|
LPENUMCONNECTIONS *ppEnum)
|
|
|
|
{
|
|
|
|
FIXME("stub: IEnumConnections = %p\n", *ppEnum);
|
2002-05-05 21:40:57 +02:00
|
|
|
return S_OK;
|
2001-01-11 23:32:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* IConnectionPoint virtual function table for IE Web Browser component
|
|
|
|
*/
|
|
|
|
|
2004-08-13 01:00:51 +02:00
|
|
|
static IConnectionPointVtbl WBCP_Vtbl =
|
2001-01-11 23:32:44 +01:00
|
|
|
{
|
|
|
|
WBCP_QueryInterface,
|
|
|
|
WBCP_AddRef,
|
|
|
|
WBCP_Release,
|
|
|
|
WBCP_GetConnectionInterface,
|
|
|
|
WBCP_GetConnectionPointContainer,
|
|
|
|
WBCP_Advise,
|
|
|
|
WBCP_Unadvise,
|
|
|
|
WBCP_EnumConnections
|
|
|
|
};
|
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
IConnectionPointImpl SHDOCVW_ConnectionPoint = { &WBCP_Vtbl, 1 };
|