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

Creating a macro - Writing a Script - Using the API

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

Postby joesch » Tue May 05, 2020 11:29 am

Hello,

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

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="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&amp;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   Expand viewCollapse view
<?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&amp;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 18 times
MyLibrary-1.0.0.oxt
(2.62 KiB) Downloaded 20 times
Last edited by MrProgrammer on Fri May 08, 2020 6:59 pm, edited 1 time in total.
Reason: Tagged ✓ [Closed]
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Postby JeJe » Tue May 05, 2020 1:18 pm

Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 1088
Joined: Wed Mar 09, 2016 2:40 pm

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

Postby joesch » Tue May 05, 2020 2:01 pm

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.
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Postby RoryOF » Tue May 05, 2020 2:23 pm

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.7 on Xubuntu 18.04.4 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 31232
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby joesch » Tue May 05, 2020 3:13 pm

As far as I remember that extension permits building the menu addon


i have a finished, working addons.xcu:

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="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&amp;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?
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Postby JeJe » Tue May 05, 2020 4:05 pm

Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 1088
Joined: Wed Mar 09, 2016 2:40 pm

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

Postby joesch » Tue May 05, 2020 4:27 pm

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 18 times
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Postby JeJe » Tue May 05, 2020 4:36 pm

Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 1088
Joined: Wed Mar 09, 2016 2:40 pm

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

Postby joesch » Tue May 05, 2020 5:05 pm

JeJe wrote:https://berma.pagesperso-orange.fr/Files_en/ExtensionCompiler.ott


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.
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

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

Postby JeJe » Wed May 06, 2020 12:04 am

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.
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 1088
Joined: Wed Mar 09, 2016 2:40 pm

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

Postby joesch » Wed May 06, 2020 9:46 pm

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.
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests