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

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Post 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
Attachments
menu_test.ods
(11.25 KiB) Downloaded 215 times
MyLibrary-1.0.0.oxt
(2.62 KiB) Downloaded 212 times
Last edited by MrProgrammer on Fri May 08, 2020 6:59 pm, edited 1 time in total.
Reason: Tagged ✓ [Closed]
JeJe
Volunteer
Posts: 2783
Joined: Wed Mar 09, 2016 2:40 pm

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

Post by JeJe »

Have you tried Extension Compiler?

https://wiki.openoffice.org/wiki/Extensions_Packager
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Post 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.
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Post 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.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Post 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?
JeJe
Volunteer
Posts: 2783
Joined: Wed Mar 09, 2016 2:40 pm

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

Post by JeJe »

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Post 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.
Attachments
MyLibrary-1.0.0.oxt
(2.62 KiB) Downloaded 217 times
JeJe
Volunteer
Posts: 2783
Joined: Wed Mar 09, 2016 2:40 pm

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

Post by JeJe »

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Post 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.
JeJe
Volunteer
Posts: 2783
Joined: Wed Mar 09, 2016 2:40 pm

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

Post 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.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Post 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.
Post Reply