Page 1 of 1

Addon toolbar icon

Posted: Wed Nov 14, 2012 10:37 am
by othmanelmoulat
hello,
i have the below addon.xcu file where i specify an icon image to use with my addon toolbar. however the toolbar button doesn't show the image and text. it only shows a dummy image. my image is 16x16 in size and stored in images folder.
can you please tell how to show a toolbar with icon and below it the text using the addon.xcu settings?

thanks

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>

<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
  <node oor:name="AddonUI">

    <node oor:name="OfficeToolBar">
      <node oor:name="com.appinux.libreoffice.libreofficeaddon" oor:op="replace">
      <node oor:name="m1" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.appinux.libreoffice.libreofficeaddon:RemotePrint</value>
        </prop>
      
        <prop oor:name="Target" oor:type="xs:string">
          <value>_self</value>
        </prop>
        <prop oor:name="Context" oor:type="xs:string">
          <value>com.sun.star.text.TextDocument</value>
        </prop>
        <prop oor:name="Title" oor:type="xs:string">         
          <value xml:lang="en">Remote print</value>
          <value xml:lang="da">Fjernprint</value>
        </prop>
          
             </node>
      </node>
    </node>
    <node oor:name="Images">
      <node oor:name="com.appinux.libreoffice.libreofficeaddon.remoteprint.images" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.appinux.libreoffice.libreofficeaddon:RemotePrint</value>
        </prop>
        <node oor:name="UserDefinedImages">
          <prop oor:name="ImageSmallURL">
             <value>%origin%/images/printer_network.png</value>
          </prop>
         
        </node>
      </node>
      </node>
  </node>
</oor:component-data>


Re: Addon toolbar icon

Posted: Wed Nov 14, 2012 5:21 pm
by othmanelmoulat
i remember in the past the addon generator of netbeans OO plugin was encoding the image icon as a binary hexadecimal code. but when it switched to use urls it no more works. does any one knows why is this? what url for image i should put? and if only accepts hexadecimal code how to convert my icon image to hexadecimal binary?

this issue is very strange..i'm not sure if someone else experience same issue as me.

Re: Addon toolbar icon

Posted: Wed Nov 14, 2012 6:01 pm
by othmanelmoulat
ok is it possible i do it programmatically, try get my toolbar button then customize it by adding image icon and text, does anyone knows how to do that using java?

Re: Addon toolbar icon

Posted: Wed Nov 14, 2012 6:25 pm
by hanya
First, please try to ImageIdentifier node from your entry, it is different things from images defined in Images node.

Re: Addon toolbar icon

Posted: Wed Nov 14, 2012 6:31 pm
by othmanelmoulat
hanya wrote:First, please try to ImageIdentifier node from your entry, it is different things from images defined in Images node.
i did that i removed the ImageIdentifier and tried without it but same thing. it doesn't work. would you please try give a correct addon.xcu to use? am i doing mistakes in Addo.xcu? if yes can you point what mistake i'm doing?

Re: Addon toolbar icon

Posted: Wed Nov 14, 2012 8:33 pm
by B Marcelly
Hi,

In your Addon.xcu :
- delete entirely the part

Code: Select all

            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value></value>
            </prop>
- delete the <value/> in the part

Code: Select all

            <prop oor:name="Title" oor:type="xs:string">
              <value/>
              <value xml:lang="en">Remote print</value>
              <value xml:lang="da">Fjernprint</value>
            </prop>
- delete the spaces surrounding the address in the value item :

Code: Select all

              <prop oor:name="ImageSmallURL">
                 <value> %origin%/images/printer_network.png </value>
              </prop>
- delete entirely the old code in comments, it will be more clear.
- of course verify that you really have an image named printer_network.png in subfolder /images/ of your extension.
- uninstall the old version of your extension; preferably restart OpenOffice; re-install the new version.

Re: Addon toolbar icon

Posted: Wed Nov 14, 2012 8:40 pm
by othmanelmoulat
i did what you say. it doesn't work! . images folder contains printer_network.png image (16x16). updated the addon.xcu..results no icon is shown!
it only works if i hard code the binary hexadecimal under ImageSmall . if i specify a url image it doesn't work. maybe the

Code: Select all

%origin%
is not pointing to the correct location ..or i don't know what is the problem..

