/jvmfwk/

a/co-23.05'>distro/collabora/co-23.05 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/winaccessibility/source/UAccCOM/AccRelation.cxx
AgeCommit message (Collapse)Author
2024-11-07[API CHANGE] a11y: Switch AccessibleRelationType to enumMichael Weghorn
Switch css::accessibility::AccessibleRelationType from integer constants to an enum. This provides more type safety and improves the debugging experience, e.g. GDB now prints com::sun::star::accessibility::AccessibleRelationType::AccessibleRelationType_CONTENT_FLOWS_TO instead of just "2" when printing the value of a corresponding variable, so it's no longer necessary to manually look up what constant has that integer value to know what relation this refers to. offapi/com/sun/star/accessibility/AccessibleRelationType.idl had this comment: > <p>We are using constants instead of a more typesafe enum. The reason > for this is that IDL enums may not be extended. Therefore, in order to > include future extensions to the set of roles we have to use constants > here.</p> However, the a11y UNO API is internal (not published), so that shouldn't be a concern. Change-Id: I44a7d56cb085dc24effb24fcd34bb222b78ef4cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176153 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-08-23tdf#91739 wina11y: Implement IAccessible2_2::get_relationTargetsOfTypeMichael Weghorn
Implement the `IAccessible2_2::get_relationTargetsOfType` method [1] in the Windows accessibility bridge. As described in NVDA issue comment [2], this method is the preferred way that NVDA uses to get e.g. the target object of the "flowsTo" relation. With this commit in place, retrieving the next Writer paragraph in the NVDA Python console using that relation now also works with the fallback code path in NVDA [3] dropped in a local build of NVDA: >>> focus.flowsTo <NVDAObjects.Dynamic_SymphonyParagraphSymphonyTextEditableTextWithAutoSelectDetectionIAccessible object at 0x0B8F5890> [1] https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/interface_i_accessible2__2.html#a63f214b322c663caf01d4bb67277f5af [2] https://github.com/nvaccess/nvda/issues/4115#issuecomment-2299084993 [3] https://github.com/nvaccess/nvda/blob/df6bd0770db12ff73905251054d12f01911030dd/source/NVDAObjects/IAccessible/__init__.py#L1861-L1874 Change-Id: Ifcd15527b4a3f5302168942f19248a0ba9a4d306 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172258 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-23wina11y: Explicitly map UNO to IA2 relation typeMichael Weghorn
Use switch/case to explicitly map from UNO's `AccessibleRelationType` to the IAccessible2 relation type strings, instead of implicitly using the integer values of the `AccessibleRelationType` as indices into a map. Let the caller allocate the string to return. Use `sal_Int16` for the `AccessibleRelationType` param to match the type of the actual integer values. Change-Id: I8c094d763ca602131a578f20719d00cad53088d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172257 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-21tdf#91739 wina11y: Ensure IAccessible for relation target existsMichael Weghorn
When retrieving the `IAccessible` for the relation target's `XAccessible` and `CMAccessible::get_IAccessibleFromXAccessible` initially returns nullptr, insert the a corresponding object and retrieve it then. The same is already done in most places calling `CMAccessible::get_IAccessibleFromXAccessible`, e.g. `CAccTableCell::get_columnHeaderCells` or `CEnumVariant::Next`. This makes sure that a proper `IAccessible` is returned instead of triggering an error if no such object has been created yet. This is the case e.g. for off-screen paragraph objects in Writer that can still be accessed on the UNO a11y level via the `AccessibleRelationType::CONTENT_FLOWS_TO` relation. However, when testing with the test docs from tdf#91739, the issue even occured much earlier, with on-screen paragraphs already that weren't available via the FLOWS_TO relation from their preceding paragraphs. With this commit in place, having NVDA read out the whole sample documents using the NVDA + Down shortcut works now for the tdf#91739 sample docs, in the same way it already does for Orca on Linux. For more details, see also the previous analysis in NVDA ticket [1]. [1] https://github.com/nvaccess/nvda/issues/4115#issuecomment-2299084993 Change-Id: I2ef06c6efa368f10dcf5d917d781dabc8ce9a65f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172215 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-21wina11y: Drop unnecessary try/catchMichael Weghorn
Returning S_OK certainly won't throw. Change-Id: Ided99c26efb42cba21889890fa37d652d1e118ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172151 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-08-21wina11y: clang-format CAccRelationMichael Weghorn
This in particular ensures that try and catch blocks are indented by an additional indentation level as expected, increasing readability. Change-Id: Ic2c3c1500c07df75e3b606ab957a44b220f52194 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172150 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-04-24[API CHANGE] a11y: Use XAccessible for relation targetsMichael Weghorn
Use a Sequence of XAccessible rather than its base interface XInterface for AccessibleRelation's TargetSet. As the targets are accessible objects as well, anything other than XAccessible doesn't make much sense. Using XAccessible right away makes that clearer and avoids the need to query the XAccessible interface. (The winaccessibility bridge was already using `static_cast`, relying on the fact that the objects are XAccessibles.) The a11y UNO API is not published, so an API change should be unproblematic. Change-Id: I7f08e98d1ec303d5343d9a7954187cdd71495ebc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166586 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2023-08-09wina11y: Drop "#CHECK#" commentsMichael Weghorn
... and "#CHECK XInterface#" comments; it's obvious that this is what the next lines do. Change-Id: I09234d1a2f5c58cfab1580f188229d28d27fc402 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155506 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-09wina11y: Use return value instead of out paramMichael Weghorn
... to return the `IAccessible*` in `AccObjectWinManager::GetIAccessibleFromXAccessible` and `CMAccessible::get_IAccessibleFromXAccessible` and adapt the call sites accordingly. This is more straight-forward and the extra bool return value didn't add anything, since it was also just saying whether the pointer was a nullptr, so rather check that directly. Also drop `AccObjectWinManager::GetIMAccByXAcc` that does the same thing and switch the only call site to use `AccObjectWinManager::GetIAccessibleFromXAccessible` instead. Change-Id: I72933df62aa9ac1ff3f2a84c5045dfae354c18e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155505 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-11-24Drop redundant -Wnon-virtual-dtorStephan Bergmann
Inspired by <https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607102.html> "[PATCH] doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor", drop explicitly enabling -Wnon-virtual-dtor in favor of -Wdelete-non-virtual-dtor, which is already enabled by -Wall. (-Wdelete-non-virtual-dtor first appeared in Clang 3.0, <https://github.com/llvm/llvm-project/commit/8bd428574c717e68a8274739d2ba0f6dc16fd0fb> "Add new warning that warns when invoking 'delete' on a polymorphic, non-final, class without a virtual destructor", and GCC 4.7, <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=014ab419efc12a59efebd2720d79e1c055675c85> "invoke.texi: Document -Wdelete-non-virtual-dtor. [...]") Dropping the explicit setting of -Wnon-virtual-dtor (and nowhere setting it implicitly via -Weffc++) means we can get rid of lots of places that either set -Wno-non-virtual-dtor or use some pragma to ignore -Wnon-virtual-dtor. (In various places across extensions/source/activex/ and winaccessibility/, the commits f26996bd3398afa789a5491968244563ccf70908 "Silence -Werror,-Wnon-virtual-dtor in generated so_activex.h (clang-cl)" and c6086ca6535692496fbd718d174d8eb5a5dea7c7 "Silence -Werror,-Wnon-virtual-dtor in generated UAccCOM.h (clang-cl)" had singled out some includes to wrap them in pragmas. Now that those pragmas are gone again, move those includes back to where they had been prior to being singled out. And the -Wno-non-virtual-dtor in external/firebird/macos-arm64.patch.0 appeared first in ccd0e5f445d4a7d0e7aca6c23c02c61bf14510b2 "Make firebird build for macOS on arm64", which, though it doesn't state it explicitly, apparently created that patch's builds/posix/prefix.darwin_arm64 as a copy of firebird's already existing builds/posix/prefix.* files, which routinely include that warning option too, so keep it there too even if it is probably irrelevant throughout.) Change-Id: I7e4fa9f2c07e267b2ed15607905027f6b78142f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143182 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>