Open web page from dialog

Jan Rheinländer jrheinlaender at gmx.de
Sun Jun 12 17:36:14 UTC 2016


Hi Fernand,

thank you for the tip with UnoControlFixedHyperlinkModel. Now this is
what I have:

Reference<XDialog> xDialog; // Created from XDialogProvider somewhere
earlier in the code

First question: How do I get a MultiServiceFactory from XDialog to
create the control? If I use the MultiComponentFactory the properties
like "PositionX" etc. are not present

Now assuming I get this MultiServiceFactory from somewhere:

Reference< XPropertySet >
xPSHyperlink(xMultiServiceFactory->createInstanceWithContext("com.sun.star.awt.UnoControlFixedHyperlinkModel",
xCC), UNO_QUERY_THROW);
xPSHyperlink->setPropertyValue("PositionX", makeAny(50));
xPSHyperlink->setPropertyValue("PositionY", makeAny(30));
xPSHyperlink->setPropertyValue("Width", makeAny(50));
xPSHyperlink->setPropertyValue("Height", makeAny(14));
xPSHyperlink->setPropertyValue("Label", makeAny(OU("Help")));
xPSHyperlink->setPropertyValue("URL",
makeAny(OU("http://ooo-imath.sourceforge.net/wiki/index.php/Main_Page")));

Second question: How do I get a XControl from the
UnoControlFixedHyperlinkModel  to add to the ControlContainer?

Reference< XControlContainer > xControlContainer(xDialog, UNO_QUERY_THROW);
xControlContainer->addControl(OU("button_help"), xHyperlinkControl);

I have looked all over the UNO API but am not getting anywhere.

Thanks,
Jan

> oDialogModel.createInstance( 
> "com.sun.star.awt.UnoControlFixedHyperlinkModel")

> On Jun 11, 2016, at 3:24 PM, "Jan Rheinländer" <jrheinlaender at gmx.de
> <mailto:jrheinlaender at gmx.de>> wrote:
>
>     Hi,
>
>     is it possible to open a website in the user's preferred browser from a
>     dialog (or from a Basic macro, or through the UNO API)?
>
>     I see that the "Help" - "About" dialog does this, but it is defined in
>     the source in Glade format, different to the Basic dialogs.
>
>     Thanks for any ideas!
>
>     Jan
>
>     ------------------------------------------------------------------------
>
>     LibreOffice mailing list
>     LibreOffice at lists.freedesktop.org
>     https://lists.freedesktop.org/mailman/listinfo/libreoffice
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20160612/3e1e969b/attachment.html>


More information about the LibreOffice mailing list