How do I change the shape size by clicking on it?

I have several shapes in LO Calc and I need those shapes to change their sizes when they are mouse clicked: the first click enlarges the shape, the second click restores the original size.

I’m trying to do this with a macro assigned to those shapes. My problem and my question: how to determine within a macro which shape has been clicked?

I know how to get the current selected shape:

dim doc as object
doc = ThisComponent
someVar = doc.CurrentSelection...

But a shape when clicked is not getting selected and this method is not working.

I tried to add a parameter for the event object to the macro:

sub ChangeSize( oEvent )

But this produces a message about wrong number of parameters.

Is there a way to detect the caller of a macro in LO Basic? Or maybe another way to implement size changing with a mouse click?

P.S. One can use a separate button for calling the macro and click this button after selecting the needed shape, but this way is less convenient.

I answered this (twice!) at In LibreOffice Calc change the size of a shape by clicking it - Stack Overflow. Please add links if you post elsewhere.

Hi, Jim. Unfortunately this case is slightly different. The main constraint here is that shapes can be transient: they are multiple, often added and can be removed. So adding a new separate shape for each original one and possibly changing the text of the macro is not very convenient, so I seek for the solution with minimal editing (in the described in the post variant the needed editing is just to right click on the shape and associate the macro with it).