ImageURL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ImageURL

Rushna Jabi
Hi all,
I am working on OpenOffice plugin using NetBeans 8.0.2.
I have created a dialog using XDialog and now I want add image on this
dialog.
but I am not getting image.

My code is:

//create the image model and set the properties
 Object imageModel =
xMultiServiceFactory.createInstance("com.sun.star.awt.UnoControlImageControlModel");
        XPropertySet imageProperties = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, imageModel);
        imageProperties.setPropertyValue("PositionX", new Integer(0));
        imageProperties.setPropertyValue("PositionY", new Integer(0));
        imageProperties.setPropertyValue("Width", new Integer(150));
        imageProperties.setPropertyValue("Height", new Integer(150));
        imageProperties.setPropertyValue("Name", name);
        imageProperties.setPropertyValue("ScaleImage", new Boolean(true));

        imageProperties.setPropertyValue("ImageURL", new
String("/images/apple.png"));

        // insert the control models into the dialog model
        XNameContainer xNameCont = ( XNameContainer
)UnoRuntime.queryInterface( XNameContainer.class, dialogModel );


       xNameCont.insertByName(name, imageModel);


I am not getting image on Dialog using relative path.
I need your support, please help me.



Thanks & regards,
Rushna Jabi
Software Engineer
SOS
Reply | Threaded
Open this post in threaded view
|

Re: ImageURL

SOS
you always need to convert a system path to a URL (i think :-) )
use the "ConvertToUrl" function what will result in
"file:///images/apple.png"
Hope it helps
Greetz
Fernand

On 30/11/2017 13:09, Rushna Jabi wrote:

> Hi all,
> I am working on OpenOffice plugin using NetBeans 8.0.2.
> I have created a dialog using XDialog and now I want add image on this
> dialog.
> but I am not getting image.
>
> My code is:
>
> //create the image model and set the properties
>   Object imageModel =
> xMultiServiceFactory.createInstance("com.sun.star.awt.UnoControlImageControlModel");
>          XPropertySet imageProperties = (XPropertySet)
> UnoRuntime.queryInterface(XPropertySet.class, imageModel);
>          imageProperties.setPropertyValue("PositionX", new Integer(0));
>          imageProperties.setPropertyValue("PositionY", new Integer(0));
>          imageProperties.setPropertyValue("Width", new Integer(150));
>          imageProperties.setPropertyValue("Height", new Integer(150));
>          imageProperties.setPropertyValue("Name", name);
>          imageProperties.setPropertyValue("ScaleImage", new Boolean(true));
>
>          imageProperties.setPropertyValue("ImageURL", new
> String("/images/apple.png"));
>
>          // insert the control models into the dialog model
>          XNameContainer xNameCont = ( XNameContainer
> )UnoRuntime.queryInterface( XNameContainer.class, dialogModel );
>
>
>         xNameCont.insertByName(name, imageModel);
>
>
> I am not getting image on Dialog using relative path.
> I need your support, please help me.
>
>
>
> Thanks & regards,
> Rushna Jabi
> Software Engineer
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]