Hello everyone,
I’m trying to move from Microsoft Office VBA to LibreOffice Basic, but I’m hitting some snags.
In Excel VBA, I have a program that loads and displays a PDF dynamically in a WebBrowser control on a form at runtime.
In LibreOffice Basic, I see that I can display the first page of a PDF in an ImageControl at design time by setting the Graphics property to the file that I would like to display (perhaps because this is the thumbnail of the PDF, but that is beside the point).
However, I was unable to find any information on whether the Graphics property on an ImageControl can also be changed at runtime and if so, how to do it.
At design time, the Graphics property shows the path to the file like this:
file:///C:/Users/<username>/Desktop/test.pdf
However, the following code does not work:
Sub StartDialog1()
Dim oDialog1 as Object
basiclibraries.loadlibrary("Tools")
oDialog1 = loadDialog("Standard","Dialog1")
oDialog1.ImageControl1.Graphics = "file:///C:/Users/<username>/Desktop/test.pdf"
oDialog1.Execute()
end sub
Variations that I tried to guess such as oDialog1.ImageControl1.Graphics = loadGraphics("file:///C:/Users/<username>/Desktop/test.pdf") or oDialog1.ImageControl1.Graphics = loadPicture("file:///C:/Users/<username>/Desktop/test.pdf") also did not work.
Interestingly, the error that I see in every case does not indicate that I am attempting to load an image the wrong way, it indicates that ImageControl1 does not exist or cannot be accessed:

I also noticed that there is no code autocompletion for oDialog1 or ImageControl1 at design time. This seems to make sense, since the oDialog1 variable is declared as a generic object, so the IDE cannot know what it is until it is instantiated.
However, I find the following behavior puzzling: When I add a watch to the variable oDialog1 and step through the code, I see that after the loadDialog command is executed, the variable oDialog1 is of the type stardiv.Toolkit.UnoDialogControl. But when I try to declare the variable oDialog1 as stardiv.Toolkit.UnoDialogControl so that I can see its properties and methods at design time, it throws an error.
Basic syntax error.
Unknown data type stardiv.Toolkit.UnoDialogControl
The VBA language reference says the following about the Picture property:
While designing a form, you can use the control’s property page to assign a bitmap to the Picture property. While running a form, you must use the LoadPicture function to assign a bitmap to Picture.
Does similar detailed information exist for the LibreOffice ImageControl (and other controls), and if so, where can I find it? Thanks!
Ray
P.S. When I search for ImageControl in the documentation (Omega Search: imagecontrol), it shows two results: SFDialogs.DialogControl service and SFDocuments.FormControl service. Both documents mention ImageControl in connection with a property called Picture (which the control does not seem to have), but neither mention a property called Graphics (which the control does have). Am I missing something?