This is a general question but I have provided the context to explain how this could be useful and also to invite completely different solutions to my immediate problem.dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, "macro:///" & LibModuleFunctionString, "", 0, Array())
You can call your own (user defined) macros by their name and by the passed parameters, not needed the Dispacther.
The Dispatcher is excellent (for example) to call the Calc Cell functions from a macro.
Code: Select all
sub My_main_routine my_routine1("constant string parameter", sStringVariable) floatResult = my_function2(floatNumberVariable1; floatNumberVariable2) my_routine3(floatResult, floatNumberVariable3) end sub
It can call the subs and functions from the MyMacros Standard library and/or from the Standard library of the actual document.
These libraries (the Standard ones) will be loaded into the memory, automatically. You must load-in the other libraries before you call a routine/function from them:
Code: Select all
... If (Not GlobalScope.BasicLibraries.isLibraryLoaded("MyLibrary1")) Then GlobalScope.BasicLibraries.LoadLibrary("MyLibrary1") End If ...
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
- Posts: 876
- Joined: Fri Jan 14, 2011 1:21 pm
- Location: Kyiv, Ukraine
Apache OpenOffice 4.1.5, LibreOffice 126.96.36.199 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
Bind your event to MyMacros>MriLib>Module1.Mri
This will show an object inspection window with all properties of the passed event struct, including the "Source" element which is the calling object.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice