Ask Your Question
0

mouse events in writer document

asked 2020-04-12 21:58:29 +0200

torreone gravatar image

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 https://ask.libreoffice.org/upfiles/1...

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 https://ask.libreoffice.org/en/questi... it would be of great help to me

edit retag flag offensive close merge delete

Comments

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?

Pansmanser gravatar imagePansmanser ( 2020-05-17 19:44:33 +0200 )edit

Read edit of my answer

torreone gravatar imagetorreone ( 2020-05-17 21:31:44 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2020-05-17 17:19:55 +0200

torreone gravatar image

updated 2020-05-17 21:31:15 +0200

In the answer I gave in this discussion https://ask.libreoffice.org/en/questi... 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

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-04-12 21:58:29 +0200

Seen: 105 times

Last updated: May 17 '20