Commit 46a2f3e4 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

oleacc: Add IServiceProvider interface to default accessible objects.

parent e75ceba1
...@@ -32,6 +32,7 @@ typedef struct { ...@@ -32,6 +32,7 @@ typedef struct {
IAccessible IAccessible_iface; IAccessible IAccessible_iface;
IOleWindow IOleWindow_iface; IOleWindow IOleWindow_iface;
IEnumVARIANT IEnumVARIANT_iface; IEnumVARIANT IEnumVARIANT_iface;
IServiceProvider IServiceProvider_iface;
LONG ref; LONG ref;
...@@ -114,6 +115,8 @@ static HRESULT WINAPI Client_QueryInterface(IAccessible *iface, REFIID riid, voi ...@@ -114,6 +115,8 @@ static HRESULT WINAPI Client_QueryInterface(IAccessible *iface, REFIID riid, voi
*ppv = &This->IOleWindow_iface; *ppv = &This->IOleWindow_iface;
}else if(IsEqualIID(riid, &IID_IEnumVARIANT)) { }else if(IsEqualIID(riid, &IID_IEnumVARIANT)) {
*ppv = &This->IEnumVARIANT_iface; *ppv = &This->IEnumVARIANT_iface;
}else if(IsEqualIID(riid, &IID_IServiceProvider)) {
*ppv = &This->IServiceProvider_iface;
}else { }else {
WARN("no interface: %s\n", debugstr_guid(riid)); WARN("no interface: %s\n", debugstr_guid(riid));
*ppv = NULL; *ppv = NULL;
...@@ -703,6 +706,50 @@ static const IEnumVARIANTVtbl ClientEnumVARIANTVtbl = { ...@@ -703,6 +706,50 @@ static const IEnumVARIANTVtbl ClientEnumVARIANTVtbl = {
Client_EnumVARIANT_Clone Client_EnumVARIANT_Clone
}; };
static inline Client* impl_from_Client_ServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, Client, IServiceProvider_iface);
}
static HRESULT WINAPI Client_ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
Client *This = impl_from_Client_ServiceProvider(iface);
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
}
static ULONG WINAPI Client_ServiceProvider_AddRef(IServiceProvider *iface)
{
Client *This = impl_from_Client_ServiceProvider(iface);
return IAccessible_AddRef(&This->IAccessible_iface);
}
static ULONG WINAPI Client_ServiceProvider_Release(IServiceProvider *iface)
{
Client *This = impl_from_Client_ServiceProvider(iface);
return IAccessible_Release(&This->IAccessible_iface);
}
static HRESULT WINAPI Client_ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guid_service,
REFIID riid, void **ppv)
{
Client *This = impl_from_Client_ServiceProvider(iface);
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guid_service), debugstr_guid(riid), ppv);
*ppv = NULL;
if (IsEqualIID(guid_service, &IIS_IsOleaccProxy))
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
return E_INVALIDARG;
}
static const IServiceProviderVtbl ClientServiceProviderVtbl = {
Client_ServiceProvider_QueryInterface,
Client_ServiceProvider_AddRef,
Client_ServiceProvider_Release,
Client_ServiceProvider_QueryService
};
static void edit_init(Client *client) static void edit_init(Client *client)
{ {
client->role = ROLE_SYSTEM_TEXT; client->role = ROLE_SYSTEM_TEXT;
...@@ -872,6 +919,7 @@ HRESULT create_client_object(HWND hwnd, const IID *iid, void **obj) ...@@ -872,6 +919,7 @@ HRESULT create_client_object(HWND hwnd, const IID *iid, void **obj)
client->IAccessible_iface.lpVtbl = &ClientVtbl; client->IAccessible_iface.lpVtbl = &ClientVtbl;
client->IOleWindow_iface.lpVtbl = &ClientOleWindowVtbl; client->IOleWindow_iface.lpVtbl = &ClientOleWindowVtbl;
client->IEnumVARIANT_iface.lpVtbl = &ClientEnumVARIANTVtbl; client->IEnumVARIANT_iface.lpVtbl = &ClientEnumVARIANTVtbl;
client->IServiceProvider_iface.lpVtbl = &ClientServiceProviderVtbl;
client->ref = 1; client->ref = 1;
client->hwnd = hwnd; client->hwnd = hwnd;
client->enum_pos = 0; client->enum_pos = 0;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
#include "oleacc_classes.h" #include "oleacc_classes.h"
#include "servprov.h"
struct win_class_data { struct win_class_data {
const WCHAR *name; const WCHAR *name;
......
...@@ -1419,9 +1419,8 @@ static void check_acc_proxy_service_(IAccessible *acc, int line) ...@@ -1419,9 +1419,8 @@ static void check_acc_proxy_service_(IAccessible *acc, int line)
HRESULT hr; HRESULT hr;
hr = IAccessible_QueryInterface(acc, &IID_IServiceProvider, (void **)&service); hr = IAccessible_QueryInterface(acc, &IID_IServiceProvider, (void **)&service);
todo_wine ok(hr == S_OK, "got %#lx\n", hr); ok(hr == S_OK, "got %#lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IServiceProvider_QueryService(service, &IIS_IsOleaccProxy, &IID_IUnknown, (void **)&unk); hr = IServiceProvider_QueryService(service, &IIS_IsOleaccProxy, &IID_IUnknown, (void **)&unk);
ok(hr == S_OK, "got %#lx\n", hr); ok(hr == S_OK, "got %#lx\n", hr);
ok(!!unk, "unk == NULL\n"); ok(!!unk, "unk == NULL\n");
...@@ -1433,7 +1432,6 @@ static void check_acc_proxy_service_(IAccessible *acc, int line) ...@@ -1433,7 +1432,6 @@ static void check_acc_proxy_service_(IAccessible *acc, int line)
ok(hr == E_INVALIDARG, "got %#lx\n", hr); ok(hr == E_INVALIDARG, "got %#lx\n", hr);
ok(!unk, "unk != NULL\n"); ok(!unk, "unk != NULL\n");
IServiceProvider_Release(service); IServiceProvider_Release(service);
}
} }
static void test_CreateStdAccessibleObject_classes(void) static void test_CreateStdAccessibleObject_classes(void)
......
...@@ -30,6 +30,7 @@ typedef struct { ...@@ -30,6 +30,7 @@ typedef struct {
IAccessible IAccessible_iface; IAccessible IAccessible_iface;
IOleWindow IOleWindow_iface; IOleWindow IOleWindow_iface;
IEnumVARIANT IEnumVARIANT_iface; IEnumVARIANT IEnumVARIANT_iface;
IServiceProvider IServiceProvider_iface;
LONG ref; LONG ref;
...@@ -55,6 +56,8 @@ static HRESULT WINAPI Window_QueryInterface(IAccessible *iface, REFIID riid, voi ...@@ -55,6 +56,8 @@ static HRESULT WINAPI Window_QueryInterface(IAccessible *iface, REFIID riid, voi
*ppv = &This->IOleWindow_iface; *ppv = &This->IOleWindow_iface;
}else if(IsEqualIID(riid, &IID_IEnumVARIANT)) { }else if(IsEqualIID(riid, &IID_IEnumVARIANT)) {
*ppv = &This->IEnumVARIANT_iface; *ppv = &This->IEnumVARIANT_iface;
}else if(IsEqualIID(riid, &IID_IServiceProvider)) {
*ppv = &This->IServiceProvider_iface;
}else { }else {
WARN("no interface: %s\n", debugstr_guid(riid)); WARN("no interface: %s\n", debugstr_guid(riid));
*ppv = NULL; *ppv = NULL;
...@@ -444,6 +447,50 @@ static const IEnumVARIANTVtbl WindowEnumVARIANTVtbl = { ...@@ -444,6 +447,50 @@ static const IEnumVARIANTVtbl WindowEnumVARIANTVtbl = {
Window_EnumVARIANT_Clone Window_EnumVARIANT_Clone
}; };
static inline Window* impl_from_Window_ServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, Window, IServiceProvider_iface);
}
static HRESULT WINAPI Window_ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
Window *This = impl_from_Window_ServiceProvider(iface);
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
}
static ULONG WINAPI Window_ServiceProvider_AddRef(IServiceProvider *iface)
{
Window *This = impl_from_Window_ServiceProvider(iface);
return IAccessible_AddRef(&This->IAccessible_iface);
}
static ULONG WINAPI Window_ServiceProvider_Release(IServiceProvider *iface)
{
Window *This = impl_from_Window_ServiceProvider(iface);
return IAccessible_Release(&This->IAccessible_iface);
}
static HRESULT WINAPI Window_ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guid_service,
REFIID riid, void **ppv)
{
Window *This = impl_from_Window_ServiceProvider(iface);
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guid_service), debugstr_guid(riid), ppv);
*ppv = NULL;
if (IsEqualIID(guid_service, &IIS_IsOleaccProxy))
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
return E_INVALIDARG;
}
static const IServiceProviderVtbl WindowServiceProviderVtbl = {
Window_ServiceProvider_QueryInterface,
Window_ServiceProvider_AddRef,
Window_ServiceProvider_Release,
Window_ServiceProvider_QueryService
};
static const struct win_class_data classes[] = { static const struct win_class_data classes[] = {
{WC_LISTBOXW, 0x10000, TRUE}, {WC_LISTBOXW, 0x10000, TRUE},
{L"#32768", 0x10001, TRUE}, /* menu */ {L"#32768", 0x10001, TRUE}, /* menu */
...@@ -467,6 +514,7 @@ HRESULT create_window_object(HWND hwnd, const IID *iid, void **obj) ...@@ -467,6 +514,7 @@ HRESULT create_window_object(HWND hwnd, const IID *iid, void **obj)
window->IAccessible_iface.lpVtbl = &WindowVtbl; window->IAccessible_iface.lpVtbl = &WindowVtbl;
window->IOleWindow_iface.lpVtbl = &WindowOleWindowVtbl; window->IOleWindow_iface.lpVtbl = &WindowOleWindowVtbl;
window->IEnumVARIANT_iface.lpVtbl = &WindowEnumVARIANTVtbl; window->IEnumVARIANT_iface.lpVtbl = &WindowEnumVARIANTVtbl;
window->IServiceProvider_iface.lpVtbl = &WindowServiceProviderVtbl;
window->ref = 1; window->ref = 1;
window->hwnd = hwnd; window->hwnd = hwnd;
......
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