Commit 10c714b4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshmtl: Moved ICustomDoc implementation to HTMLDocumentObj.

parent 2fb0d1e4
......@@ -1682,9 +1682,6 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
}else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
*ppv = PERSTRINIT(This);
}else if(IsEqualGUID(&IID_ICustomDoc, riid)) {
TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppv);
*ppv = CUSTOMDOC(This);
}else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) {
TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This, ppv);
*ppv = HTMLDOC(This);
......@@ -1860,6 +1857,46 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
return S_OK;
}
/**********************************************************
* ICustomDoc implementation
*/
#define CUSTOMDOC_THIS(iface) DEFINE_THIS(HTMLDocumentObj, CustomDoc, iface)
static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv)
{
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
return IHTMLDocument2_QueryInterface(HTMLDOC(&This->basedoc), riid, ppv);
}
static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
{
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
return IHTMLDocument2_AddRef(HTMLDOC(&This->basedoc));
}
static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
{
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
return IHTMLDocument_Release(HTMLDOC(&This->basedoc));
}
static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
{
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
FIXME("(%p)->(%p)\n", This, pUIHandler);
return E_NOTIMPL;
}
#undef CUSTOMDOC_THIS
static const ICustomDocVtbl CustomDocVtbl = {
CustomDoc_QueryInterface,
CustomDoc_AddRef,
CustomDoc_Release,
CustomDoc_SetUIHandler
};
#define HTMLDOCOBJ_THIS(base) DEFINE_THIS2(HTMLDocumentObj, basedoc, base)
static HRESULT HTMLDocumentObj_QueryInterface(HTMLDocument *base, REFIID riid, void **ppv)
......@@ -1869,9 +1906,17 @@ static HRESULT HTMLDocumentObj_QueryInterface(HTMLDocument *base, REFIID riid, v
if(htmldoc_qi(&This->basedoc, riid, ppv))
return *ppv ? S_OK : E_NOINTERFACE;
if(IsEqualGUID(&IID_ICustomDoc, riid)) {
TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppv);
*ppv = CUSTOMDOC(This);
}else {
FIXME("Unimplemented interface %s\n", debugstr_guid(riid));
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG HTMLDocumentObj_AddRef(HTMLDocument *base)
......@@ -1952,6 +1997,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
init_doc(&doc->basedoc, &HTMLDocumentObjVtbl);
doc->lpCustomDocVtbl = &CustomDocVtbl;
doc->ref = 1;
doc->basedoc.doc_obj = doc;
......
......@@ -274,7 +274,6 @@ struct HTMLDocument {
const IOleControlVtbl *lpOleControlVtbl;
const IHlinkTargetVtbl *lpHlinkTargetVtbl;
const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
const ICustomDocVtbl *lpCustomDocVtbl;
const IDispatchExVtbl *lpIDispatchExVtbl;
const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
......@@ -308,6 +307,7 @@ static inline ULONG htmldoc_release(HTMLDocument *This)
struct HTMLDocumentObj {
HTMLDocument basedoc;
const ICustomDocVtbl *lpCustomDocVtbl;
LONG ref;
......
......@@ -705,46 +705,6 @@ static const IOleControlVtbl OleControlVtbl = {
OleControl_FreezeEvents
};
/**********************************************************
* ICustomDoc implementation
*/
#define CUSTOMDOC_THIS(iface) DEFINE_THIS(HTMLDocument, CustomDoc, iface)
static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv)
{
HTMLDocument *This = CUSTOMDOC_THIS(iface);
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
}
static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
{
HTMLDocument *This = CUSTOMDOC_THIS(iface);
return IHTMLDocument2_AddRef(HTMLDOC(This));
}
static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
{
HTMLDocument *This = CUSTOMDOC_THIS(iface);
return IHTMLDocument_Release(HTMLDOC(This));
}
static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
{
HTMLDocument *This = CUSTOMDOC_THIS(iface);
FIXME("(%p)->(%p)\n", This, pUIHandler);
return E_NOTIMPL;
}
#undef CUSTOMDOC_THIS
static const ICustomDocVtbl CustomDocVtbl = {
CustomDoc_QueryInterface,
CustomDoc_AddRef,
CustomDoc_Release,
CustomDoc_SetUIHandler
};
void HTMLDocument_LockContainer(HTMLDocumentObj *This, BOOL fLock)
{
IOleContainer *container;
......@@ -766,5 +726,4 @@ void HTMLDocument_OleObj_Init(HTMLDocument *This)
This->lpOleObjectVtbl = &OleObjectVtbl;
This->lpOleDocumentVtbl = &OleDocumentVtbl;
This->lpOleControlVtbl = &OleControlVtbl;
This->lpCustomDocVtbl = &CustomDocVtbl;
}
......@@ -4095,6 +4095,7 @@ static void test_window(IHTMLDocument2 *doc)
IHTMLWindow2 *window, *window2, *self;
IHTMLDocument2 *doc2 = NULL;
IDispatch *disp;
IUnknown *unk;
BSTR str;
HRESULT hres;
......@@ -4110,6 +4111,11 @@ static void test_window(IHTMLDocument2 *doc)
test_ifaces((IUnknown*)doc2, doc_node_iids);
test_ifaces((IUnknown*)doc, doc_obj_iids);
unk = (void*)0xdeadbeef;
hres = IHTMLDocument2_QueryInterface(doc2, &IID_ICustomDoc, (void**)&unk);
ok(hres == E_NOINTERFACE, "QueryInterface(IID_ICustomDoc) returned: %08x\n", hres);
ok(!unk, "unk = %p\n", unk);
IHTMLDocument_Release(doc2);
hres = IHTMLWindow2_get_window(window, &window2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment