office-gobmx/winaccessibility/source/UAccCOMIDL/UAccCOM.idl
Michael Weghorn 002a29b8dd tdf#91739 wina11y: Add skeleton IAccessible2_2 implementation
Derive from the `IAccessible2_2` insterface [1] instead of
directly from (its base interface) `IAccessible2` and
add dummy implementations for the corresponding methods
that return `E_NOTIMPL` to indicate that there's no
real implementation yet.

An actual implementations for at least
`CMAccessible::get_relationTargetsOfType`
is planned for a separate upcoming commit.

Support for the interface can be checked e.g.
in Accerciser's Python console:

Before:

    >>> from comInterfaces import IAccessible2Lib as IA2
    >>> focus.IAccessibleObject
    <POINTER(IAccessible2) ptr=0x9667f24 at 6841850>
    >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessible2)
    <POINTER(IAccessible2) ptr=0x9667f24 at 6822120>
    >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessible2_2)
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "C:\tools\cygwin\home\user\development\git\nvda\.venv\Lib\site-packages\comtypes\__init__.py", line 831, in QueryInterface
        self.__com_QueryInterface(byref(iid), byref(p))
      File "C:\tools\cygwin\home\user\development\git\nvda\source\monkeyPatches\comtypesMonkeyPatches.py", line 33, in __call__
        return super().__call__(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    _ctypes.COMError: (-2147467262, 'No such interface supported', (None, None, None, 0, None))

With this commit in place:

    >>> from comInterfaces import IAccessible2Lib as IA2
    >>> focus.IAccessibleObject
    <POINTER(IAccessible2) ptr=0x988c784 at 6363580>
    >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessible2)
    <POINTER(IAccessible2) ptr=0x988c784 at c55d7b0>
    >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessible2_2)
    <POINTER(IAccessible2_2) ptr=0x974d824 at 6847f80>

And calling one of the methods gives a "Not Implemented" COMError
as expected:

    >>> ia2_2 = focus.IAccessibleObject.QueryInterface(IA2.IAccessible2_2)
    >>> ia2_2.attribute("dummy")
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "C:\tools\cygwin\home\user\development\git\nvda\.venv\Lib\site-packages\comtypes\_memberspec.py", line 482, in __call__
        return self.fget(self.instance, *args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    _ctypes.COMError: (-2147467263, 'Not implemented', (None, None, None, 0, None))

[1] 34f96c2a28/api/Accessible2_2.idl

Change-Id: I77bed1f27353c4d08229ffe17afee03b813a4d4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172256
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-23 07:40:10 +02:00

208 lines
5.9 KiB
Text

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
import "oaidl.idl";
import "ocidl.idl";
import "ia2_api_all.idl";
import "defines.idl";
[
object,
uuid(D00F5EB7-588A-487F-A6F6-0B5D7D1815AA),
dual,
helpstring("IMAccessible Interface"),
pointer_default(unique)
]
interface IMAccessible : IAccessible2_2
{
[id(2), helpstring("method Put_XAccRole")] HRESULT Put_XAccRole(unsigned short pRole);
[id(3), helpstring("method DecreaseState")] HRESULT DecreaseState(DWORD pXSate);
[id(4), helpstring("method IncreaseState")] HRESULT IncreaseState(DWORD pXSate);
[id(6), helpstring("method Put_XAccValue")] HRESULT Put_XAccValue(const OLECHAR* pszAccValue);
[id(7), helpstring("method SetState")] HRESULT SetState(DWORD pXSate);
[id(9), helpstring("method Put_XAccFocus")] HRESULT Put_XAccFocus(long dChildID);
[id(10), helpstring("method Put_XAccParent")] HRESULT Put_XAccParent(IMAccessible* pIParent);
[id(13), helpstring("method Put_XAccWindowHandle")] HRESULT Put_XAccWindowHandle(HWND hwnd);
[id(14), helpstring("method Put_XAccChildID")] HRESULT Put_XAccChildID(long dChildID);
[id(19), helpstring("method SetXAccessible")] HRESULT SetXAccessible(hyper XAccessible);
[id(25), helpstring("method Put_XAccObjectManager")] HRESULT Put_XAccObjectManager(hyper pManager);
[id(26), helpstring("method NotifyDestroy")] HRESULT NotifyDestroy();
};
[
object,
uuid(951299EE-1841-4249-9E07-812C0739E489),
dual,
helpstring("IEnumVariant Interface"),
pointer_default(unique)
]
interface IEnumVariant : IEnumVARIANT
{
[id(1), helpstring("method ClearEnumeration")] HRESULT ClearEnumeration();
[id(2), helpstring("method PutSelection")] HRESULT PutSelection(hyper pXSelection);
};
[
object,
uuid(6641185C-E099-4C45-B753-3FBC0EE40646),
dual,
helpstring("IUNOXWrapper Interface"),
pointer_default(unique)
]
interface IUNOXWrapper : IUnknown
{
[id(1), helpstring("method put_XInterface")] HRESULT put_XInterface(hyper pXInterface);
[id(2), helpstring("method put_XSubInterface")] HRESULT put_XSubInterface(hyper pXSubInterface);
};
[
uuid(19ECB1B0-9376-4FF9-B580-223FC9C200B8),
version(1.0),
helpstring("UAccCOM 1.0 Type Library")
]
library UACCCOMLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
importlib("oleacc.dll");
[
uuid(CF8DF8BA-44FE-4B10-BD2E-8C8CB322485F),
helpstring("MAccessible Class")
]
coclass MAccessible
{
[default] interface IMAccessible;
};
[
uuid(152884E0-268B-4481-9AE7-1B372D3AA97F),
helpstring("EnumVariant Class")
]
coclass EnumVariant
{
[default] interface IEnumVariant;
};
[
uuid(AA360FB0-BC98-41C1-A885-BB921F5ED601),
helpstring("UNOXWrapper Class")
]
coclass UNOXWrapper
{
[default] interface IUNOXWrapper;
};
[
uuid(9FD9BA47-70AF-4160-99F1-526F2B9F111B),
helpstring("AccComponent Class")
]
coclass AccComponent
{
[default] interface IAccessibleComponent;
};
[
uuid(8745CF0C-3104-4BAE-B7D0-D7B1717C006E),
helpstring("AccRelation Class")
]
coclass AccRelation
{
[default] interface IAccessibleRelation;
};
[
uuid(AA49F20E-BB4E-400D-A5B0-6F5B7B770227),
helpstring("AccAction Class")
]
coclass AccAction
{
[default] interface IAccessibleAction;
};
[
uuid(6D8AB08B-CCE9-471E-8A41-35773D5263F5),
helpstring("AccText Class")
]
coclass AccText
{
[default] interface IAccessibleText;
};
[
uuid(79CE1450-1F61-48E2-BF76-C07BD10105E2),
helpstring("AccEditableText Class")
]
coclass AccEditableText
{
[default] interface IAccessibleEditableText;
};
[
uuid(CC55D71B-1828-4EE0-89E2-C3749CF9C9AB),
helpstring("AccHypertext Class")
]
coclass AccHypertext
{
[default] interface IAccessibletext;
};
[
uuid(73A45800-7A62-432C-A1A6-BF8852994331),
helpstring("AccImage Class")
]
coclass AccImage
{
[default] interface IAccessibleImage;
};
[
uuid(730A561B-1AF6-49E1-9C04-9A2F48CD8512),
helpstring("AccValue Class")
]
coclass AccValue
{
[default] interface IAccessibleValue;
};
[
uuid(92BAA62D-535A-4EAB-9ABB-BFA60B7A6DB6),
helpstring("AccTable Class")
]
coclass AccTable
{
[default] interface IAccessibleTable;
};
[
uuid(77948F17-05C8-4DAA-93D4-BCCD16ADC660),
helpstring("AccTableCell Class")
]
coclass AccTableCell
{
[default] interface IAccessibleTableCell;
};
[
uuid(519A64CD-F6A6-4793-BE50-4E36C4C593EF),
helpstring("AccHyperLink Class")
]
coclass AccHyperLink
{
[default] interface IAccessibleAction;
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */