Icons are not displayed in calc from my extension

I set the addons.xcu to display icons but not displayed.

I’m developing on Eclipse and using Libreoffice SDK plugin.

I set the images path in package.properties.

Do I need other settings?

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

<oor:component-data oor:package=“org.openoffice.Office” oor:name=“Addons”
xmlns:oor=“http://openoffice.org/2001/registry” xmlns:xs=“XML Schema”>

	<node oor:name="OfficeMenuBar">
		<node oor:name="org.libreoffice.example.menubar" oor:op="replace">
			<prop oor:name="Title" oor:type="xs:string">
				<value xml:lang="en-US">Extention</value>
			</prop>
			<prop oor:name="Context" oor:type="xs:string">
				<value>com.sun.star.sheet.SpreadsheetDocument</value>
			</prop>
			<node oor:name="Submenu">
				<node oor:name="M1" oor:op="replace">
					<prop oor:name="Title">
						<value xml:lang="en-US">InsertDate</value>
					</prop>
					<prop oor:name="URL">
						<value>service:org.libreoffice.example?InsertDate</value>
					</prop>
					<prop oor:name="Target" oor:type="xs:string">
						<value>_self</value>
					</prop>
				</node>
			</node>
		</node>
	</node>

	<node oor:name="Images">
	  <node oor:name="org.libreoffice.example.image1" oor:op="replace">
		<prop oor:name="URL" oor:type="xs:string">
		  <value>service:org.libreoffice.example?InsertDate</value>
		</prop>
		<node oor:name="UserDefinedImages">
		  <prop oor:name="ImageSmallURL" oor:type="xs:string">
			<value>%origin%/images/image16.png</value>
		  </prop>
		  <prop oor:name="ImageBigURL" oor:type="xs:string">
			<value>%origin%/images/image.png</value>
		  </prop>
		</node>
	  </node>
	</node>

</node>

</oor:component-data>

  1. You should, probably, use language codes only, without locales, i. e. “en”, “ru” etc.
  2. PNG may be a problem. I tried to make an extension. BMP icons are OK, but PNG ones do not show up.

I asked this question but got no reply.

Thank you for 2 persons who answered my question.

Unfortunately, I still failed to display the icons.

I made the icons bmp.

And made “lang” value to “en”.

====================

I wish Error message was displayed like

“The image file was not found.”,

“The image file’s format is not stable to display.”

I succeeded to display icons.

I needed to put image files in the same folder containing addons.xcu.

===========================

I’ve found this at the site

https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/AddOns/Images_for_Toolbars_and_Menus

Note #1: As of Apache OpenOffice 4.1.0, %origin% is substituted with something like

vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages/svfj5eg0.tmp_/AddOn.oxt/registry/data/org/openoffice/Office/images

===========================

Thank everyone to reply.

But “Title” was not displayed with icon on Notebook Bar.

About this, I found the same question.

At here, not be resolved, and might be reported as a bug.

Can you share the whole Addon.xcu? I still can’t cope with my case.

If you use some non-english localization for LibreOffice, you can try to set the empty parameters ‘lang’ in the .xcu & .xml files.

Now: <value xml:lang="en-US">

Try to do empty ‘langs’: <value xml:lang="">

Hello,

This may be of some help. Have not created an extension for a few years now but went back as originally and looked at some other extensions. Don’t remember how it all works but may be of some help to you.

In Addons.xcu you are naming both large and small icons and providing what seems to be a full name with the extension. The choice is actually made bu the user in LO Options and no need to note in this file. The icons are provided (don’t remember exactly how) with distinguishing with additional information added to the icon name.

For example, here are the icons for BasicAddOnBuilder extension:

image description

And the Addon.xcu:

