Page 1 of 1

[Closed] menu entry in /Configurations2/menubar/menubar.xml

Posted: Tue May 05, 2020 11:29 am
by joesch
Hello,

in an extension (MyLibrary-1.0.0.oxt) there is a configuration file addons.xcu with the following content:

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="OfficeMenuBar">
			<node oor:name="MyLibrary.OfficeMenuBar" oor:op="replace">
				<prop oor:name="Context" oor:type="xs:string">
					<value>com.sun.star.sheet.SpreadsheetDocument</value>
				</prop>
				<prop oor:name="Title" oor:type="xs:string">
					<value>MyMenu</value>
				</prop>
				<node oor:name="Submenu">
				<node oor:name="m001" oor:op="replace">
					<prop oor:name="Context" oor:type="xs:string">
						<value>com.sun.star.sheet.SpreadsheetDocument</value>
					</prop>
					<prop oor:name="URL" oor:type="xs:string">
						<value>vnd.sun.star.script:MyLibrary.Module1.Main?language=Basic&location=application</value>
					</prop>
					<prop oor:name="Title" oor:type="xs:string">
						<value>MyMacro</value>
					</prop>
					<prop oor:name="Target" oor:type="xs:string">
						<value>_self</value>
					</prop>
				</node>
				</node>
			</node>
		</node>
	</node>
</oor:component-data>
(everything ok, works fine)

There is now a file (menu_test.ods) in which a macro is stored. At the same time a menu configuration is to be stored in this file, which adds an entry for the macro stored in the file to a menu.
This is very simple for a 'normal' menu, e.g. the help menu, the entry in /Configurations2/menubar/menubar.xml (in the file menu_test.ods) must be:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE menu:menubar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "menubar.dtd">
<menu:menubar xmlns:menu="http://openoffice.org/2001/menu" menu:id="menubar">
...
 <menu:menu menu:id=".uno:HelpMenu" menu:label="">
  <menu:menupopup>
   <menu:menuitem menu:id=".uno:HelpIndex"/>
   <menu:menuitem menu:id=".uno:ExtendedHelp"/>
   <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:HelpSupport"/>
   <menu:menuitem menu:id=".uno:OnlineRegistrationDlg" menu:label="OnlineRegistrationDlg"/>
   <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:About"/>
  <menu:menuitem menu:id="vnd.sun.star.script:Standard.Module1.testmacro?language=Basic&location=document" menu:label="testmacro"/>
  </menu:menupopup>
 </menu:menu>
</menu:menubar>
But what should the entry be for the menu created by the extension (more precisely by the included addons.xcu)?


Greetings,
joesch

Re: special menu entry in /Configurations2/menubar/menubar.x

Posted: Tue May 05, 2020 1:18 pm
by JeJe
Have you tried Extension Compiler?

https://wiki.openoffice.org/wiki/Extensions_Packager

Re: special menu entry in /Configurations2/menubar/menubar.x

Posted: Tue May 05, 2020 2:01 pm
by joesch
No, I haven't.
The download links there:
http://berma.pagesperso-orange.fr/Files ... mpiler.ott
http://berma.pagesperso-orange.fr/Files ... ler-Fr.odt

are (at least at present) not reachable.

Furthermore the description of "Extension Compiler" does not let me realize that it would be useful for my purposes, because I have no difficulties to create my extension.

Re: special menu entry in /Configurations2/menubar/menubar.x

Posted: Tue May 05, 2020 2:23 pm
by RoryOF
Try an internet search for the two filenames and see if you can find another site from which to download them. As far as I remember that extension permits building the menu addon - you can ignore the facilities you don't need, or generate a dummy file, and then substitute your correct filename into that template.

Re: special menu entry in /Configurations2/menubar/menubar.x

Posted: Tue May 05, 2020 3:13 pm
by joesch
As far as I remember that extension permits building the menu addon
i have a finished, working addons.xcu:

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="OfficeMenuBar">
         <node oor:name="MyLibrary.OfficeMenuBar" oor:op="replace">
            <prop oor:name="Context" oor:type="xs:string">
               <value>com.sun.star.sheet.SpreadsheetDocument</value>
            </prop>
            <prop oor:name="Title" oor:type="xs:string">
               <value>MyMenu</value>
            </prop>
            <node oor:name="Submenu">
            <node oor:name="m001" oor:op="replace">
               <prop oor:name="Context" oor:type="xs:string">
                  <value>com.sun.star.sheet.SpreadsheetDocument</value>
               </prop>
               <prop oor:name="URL" oor:type="xs:string">
                  <value>vnd.sun.star.script:MyLibrary.Module1.Main?language=Basic&location=application</value>
               </prop>
               <prop oor:name="Title" oor:type="xs:string">
                  <value>MyMacro</value>
               </prop>
               <prop oor:name="Target" oor:type="xs:string">
                  <value>_self</value>
               </prop>
            </node>
            </node>
         </node>
      </node>
   </node>
</oor:component-data>
Why should it be good to create another one? Or have I misunderstood something?

Re: special menu entry in /Configurations2/menubar/menubar.x

Posted: Tue May 05, 2020 4:05 pm
by JeJe

Re: special menu entry in /Configurations2/menubar/menubar.x

Posted: Tue May 05, 2020 4:27 pm
by joesch
Thank you.

I downloaded the sample:
https://berma.pagesperso-orange.fr/File ... onDemo.zip

and there is no file named menubar.xml but a normal AddonUI.xcu.

And now?
I have, as already written, a finished extension, with menu, (and logically with Addons.xcu file) which works absolutly without problems. See attached file.

I am looking for a specific entry for the file menubar.xml in a file *.ods.

Re: special menu entry in /Configurations2/menubar/menubar.x

Posted: Tue May 05, 2020 4:36 pm
by JeJe

Re: special menu entry in /Configurations2/menubar/menubar.x

Posted: Tue May 05, 2020 5:05 pm
by joesch
Yes, I know!

And this compiler does not create a file menubar.xml but the file AddonUI.xcu.

But I already have the latter file (AddonUI.xcu) and don't need it.

I have now explained all this several times. Is my english not sufficiently understandable?


My question is not about creating a menu with an extension, but about a very special question about saving a menu in a Calc file (*.ods).

Normally you would do this in Calc, by calling Tools-Customize-Menus, but because the menu I want to add an additional entry to is installed via extension, it is not listed there.
So I have to edit the file /Configurations2/menubar/menubar.xml by hand, but I don't know what the entry should be.

Re: Special menu entry in /Configurations2/menubar/menubar.x

Posted: Wed May 06, 2020 12:04 am
by JeJe
If you can't find the solution and perhaps its not possible - then the alternative would be for the extension to create the menu from code (when its first run maybe), instead of being part of the installation. The user can edit the menu themselves that way rather than it being fixed.

Re: Special menu entry in /Configurations2/menubar/menubar.x

Posted: Wed May 06, 2020 9:46 pm
by joesch
I have tried a lot of things in the meantime and assume that the menu adjustment I want is not possible in the desired way.

The topic can therefore be regarded as finished.