mouse events in writer document

Is it possible in a writer document to detect mouse events (eg right or left click on any element of the text, such as sections, paragraphs, etc.)?
I see that on tools-customize-events
there is a long list of detectable events, but none inherent in mouse events

I searched the net but can’t find anything

Thanks in advance for any suggestions

PS: if anyone has any suggestions on the question I had asked here Calc Sheet events onSelectChange, onChange, onCalculate it would be of great help to me

I don’t think you can do that. Could you perhaps select the required element and assign a keystroke to a macro to do what you want?

Read edit of my answer

In the answer I gave in this discussion [Calc] How to start a macro with user-specified parameters? there may be an indirect answer, certainly the solution to the initial problem that led me to open this discussion

Edit: mini-tutorial
In the following we will call PX the point in the document where the context menu was opened

  • Use a wrtEv user function that initially contains the statement
    oVC = thisComponent.currentController.viewCursor
    oVC is the reference to the viewCursor
  • Enter wrtEv both in the contextual menu (hereinafter mcText) associated with the “text” (the contextual that opens with a right click on a text segment at one point) and in the contextual menu (hereinafter mcTable, the specific menu contextual with right click inside a table)

This done, you can now access everything a viewCursor has access to:

  1. with oVC. textParagraph directly accesses the paragraph containing the PX point

  2. with oVC.location the X and Y coordinates of PX are obtained

  3. the section (if any) containing PX is located in oVC.textSection

  4. the table and the cell containing PX (if existing) are in oVC.textTable and oVC.cell

There is therefore no need for a keystroke to call up the macro, it is activated directly from the context menu which, if desired, can contain submenus with hierarchies of user macros, each of which can perform different functions in relation to the position of PX and the relative text Content