How can a macro access the selected portion of a cell open for editing?

I have a Basic macro that currently works on the contents (string value) of the selected cell. I would like to extend this to check if a cell is currently being edited, and, if so, just work on the selected part of the cell, i.e. of the text or formula. So how can I do these two things?

  1. Check for edit mode
  2. Access the currently selected part of the formula

As far as I can tell, you can’t - with one exception.
The only way I know of to get a selected part of the content of a cell under editiing, is the getTransferable() method of the CurrentController which must know the sub-selection, but doesn’t publish it. However, this way you can get the selected part, and probably paste it elsewhere, but you can’t change the selection itself or work with its content in situ.

If you want to compose a text (cell-content) somewhere else from such parts selected one by one manually, this may suffice, but I doubt I there is a plausible use-case.

Thanks a lot, in my current case that ought to do the job: I am creating a URL to look up a word from a vocabulary list in Wiktionary, and would like to do that for part of the cell, e.g. to look up a word within a phrase. And how do I check if a cell is being edited? I hope to start trying stuff out again later this evening (CET).

I would have liked to look up more in the documentation myself, but I have not been very successful yet in finding my way around it:(

The relevant documentation is in the subranges of LibreOffice: Class List, but there you won’t find what probably wanted objects/methods/properties do not exist, and it’s (imo) much too complicated to find what objets provide the needed methods, suppport (or can create instances of) the wanted sevices, or export respective interfaces.
Most of what I mention in answers to “macrro” or API questions either is from the famous texts by Andrew Pitonyak, or from own experiences and some wearisome research. In specific any “you can’t” may be wrong due to insufficient knowledge.
In this case, however, I feel pretty sure that CurrentController is the only thing knowing about your open question, and if it doesn’t tell, I’m out.
Concerning your additional information I don’t feel sure how to understand it. I wold need an a example of have/want probably if you are hoping for additional advice.