Addon toolbar icon

Creating a macro - Writing a Script - Using the API

Addon toolbar icon

Postby othmanelmoulat » Wed Nov 14, 2012 10:37 am

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   Expand viewCollapse view
<?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>

Last edited by othmanelmoulat on Thu Nov 15, 2012 9:37 pm, edited 4 times in total.
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Addon toolbar icon

Postby othmanelmoulat » Wed Nov 14, 2012 5:21 pm

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.
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Addon toolbar icon

Postby othmanelmoulat » Wed Nov 14, 2012 6:01 pm

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?
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Addon toolbar icon

Postby hanya » Wed Nov 14, 2012 6:25 pm

First, please try to ImageIdentifier node from your entry, it is different things from images defined in Images node.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
hanya
Volunteer
 
Posts: 884
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Addon toolbar icon

Postby othmanelmoulat » Wed Nov 14, 2012 6:31 pm

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?
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Addon toolbar icon

Postby B Marcelly » Wed Nov 14, 2012 8:33 pm

Hi,

In your Addon.xcu :
- delete entirely the part
Code: Select all   Expand viewCollapse view
            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value></value>
            </prop>

- delete the <value/> in the part
Code: Select all   Expand viewCollapse view
            <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   Expand viewCollapse view
              <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.
Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
B Marcelly
Volunteer
 
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Addon toolbar icon

Postby othmanelmoulat » Wed Nov 14, 2012 8:40 pm

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   Expand viewCollapse view
%origin%
is not pointing to the correct location ..or i don't know what is the problem..
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Addon toolbar icon

Postby hanya » Thu Nov 15, 2012 5:00 am

%origin% is top most location after the extension installed. I placed these files as follows, it worked.
Code: Select all   Expand viewCollapse view
/ (extension top dir)
|- META-INF/manifest.xml
|- description.xml
|- Addons.xcu
|- images/print_network.png
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
hanya
Volunteer
 
Posts: 884
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Addon toolbar icon

Postby othmanelmoulat » Thu Nov 15, 2012 10:19 am

hanya wrote:%origin% is top most location after the extension installed. I placed these files as follows, it worked.
Code: Select all   Expand viewCollapse view
/ (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'
Attachments
LibreofficeAddon.oxt.zip
oxt extension
(40.82 KiB) Downloaded 100 times
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Addon toolbar icon

Postby hanya » Thu Nov 15, 2012 2:17 pm

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   Expand viewCollapse view
<value>%origin%/../../../../../images/printer_network.png</value>
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
hanya
Volunteer
 
Posts: 884
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Addon toolbar icon

Postby othmanelmoulat » Thu Nov 15, 2012 2:21 pm

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   Expand viewCollapse view
<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?
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Addon toolbar icon

Postby hanya » Thu Nov 15, 2012 8:23 pm

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   Expand viewCollapse view
<?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>
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
hanya
Volunteer
 
Posts: 884
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Addon toolbar icon

Postby othmanelmoulat » Thu Nov 15, 2012 8:43 pm

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   Expand viewCollapse view
<?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.
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Addon toolbar icon [Solved]

Postby othmanelmoulat » Thu Nov 15, 2012 8:46 pm

@hanya
I would appreciate a lot if you look at my second question at viewtopic.php?f=20&t=57460

need your hand solving this question too ;)
many thanks!
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Addon toolbar icon [Solved]

Postby othmanelmoulat » Thu Nov 15, 2012 9:36 pm

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?
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am


Return to Macros and UNO API

Who is online

Users browsing this forum: Spaltersar and 7 guests