Dialog box blocks LibreOffice

Hello everyone,

I’ve developed an extension that displays a dialog box. When I run the macro from the LibreOffice menu (created during the extension installation), everything works perfectly.

However, I’ve also created a Windows shortcut to launch this macro, and that’s where the issues arise. (“C:\Program Files\LibreOffice\program\soffice.exe” “macro:///mymacro.init.executeMacro”).

If LibreOffice is already running, the dialog box prevents new documents (Calc, Writer, etc.) from opening until it is closed.

On the other hand, if LibreOffice was not running before executing the shortcut, the macro works as expected.

Does anyone have an idea how to fix this issue?

Thanks

maybe this : Modal/non-modal dialog - #2 by JohnSUN

I don’t think it’s a modal issue (I’ve already tested in non-modal mode with no effect). The only situation where the dialog blocks is when the macro is launched via the Windows shortcut and LibreOffice is already running.

Your question requires clarification.
Let’s do this with an example.

Let’s write the following macro to the Standard library (My macros…), Module1, which calls a simple modal dialog:

Sub Test()
  Msgbox "Hello, World!" 
End Sub

What is the desired and undesired behavior when calling the Test macro directly and via the command line:

"C:\Program Files\LibreOffice\program\soffice.exe" macro:///Standard.Module1.Test

I would have preferred that the dialog box not block LibreOffice. To work around the problem, I’m going to migrate to DialogProvider2, which seems to be more suitable. But it’s a lot of work to adapt it to the extension. Thank you

This is a good idea, since the Basic CreateUnoDialog function has a number of limitations that prevent it from creating a “full-featured” non-modal dialog.

1 Like