mshtml: Move IConnectionPointContainer to the separated struct.

This commit is contained in:
Jacek Caban 2007-06-29 02:49:27 +02:00 committed by Alexandre Julliard
parent fc4fd71e01
commit f09a6f7283
3 changed files with 30 additions and 21 deletions

View File

@ -107,7 +107,7 @@ static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoi
if(!ppCPC)
return E_POINTER;
*ppCPC = CONPTCONT(This->doc);
*ppCPC = CONPTCONT(&This->doc->cp_container);
IConnectionPointContainer_AddRef(*ppCPC);
return S_OK;
}
@ -209,31 +209,31 @@ static void ConnectionPoint_Destroy(ConnectionPoint *This)
mshtml_free(This->sinks);
}
#define CONPTCONT_THIS(iface) DEFINE_THIS(HTMLDocument, ConnectionPointContainer, iface)
#define CONPTCONT_THIS(iface) DEFINE_THIS(ConnectionPointContainer, ConnectionPointContainer, iface)
static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
REFIID riid, void **ppv)
{
HTMLDocument *This = CONPTCONT_THIS(iface);
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
ConnectionPointContainer *This = CONPTCONT_THIS(iface);
return IUnknown_QueryInterface(This->outer, riid, ppv);
}
static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
{
HTMLDocument *This = CONPTCONT_THIS(iface);
return IHTMLDocument2_AddRef(HTMLDOC(This));
ConnectionPointContainer *This = CONPTCONT_THIS(iface);
return IUnknown_AddRef(This->outer);
}
static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
{
HTMLDocument *This = CONPTCONT_THIS(iface);
return IHTMLDocument2_Release(HTMLDOC(This));
ConnectionPointContainer *This = CONPTCONT_THIS(iface);
return IUnknown_Release(This->outer);
}
static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
IEnumConnectionPoints **ppEnum)
{
HTMLDocument *This = CONPTCONT_THIS(iface);
ConnectionPointContainer *This = CONPTCONT_THIS(iface);
FIXME("(%p)->(%p)\n", This, ppEnum);
return E_NOTIMPL;
}
@ -241,14 +241,14 @@ static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionP
static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
REFIID riid, IConnectionPoint **ppCP)
{
HTMLDocument *This = CONPTCONT_THIS(iface);
ConnectionPointContainer *This = CONPTCONT_THIS(iface);
ConnectionPoint *iter;
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppCP);
*ppCP = NULL;
for(iter = &This->cp_propnotif; iter; iter = iter->next) {
for(iter = This->cp_list; iter; iter = iter->next) {
if(IsEqualGUID(&iter->iid, riid))
*ppCP = CONPOINT(iter);
}
@ -272,14 +272,17 @@ static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
#undef CONPTCONT_THIS
void HTMLDocument_ConnectionPoints_Init(HTMLDocument *This)
void ConnectionPointContainer_Init(ConnectionPointContainer *This, ConnectionPoint *cp_list,
IUnknown *outer)
{
This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
This->cp_list = cp_list;
This->outer = outer;
}
void HTMLDocument_ConnectionPoints_Destroy(HTMLDocument *This)
void ConnectionPointContainer_Destroy(ConnectionPointContainer *This)
{
ConnectionPoint *iter = &This->cp_propnotif;
ConnectionPoint *iter = This->cp_list;
while(iter) {
ConnectionPoint_Destroy(iter);

View File

@ -109,7 +109,7 @@ static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID
*ppvObject = HLNKTARGET(This);
}else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppvObject);
*ppvObject = CONPTCONT(This);
*ppvObject = CONPTCONT(&This->cp_container);
}else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppvObject);
*ppvObject = PERSTRINIT(This);
@ -171,7 +171,7 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
release_nodes(This);
HTMLDocument_ConnectionPoints_Destroy(This);
ConnectionPointContainer_Destroy(&This->cp_container);
if(This->nscontainer)
NSContainer_Release(This->nscontainer);
@ -1141,12 +1141,12 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
HTMLDocument_Window_Init(ret);
HTMLDocument_Service_Init(ret);
HTMLDocument_Hlink_Init(ret);
HTMLDocument_ConnectionPoints_Init(ret);
ConnectionPoint_Init(&ret->cp_propnotif, ret, &IID_IPropertyNotifySink, NULL);
ConnectionPoint_Init(&ret->cp_htmldocevents, ret, &DIID_HTMLDocumentEvents, &ret->cp_propnotif);
ConnectionPoint_Init(&ret->cp_htmldocevents2, ret, &DIID_HTMLDocumentEvents2,
&ret->cp_htmldocevents);
ConnectionPointContainer_Init(&ret->cp_container, &ret->cp_propnotif, (IUnknown*)HTMLDOC(ret));
ret->nscontainer = NSContainer_Create(ret, NULL);
ret->window = HTMLWindow_Create(ret);

View File

@ -71,6 +71,13 @@ typedef enum {
EDITMODE
} USERMODE;
typedef struct {
const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
ConnectionPoint *cp_list;
IUnknown *outer;
} ConnectionPointContainer;
struct ConnectionPoint {
const IConnectionPointVtbl *lpConnectionPointVtbl;
@ -104,7 +111,6 @@ struct HTMLDocument {
const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
const IOleControlVtbl *lpOleControlVtbl;
const IHlinkTargetVtbl *lpHlinkTargetVtbl;
const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
LONG ref;
@ -137,6 +143,7 @@ struct HTMLDocument {
DWORD update;
ConnectionPointContainer cp_container;
ConnectionPoint cp_htmldocevents;
ConnectionPoint cp_htmldocevents2;
ConnectionPoint cp_propnotif;
@ -338,11 +345,10 @@ void HTMLDocument_View_Init(HTMLDocument*);
void HTMLDocument_Window_Init(HTMLDocument*);
void HTMLDocument_Service_Init(HTMLDocument*);
void HTMLDocument_Hlink_Init(HTMLDocument*);
void HTMLDocument_ConnectionPoints_Init(HTMLDocument*);
void HTMLDocument_ConnectionPoints_Destroy(HTMLDocument*);
void ConnectionPoint_Init(ConnectionPoint*,HTMLDocument*,REFIID,ConnectionPoint*);
void ConnectionPointContainer_Init(ConnectionPointContainer*,ConnectionPoint*,IUnknown*);
void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
void NSContainer_Release(NSContainer*);