Re: Addon toolbar icon

Posted: Thu Nov 15, 2012 5:00 am
by hanya
%origin% is top most location after the extension installed. I placed these files as follows, it worked.

Code: Select all

/ (extension top dir)
 |- META-INF/manifest.xml
 |- description.xml
 |- Addons.xcu
 |- images/print_network.png

Re: Addon toolbar icon

Posted: Thu Nov 15, 2012 10:19 am
by othmanelmoulat
hanya wrote:%origin% is top most location after the extension installed. I placed these files as follows, it worked.

Code: Select all

/ (extension top dir)
 |- META-INF/manifest.xml
 |- description.xml
 |- Addons.xcu
 |- images/print_network.png
my extension oxt structure generated by netbeans IDE is attached. it seems it is not same structure. and the images folder is at top dir but the addon.xcu is below another folder structure under top folder 'registry'

Re: Addon toolbar icon

Posted: Thu Nov 15, 2012 2:17 pm
by hanya
othmanelmoulat wrote:my extension oxt structure generated by netbeans IDE is attached. it seems it is not same structure. and the images folder is at top dir but the addon.xcu is below another folder structure under top folder 'registry'
For that structure, you have to write the URL something like:

Code: Select all

<value>%origin%/../../../../../images/printer_network.png</value>

Re: Addon toolbar icon

Posted: Thu Nov 15, 2012 2:21 pm
by othmanelmoulat
hanya wrote:
othmanelmoulat wrote:my extension oxt structure generated by netbeans IDE is attached. it seems it is not same structure. and the images folder is at top dir but the addon.xcu is below another folder structure under top folder 'registry'
For that structure, you have to write the URL something like:

Code: Select all

<value>%origin%/../../../../../images/printer_network.png</value>
thank you the icon is now displayed. but the text is not displayed under the icon image. is there a way to get both image icon and text displayed in button?

Re: Addon toolbar icon

Posted: Thu Nov 15, 2012 8:23 pm
by hanya
othmanelmoulat wrote:thank you the icon is now displayed. but the text is not displayed under the icon image. is there a way to get both image icon and text displayed in button?
You need to add additional configuration have to be added to your extension package written below. You have to follow B Marcelly's suggestion described above to enable the configuration.

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI">
<node oor:name="UIElements">
    <node oor:name="States">
        <node oor:name="private:resource/toolbar/addon_com.appinux.libreoffice.libreofficeaddon" oor:op="replace">
            <prop oor:name="UIName" oor:type="xs:string">
                <value xml:lang="en">FooBar</value>
            </prop>
            <prop oor:name="Style" oor:type="xs:int">
                <value>2</value>
            </prop>
        </node>
    </node>
</node>
</oor:component-data>

Re: Addon toolbar icon

Posted: Thu Nov 15, 2012 8:43 pm
by othmanelmoulat
hanya wrote:
othmanelmoulat wrote:thank you the icon is now displayed. but the text is not displayed under the icon image. is there a way to get both image icon and text displayed in button?
You need to add additional configuration have to be added to your extension package written below. You have to follow B Marcelly's suggestion described above to enable the configuration.

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI">
<node oor:name="UIElements">
    <node oor:name="States">
        <node oor:name="private:resource/toolbar/addon_com.appinux.libreoffice.libreofficeaddon" oor:op="replace">
            <prop oor:name="UIName" oor:type="xs:string">
                <value xml:lang="en">FooBar</value>
            </prop>
            <prop oor:name="Style" oor:type="xs:int">
                <value>2</value>
            </prop>
        </node>
    </node>
</node>
</oor:component-data>
Great thank you this solved the issue.

Re: Addon toolbar icon [Solved]

Posted: Thu Nov 15, 2012 8:46 pm
by othmanelmoulat
@hanya
I would appreciate a lot if you look at my second question at http://forum.openoffice.org/en/forum/vi ... 20&t=57460

need your hand solving this question too ;)
many thanks!

Re: Addon toolbar icon [Solved]

Posted: Thu Nov 15, 2012 9:36 pm
by othmanelmoulat
in fact if i debug the extension from Netbeans IDE i can see both icon image and text. however if i install oxt from LO the text doesn't show beside the icon..this is strange issue .do you have an idea why is this happening?