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>
2022-03-23Drop ENTER/LEAVE_PROTECTED_BLOCK and ISDESTROY macrosMike Kaganski
... that created some local language dialect. Mostly an automatic rewrite, with clang-format applied where it is unavoidable. Change-Id: Ibc24d00f6e80000320fa9bfb35ee16add0f714cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131961 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-23Drop SAFE_SYSFREESTRING macroMike Kaganski
It is simply useless, and in vast majority of cases, it simply nullified variables immediately before assigning them new values. Change-Id: Ibdad31229069d3cc7000624d5fca372472e8b59c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131955 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-30Extended loplugin:referencecasting/redundantcast (clang-cl): winaccessibilityStephan Bergmann
Change-Id: I6de94437ed00b295be1c388ac4a2c0784dd3cc6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122883 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-19loplugin:fakebool (clang-cl)Stephan Bergmann
...plus follow-up loplugin:implicitboolconversion and loplugin:redundantcast Change-Id: I9fc9c5cb46fbb50da87ff80af64cb0dfda3e5f90 Reviewed-on: https://gerrit.libreoffice.org/83207 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-02-Werror,-Wmicrosoft-exception-spec (clang-cl)Stephan Bergmann
No idea why that started to show up now, but C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/um/combaseapi.h contains > #define STDMETHOD(method) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE method while C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/um/winnt.h contains > #define STDMETHODIMP HRESULT STDMETHODCALLTYPE which caused failures like > [build CXX] embedserv/source/inprocserv/dllentry.cxx > embedserv/source/inprocserv/dllentry.cxx(261,40): error: 'QueryInterface' is missing exception specification '__attribute__((nothrow))' [-Werror,-Wmicrosoft-exception-spec] > STDMETHODIMP InprocEmbedProvider_Impl::QueryInterface( REFIID riid, void ** ppv ) > ^ > embedserv/source/inprocserv/dllentry.cxx(143,15): note: previous declaration is here > STDMETHOD(QueryInterface)(REFIID riid, void ** ppvObj) override; > ^ Change-Id: I0fe3554c2da4089bf0f883e1132d6f2ee95ae2c3 Reviewed-on: https://gerrit.libreoffice.org/79970 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-04-03WinAPI: Fix some leftovers having UNICODE-define-dependencyMike Kaganski
Change-Id: I21b4df5b595c3814a5a3fb85d9da531729447b7e Reviewed-on: https://gerrit.libreoffice.org/70193 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-27loplugin:includeform: winaccessibility (Windows)Stephan Bergmann
Change-Id: I8b83e650202c2b169803c22a7f94223a180dd48a
2016-10-15clang-cl loplugin: winaccessibilityStephan Bergmann
Change-Id: I40f8a6fef9d66b28a1d72551a6873b041b38b09d Reviewed-on: https://gerrit.libreoffice.org/29840 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-05-24remove unused struct memberJochen Nitschke
TYPE_BSTR_MAP.type was never used, this makes struct obsolete. replace magic numbers with constants Change-Id: Ifbe236c102f78cc570401254dda2fba9bb2c2a95 Reviewed-on: https://gerrit.libreoffice.org/25228 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2016-03-04Silence -Werror,-Wnon-virtual-dtor in generated UAccCOM.h (clang-cl)Stephan Bergmann
Change-Id: I9466931485ed5421be589def16185d5c036bdcb8
2014-01-27fdo#73464 - get relation BSTR allocation right.Michael Meeks
Change-Id: I270bc9c8e0507f44d2c27639e86002c60f4e2e6d
2013-12-12winaccessibility: fix locking in UAccCOMMichael Stahl
The COM components will (usually? always?) be called on the main thread via COM, and may also be called on any thread from the UNO event listeners. Both ways may access the global AccWinObjectManager. So the easiest way to lock all that without introducing new deadlocks seems to be to just use the SolarMutex. The fact that the main thread is in a COM STA is rather irrelevant here since we don't currently do the required manual marshalling of the COM pointers so they can be accessed from UNO event listeners running in threads other than the main thread anyway. To get that to build: - use prewin.h and postwin.h around ATL headers - link UAccCOM against vcl - define both UNICODE and _UNICODE to not break on mis-matching TCHAR nonsense Change-Id: I1ccdf7a4a5c2b5f0b9c29ef39d126c4b8a16898a
2013-12-12winaccessibility: remove CheckEnableAccessible.h and assorted noiseMichael Stahl
Change-Id: I45e1d72b1abf64a965397c50ac3b95b5bbee3206
2013-11-21winaccessibility: pass pointers as "hyper" in the COM IDLMichael Stahl
Change-Id: I083589fd57540e3b4ec488aeb84bc92dddc02d36
2013-11-20winaccessibility: remove UAccCOM2.hMichael Stahl
At least with MSVC2012 there is no warning C4917 here. Change-Id: I8de6cfc33791b1bb5e2b7808e306f733cf8cfcb5
2013-11-19winaccessibility: remove executable bitsMichael Stahl
Change-Id: I691c5fc3554bcdeb6c3beb0e5b445cfcd7b51e4c
2013-11-19Remove WNT defineDavid Ostrovsky
Change-Id: Ia69141f58fad25797d7d7495a357dd18c7abf08d
2013-11-19Move to MPLv2 license headers, add modelines.Michael Meeks
Change-Id: I895bab038eda82b80e1a223ad877a9674fe561ee
2013-11-19Integrate branch of IAccessible2Steve Yin
Just the winaccessibility directory initially. Change-Id: Ia21abb8d7088646ad6c1f83b3a03e7add716b0c0