Commit abc1f7da authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Implement UiaLookupId for AutomationIdentifierType_Pattern GUIDs.

parent 51aa5316
......@@ -4063,6 +4063,45 @@ static const struct uia_lookup_id uia_event_lookup_ids[] = {
{ &Notification_Event_GUID, UIA_NotificationEventId },
};
static const struct uia_lookup_id uia_pattern_lookup_ids[] = {
{ &Invoke_Pattern_GUID, UIA_InvokePatternId },
{ &Selection_Pattern_GUID, UIA_SelectionPatternId },
{ &Value_Pattern_GUID, UIA_ValuePatternId },
{ &RangeValue_Pattern_GUID, UIA_RangeValuePatternId },
{ &Scroll_Pattern_GUID, UIA_ScrollPatternId },
{ &ExpandCollapse_Pattern_GUID, UIA_ExpandCollapsePatternId },
{ &Grid_Pattern_GUID, UIA_GridPatternId },
{ &GridItem_Pattern_GUID, UIA_GridItemPatternId },
{ &MultipleView_Pattern_GUID, UIA_MultipleViewPatternId },
{ &Window_Pattern_GUID, UIA_WindowPatternId },
{ &SelectionItem_Pattern_GUID, UIA_SelectionItemPatternId },
{ &Dock_Pattern_GUID, UIA_DockPatternId },
{ &Table_Pattern_GUID, UIA_TablePatternId },
{ &TableItem_Pattern_GUID, UIA_TableItemPatternId },
{ &Text_Pattern_GUID, UIA_TextPatternId },
{ &Toggle_Pattern_GUID, UIA_TogglePatternId },
{ &Transform_Pattern_GUID, UIA_TransformPatternId },
{ &ScrollItem_Pattern_GUID, UIA_ScrollItemPatternId },
{ &LegacyIAccessible_Pattern_GUID, UIA_LegacyIAccessiblePatternId },
{ &ItemContainer_Pattern_GUID, UIA_ItemContainerPatternId },
{ &VirtualizedItem_Pattern_GUID, UIA_VirtualizedItemPatternId },
{ &SynchronizedInput_Pattern_GUID, UIA_SynchronizedInputPatternId },
/* Implemented on Win8+ */
{ &ObjectModel_Pattern_GUID, UIA_ObjectModelPatternId },
{ &Annotation_Pattern_GUID, UIA_AnnotationPatternId },
{ &Text_Pattern2_GUID, UIA_TextPattern2Id },
{ &Styles_Pattern_GUID, UIA_StylesPatternId },
{ &Spreadsheet_Pattern_GUID, UIA_SpreadsheetPatternId },
{ &SpreadsheetItem_Pattern_GUID, UIA_SpreadsheetItemPatternId },
{ &Tranform_Pattern2_GUID, UIA_TransformPattern2Id },
{ &TextChild_Pattern_GUID, UIA_TextChildPatternId },
{ &Drag_Pattern_GUID, UIA_DragPatternId },
{ &DropTarget_Pattern_GUID, UIA_DropTargetPatternId },
{ &TextEdit_Pattern_GUID, UIA_TextEditPatternId },
/* Implemented on Win10+. */
{ &CustomNavigation_Pattern_GUID, UIA_CustomNavigationPatternId },
};
static void test_UiaLookupId(void)
{
static const struct {
......@@ -4074,6 +4113,7 @@ static void test_UiaLookupId(void)
{
{ "property", AutomationIdentifierType_Property, uia_property_lookup_ids, ARRAY_SIZE(uia_property_lookup_ids) },
{ "event", AutomationIdentifierType_Event, uia_event_lookup_ids, ARRAY_SIZE(uia_event_lookup_ids) },
{ "pattern", AutomationIdentifierType_Pattern, uia_pattern_lookup_ids, ARRAY_SIZE(uia_pattern_lookup_ids) },
};
unsigned int i, y;
......
......@@ -33,6 +33,12 @@ struct uia_event_info {
int event_arg_type;
};
struct uia_pattern_info {
const GUID *guid;
int pattern_id;
const GUID *pattern_iid;
};
[
version(1.0),
uuid(8a9ca8eb-856b-43d9-abd7-4a590054064f),
......
......@@ -37,6 +37,13 @@ static int __cdecl uia_event_guid_compare(const void *a, const void *b)
return memcmp(guid, event->guid, sizeof(*guid));
}
static int __cdecl uia_pattern_guid_compare(const void *a, const void *b)
{
const GUID *guid = a;
const struct uia_pattern_info *pattern = b;
return memcmp(guid, pattern->guid, sizeof(*guid));
}
/* Sorted by GUID. */
static const struct uia_prop_info default_uia_properties[] = {
{ &AutomationId_Property_GUID, UIA_AutomationIdPropertyId,
......@@ -402,6 +409,89 @@ static const struct uia_event_info *uia_event_info_from_guid(const GUID *guid)
return NULL;
}
/* Sorted by GUID. */
static const struct uia_pattern_info default_uia_patterns[] = {
{ &ScrollItem_Pattern_GUID, UIA_ScrollItemPatternId,
&IID_IScrollItemProvider, },
{ &Tranform_Pattern2_GUID, UIA_TransformPattern2Id,
&IID_ITransformProvider2, },
{ &ItemContainer_Pattern_GUID, UIA_ItemContainerPatternId,
&IID_IItemContainerProvider, },
{ &Drag_Pattern_GUID, UIA_DragPatternId,
&IID_IDragProvider, },
{ &Window_Pattern_GUID, UIA_WindowPatternId,
&IID_IWindowProvider, },
{ &VirtualizedItem_Pattern_GUID, UIA_VirtualizedItemPatternId,
&IID_IVirtualizedItemProvider, },
{ &Dock_Pattern_GUID, UIA_DockPatternId,
&IID_IDockProvider, },
{ &Styles_Pattern_GUID, UIA_StylesPatternId,
&IID_IStylesProvider, },
{ &DropTarget_Pattern_GUID, UIA_DropTargetPatternId,
&IID_IDropTargetProvider, },
{ &Text_Pattern_GUID, UIA_TextPatternId,
&IID_ITextProvider, },
{ &Toggle_Pattern_GUID, UIA_TogglePatternId,
&IID_IToggleProvider, },
{ &GridItem_Pattern_GUID, UIA_GridItemPatternId,
&IID_IGridItemProvider, },
{ &RangeValue_Pattern_GUID, UIA_RangeValuePatternId,
&IID_IRangeValueProvider, },
{ &TextEdit_Pattern_GUID, UIA_TextEditPatternId,
&IID_ITextEditProvider, },
{ &CustomNavigation_Pattern_GUID, UIA_CustomNavigationPatternId,
&IID_ICustomNavigationProvider, },
{ &Table_Pattern_GUID, UIA_TablePatternId,
&IID_ITableProvider, },
{ &Value_Pattern_GUID, UIA_ValuePatternId,
&IID_IValueProvider, },
{ &LegacyIAccessible_Pattern_GUID, UIA_LegacyIAccessiblePatternId,
&IID_ILegacyIAccessibleProvider, },
{ &Text_Pattern2_GUID, UIA_TextPattern2Id,
&IID_ITextProvider2, },
{ &ExpandCollapse_Pattern_GUID, UIA_ExpandCollapsePatternId,
&IID_IExpandCollapseProvider, },
{ &SynchronizedInput_Pattern_GUID, UIA_SynchronizedInputPatternId,
&IID_ISynchronizedInputProvider, },
{ &Scroll_Pattern_GUID, UIA_ScrollPatternId,
&IID_IScrollProvider, },
{ &TextChild_Pattern_GUID, UIA_TextChildPatternId,
&IID_ITextChildProvider, },
{ &TableItem_Pattern_GUID, UIA_TableItemPatternId,
&IID_ITableItemProvider, },
{ &Spreadsheet_Pattern_GUID, UIA_SpreadsheetPatternId,
&IID_ISpreadsheetProvider, },
{ &Grid_Pattern_GUID, UIA_GridPatternId,
&IID_IGridProvider, },
{ &Annotation_Pattern_GUID, UIA_AnnotationPatternId,
&IID_IAnnotationProvider, },
{ &Transform_Pattern_GUID, UIA_TransformPatternId,
&IID_ITransformProvider, },
{ &MultipleView_Pattern_GUID, UIA_MultipleViewPatternId,
&IID_IMultipleViewProvider, },
{ &Selection_Pattern_GUID, UIA_SelectionPatternId,
&IID_ISelectionProvider, },
{ &SelectionItem_Pattern_GUID, UIA_SelectionItemPatternId,
&IID_ISelectionItemProvider, },
{ &Invoke_Pattern_GUID, UIA_InvokePatternId,
&IID_IInvokeProvider, },
{ &ObjectModel_Pattern_GUID, UIA_ObjectModelPatternId,
&IID_IObjectModelProvider, },
{ &SpreadsheetItem_Pattern_GUID, UIA_SpreadsheetItemPatternId,
&IID_ISpreadsheetItemProvider, },
};
static const struct uia_pattern_info *uia_pattern_info_from_guid(const GUID *guid)
{
struct uia_pattern_info *pattern;
if ((pattern = bsearch(guid, default_uia_patterns, ARRAY_SIZE(default_uia_patterns), sizeof(*pattern),
uia_pattern_guid_compare)))
return pattern;
return NULL;
}
/***********************************************************************
* UiaLookupId (uiautomationcore.@)
*/
......@@ -438,6 +528,17 @@ int WINAPI UiaLookupId(enum AutomationIdentifierType type, const GUID *guid)
}
case AutomationIdentifierType_Pattern:
{
const struct uia_pattern_info *pattern = uia_pattern_info_from_guid(guid);
if (pattern)
ret_id = pattern->pattern_id;
else
FIXME("Failed to find patternId for GUID %s\n", debugstr_guid(guid));
break;
}
case AutomationIdentifierType_ControlType:
case AutomationIdentifierType_TextAttribute:
case AutomationIdentifierType_LandmarkType:
......
......@@ -261,6 +261,44 @@ DEFINE_GUID(TextEdit_ConversionTargetChanged_Event_GUID, 0x3388c18
DEFINE_GUID(Changes_Event_GUID, 0x7df26714,0x614f,0x4e05,0x94,0x88,0x71,0x6c,0x5b,0xa1,0x94,0x36);
DEFINE_GUID(Notification_Event_GUID, 0x72c5a2f7,0x9788,0x480f,0xb8,0xeb,0x4d,0xee,0x00,0xf6,0x18,0x6f);
/*
* AutomationIdentifierType_Pattern GUIDs.
*/
DEFINE_GUID(Invoke_Pattern_GUID, 0xd976c2fc,0x66ea,0x4a6e,0xb2,0x8f,0xc2,0x4c,0x75,0x46,0xad,0x37);
DEFINE_GUID(Selection_Pattern_GUID, 0x66e3b7e8,0xd821,0x4d25,0x87,0x61,0x43,0x5d,0x2c,0x8b,0x25,0x3f);
DEFINE_GUID(Value_Pattern_GUID, 0x17faad9e,0xc877,0x475b,0xb9,0x33,0x77,0x33,0x27,0x79,0xb6,0x37);
DEFINE_GUID(RangeValue_Pattern_GUID, 0x18b00d87,0xb1c9,0x476a,0xbf,0xbd,0x5f,0x0b,0xdb,0x92,0x6f,0x63);
DEFINE_GUID(Scroll_Pattern_GUID, 0x895fa4b4,0x759d,0x4c50,0x8e,0x15,0x03,0x46,0x06,0x72,0x00,0x3c);
DEFINE_GUID(ExpandCollapse_Pattern_GUID, 0xae05efa2,0xf9d1,0x428a,0x83,0x4c,0x53,0xa5,0xc5,0x2f,0x9b,0x8b);
DEFINE_GUID(Grid_Pattern_GUID, 0x260a2ccb,0x93a8,0x4e44,0xa4,0xc1,0x3d,0xf3,0x97,0xf2,0xb0,0x2b);
DEFINE_GUID(GridItem_Pattern_GUID, 0xf2d5c877,0xa462,0x4957,0xa2,0xa5,0x2c,0x96,0xb3,0x03,0xbc,0x63);
DEFINE_GUID(MultipleView_Pattern_GUID, 0x547a6ae4,0x113f,0x47c4,0x85,0x0f,0xdb,0x4d,0xfa,0x46,0x6b,0x1d);
DEFINE_GUID(Window_Pattern_GUID, 0x27901735,0xc760,0x4994,0xad,0x11,0x59,0x19,0xe6,0x06,0xb1,0x10);
DEFINE_GUID(SelectionItem_Pattern_GUID, 0x9bc64eeb,0x87c7,0x4b28,0x94,0xbb,0x4d,0x9f,0xa4,0x37,0xb6,0xef);
DEFINE_GUID(Dock_Pattern_GUID, 0x9cbaa846,0x83c8,0x428d,0x82,0x7f,0x7e,0x60,0x63,0xfe,0x06,0x20);
DEFINE_GUID(Table_Pattern_GUID, 0xc415218e,0xa028,0x461e,0xaa,0x92,0x8f,0x92,0x5c,0xf7,0x93,0x51);
DEFINE_GUID(TableItem_Pattern_GUID, 0xdf1343bd,0x1888,0x4a29,0xa5,0x0c,0xb9,0x2e,0x6d,0xe3,0x7f,0x6f);
DEFINE_GUID(Text_Pattern_GUID, 0x8615f05d,0x7de5,0x44fd,0xa6,0x79,0x2c,0xa4,0xb4,0x60,0x33,0xa8);
DEFINE_GUID(Toggle_Pattern_GUID, 0x0b419760,0xe2f4,0x43ff,0x8c,0x5f,0x94,0x57,0xc8,0x2b,0x56,0xe9);
DEFINE_GUID(Transform_Pattern_GUID, 0x24b46fdb,0x587e,0x49f1,0x9c,0x4a,0xd8,0xe9,0x8b,0x66,0x4b,0x7b);
DEFINE_GUID(ScrollItem_Pattern_GUID, 0x4591d005,0xa803,0x4d5c,0xb4,0xd5,0x8d,0x28,0x00,0xf9,0x06,0xa7);
DEFINE_GUID(LegacyIAccessible_Pattern_GUID, 0x54cc0a9f,0x3395,0x48af,0xba,0x8d,0x73,0xf8,0x56,0x90,0xf3,0xe0);
DEFINE_GUID(ItemContainer_Pattern_GUID, 0x3d13da0f,0x8b9a,0x4a99,0x85,0xfa,0xc5,0xc9,0xa6,0x9f,0x1e,0xd4);
DEFINE_GUID(VirtualizedItem_Pattern_GUID, 0xf510173e,0x2e71,0x45e9,0xa6,0xe5,0x62,0xf6,0xed,0x82,0x89,0xd5);
DEFINE_GUID(SynchronizedInput_Pattern_GUID, 0x05c288a6,0xc47b,0x488b,0xb6,0x53,0x33,0x97,0x7a,0x55,0x1b,0x8b);
DEFINE_GUID(ObjectModel_Pattern_GUID, 0x3e04acfe,0x08fc,0x47ec,0x96,0xbc,0x35,0x3f,0xa3,0xb3,0x4a,0xa7);
DEFINE_GUID(Annotation_Pattern_GUID, 0xf6c72ad7,0x356c,0x4850,0x92,0x91,0x31,0x6f,0x60,0x8a,0x8c,0x84);
DEFINE_GUID(Text_Pattern2_GUID, 0x498479a2,0x5b22,0x448d,0xb6,0xe4,0x64,0x74,0x90,0x86,0x06,0x98);
DEFINE_GUID(Styles_Pattern_GUID, 0x1ae62655,0xda72,0x4d60,0xa1,0x53,0xe5,0xaa,0x69,0x88,0xe3,0xbf);
DEFINE_GUID(Spreadsheet_Pattern_GUID, 0x6a5b24c9,0x9d1e,0x4b85,0x9e,0x44,0xc0,0x2e,0x31,0x69,0xb1,0x0b);
DEFINE_GUID(SpreadsheetItem_Pattern_GUID, 0x32cf83ff,0xf1a8,0x4a8c,0x86,0x58,0xd4,0x7b,0xa7,0x4e,0x20,0xba);
DEFINE_GUID(Tranform_Pattern2_GUID, 0x8afcfd07,0xa369,0x44de,0x98,0x8b,0x2f,0x7f,0xf4,0x9f,0xb8,0xa8);
DEFINE_GUID(TextChild_Pattern_GUID, 0x7533cab7,0x3bfe,0x41ef,0x9e,0x85,0xe2,0x63,0x8c,0xbe,0x16,0x9e);
DEFINE_GUID(Drag_Pattern_GUID, 0xc0bee21f,0xccb3,0x4fed,0x99,0x5b,0x11,0x4f,0x6e,0x3d,0x27,0x28);
DEFINE_GUID(DropTarget_Pattern_GUID, 0x0bcbec56,0xbd34,0x4b7b,0x9f,0xd5,0x26,0x59,0x90,0x5e,0xa3,0xdc);
DEFINE_GUID(TextEdit_Pattern_GUID, 0x69f3ff89,0x5af9,0x4c75,0x93,0x40,0xf2,0xde,0x29,0x2e,0x45,0x91);
DEFINE_GUID(CustomNavigation_Pattern_GUID, 0xafea938a,0x621e,0x4054,0xbb,0x2c,0x2f,0x46,0x11,0x4d,0xac,0x3f);
enum AutomationIdentifierType
{
AutomationIdentifierType_Property,
......
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