<?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="BasicAddonBuilder.OfficeToolBar" oor:op="replace">
				<node oor:name="m1" oor:op="replace">
					<prop oor:name="Context" oor:type="xs:string">
						<value>com.sun.star.text.TextDocument,com.sun.star.sheet.SpreadsheetDocument,com.sun.star.script.BasicIDE</value>
					</prop>
					<prop oor:name="URL" oor:type="xs:string">
						<value>vnd.sun.star.script:BasicAddonBuilder.Main.RunWizard?language=Basic&amp;location=application</value>
					</prop>
					<prop oor:name="ImageIdentifier" oor:type="xs:string">
						<value>%origin%/icons/bab</value>
					</prop>
					<prop oor:name="Title" oor:type="xs:string">
						<value>BasicAddonBuilder</value>
					</prop>
					<prop oor:name="Target" oor:type="xs:string">
						<value>_self</value>
					</prop>
				</node>
			</node>
		</node>
		<node oor:name="OfficeHelp">
				<node oor:name="BasicAddonBuilder.OfficeHelp.m1" oor:op="replace">
					<prop oor:name="Context" oor:type="xs:string">
						<value></value>
					</prop>
					<prop oor:name="URL" oor:type="xs:string">
						<value>vnd.sun.star.script:BasicAddonBuilder.Main.RunAbout?language=Basic&amp;location=application</value>
					</prop>
					<prop oor:name="ImageIdentifier" oor:type="xs:string">
						<value>%origin%/icons/bab</value>
					</prop>
					<prop oor:name="Title" oor:type="xs:string">
						<value>About BasicAddonBuilder...</value>
						<value xml:lang="it">Informazioni su  BasicAddonBuilder...</value>
						<value xml:lang="fr">A propos de BasicAddonBuilder...</value>
						<value xml:lang="da">Om BasicAddonBuilder</value>

					</prop>
					<prop oor:name="Target" oor:type="xs:string">
						<value>_self</value>
					</prop>
				</node>
		</node>
	</node>
</oor:component-data>

Or for MRI extension:

image description

<?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="AddonMenu">
		<node oor:name="mytools.mri201" oor:op="fuse">
			<prop oor:name="Title" oor:type="xs:string">
				<value xml:lang="en-US">~MRI</value>
				<value xml:lang="ja">~MRI</value>
			</prop>
			<prop oor:name="URL" oor:type="xs:string">
				<value>service:mytools.Mri?current</value>
			</prop>
			<prop oor:name="Target" oor:type="xs:string">
				<value>_self</value>
			</prop>
			<prop oor:name="Context" oor:type="xs:string">
				<value></value>
			</prop>
			<prop oor:name="ImageIdentifier" oor:type="xs:string">
				<value>%origin%/icons/current</value>
			</prop>
		</node>
		<node oor:name="mytools.mri202" oor:op="fuse">
			<prop oor:name="Title" oor:type="xs:string">
				<value xml:lang="en-US">~MRI &lt;- selection</value>
				<value xml:lang="ja">~MRI &lt;- selection</value>
			</prop>
			<prop oor:name="URL" oor:type="xs:string">
				<value>service:mytools.Mri?selection</value>
			</prop>
			<prop oor:name="Target" oor:type="xs:string">
				<value>_self</value>
			</prop>
			<prop oor:name="Context" oor:type="xs:string">
				<value></value>
			</prop>
			<prop oor:name="ImageIdentifier" oor:type="xs:string">
				<value>%origin%/icons/selection</value>
			</prop>
		</node>
	</node>
</node>
</oor:component-data> 

When I did my extension it followed this same pattern. Notice this line in each (mine had same):

			<prop oor:name="ImageIdentifier" oor:type="xs:string">

and the line(s) following. Yours is not the same.

Sorry cannot help further at this time.

Additional note,

_16 = 16X16 small icons and _26 = 26X26 large icons.

Need one large and one small for icons appearing on a toolbar.

Thank you for your reply.

I set icons that size are 16 and 26 pixel.

But have not displayed on the menubar and the notebookbar yet.

Sorry, but I may have not understood. Though this was for a toolbar not a menubar. Personally do not know about notebookbar. If it is the toolbar, lines in Addons.xcu are not what I noted in the answer and from my past experience. Those need to be changed.

Your lines:

    <node oor:name="UserDefinedImages">
      <prop oor:name="ImageSmallURL" oor:type="xs:string">
        <value>%origin%/images/image16.png</value>
      </prop>
      <prop oor:name="ImageBigURL" oor:type="xs:string">
        <value>%origin%/images/image.png</value>
      </prop>

Others lines:

                </prop>
                <prop oor:name="ImageIdentifier" oor:type="xs:string">
                    <value>%origin%/icons/bab</value>
                </prop>

Not clear why you have icons in an image folder.