[Solved] Use library “ResizableDialog” in an autonomous file

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
Sébastien C
Posts: 111
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France

[Solved] Use library “ResizableDialog” in an autonomous file

Post by Sébastien C »

Hello Team,

I experiment actually the wonderful code snippet of roland65 : “Resizable dialog”.

This code is a little beyond my abilities, although I can understand the general meaning of it, and use it. I did not have any problem installing the “ResizableDialog” library. Finally, I am personally just interested by the non-modal dialog box. I use LibreOffice and it works without problem.

I find myself in front of a problem. My use would be really easy if my users should NOT have to install a library (or an extension). It is therefore necessary that the code is included in the file, in this case and for what I want to do, in a Calc’s file.

I thought that changing the only line

Code: Select all

sURL = "vnd.sun.star.script:ResizableDialog.Dialog2?location=application"
by one who would follow the type

Code: Select all

sURL = "vnd.sun.star.script:Standard.Dialog1?location=document"
would solve the problem. Obviously, I've opened a “Standard” library in my file, as much as a “Dialog1” is of course present.

Launching the macro named “ResizableDialog”, I have the following message:
exceptionParent.png
I understood that there was a copy between outer and inner dialog... And I presume it is a problem of a Child without Parent... From there to really understand the mechanism of this system without warning social services, it's a bit complicated for me (or it will take me a lot of time)...

Could you help me :?:
Last edited by Sébastien C on Thu Jun 07, 2018 9:38 am, edited 1 time in total.
LibreOffice v. 7.3.2.2, under GNU-Linux Mint and, in virtualization and just for tests, LibreOffice v. 7.3.2.2 an OpenOffice v. 4.1.12 under M$-W 10 :ouch: .
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: Use the library “ResizableDialog” in an autonomous file.

Post by JeJe »

The url with a document doesn't work I'm afraid, either with the standard library or another one in the document. Don't know why - it works with the location = application and that's the reason for the separate library.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Sébastien C
Posts: 111
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France

Re: Use the library “ResizableDialog” in an autonomous file.

Post by Sébastien C »

JeJe wrote:it works with the location = application and that's the reason for the separate library.
I understood that... ;)
JeJe wrote: Don't know why
Precisely, I would like to know why :crazy:

Thanks for your interest.
:D
LibreOffice v. 7.3.2.2, under GNU-Linux Mint and, in virtualization and just for tests, LibreOffice v. 7.3.2.2 an OpenOffice v. 4.1.12 under M$-W 10 :ouch: .
hubert lambert
Posts: 145
Joined: Mon Jun 13, 2016 10:50 am

Re: Use the library “ResizableDialog” in an autonomous file.

Post by hubert lambert »

Hello,

This is the same problem as with the DialogProvider service : you need to instanciate the service with the document as argument, so that the program gets the right context for locating de dialog.

Thus replace this line:

Code: Select all

oDP = CreateUnoService("com.sun.star.awt.ContainerWindowProvider")
with something like this:

Code: Select all

oDP = getDefaultContext.ServiceManager.createInstanceWithArguments("com.sun.star.awt.ContainerWindowProvider", array(thiscomponent))
Regards.
AOOo 4.1.2 on Win7 | LibreOffice on various Linux systems
User avatar
Sébastien C
Posts: 111
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France

Re: Use the library “ResizableDialog” in an autonomous file.

Post by Sébastien C »

I am sorry hubert lambert. If your line do not change anything in the context of library, it do not work at same in a context of file. I join a file, just for example, where there are a “resizableDialog” module in “Standard” library. The macro to call is, of course, ResizableDialog().

Thanks for your interest too.
Attachments
paveNonModal.ods
(14.77 KiB) Downloaded 138 times
LibreOffice v. 7.3.2.2, under GNU-Linux Mint and, in virtualization and just for tests, LibreOffice v. 7.3.2.2 an OpenOffice v. 4.1.12 under M$-W 10 :ouch: .
hubert lambert
Posts: 145
Joined: Mon Jun 13, 2016 10:50 am

Re: Use the library “ResizableDialog” in an autonomous file.

Post by hubert lambert »

Your dialog uri is wrong. This one works:

Code: Select all

sURL = "vnd.sun.star.script:Standard.Dialog1?location=document"
You may also prefer this way of instanciating the ContainerWindowProvider:

Code: Select all

	oDP = CreateUnoService("com.sun.star.awt.ContainerWindowProvider")
	oDP.initialize(array(thiscomponent))
Attachments
paveNonModal.ods
(15.7 KiB) Downloaded 148 times
AOOo 4.1.2 on Win7 | LibreOffice on various Linux systems
User avatar
Sébastien C
Posts: 111
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France

Re: Use the library “ResizableDialog” in an autonomous file.

Post by Sébastien C »

Hello everyone,

I am ABSOLUTELY stupid (and a bit tired). Typical of several errors that accumulate after multiple trials. A HUGE thank you for this help Hubert Lambert :bravo: ... and my apologies for the slowness of my neurons!

If it happens, as I believe, to the friend Roland65, to go through here, it will undoubtedly allow him to correct to perfection his code snippet possibly also adding this possibility.

A VERY big thank you to everyone!
:D
LibreOffice v. 7.3.2.2, under GNU-Linux Mint and, in virtualization and just for tests, LibreOffice v. 7.3.2.2 an OpenOffice v. 4.1.12 under M$-W 10 :ouch: .
Post Reply