Accessing items in the Navigator window programatically

Hi all,

For reference, I am using:

LibreOffice 7.5.4.2
Python 3.8.16

I need to work with all of the hyperlinks in a document programatically.

I know that I can traverse the document looking for hyperlinks, but the information is already shown in the Navigator window. I am sure that getting the list of hyperlinks directly from the Navigator window would be more performant & reliable, hence my question:

Is there any way to access the details in the navigator window programatically?

… and if not, does anyone know whether this may be being worked on? The Navigator window is a great tool and developers working with LibreOffice would be able to produce better, more optimised solutions using it.

Many thanks,
@fuzzybear

A feature request would go to https://bugs.documentfoundation.org/
I doubt if it would be accepted as valid, and if so, if somebody would work on it.

In the meantime you might consider for your own workplace and documents to always use a custom routine for the insertion of hyperlinks which at the same time creates a bookmark for it. The bookmarks contained in a Writer document are available to user code via
myWriterDocumentModel.Bookmarks.

1 Like

Thanks, I have submitted an enhancement request, you never know your luck!

The mentioned enhancement request is tdf#157391.
BTW: There are lots of related issues. In many cases functionality provided via the UI is neither supported by API services (and their interfaces) nor eligible for (successful) macro recording.
Concerning the current issue I would like to point out:

  • There are objects in Writer that may “contain” (have assigned) hyperlinks which aren’t listed by the navigator.
  • Calc and Draw have completely different ways to handle hyperlinks and neither of them shows them in the Navigator.

Understood, thanks for your insight.

As far as I know, there is currently no description of the Navigator object model.
Using AccessibleContext, you can get Navigator data, but keep in mind that all Accessible interfaces work on a user-visible “screen”. If the Navigator is closed by the user, then there is no more information…

But be careful with the sequence AccessibleContext.getAccessibleChild, see Is it possible to have automatic capitalization of defined variables/constants and keywords in Basic? - #10 by sokol92

1 Like