2014-12-24 19:15:45 -06:00
|
|
|
// 24 december 2014
|
|
|
|
|
|
|
|
struct tableAcc {
|
2014-12-25 13:32:49 -06:00
|
|
|
IAccessibleVtbl *vtbl;
|
2014-12-24 19:15:45 -06:00
|
|
|
ULONG refcount;
|
|
|
|
struct table *t;
|
2015-01-04 00:13:35 -06:00
|
|
|
IAccessible *std;
|
2015-02-12 20:40:54 -06:00
|
|
|
|
2015-02-12 22:47:32 -06:00
|
|
|
LONG role;
|
2015-02-12 20:40:54 -06:00
|
|
|
intptr_t row;
|
|
|
|
intptr_t column;
|
2014-12-24 19:15:45 -06:00
|
|
|
};
|
|
|
|
|
2015-01-03 23:54:38 -06:00
|
|
|
#define TA ((struct tableAcc *) this)
|
|
|
|
|
2014-12-24 19:55:13 -06:00
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccQueryInterface(IAccessible *this, REFIID riid, void **ppvObject)
|
2014-12-24 19:15:45 -06:00
|
|
|
{
|
|
|
|
if (ppvObject == NULL)
|
|
|
|
return E_POINTER;
|
2014-12-24 20:53:30 -06:00
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid, &IID_IDispatch) ||
|
|
|
|
IsEqualIID(riid, &IID_IAccessible)) {
|
2015-01-03 23:58:28 -06:00
|
|
|
// TODO figure out what pointer to use here
|
2015-01-03 23:54:38 -06:00
|
|
|
TA->vtbl->AddRef(TA);
|
2014-12-24 19:15:45 -06:00
|
|
|
*ppvObject = (void *) this;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
*ppvObject = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO use InterlockedIncrement()/InterlockedDecrement() for these?
|
|
|
|
|
2014-12-24 19:55:13 -06:00
|
|
|
static ULONG STDMETHODCALLTYPE tableAccAddRef(IAccessible *this)
|
2014-12-24 19:15:45 -06:00
|
|
|
{
|
|
|
|
TA->refcount++;
|
2014-12-25 14:56:06 -06:00
|
|
|
// TODO correct?
|
2014-12-24 19:15:45 -06:00
|
|
|
return TA->refcount;
|
|
|
|
}
|
|
|
|
|
2014-12-24 19:55:13 -06:00
|
|
|
static ULONG STDMETHODCALLTYPE tableAccRelease(IAccessible *this)
|
2014-12-24 19:15:45 -06:00
|
|
|
{
|
|
|
|
TA->refcount--;
|
|
|
|
if (TA->refcount == 0) {
|
2015-01-04 00:13:35 -06:00
|
|
|
IAccessible_Release(TA->std);
|
2015-01-03 23:58:28 -06:00
|
|
|
tableFree(TA, "error freeing Table accessibility object");
|
2014-12-24 19:15:45 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return TA->refcount;
|
|
|
|
}
|
|
|
|
|
2015-02-13 13:31:03 -06:00
|
|
|
// IDispatch
|
|
|
|
// TODO make sure relegating these to the standard accessibility object is harmless
|
2014-12-24 19:55:13 -06:00
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccGetTypeInfoCount(IAccessible *this, UINT *pctinfo)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_GetTypeInfoCount(TA->std, pctinfo);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccGetTypeInfo(IAccessible *this, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_GetTypeInfo(TA->std, iTInfo, lcid, ppTInfo);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccGetIDsOfNames(IAccessible *this, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_GetIDsOfNames(TA->std, riid, rgszNames, cNames, lcid, rgDispId);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccInvoke(IAccessible *this, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_Invoke(TA->std, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// IAccessible
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accParent(IAccessible *this, IDispatch **ppdispParent)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accParent(TA->std, ppdispParent);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accChildCount(IAccessible *this, long *pcountChildren)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accChildCount(TA->std, pcountChildren);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accChild(IAccessible *this, VARIANT varChild, IDispatch **ppdispChild)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accChild(TA->std, varChild, ppdispChild);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accName(IAccessible *this, VARIANT varChild, BSTR *pszName)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accName(TA->std, varChild, pszName);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accValue(IAccessible *this, VARIANT varChild, BSTR *pszValue)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accValue(TA->std, varChild, pszValue);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accDescription(IAccessible *this, VARIANT varChild, BSTR *pszDescription)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accDescription(TA->std, varChild, pszDescription);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accRole(IAccessible *this, VARIANT varChild, VARIANT *pvarRole)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accRole(TA->std, varChild, pvarRole);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accState(IAccessible *this, VARIANT varChild, VARIANT *pvarState)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accState(TA->std, varChild, pvarState);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accHelp(IAccessible *this, VARIANT varChild, BSTR *pszHelp)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accHelp(TA->std, varChild, pszHelp);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accHelpTopic(IAccessible *this, BSTR *pszHelpFile, VARIANT varChild, long *pidTopic)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accHelpTopic(TA->std, pszHelpFile, varChild, pidTopic);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accKeyboardShortcut(IAccessible *this, VARIANT varChild, BSTR *pszKeyboardShortcut)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accKeyboardShortcut(TA->std, varChild, pszKeyboardShortcut);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accFocus(IAccessible *this, VARIANT *pvarChild)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accFocus(TA->std, pvarChild);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accSelection(IAccessible *this, VARIANT *pvarChildren)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accSelection(TA->std, pvarChildren);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccget_accDefaultAction(IAccessible *this, VARIANT varChild, BSTR *pszDefaultAction)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_get_accDefaultAction(TA->std, varChild, pszDefaultAction);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccaccSelect(IAccessible *this, long flagsSelect, VARIANT varChild)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_accSelect(TA->std, flagsSelect, varChild);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccaccLocation(IAccessible *this, long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varChild)
|
|
|
|
{
|
2015-01-04 00:13:35 -06:00
|
|
|
return IAccessible_accLocation(TA->std, pxLeft, pyTop, pcxWidth, pcyHeight, varChild);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccaccNavigate(IAccessible *this, long navDir, VARIANT varStart, VARIANT *pvarEndUpAt)
|
|
|
|
{
|
2015-01-04 00:13:35 -06:00
|
|
|
return IAccessible_accNavigate(TA->std, navDir, varStart, pvarEndUpAt);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccaccHitTest(IAccessible *this, long xLeft, long yTop, VARIANT *pvarChild)
|
|
|
|
{
|
2015-01-04 00:13:35 -06:00
|
|
|
return IAccessible_accHitTest(TA->std, xLeft, yTop, pvarChild);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccaccDoDefaultAction(IAccessible *this, VARIANT varChild)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_accDoDefaultAction(TA->std, varChild);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccput_accName(IAccessible *this, VARIANT varChild, BSTR szName)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_put_accName(TA->std, varChild, szName);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE tableAccput_accValue(IAccessible *this, VARIANT varChild, BSTR szValue)
|
|
|
|
{
|
2015-02-13 13:31:03 -06:00
|
|
|
return IAccessible_put_accValue(TA->std, varChild, szValue);
|
2014-12-24 19:55:13 -06:00
|
|
|
}
|
|
|
|
|
2014-12-24 19:15:45 -06:00
|
|
|
static const IAccessibleVtbl tableAccVtbl = {
|
|
|
|
.QueryInterface = tableAccQueryInterface,
|
|
|
|
.AddRef = tableAccAddRef,
|
|
|
|
.Release = tableAccRelease,
|
2014-12-24 19:55:13 -06:00
|
|
|
.GetTypeInfoCount = tableAccGetTypeInfoCount,
|
|
|
|
.GetTypeInfo = tableAccGetTypeInfo,
|
|
|
|
.GetIDsOfNames = tableAccGetIDsOfNames,
|
|
|
|
.Invoke = tableAccInvoke,
|
|
|
|
.get_accParent = tableAccget_accParent,
|
|
|
|
.get_accChildCount = tableAccget_accChildCount,
|
|
|
|
.get_accChild = tableAccget_accChild,
|
|
|
|
.get_accName = tableAccget_accName,
|
|
|
|
.get_accValue = tableAccget_accValue,
|
|
|
|
.get_accDescription = tableAccget_accDescription,
|
|
|
|
.get_accRole = tableAccget_accRole,
|
|
|
|
.get_accState = tableAccget_accState,
|
|
|
|
.get_accHelp = tableAccget_accHelp,
|
|
|
|
.get_accHelpTopic = tableAccget_accHelpTopic,
|
|
|
|
.get_accKeyboardShortcut = tableAccget_accKeyboardShortcut,
|
|
|
|
.get_accFocus = tableAccget_accFocus,
|
|
|
|
.get_accSelection = tableAccget_accSelection,
|
|
|
|
.get_accDefaultAction = tableAccget_accDefaultAction,
|
|
|
|
.accSelect = tableAccaccSelect,
|
|
|
|
.accLocation = tableAccaccLocation,
|
|
|
|
.accNavigate = tableAccaccNavigate,
|
|
|
|
.accHitTest = tableAccaccHitTest,
|
|
|
|
.accDoDefaultAction = tableAccaccDoDefaultAction,
|
|
|
|
.put_accName = tableAccput_accName,
|
|
|
|
.put_accValue = tableAccput_accValue,
|
2014-12-24 19:15:45 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct tableAcc *newTableAcc(struct table *t)
|
|
|
|
{
|
|
|
|
struct tableAcc *ta;
|
2015-01-04 00:13:35 -06:00
|
|
|
HRESULT hr;
|
|
|
|
IAccessible *std;
|
2014-12-24 19:15:45 -06:00
|
|
|
|
|
|
|
ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object");
|
2014-12-25 13:32:49 -06:00
|
|
|
ta->vtbl = &tableAccVtbl;
|
|
|
|
ta->vtbl->AddRef(ta);
|
2014-12-24 19:15:45 -06:00
|
|
|
ta->t = t;
|
2015-01-04 00:13:35 -06:00
|
|
|
hr = CreateStdAccessibleObject(t->hwnd, OBJID_CLIENT, &IID_IAccessible, &std);
|
|
|
|
if (hr != S_OK)
|
|
|
|
// TODO panichresult
|
|
|
|
panic("error creating standard accessible object for Table");
|
|
|
|
ta->std = std;
|
2015-02-12 20:40:54 -06:00
|
|
|
ta->role = ROLE_SYSTEM_TABLE;
|
|
|
|
ta->row = -1;
|
|
|
|
ta->column = -1;
|
2014-12-24 19:15:45 -06:00
|
|
|
return ta;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void freeTableAcc(struct tableAcc *ta)
|
|
|
|
{
|
|
|
|
ta->t = NULL;
|
2014-12-25 13:32:49 -06:00
|
|
|
ta->vtbl->Release(ta);
|
2014-12-24 19:15:45 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
HANDLER(accessibilityHandler)
|
|
|
|
{
|
|
|
|
if (uMsg != WM_GETOBJECT)
|
|
|
|
return FALSE;
|
2014-12-25 13:32:49 -06:00
|
|
|
if (((DWORD) lParam) != OBJID_CLIENT)
|
2014-12-24 19:15:45 -06:00
|
|
|
return FALSE;
|
2014-12-24 20:53:30 -06:00
|
|
|
*lResult = LresultFromObject(&IID_IAccessible, wParam, t->ta);
|
2014-12-24 19:15:45 -06:00
|
|
|
// TODO check *lResult
|
|
|
|
return TRUE;
|
|
|
|
}
|