You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Rushna Jabi <ru...@gmail.com> on 2017/11/30 12:09:04 UTC

ImageURL

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

Re: ImageURL

Posted by sos <so...@pmg.be>.
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: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org