Commit 3662980f authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

mshtml: Add IHTMLEditServices stub implementation.

parent 076f50ee
......@@ -4761,6 +4761,8 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
IOleDocumentView_SetInPlaceSite(&This->basedoc.IOleDocumentView_iface, NULL);
if(This->undomgr)
IOleUndoManager_Release(This->undomgr);
if(This->editsvcs)
IHTMLEditServices_Release(This->editsvcs);
if(This->tooltips_hwnd)
DestroyWindow(This->tooltips_hwnd);
......
......@@ -554,6 +554,7 @@ const char *debugstr_mshtml_guid(const GUID *iid)
X(IID_IHlinkTarget);
X(IID_IHTMLDocument6);
X(IID_IHTMLDocument7);
X(IID_IHTMLEditServices);
X(IID_IHTMLFramesCollection2);
X(IID_IHTMLPrivateWindow);
X(IID_IHtmlLoadOptions);
......
......@@ -602,6 +602,7 @@ struct HTMLDocumentObj {
DOCHOSTUIINFO hostinfo;
IOleUndoManager *undomgr;
IHTMLEditServices *editsvcs;
HWND hwnd;
HWND tooltips_hwnd;
......
......@@ -205,6 +205,131 @@ static IOleUndoManager *create_undomgr(void)
return &ret->IOleUndoManager_iface;
}
typedef struct {
IHTMLEditServices IHTMLEditServices_iface;
LONG ref;
} editsvcs;
static inline editsvcs *impl_from_IHTMLEditServices(IHTMLEditServices *iface)
{
return CONTAINING_RECORD(iface, editsvcs, IHTMLEditServices_iface);
}
static HRESULT WINAPI editsvcs_QueryInterface(IHTMLEditServices *iface, REFIID riid, void **ppv)
{
editsvcs *This = impl_from_IHTMLEditServices(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
if(IsEqualGUID(riid, &IID_IUnknown)) {
*ppv = &This->IHTMLEditServices_iface;
} else if(IsEqualGUID(riid, &IID_IHTMLEditServices)) {
*ppv = &This->IHTMLEditServices_iface;
} else {
*ppv = NULL;
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI editsvcs_AddRef(IHTMLEditServices *iface)
{
editsvcs *This = impl_from_IHTMLEditServices(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
static ULONG WINAPI editsvcs_Release(IHTMLEditServices *iface)
{
editsvcs *This = impl_from_IHTMLEditServices(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
if(!ref)
heap_free(This);
return ref;
}
static HRESULT WINAPI editsvcs_AddDesigner(IHTMLEditServices *iface,
IHTMLEditDesigner *pIDesigner)
{
editsvcs *This = impl_from_IHTMLEditServices(iface);
FIXME("(%p)->(%p)\n", This, pIDesigner);
return E_NOTIMPL;
}
static HRESULT WINAPI editsvcs_RemoveDesigner(IHTMLEditServices *iface,
IHTMLEditDesigner *pIDesigner)
{
editsvcs *This = impl_from_IHTMLEditServices(iface);
FIXME("(%p)->(%p)\n", This, pIDesigner);
return E_NOTIMPL;
}
static HRESULT WINAPI editsvcs_GetSelectionServices(IHTMLEditServices *iface,
IMarkupContainer *pIContainer, ISelectionServices **ppSelSvc)
{
editsvcs *This = impl_from_IHTMLEditServices(iface);
FIXME("(%p)->(%p,%p)\n", This, pIContainer, ppSelSvc);
return E_NOTIMPL;
}
static HRESULT WINAPI editsvcs_MoveToSelectionAnchor(IHTMLEditServices *iface,
IMarkupPointer *pIStartAnchor)
{
editsvcs *This = impl_from_IHTMLEditServices(iface);
FIXME("(%p)->(%p)\n", This, pIStartAnchor);
return E_NOTIMPL;
}
static HRESULT WINAPI editsvcs_MoveToSelectionEnd(IHTMLEditServices *iface,
IMarkupPointer *pIEndAnchor)
{
editsvcs *This = impl_from_IHTMLEditServices(iface);
FIXME("(%p)->(%p)\n", This, pIEndAnchor);
return E_NOTIMPL;
}
static HRESULT WINAPI editsvcs_SelectRange(IHTMLEditServices *iface,
IMarkupPointer *pStart, IMarkupPointer *pEnd, SELECTION_TYPE eType)
{
editsvcs *This = impl_from_IHTMLEditServices(iface);
FIXME("(%p)->(%p,%p,%#x)\n", This, pStart, pEnd, eType);
return E_NOTIMPL;
}
static const IHTMLEditServicesVtbl editsvcsVtbl = {
editsvcs_QueryInterface,
editsvcs_AddRef,
editsvcs_Release,
editsvcs_AddDesigner,
editsvcs_RemoveDesigner,
editsvcs_GetSelectionServices,
editsvcs_MoveToSelectionAnchor,
editsvcs_MoveToSelectionEnd,
editsvcs_SelectRange,
};
static IHTMLEditServices *create_editsvcs(void)
{
editsvcs *ret = heap_alloc(sizeof(*ret));
if (ret) {
ret->IHTMLEditServices_iface.lpVtbl = &editsvcsVtbl;
ret->ref = 1;
return &ret->IHTMLEditServices_iface;
}
return NULL;
}
/**********************************************************
* IServiceProvider implementation
*/
......@@ -264,6 +389,18 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG
return IWindowForBindingUI_QueryInterface(&This->doc_obj->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->doc_obj->editsvcs)
return E_OUTOFMEMORY;
return IHTMLEditServices_QueryInterface(This->doc_obj->editsvcs, riid, ppv);
}
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
if(This->doc_obj->client) {
......
......@@ -8498,8 +8498,12 @@ static void test_ServiceProvider(void)
hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IUnknown, (void**)&unk);
ok(hres == S_OK, "got 0x%08x\n", hres);
ok(iface_cmp((IUnknown*)doc, unk), "got wrong pointer\n");
IUnknown_Release(unk);
hres = IServiceProvider_QueryService(provider, &SID_SHTMLEditServices, &IID_IHTMLEditServices, (void**)&unk);
ok(hres == S_OK, "QueryService(HTMLEditServices) failed: %08x\n", hres);
IUnknown_Release(unk);
IServiceProvider_Release(provider);
release_document(doc);
}
......
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