mshtml: Added HTMLDocument's IDispatchEx implementation.

This commit is contained in:
Jacek Caban 2008-04-21 18:21:54 +02:00 committed by Alexandre Julliard
parent 7d0034a5ba
commit 98ab1a92c0
3 changed files with 180 additions and 1 deletions

View File

@ -51,7 +51,12 @@ static struct list dispex_data_list = LIST_INIT(dispex_data_list);
static REFIID tid_ids[] = {
&IID_NULL,
&DIID_DispHTMLDocument,
&DIID_DispHTMLWindow2,
&IID_IHTMLDocument2,
&IID_IHTMLDocument3,
&IID_IHTMLDocument4,
&IID_IHTMLDocument5,
&IID_IHTMLWindow2,
&IID_IHTMLWindow3,
&IID_IOmNavigator

View File

@ -46,7 +46,10 @@ static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID
*ppvObject = HTMLDOC(This);
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch, %p)\n", This, ppvObject);
*ppvObject = HTMLDOC(This);
*ppvObject = DISPATCHEX(This);
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
TRACE("(%p)->(IID_IDispatchEx, %p)\n", This, ppvObject);
*ppvObject = DISPATCHEX(This);
}else if(IsEqualGUID(&IID_IHTMLDocument, riid)) {
TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This, ppvObject);
*ppvObject = HTMLDOC(This);
@ -1354,6 +1357,167 @@ static const IHTMLDocument2Vtbl HTMLDocumentVtbl = {
HTMLDocument_createStyleSheet
};
#define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
static HRESULT WINAPI DocDispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IHTMLWindow2_QueryInterface(HTMLDOC(This), riid, ppv);
}
static ULONG WINAPI DocDispatchEx_AddRef(IDispatchEx *iface)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IHTMLWindow2_AddRef(HTMLDOC(This));
}
static ULONG WINAPI DocDispatchEx_Release(IDispatchEx *iface)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IHTMLWindow2_AddRef(HTMLDOC(This));
}
static HRESULT WINAPI DocDispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
}
static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
}
static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
}
static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
HTMLDocument *This = DISPEX_THIS(iface);
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
switch(dispIdMember) {
case DISPID_READYSTATE:
TRACE("DISPID_READYSTATE\n");
if(!(wFlags & DISPATCH_PROPERTYGET))
return E_INVALIDARG;
V_VT(pVarResult) = VT_I4;
V_I4(pVarResult) = This->readystate;
return S_OK;
}
return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
}
static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_GetDispID(DISPATCHEX(&This->dispex), bstrName, grfdex, pid);
}
static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_InvokeEx(DISPATCHEX(&This->dispex), id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
}
static HRESULT WINAPI DocDispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This->dispex), bstrName, grfdex);
}
static HRESULT WINAPI DocDispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This->dispex), id);
}
static HRESULT WINAPI DocDispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_GetMemberProperties(DISPATCHEX(&This->dispex), id, grfdexFetch, pgrfdex);
}
static HRESULT WINAPI DocDispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_GetMemberName(DISPATCHEX(&This->dispex), id, pbstrName);
}
static HRESULT WINAPI DocDispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_GetNextDispID(DISPATCHEX(&This->dispex), grfdex, id, pid);
}
static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
{
HTMLDocument *This = DISPEX_THIS(iface);
return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This->dispex), ppunk);
}
#undef DISPEX_THIS
static const IDispatchExVtbl DocDispatchExVtbl = {
DocDispatchEx_QueryInterface,
DocDispatchEx_AddRef,
DocDispatchEx_Release,
DocDispatchEx_GetTypeInfoCount,
DocDispatchEx_GetTypeInfo,
DocDispatchEx_GetIDsOfNames,
DocDispatchEx_Invoke,
DocDispatchEx_GetDispID,
DocDispatchEx_InvokeEx,
DocDispatchEx_DeleteMemberByName,
DocDispatchEx_DeleteMemberByDispID,
DocDispatchEx_GetMemberProperties,
DocDispatchEx_GetMemberName,
DocDispatchEx_GetNextDispID,
DocDispatchEx_GetNameSpaceParent
};
static dispex_static_data_t HTMLDocument_dispex = {
DispHTMLDocument_tid,
NULL,
{
IHTMLDocument2_tid,
IHTMLDocument3_tid,
IHTMLDocument4_tid,
IHTMLDocument5_tid,
0
}
};
HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
{
HTMLDocument *ret;
@ -1363,6 +1527,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
ret = heap_alloc_zero(sizeof(HTMLDocument));
ret->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl;
ret->lpIDispatchExVtbl = &DocDispatchExVtbl;
ret->ref = 0;
ret->readystate = READYSTATE_UNINITIALIZED;
@ -1394,6 +1559,8 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
ConnectionPoint_Init(&ret->cp_htmldocevents, &ret->cp_container, &DIID_HTMLDocumentEvents);
ConnectionPoint_Init(&ret->cp_htmldocevents2, &ret->cp_container, &DIID_HTMLDocumentEvents2);
init_dispex(&ret->dispex, (IUnknown*)HTMLDOC(ret), &HTMLDocument_dispex);
ret->nscontainer = NSContainer_Create(ret, NULL);
ret->window = HTMLWindow_Create(ret);

View File

@ -61,7 +61,12 @@ typedef struct event_target_t event_target_t;
/* NOTE: make sure to keep in sync with dispex.c */
typedef enum {
NULL_tid,
DispHTMLDocument_tid,
DispHTMLWindow2_tid,
IHTMLDocument2_tid,
IHTMLDocument3_tid,
IHTMLDocument4_tid,
IHTMLDocument5_tid,
IHTMLWindow2_tid,
IHTMLWindow3_tid,
IOmNavigator_tid,
@ -149,6 +154,7 @@ typedef struct {
} HTMLOptionElementFactory;
struct HTMLDocument {
DispatchEx dispex;
const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
@ -168,6 +174,7 @@ struct HTMLDocument {
const IHlinkTargetVtbl *lpHlinkTargetVtbl;
const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
const ICustomDocVtbl *lpCustomDocVtbl;
const IDispatchExVtbl *lpIDispatchExVtbl;
LONG ref;