2014-05-01 16:13:54 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Piotr Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
2021-09-27 16:10:59 +02:00
|
|
|
#include <assert.h>
|
2014-05-01 16:13:54 +02:00
|
|
|
#include "oleacc_private.h"
|
2021-09-27 16:10:51 +02:00
|
|
|
#include "commctrl.h"
|
2014-05-01 16:13:54 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2018-02-02 01:03:57 +01:00
|
|
|
#include "wine/heap.h"
|
2014-05-01 16:13:54 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(oleacc);
|
|
|
|
|
2021-09-27 16:10:55 +02:00
|
|
|
typedef struct win_class_vtbl win_class_vtbl;
|
2014-05-01 16:13:54 +02:00
|
|
|
typedef struct {
|
|
|
|
IAccessible IAccessible_iface;
|
2014-05-15 17:53:13 +02:00
|
|
|
IOleWindow IOleWindow_iface;
|
2015-03-21 11:25:45 +01:00
|
|
|
IEnumVARIANT IEnumVARIANT_iface;
|
2022-04-25 21:08:01 +02:00
|
|
|
IServiceProvider IServiceProvider_iface;
|
2014-05-01 16:13:54 +02:00
|
|
|
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
HWND hwnd;
|
2015-03-21 13:19:59 +01:00
|
|
|
HWND enum_pos;
|
2021-09-27 16:10:55 +02:00
|
|
|
INT role;
|
|
|
|
|
|
|
|
const win_class_vtbl *vtbl;
|
2014-05-01 16:13:54 +02:00
|
|
|
} Client;
|
|
|
|
|
2021-09-27 16:10:55 +02:00
|
|
|
struct win_class_vtbl {
|
|
|
|
void (*init)(Client*);
|
2021-09-27 16:10:59 +02:00
|
|
|
HRESULT (*get_state)(Client*, VARIANT, VARIANT*);
|
2021-09-27 16:11:05 +02:00
|
|
|
HRESULT (*get_name)(Client*, VARIANT, BSTR*);
|
2021-09-27 16:11:09 +02:00
|
|
|
HRESULT (*get_kbd_shortcut)(Client*, VARIANT, BSTR*);
|
2021-09-27 16:11:13 +02:00
|
|
|
HRESULT (*get_value)(Client*, VARIANT, BSTR*);
|
2021-09-27 16:11:20 +02:00
|
|
|
HRESULT (*put_value)(Client*, VARIANT, BSTR);
|
2021-09-27 16:10:55 +02:00
|
|
|
};
|
|
|
|
|
2021-09-27 16:11:05 +02:00
|
|
|
static HRESULT win_get_name(HWND hwnd, BSTR *name)
|
|
|
|
{
|
|
|
|
WCHAR buf[1024];
|
|
|
|
UINT i, len;
|
|
|
|
|
|
|
|
len = SendMessageW(hwnd, WM_GETTEXT, ARRAY_SIZE(buf), (LPARAM)buf);
|
|
|
|
if(!len)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
for(i=0; i<len; i++) {
|
|
|
|
if(buf[i] == '&') {
|
|
|
|
len--;
|
|
|
|
memmove(buf+i, buf+i+1, (len-i)*sizeof(WCHAR));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*name = SysAllocStringLen(buf, len);
|
|
|
|
return *name ? S_OK : E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2021-09-27 16:11:09 +02:00
|
|
|
static HRESULT win_get_kbd_shortcut(HWND hwnd, BSTR *shortcut)
|
|
|
|
{
|
|
|
|
WCHAR buf[1024];
|
|
|
|
UINT i, len;
|
|
|
|
|
|
|
|
len = SendMessageW(hwnd, WM_GETTEXT, ARRAY_SIZE(buf), (LPARAM)buf);
|
|
|
|
if(!len)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
for(i=0; i<len; i++) {
|
|
|
|
if(buf[i] == '&')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(i+1 >= len)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
*shortcut = SysAllocString(L"Alt+!");
|
|
|
|
if(!*shortcut)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
(*shortcut)[4] = buf[i+1];
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-05-01 16:13:54 +02:00
|
|
|
static inline Client* impl_from_Client(IAccessible *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, Client, IAccessible_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_QueryInterface(IAccessible *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if(IsEqualIID(riid, &IID_IAccessible) ||
|
|
|
|
IsEqualIID(riid, &IID_IDispatch) ||
|
|
|
|
IsEqualIID(riid, &IID_IUnknown)) {
|
|
|
|
*ppv = iface;
|
2014-05-15 17:53:13 +02:00
|
|
|
}else if(IsEqualIID(riid, &IID_IOleWindow)) {
|
|
|
|
*ppv = &This->IOleWindow_iface;
|
2015-03-21 11:25:45 +01:00
|
|
|
}else if(IsEqualIID(riid, &IID_IEnumVARIANT)) {
|
|
|
|
*ppv = &This->IEnumVARIANT_iface;
|
2022-04-25 21:08:01 +02:00
|
|
|
}else if(IsEqualIID(riid, &IID_IServiceProvider)) {
|
|
|
|
*ppv = &This->IServiceProvider_iface;
|
2014-05-15 17:53:13 +02:00
|
|
|
}else {
|
|
|
|
WARN("no interface: %s\n", debugstr_guid(riid));
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
2014-05-15 17:53:13 +02:00
|
|
|
IAccessible_AddRef(iface);
|
|
|
|
return S_OK;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Client_AddRef(IAccessible *iface)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
2022-02-23 09:10:09 +01:00
|
|
|
TRACE("(%p) ref = %lu\n", This, ref);
|
2014-05-01 16:13:54 +02:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Client_Release(IAccessible *iface)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
2022-02-23 09:10:09 +01:00
|
|
|
TRACE("(%p) ref = %lu\n", This, ref);
|
2014-05-01 16:13:54 +02:00
|
|
|
|
|
|
|
if(!ref)
|
|
|
|
heap_free(This);
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_GetTypeInfoCount(IAccessible *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, pctinfo);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_GetTypeInfo(IAccessible *iface,
|
|
|
|
UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2022-02-23 09:10:09 +01:00
|
|
|
FIXME("(%p)->(%u %lx %p)\n", This, iTInfo, lcid, ppTInfo);
|
2014-05-01 16:13:54 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_GetIDsOfNames(IAccessible *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2022-02-23 09:10:09 +01:00
|
|
|
FIXME("(%p)->(%s %p %u %lx %p)\n", This, debugstr_guid(riid),
|
2014-05-01 16:13:54 +02:00
|
|
|
rgszNames, cNames, lcid, rgDispId);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_Invoke(IAccessible *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2022-02-23 09:10:09 +01:00
|
|
|
FIXME("(%p)->(%lx %s %lx %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
2014-05-01 16:13:54 +02:00
|
|
|
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_get_accParent(IAccessible *iface, IDispatch **ppdispParent)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-09 13:59:58 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, ppdispParent);
|
|
|
|
|
|
|
|
return AccessibleObjectFromWindow(This->hwnd, OBJID_WINDOW,
|
|
|
|
&IID_IDispatch, (void**)ppdispParent);
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_get_accChildCount(IAccessible *iface, LONG *pcountChildren)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-01 16:14:17 +02:00
|
|
|
HWND cur;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pcountChildren);
|
|
|
|
|
|
|
|
*pcountChildren = 0;
|
|
|
|
for(cur = GetWindow(This->hwnd, GW_CHILD); cur; cur = GetWindow(cur, GW_HWNDNEXT))
|
|
|
|
(*pcountChildren)++;
|
|
|
|
|
|
|
|
return S_OK;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_get_accChild(IAccessible *iface,
|
|
|
|
VARIANT varChildID, IDispatch **ppdispChild)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2015-03-21 11:25:39 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varChildID), ppdispChild);
|
|
|
|
|
|
|
|
*ppdispChild = NULL;
|
|
|
|
return E_INVALIDARG;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 16:11:05 +02:00
|
|
|
static HRESULT WINAPI Client_get_accName(IAccessible *iface, VARIANT id, BSTR *name)
|
2014-05-01 16:13:54 +02:00
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-01 16:14:24 +02:00
|
|
|
|
2021-09-27 16:11:05 +02:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&id), name);
|
2014-05-01 16:14:24 +02:00
|
|
|
|
2021-09-27 16:11:05 +02:00
|
|
|
*name = NULL;
|
|
|
|
if(This->vtbl && This->vtbl->get_name)
|
|
|
|
return This->vtbl->get_name(This, id, name);
|
2014-05-01 16:14:24 +02:00
|
|
|
|
2021-09-27 16:11:05 +02:00
|
|
|
if(convert_child_id(&id) != CHILDID_SELF || !IsWindow(This->hwnd))
|
|
|
|
return E_INVALIDARG;
|
2014-05-01 16:14:24 +02:00
|
|
|
|
2021-09-27 16:11:05 +02:00
|
|
|
return win_get_name(This->hwnd, name);
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 16:11:13 +02:00
|
|
|
static HRESULT WINAPI Client_get_accValue(IAccessible *iface, VARIANT id, BSTR *value)
|
2014-05-01 16:13:54 +02:00
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-01 16:14:31 +02:00
|
|
|
|
2021-09-27 16:11:13 +02:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&id), value);
|
2014-05-01 16:14:31 +02:00
|
|
|
|
2021-09-27 16:11:13 +02:00
|
|
|
*value = NULL;
|
|
|
|
if(This->vtbl && This->vtbl->get_value)
|
|
|
|
return This->vtbl->get_value(This, id, value);
|
|
|
|
|
|
|
|
if(convert_child_id(&id) != CHILDID_SELF)
|
2014-05-01 16:14:31 +02:00
|
|
|
return E_INVALIDARG;
|
|
|
|
return S_FALSE;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_get_accDescription(IAccessible *iface,
|
|
|
|
VARIANT varID, BSTR *pszDescription)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-01 16:14:37 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszDescription);
|
|
|
|
|
|
|
|
*pszDescription = NULL;
|
|
|
|
if(convert_child_id(&varID) != CHILDID_SELF)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
return S_FALSE;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_get_accRole(IAccessible *iface, VARIANT varID, VARIANT *pvarRole)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-01 16:14:42 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarRole);
|
|
|
|
|
|
|
|
if(convert_child_id(&varID) != CHILDID_SELF) {
|
|
|
|
V_VT(pvarRole) = VT_EMPTY;
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
V_VT(pvarRole) = VT_I4;
|
2021-09-27 16:10:55 +02:00
|
|
|
V_I4(pvarRole) = This->role;
|
2014-05-01 16:14:42 +02:00
|
|
|
return S_OK;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 16:10:59 +02:00
|
|
|
static HRESULT client_get_state(Client *client, VARIANT id, VARIANT *state)
|
2014-05-01 16:13:54 +02:00
|
|
|
{
|
2021-09-16 13:54:17 +02:00
|
|
|
GUITHREADINFO info;
|
2014-05-01 16:15:03 +02:00
|
|
|
LONG style;
|
|
|
|
|
2021-09-27 16:10:59 +02:00
|
|
|
if(convert_child_id(&id) != CHILDID_SELF) {
|
|
|
|
V_VT(state) = VT_EMPTY;
|
2014-05-01 16:15:03 +02:00
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
2021-09-27 16:10:59 +02:00
|
|
|
V_VT(state) = VT_I4;
|
|
|
|
V_I4(state) = 0;
|
2014-05-01 16:15:03 +02:00
|
|
|
|
2021-09-27 16:10:59 +02:00
|
|
|
style = GetWindowLongW(client->hwnd, GWL_STYLE);
|
2014-05-01 16:15:03 +02:00
|
|
|
if(style & WS_DISABLED)
|
2021-09-27 16:10:59 +02:00
|
|
|
V_I4(state) |= STATE_SYSTEM_UNAVAILABLE;
|
|
|
|
else if(IsWindow(client->hwnd))
|
|
|
|
V_I4(state) |= STATE_SYSTEM_FOCUSABLE;
|
2021-09-16 13:54:17 +02:00
|
|
|
|
|
|
|
info.cbSize = sizeof(info);
|
2021-09-27 16:10:59 +02:00
|
|
|
if(GetGUIThreadInfo(0, &info) && info.hwndFocus == client->hwnd)
|
|
|
|
V_I4(state) |= STATE_SYSTEM_FOCUSED;
|
2014-05-01 16:15:03 +02:00
|
|
|
if(!(style & WS_VISIBLE))
|
2021-09-27 16:10:59 +02:00
|
|
|
V_I4(state) |= STATE_SYSTEM_INVISIBLE;
|
2014-05-01 16:15:03 +02:00
|
|
|
return S_OK;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 16:10:59 +02:00
|
|
|
static HRESULT WINAPI Client_get_accState(IAccessible *iface, VARIANT id, VARIANT *state)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&id), state);
|
|
|
|
|
|
|
|
if(This->vtbl && This->vtbl->get_state)
|
|
|
|
return This->vtbl->get_state(This, id, state);
|
|
|
|
return client_get_state(This, id, state);
|
|
|
|
}
|
|
|
|
|
2014-05-01 16:13:54 +02:00
|
|
|
static HRESULT WINAPI Client_get_accHelp(IAccessible *iface, VARIANT varID, BSTR *pszHelp)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-01 16:14:48 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszHelp);
|
|
|
|
|
|
|
|
*pszHelp = NULL;
|
|
|
|
if(convert_child_id(&varID) != CHILDID_SELF)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
return S_FALSE;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_get_accHelpTopic(IAccessible *iface,
|
|
|
|
BSTR *pszHelpFile, VARIANT varID, LONG *pidTopic)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
|
|
|
FIXME("(%p)->(%p %s %p)\n", This, pszHelpFile, debugstr_variant(&varID), pidTopic);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_get_accKeyboardShortcut(IAccessible *iface,
|
2021-09-27 16:11:09 +02:00
|
|
|
VARIANT id, BSTR *shortcut)
|
2014-05-01 16:13:54 +02:00
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-01 16:14:58 +02:00
|
|
|
|
2021-09-27 16:11:09 +02:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&id), shortcut);
|
2014-05-01 16:14:58 +02:00
|
|
|
|
2021-09-27 16:11:09 +02:00
|
|
|
*shortcut = NULL;
|
|
|
|
if(This->vtbl && This->vtbl->get_kbd_shortcut)
|
|
|
|
return This->vtbl->get_kbd_shortcut(This, id, shortcut);
|
2014-05-01 16:14:58 +02:00
|
|
|
|
2021-09-27 16:11:09 +02:00
|
|
|
if(convert_child_id(&id) != CHILDID_SELF)
|
|
|
|
return E_INVALIDARG;
|
2014-05-01 16:14:58 +02:00
|
|
|
|
2021-09-27 16:11:09 +02:00
|
|
|
return win_get_kbd_shortcut(This->hwnd, shortcut);
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
2021-09-20 18:03:25 +02:00
|
|
|
static HRESULT WINAPI Client_get_accFocus(IAccessible *iface, VARIANT *focus)
|
2014-05-01 16:13:54 +02:00
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2021-09-20 18:03:25 +02:00
|
|
|
GUITHREADINFO info;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, focus);
|
|
|
|
|
|
|
|
V_VT(focus) = VT_EMPTY;
|
|
|
|
info.cbSize = sizeof(info);
|
|
|
|
if(GetGUIThreadInfo(0, &info) && info.hwndFocus) {
|
|
|
|
if(info.hwndFocus == This->hwnd) {
|
|
|
|
V_VT(focus) = VT_I4;
|
|
|
|
V_I4(focus) = CHILDID_SELF;
|
|
|
|
}
|
|
|
|
else if(IsChild(This->hwnd, info.hwndFocus)) {
|
|
|
|
IDispatch *disp;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = AccessibleObjectFromWindow(info.hwndFocus, OBJID_WINDOW,
|
|
|
|
&IID_IDispatch, (void**)&disp);
|
|
|
|
if(FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
if(!disp)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
V_VT(focus) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(focus) = disp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_get_accSelection(IAccessible *iface, VARIANT *pvarID)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, pvarID);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_get_accDefaultAction(IAccessible *iface,
|
|
|
|
VARIANT varID, BSTR *pszDefaultAction)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-01 16:14:53 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszDefaultAction);
|
|
|
|
|
|
|
|
*pszDefaultAction = NULL;
|
|
|
|
if(convert_child_id(&varID) != CHILDID_SELF)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
return S_FALSE;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_accSelect(IAccessible *iface, LONG flagsSelect, VARIANT varID)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2022-02-23 09:10:09 +01:00
|
|
|
FIXME("(%p)->(%lx %s)\n", This, flagsSelect, debugstr_variant(&varID));
|
2014-05-01 16:13:54 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_accLocation(IAccessible *iface, LONG *pxLeft,
|
|
|
|
LONG *pyTop, LONG *pcxWidth, LONG *pcyHeight, VARIANT varID)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-12 12:53:39 +02:00
|
|
|
RECT rect;
|
|
|
|
POINT pt;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p %p %p %p %s)\n", This, pxLeft, pyTop,
|
2014-05-01 16:13:54 +02:00
|
|
|
pcxWidth, pcyHeight, debugstr_variant(&varID));
|
2014-05-12 12:53:39 +02:00
|
|
|
|
|
|
|
*pxLeft = *pyTop = *pcxWidth = *pcyHeight = 0;
|
|
|
|
if(convert_child_id(&varID) != CHILDID_SELF)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if(!GetClientRect(This->hwnd, &rect))
|
|
|
|
return S_OK;
|
|
|
|
|
2019-03-24 14:26:44 +01:00
|
|
|
pt.x = rect.left;
|
2014-05-12 12:53:39 +02:00
|
|
|
pt.y = rect.top;
|
|
|
|
MapWindowPoints(This->hwnd, NULL, &pt, 1);
|
|
|
|
*pxLeft = pt.x;
|
|
|
|
*pyTop = pt.y;
|
|
|
|
|
|
|
|
pt.x = rect.right;
|
|
|
|
pt.y = rect.bottom;
|
|
|
|
MapWindowPoints(This->hwnd, NULL, &pt, 1);
|
|
|
|
*pcxWidth = pt.x - *pxLeft;
|
|
|
|
*pcyHeight = pt.y - *pyTop;
|
|
|
|
return S_OK;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_accNavigate(IAccessible *iface,
|
|
|
|
LONG navDir, VARIANT varStart, VARIANT *pvarEnd)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2022-02-23 09:10:09 +01:00
|
|
|
FIXME("(%p)->(%ld %s %p)\n", This, navDir, debugstr_variant(&varStart), pvarEnd);
|
2014-05-01 16:13:54 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_accHitTest(IAccessible *iface,
|
|
|
|
LONG xLeft, LONG yTop, VARIANT *pvarID)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2014-05-09 13:59:51 +02:00
|
|
|
HWND child;
|
|
|
|
POINT pt;
|
|
|
|
|
2022-02-23 09:10:09 +01:00
|
|
|
TRACE("(%p)->(%ld %ld %p)\n", This, xLeft, yTop, pvarID);
|
2014-05-09 13:59:51 +02:00
|
|
|
|
|
|
|
V_VT(pvarID) = VT_I4;
|
|
|
|
V_I4(pvarID) = 0;
|
|
|
|
|
|
|
|
pt.x = xLeft;
|
|
|
|
pt.y = yTop;
|
|
|
|
if(!IsWindowVisible(This->hwnd) || !ScreenToClient(This->hwnd, &pt))
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
child = ChildWindowFromPointEx(This->hwnd, pt, CWP_SKIPINVISIBLE);
|
|
|
|
if(!child || child==This->hwnd)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
V_VT(pvarID) = VT_DISPATCH;
|
|
|
|
return AccessibleObjectFromWindow(child, OBJID_WINDOW,
|
|
|
|
&IID_IDispatch, (void**)&V_DISPATCH(pvarID));
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_accDoDefaultAction(IAccessible *iface, VARIANT varID)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&varID));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_put_accName(IAccessible *iface, VARIANT varID, BSTR pszName)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
|
|
|
FIXME("(%p)->(%s %s)\n", This, debugstr_variant(&varID), debugstr_w(pszName));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2021-09-27 16:11:16 +02:00
|
|
|
static HRESULT WINAPI Client_put_accValue(IAccessible *iface, VARIANT id, BSTR value)
|
2014-05-01 16:13:54 +02:00
|
|
|
{
|
|
|
|
Client *This = impl_from_Client(iface);
|
2021-09-27 16:11:16 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&id), value);
|
|
|
|
|
2021-09-27 16:11:20 +02:00
|
|
|
if(This->vtbl && This->vtbl->put_value)
|
|
|
|
return This->vtbl->put_value(This, id, value);
|
|
|
|
|
2021-09-27 16:11:16 +02:00
|
|
|
if(convert_child_id(&id) != CHILDID_SELF)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
return S_FALSE;
|
2014-05-01 16:13:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IAccessibleVtbl ClientVtbl = {
|
|
|
|
Client_QueryInterface,
|
|
|
|
Client_AddRef,
|
|
|
|
Client_Release,
|
|
|
|
Client_GetTypeInfoCount,
|
|
|
|
Client_GetTypeInfo,
|
|
|
|
Client_GetIDsOfNames,
|
|
|
|
Client_Invoke,
|
|
|
|
Client_get_accParent,
|
|
|
|
Client_get_accChildCount,
|
|
|
|
Client_get_accChild,
|
|
|
|
Client_get_accName,
|
|
|
|
Client_get_accValue,
|
|
|
|
Client_get_accDescription,
|
|
|
|
Client_get_accRole,
|
|
|
|
Client_get_accState,
|
|
|
|
Client_get_accHelp,
|
|
|
|
Client_get_accHelpTopic,
|
|
|
|
Client_get_accKeyboardShortcut,
|
|
|
|
Client_get_accFocus,
|
|
|
|
Client_get_accSelection,
|
|
|
|
Client_get_accDefaultAction,
|
|
|
|
Client_accSelect,
|
|
|
|
Client_accLocation,
|
|
|
|
Client_accNavigate,
|
|
|
|
Client_accHitTest,
|
|
|
|
Client_accDoDefaultAction,
|
|
|
|
Client_put_accName,
|
|
|
|
Client_put_accValue
|
|
|
|
};
|
|
|
|
|
2014-05-15 17:53:13 +02:00
|
|
|
static inline Client* impl_from_Client_OleWindow(IOleWindow *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, Client, IOleWindow_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_OleWindow_QueryInterface(IOleWindow *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_OleWindow(iface);
|
|
|
|
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Client_OleWindow_AddRef(IOleWindow *iface)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_OleWindow(iface);
|
|
|
|
return IAccessible_AddRef(&This->IAccessible_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Client_OleWindow_Release(IOleWindow *iface)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_OleWindow(iface);
|
|
|
|
return IAccessible_Release(&This->IAccessible_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_OleWindow_GetWindow(IOleWindow *iface, HWND *phwnd)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_OleWindow(iface);
|
2014-05-15 17:53:37 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, phwnd);
|
|
|
|
|
|
|
|
*phwnd = This->hwnd;
|
|
|
|
return S_OK;
|
2014-05-15 17:53:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_OleWindow_ContextSensitiveHelp(IOleWindow *iface, BOOL fEnterMode)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_OleWindow(iface);
|
|
|
|
FIXME("(%p)->(%x)\n", This, fEnterMode);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleWindowVtbl ClientOleWindowVtbl = {
|
|
|
|
Client_OleWindow_QueryInterface,
|
|
|
|
Client_OleWindow_AddRef,
|
|
|
|
Client_OleWindow_Release,
|
|
|
|
Client_OleWindow_GetWindow,
|
|
|
|
Client_OleWindow_ContextSensitiveHelp
|
|
|
|
};
|
|
|
|
|
2015-03-21 11:25:45 +01:00
|
|
|
static inline Client* impl_from_Client_EnumVARIANT(IEnumVARIANT *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, Client, IEnumVARIANT_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_EnumVARIANT_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_EnumVARIANT(iface);
|
|
|
|
return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Client_EnumVARIANT_AddRef(IEnumVARIANT *iface)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_EnumVARIANT(iface);
|
|
|
|
return IAccessible_AddRef(&This->IAccessible_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Client_EnumVARIANT_Release(IEnumVARIANT *iface)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_EnumVARIANT(iface);
|
|
|
|
return IAccessible_Release(&This->IAccessible_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_EnumVARIANT_Next(IEnumVARIANT *iface,
|
|
|
|
ULONG celt, VARIANT *rgVar, ULONG *pCeltFetched)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_EnumVARIANT(iface);
|
2015-03-21 13:19:59 +01:00
|
|
|
HWND cur = This->enum_pos, next;
|
|
|
|
ULONG fetched = 0;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-23 09:10:09 +01:00
|
|
|
TRACE("(%p)->(%lu %p %p)\n", This, celt, rgVar, pCeltFetched);
|
2015-03-21 13:19:59 +01:00
|
|
|
|
|
|
|
if(!celt) {
|
|
|
|
if(pCeltFetched)
|
|
|
|
*pCeltFetched = 0;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!This->enum_pos)
|
|
|
|
next = GetWindow(This->hwnd, GW_CHILD);
|
|
|
|
else
|
|
|
|
next = GetWindow(This->enum_pos, GW_HWNDNEXT);
|
|
|
|
|
|
|
|
while(next) {
|
|
|
|
cur = next;
|
|
|
|
|
|
|
|
V_VT(rgVar+fetched) = VT_DISPATCH;
|
|
|
|
hr = AccessibleObjectFromWindow(cur, OBJID_WINDOW,
|
|
|
|
&IID_IDispatch, (void**)&V_DISPATCH(rgVar+fetched));
|
|
|
|
if(FAILED(hr)) {
|
|
|
|
V_VT(rgVar+fetched) = VT_EMPTY;
|
|
|
|
while(fetched > 0) {
|
|
|
|
VariantClear(rgVar+fetched-1);
|
|
|
|
fetched--;
|
|
|
|
}
|
|
|
|
if(pCeltFetched)
|
|
|
|
*pCeltFetched = 0;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
fetched++;
|
|
|
|
if(fetched == celt)
|
|
|
|
break;
|
|
|
|
|
|
|
|
next = GetWindow(cur, GW_HWNDNEXT);
|
|
|
|
}
|
|
|
|
|
|
|
|
This->enum_pos = cur;
|
|
|
|
if(pCeltFetched)
|
|
|
|
*pCeltFetched = fetched;
|
|
|
|
return celt == fetched ? S_OK : S_FALSE;
|
2015-03-21 11:25:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_EnumVARIANT_Skip(IEnumVARIANT *iface, ULONG celt)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_EnumVARIANT(iface);
|
2015-03-21 13:19:59 +01:00
|
|
|
HWND next;
|
|
|
|
|
2022-02-23 09:10:09 +01:00
|
|
|
TRACE("(%p)->(%lu)\n", This, celt);
|
2015-03-21 13:19:59 +01:00
|
|
|
|
|
|
|
while(celt) {
|
|
|
|
if(!This->enum_pos)
|
|
|
|
next = GetWindow(This->hwnd, GW_CHILD);
|
|
|
|
else
|
|
|
|
next = GetWindow(This->enum_pos, GW_HWNDNEXT);
|
|
|
|
if(!next)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
This->enum_pos = next;
|
|
|
|
celt--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2015-03-21 11:25:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_EnumVARIANT_Reset(IEnumVARIANT *iface)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_EnumVARIANT(iface);
|
2015-03-21 13:19:59 +01:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
This->enum_pos = 0;
|
|
|
|
return S_OK;
|
2015-03-21 11:25:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Client_EnumVARIANT_Clone(IEnumVARIANT *iface, IEnumVARIANT **ppEnum)
|
|
|
|
{
|
|
|
|
Client *This = impl_from_Client_EnumVARIANT(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, ppEnum);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IEnumVARIANTVtbl ClientEnumVARIANTVtbl = {
|
|
|
|
Client_EnumVARIANT_QueryInterface,
|
|
|
|
Client_EnumVARIANT_AddRef,
|
|
|
|
Client_EnumVARIANT_Release,
|
|
|
|
Client_EnumVARIANT_Next,
|
|
|
|
Client_EnumVARIANT_Skip,
|
|
|
|
Client_EnumVARIANT_Reset,
|
|
|
|
Client_EnumVARIANT_Clone
|
|
|
|
};
|
|
|
|
|
2022-04-25 21:08:01 +02:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2021-09-27 16:10:55 +02:00
|
|
|
static void edit_init(Client *client)
|
|
|
|
{
|
|
|
|
client->role = ROLE_SYSTEM_TEXT;
|
|
|
|
}
|
|
|
|
|
2021-09-27 16:10:59 +02:00
|
|
|
static HRESULT edit_get_state(Client *client, VARIANT id, VARIANT *state)
|
|
|
|
{
|
|
|
|
HRESULT hres;
|
|
|
|
LONG style;
|
|
|
|
|
|
|
|
hres = client_get_state(client, id, state);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
assert(V_VT(state) == VT_I4);
|
|
|
|
|
|
|
|
style = GetWindowLongW(client->hwnd, GWL_STYLE);
|
|
|
|
if(style & ES_READONLY)
|
|
|
|
V_I4(state) |= STATE_SYSTEM_READONLY;
|
|
|
|
if(style & ES_PASSWORD)
|
|
|
|
V_I4(state) |= STATE_SYSTEM_PROTECTED;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-09-27 16:11:05 +02:00
|
|
|
/*
|
|
|
|
* Edit control objects have their name property defined by the first static
|
|
|
|
* text control preceding them in the order of window creation. If one is not
|
|
|
|
* found, the edit has no name property. In the case of the keyboard shortcut
|
|
|
|
* property, the first preceding visible static text control is used.
|
|
|
|
*/
|
|
|
|
static HWND edit_find_label(HWND hwnd, BOOL visible)
|
|
|
|
{
|
|
|
|
HWND cur;
|
|
|
|
|
|
|
|
for(cur = hwnd; cur; cur = GetWindow(cur, GW_HWNDPREV)) {
|
|
|
|
WCHAR class_name[64];
|
|
|
|
|
|
|
|
if(!RealGetWindowClassW(cur, class_name, ARRAY_SIZE(class_name)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(!wcsicmp(class_name, WC_STATICW)) {
|
|
|
|
if(visible && !(GetWindowLongW(cur, GWL_STYLE) & WS_VISIBLE))
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return cur;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT edit_get_name(Client *client, VARIANT id, BSTR *name)
|
|
|
|
{
|
|
|
|
HWND label;
|
|
|
|
|
|
|
|
if(convert_child_id(&id) != CHILDID_SELF || !IsWindow(client->hwnd))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
label = edit_find_label(client->hwnd, FALSE);
|
|
|
|
if(!label)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
return win_get_name(label, name);
|
|
|
|
}
|
|
|
|
|
2021-09-27 16:11:09 +02:00
|
|
|
static HRESULT edit_get_kbd_shortcut(Client *client, VARIANT id, BSTR *shortcut)
|
|
|
|
{
|
|
|
|
HWND label;
|
|
|
|
|
|
|
|
if(convert_child_id(&id) != CHILDID_SELF)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
label = edit_find_label(client->hwnd, TRUE);
|
|
|
|
if(!label)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
return win_get_kbd_shortcut(label, shortcut);
|
|
|
|
}
|
|
|
|
|
2021-09-27 16:11:13 +02:00
|
|
|
static HRESULT edit_get_value(Client *client, VARIANT id, BSTR *value_out)
|
|
|
|
{
|
|
|
|
WCHAR *buf;
|
|
|
|
UINT len;
|
|
|
|
|
|
|
|
if(convert_child_id(&id) != CHILDID_SELF)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if(GetWindowLongW(client->hwnd, GWL_STYLE) & ES_PASSWORD)
|
|
|
|
return E_ACCESSDENIED;
|
|
|
|
|
|
|
|
len = SendMessageW(client->hwnd, WM_GETTEXTLENGTH, 0, 0);
|
|
|
|
buf = heap_alloc_zero((len + 1) * sizeof(*buf));
|
|
|
|
if(!buf)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
SendMessageW(client->hwnd, WM_GETTEXT, len + 1, (LPARAM)buf);
|
|
|
|
*value_out = SysAllocString(buf);
|
|
|
|
heap_free(buf);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-09-27 16:11:20 +02:00
|
|
|
static HRESULT edit_put_value(Client *client, VARIANT id, BSTR value)
|
|
|
|
{
|
|
|
|
if(convert_child_id(&id) != CHILDID_SELF || !IsWindow(client->hwnd))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
SendMessageW(client->hwnd, WM_SETTEXT, 0, (LPARAM)value);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-09-27 16:10:55 +02:00
|
|
|
static const win_class_vtbl edit_vtbl = {
|
|
|
|
edit_init,
|
2021-09-27 16:10:59 +02:00
|
|
|
edit_get_state,
|
2021-09-27 16:11:05 +02:00
|
|
|
edit_get_name,
|
2021-09-27 16:11:09 +02:00
|
|
|
edit_get_kbd_shortcut,
|
2021-09-27 16:11:13 +02:00
|
|
|
edit_get_value,
|
2021-09-27 16:11:20 +02:00
|
|
|
edit_put_value,
|
2021-09-27 16:10:55 +02:00
|
|
|
};
|
|
|
|
|
2021-09-27 16:10:51 +02:00
|
|
|
static const struct win_class_data classes[] = {
|
|
|
|
{WC_LISTBOXW, 0x10000, TRUE},
|
|
|
|
{L"#32768", 0x10001, TRUE}, /* menu */
|
|
|
|
{WC_BUTTONW, 0x10002, TRUE},
|
|
|
|
{WC_STATICW, 0x10003, TRUE},
|
2021-09-27 16:10:55 +02:00
|
|
|
{WC_EDITW, 0x10004, FALSE, &edit_vtbl},
|
2021-09-27 16:10:51 +02:00
|
|
|
{WC_COMBOBOXW, 0x10005, TRUE},
|
|
|
|
{L"#32770", 0x10006, TRUE}, /* dialog */
|
|
|
|
{L"#32771", 0x10007, TRUE}, /* winswitcher */
|
|
|
|
{L"MDIClient", 0x10008, TRUE},
|
|
|
|
{L"#32769", 0x10009, TRUE}, /* desktop */
|
|
|
|
{WC_SCROLLBARW, 0x1000a, TRUE},
|
|
|
|
{STATUSCLASSNAMEW, 0x1000b, TRUE},
|
|
|
|
{TOOLBARCLASSNAMEW, 0x1000c, TRUE},
|
|
|
|
{PROGRESS_CLASSW, 0x1000d, TRUE},
|
|
|
|
{ANIMATE_CLASSW, 0x1000e, TRUE},
|
|
|
|
{WC_TABCONTROLW, 0x1000f, TRUE},
|
|
|
|
{HOTKEY_CLASSW, 0x10010, TRUE},
|
|
|
|
{WC_HEADERW, 0x10011, TRUE},
|
|
|
|
{TRACKBAR_CLASSW, 0x10012, TRUE},
|
|
|
|
{WC_LISTVIEWW, 0x10013, TRUE},
|
|
|
|
{UPDOWN_CLASSW, 0x10016, TRUE},
|
|
|
|
{TOOLTIPS_CLASSW, 0x10018, TRUE},
|
|
|
|
{WC_TREEVIEWW, 0x10019, TRUE},
|
|
|
|
{DATETIMEPICK_CLASSW, 0, TRUE},
|
|
|
|
{WC_IPADDRESSW, 0, TRUE},
|
|
|
|
{L"RICHEDIT", 0x1001c, TRUE},
|
|
|
|
{L"RichEdit20A", 0, TRUE},
|
|
|
|
{L"RichEdit20W", 0, TRUE},
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
2014-05-01 16:13:54 +02:00
|
|
|
HRESULT create_client_object(HWND hwnd, const IID *iid, void **obj)
|
|
|
|
{
|
2021-09-27 16:10:55 +02:00
|
|
|
const struct win_class_data *data;
|
2014-05-01 16:13:54 +02:00
|
|
|
Client *client;
|
2021-09-27 16:10:55 +02:00
|
|
|
HRESULT hres = S_OK;
|
2014-05-01 16:13:54 +02:00
|
|
|
|
|
|
|
if(!IsWindow(hwnd))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
client = heap_alloc_zero(sizeof(Client));
|
|
|
|
if(!client)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2021-09-27 16:10:55 +02:00
|
|
|
data = find_class_data(hwnd, classes);
|
2021-09-27 16:10:51 +02:00
|
|
|
|
2014-05-01 16:13:54 +02:00
|
|
|
client->IAccessible_iface.lpVtbl = &ClientVtbl;
|
2014-05-15 17:53:13 +02:00
|
|
|
client->IOleWindow_iface.lpVtbl = &ClientOleWindowVtbl;
|
2015-03-21 11:25:45 +01:00
|
|
|
client->IEnumVARIANT_iface.lpVtbl = &ClientEnumVARIANTVtbl;
|
2022-04-25 21:08:01 +02:00
|
|
|
client->IServiceProvider_iface.lpVtbl = &ClientServiceProviderVtbl;
|
2014-05-01 16:13:54 +02:00
|
|
|
client->ref = 1;
|
|
|
|
client->hwnd = hwnd;
|
2015-03-21 13:19:59 +01:00
|
|
|
client->enum_pos = 0;
|
2021-09-27 16:10:55 +02:00
|
|
|
client->role = ROLE_SYSTEM_CLIENT;
|
|
|
|
|
|
|
|
if(data)
|
|
|
|
client->vtbl = data->vtbl;
|
|
|
|
if(client->vtbl && client->vtbl->init)
|
|
|
|
client->vtbl->init(client);
|
2014-05-01 16:13:54 +02:00
|
|
|
|
|
|
|
hres = IAccessible_QueryInterface(&client->IAccessible_iface, iid, obj);
|
|
|
|
IAccessible_Release(&client->IAccessible_iface);
|
|
|
|
return hres;
|
|
|
|
}
|