Commit ac56d24e authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Move the IServiceProvider interface out of basedoc.

parent 5e062a99
......@@ -5633,8 +5633,6 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
*ppv = &This->IOleInPlaceObjectWindowless_iface;
else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid))
*ppv = &This->IOleInPlaceObjectWindowless_iface;
else if(IsEqualGUID(&IID_IServiceProvider, riid))
*ppv = &This->IServiceProvider_iface;
else if(IsEqualGUID(&IID_IOleCommandTarget, riid))
*ppv = &This->IOleCommandTarget_iface;
else if(IsEqualGUID(&IID_IOleControl, riid))
......@@ -5728,7 +5726,6 @@ static void init_doc(HTMLDocument *doc, IUnknown *outer, IDispatchEx *dispex)
HTMLDocument_Persist_Init(doc);
HTMLDocument_OleCmd_Init(doc);
HTMLDocument_OleObj_Init(doc);
HTMLDocument_Service_Init(doc);
}
static inline HTMLDocumentNode *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
......@@ -5747,6 +5744,8 @@ static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
if(IsEqualGUID(&IID_IInternetHostSecurityManager, riid))
*ppv = &This->IInternetHostSecurityManager_iface;
else if(IsEqualGUID(&IID_IServiceProvider, riid))
*ppv = &This->IServiceProvider_iface;
else if(IsEqualGUID(&IID_IConnectionPointContainer, riid))
*ppv = &This->cp_container.IConnectionPointContainer_iface;
else
......@@ -6136,6 +6135,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo
init_doc(&doc->basedoc, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
&doc->node.event_target.dispex.IDispatchEx_iface);
ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->basedoc.IHTMLDocument2_iface, HTMLDocumentNode_cpc);
HTMLDocumentNode_Service_Init(doc);
HTMLDocumentNode_SecMgr_Init(doc);
list_init(&doc->selection_list);
......@@ -6254,6 +6254,8 @@ static HRESULT WINAPI HTMLDocumentObj_QueryInterface(IUnknown *iface, REFIID rii
*ppv = &This->IViewObjectEx_iface;
}else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
*ppv = &This->IViewObjectEx_iface;
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
*ppv = &This->IServiceProvider_iface;
}else if(IsEqualGUID(&IID_ITargetContainer, riid)) {
*ppv = &This->ITargetContainer_iface;
}else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
......@@ -6480,6 +6482,7 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii
init_dispatch(&doc->dispex, (IUnknown*)&doc->ICustomDoc_iface, &HTMLDocumentObj_dispex, COMPAT_MODE_QUIRKS);
init_doc(&doc->basedoc, outer ? outer : &doc->IUnknown_inner, &doc->dispex.IDispatchEx_iface);
ConnectionPointContainer_Init(&doc->cp_container, &doc->IUnknown_inner, HTMLDocumentObj_cpc);
HTMLDocumentObj_Service_Init(doc);
TargetContainer_Init(doc);
doc->is_mhtml = is_mhtml;
......
......@@ -3742,7 +3742,7 @@ static HRESULT WINAPI HTMLWindowSP_QueryService(IServiceProvider *iface, REFGUID
if(!This->outer_window || !This->outer_window->browser)
return E_NOINTERFACE;
return IServiceProvider_QueryService(&This->outer_window->browser->doc->basedoc.IServiceProvider_iface,
return IServiceProvider_QueryService(&This->outer_window->browser->doc->IServiceProvider_iface,
guidService, riid, ppv);
}
......
......@@ -656,7 +656,6 @@ struct HTMLDocument {
IOleDocument IOleDocument_iface;
IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
IServiceProvider IServiceProvider_iface;
IOleCommandTarget IOleCommandTarget_iface;
IOleControl IOleControl_iface;
IHlinkTarget IHlinkTarget_iface;
......@@ -703,6 +702,7 @@ struct HTMLDocumentObj {
ICustomDoc ICustomDoc_iface;
IOleDocumentView IOleDocumentView_iface;
IViewObjectEx IViewObjectEx_iface;
IServiceProvider IServiceProvider_iface;
ITargetContainer ITargetContainer_iface;
IWindowForBindingUI IWindowForBindingUI_iface;
......@@ -896,6 +896,7 @@ struct HTMLDocumentNode {
HTMLDOMNode node;
HTMLDocument basedoc;
IServiceProvider IServiceProvider_iface;
IInternetHostSecurityManager IInternetHostSecurityManager_iface;
nsIDocumentObserver nsIDocumentObserver_iface;
......@@ -965,11 +966,12 @@ void detach_html_storage(IHTMLStorage*) DECLSPEC_HIDDEN;
void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
void HTMLDocument_View_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void HTMLDocumentObj_Service_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void HTMLDocumentNode_Service_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
......
......@@ -332,33 +332,76 @@ static IHTMLEditServices *create_editsvcs(void)
* IServiceProvider implementation
*/
static inline HTMLDocument *impl_from_IServiceProvider(IServiceProvider *iface)
static inline HTMLDocumentNode *HTMLDocumentNode_from_IServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, HTMLDocument, IServiceProvider_iface);
return CONTAINING_RECORD(iface, HTMLDocumentNode, IServiceProvider_iface);
}
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
static HRESULT WINAPI DocNodeServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
HTMLDocument *This = impl_from_IServiceProvider(iface);
return htmldoc_query_interface(This, riid, ppv);
HTMLDocumentNode *This = HTMLDocumentNode_from_IServiceProvider(iface);
return htmldoc_query_interface(&This->basedoc, riid, ppv);
}
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
static ULONG WINAPI DocNodeServiceProvider_AddRef(IServiceProvider *iface)
{
HTMLDocument *This = impl_from_IServiceProvider(iface);
return htmldoc_addref(This);
HTMLDocumentNode *This = HTMLDocumentNode_from_IServiceProvider(iface);
return htmldoc_addref(&This->basedoc);
}
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
static ULONG WINAPI DocNodeServiceProvider_Release(IServiceProvider *iface)
{
HTMLDocument *This = impl_from_IServiceProvider(iface);
return htmldoc_release(This);
HTMLDocumentNode *This = HTMLDocumentNode_from_IServiceProvider(iface);
return htmldoc_release(&This->basedoc);
}
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
static HRESULT WINAPI DocNodeServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
REFIID riid, void **ppv)
{
HTMLDocument *This = impl_from_IServiceProvider(iface);
HTMLDocumentNode *This = HTMLDocumentNode_from_IServiceProvider(iface);
if(IsEqualGUID(&SID_SContainerDispatch, guidService)) {
TRACE("SID_SContainerDispatch\n");
return IHTMLDocument2_QueryInterface(&This->basedoc.IHTMLDocument2_iface, riid, ppv);
}
return IServiceProvider_QueryService(&This->basedoc.doc_obj->IServiceProvider_iface, guidService, riid, ppv);
}
static const IServiceProviderVtbl DocNodeServiceProviderVtbl = {
DocNodeServiceProvider_QueryInterface,
DocNodeServiceProvider_AddRef,
DocNodeServiceProvider_Release,
DocNodeServiceProvider_QueryService
};
static inline HTMLDocumentObj *HTMLDocumentObj_from_IServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, HTMLDocumentObj, IServiceProvider_iface);
}
static HRESULT WINAPI DocObjServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
HTMLDocumentObj *This = HTMLDocumentObj_from_IServiceProvider(iface);
return htmldoc_query_interface(&This->basedoc, riid, ppv);
}
static ULONG WINAPI DocObjServiceProvider_AddRef(IServiceProvider *iface)
{
HTMLDocumentObj *This = HTMLDocumentObj_from_IServiceProvider(iface);
return htmldoc_addref(&This->basedoc);
}
static ULONG WINAPI DocObjServiceProvider_Release(IServiceProvider *iface)
{
HTMLDocumentObj *This = HTMLDocumentObj_from_IServiceProvider(iface);
return htmldoc_release(&This->basedoc);
}
static HRESULT WINAPI DocObjServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
REFIID riid, void **ppv)
{
HTMLDocumentObj *This = HTMLDocumentObj_from_IServiceProvider(iface);
if(IsEqualGUID(&CLSID_CMarkup, guidService)) {
FIXME("(%p)->(CLSID_CMarkup %s %p)\n", This, debugstr_guid(riid), ppv);
......@@ -368,43 +411,43 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG
if(IsEqualGUID(&SID_SOleUndoManager, guidService)) {
TRACE("SID_SOleUndoManager\n");
if(!This->doc_obj->undomgr)
This->doc_obj->undomgr = create_undomgr();
if(!This->undomgr)
This->undomgr = create_undomgr();
if (!This->doc_obj->undomgr)
if (!This->undomgr)
return E_OUTOFMEMORY;
return IOleUndoManager_QueryInterface(This->doc_obj->undomgr, riid, ppv);
return IOleUndoManager_QueryInterface(This->undomgr, riid, ppv);
}
if(IsEqualGUID(&SID_SContainerDispatch, guidService)) {
TRACE("SID_SContainerDispatch\n");
return IHTMLDocument2_QueryInterface(&This->IHTMLDocument2_iface, riid, ppv);
return IHTMLDocument2_QueryInterface(&This->basedoc.IHTMLDocument2_iface, riid, ppv);
}
if(IsEqualGUID(&IID_IWindowForBindingUI, guidService)) {
TRACE("IID_IWindowForBindingUI\n");
return IWindowForBindingUI_QueryInterface(&This->doc_obj->IWindowForBindingUI_iface, riid, ppv);
return IWindowForBindingUI_QueryInterface(&This->IWindowForBindingUI_iface, riid, ppv);
}
if(IsEqualGUID(&SID_SHTMLEditServices, guidService)) {
TRACE("SID_SHTMLEditServices\n");
if(!This->doc_obj->editsvcs)
This->doc_obj->editsvcs = create_editsvcs();
if(!This->editsvcs)
This->editsvcs = create_editsvcs();
if (!This->doc_obj->editsvcs)
if (!This->editsvcs)
return E_OUTOFMEMORY;
return IHTMLEditServices_QueryInterface(This->doc_obj->editsvcs, riid, ppv);
return IHTMLEditServices_QueryInterface(This->editsvcs, riid, ppv);
}
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
if(This->doc_obj->client) {
if(This->client) {
HRESULT hres;
hres = do_query_service((IUnknown*)This->doc_obj->client, guidService, riid, ppv);
hres = do_query_service((IUnknown*)This->client, guidService, riid, ppv);
if(SUCCEEDED(hres))
return hres;
}
......@@ -413,14 +456,19 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG
return E_NOINTERFACE;
}
static const IServiceProviderVtbl ServiceProviderVtbl = {
ServiceProvider_QueryInterface,
ServiceProvider_AddRef,
ServiceProvider_Release,
ServiceProvider_QueryService
static const IServiceProviderVtbl DocObjServiceProviderVtbl = {
DocObjServiceProvider_QueryInterface,
DocObjServiceProvider_AddRef,
DocObjServiceProvider_Release,
DocObjServiceProvider_QueryService
};
void HTMLDocument_Service_Init(HTMLDocument *This)
void HTMLDocumentNode_Service_Init(HTMLDocumentNode *This)
{
This->IServiceProvider_iface.lpVtbl = &DocNodeServiceProviderVtbl;
}
void HTMLDocumentObj_Service_Init(HTMLDocumentObj *This)
{
This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
This->IServiceProvider_iface.lpVtbl = &DocObjServiceProviderVtbl;
}
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