Ask Your Question
0

Detecting assistive technology on Windows

asked 2019-05-06 17:35:51 +0200

DictationScratchPad gravatar image

Hello

I noticed that LibreOffice supports assistive technology (AT) and that in order for LibreOffice to expose its information it must detect the presence of AT.

I have looked through the wiki and found this page: https://wiki.documentfoundation.org/A... where it explains what I just said. It does not explain what LibreOffice looks for specifically though.

I am developing dictation software and need to know the text and caret position in a document. Through IAccessible2 this is possible but I do not know how to let LibreOffice know that my AT is active.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2019-05-09 16:47:40 +0200

vsfoote gravatar image

updated 2019-05-09 16:48:53 +0200

Believe apps need to HWND_BROADCAST to emit SPI_SETSCREENREADER to be seen as AT, including your effort. [1]

You can force that mode by launching LibreOffice with the flag "SAL_FORCE_IACCESSABLE2=1" [2] for apps that do not.

For determining IAccessible2 support, LibreOffice will issue HasAtHook() to read system SPI_GETSCREENREADER status. [3]

Should get your app connected. What I don't know is if the text and caret positions would be exposed for the TEXT role(s) we use.

=-refs-= [1] https://docs.microsoft.com/en-us/wind... //beleive the systemparametersinfoa is per user flavor [2] https://opengrok.libreoffice.org/xref... [3] https://opengrok.libreoffice.org/xref...

edit flag offensive delete link more

Comments

This was exactly what I needed. Thank you very much!

DictationScratchPad gravatar imageDictationScratchPad ( 2019-05-13 09:21:03 +0200 )edit
0

answered 2019-05-06 18:18:06 +0200

Lupp gravatar image

Did you already enable the respective option under Tools>Options>LibreOffice>Accessibility?

edit flag offensive delete link more

Comments

I did, yes. It was actually enabled by default.

DictationScratchPad gravatar imageDictationScratchPad ( 2019-05-07 09:33:24 +0200 )edit

Sorry.
(I hope you won't expect the next answer by me now. I never used "AT", and only hinted to a very simple probable error. - Yes this kind of errors often occur.)
By the way: I would like to know what, exactly, you address as caret position in your question. Is it related to the .Position property of the ViewCursor?

Lupp gravatar imageLupp ( 2019-05-07 12:19:00 +0200 )edit

I'm trying to use IAccessible2, specifically caretOffset to gain the caret position in relation to the text surrounding it.

Using various inspection tools (aViewer and AccProbe) i have been unable to gain anything from LibreOffice. I am suspecting that this is due to LibreOffice not thinking the aforementioned tools are "AT". Which leads me back to my question of how I am supposed to let LibreOffice know when an "AT" is in use.

For instance, I know that Chrome does the following: Chrome calls NotifyWinEvent with EVENT_SYSTEM_ALERT and the custom object id of 1. If it subsequently receives a WM_GETOBJECT call for that custom object id, it assumes that AT is running.

DictationScratchPad gravatar imageDictationScratchPad ( 2019-05-07 13:22:19 +0200 )edit

(Still not about helping. Just for curiosity.)
I just read about the caretOffset routine. Let me assume that the child text objects mentioned there not need to be taken in account as far as LibreOffice is concerned. At least I put them aside for now.
Then I need to understand what the text should be in your case. Text objects called by this name in Writer belong to the overall document (bodytext then), to frames, to TableCells, or to shapes. In Calc it can be a shape again, but mostly it will be a cell. In the given context, however, the text object should be somthing different, I suppose. Can you quench my curiosity?

Lupp gravatar imageLupp ( 2019-05-07 14:11:24 +0200 )edit

The text should be the text surrounding the caret. IAccessible2 returns the focus of which the caret is placed enabling me to get the text from the focused object. This should return the text in context with the caret and not frames or otherwise as they are not the focus point.

It works intentionally in both Chrome, Firefox and Opera. I'm still struggling with LibreOffice.

Hope this is somewhat quenching.

DictationScratchPad gravatar imageDictationScratchPad ( 2019-05-09 10:26:11 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-05-06 17:35:51 +0200

Seen: 44 times

Last updated: May 09