[Solved] Add item in File / Wizards menu

Discussions about using 3rd party extension with OpenOffice.org

[Solved] Add item in File / Wizards menu

Postby Mr.Dandy » Wed Dec 09, 2020 6:32 pm

Hello folks,

Try to build an OXT who add its menu item under File / Wizards
Capture.PNG

I use an Addons.xcu like this:
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="OfficeMenuBarMerging">
      <node oor:name="foo-menu" oor:op="replace">
      <node oor:name="S1" oor:op="replace">
        <prop oor:name="MergePoint">
          <value>.uno:PickList\.uno:AutoPilotMenu</value>
        </prop>
        <prop oor:name="MergeCommand">
         <value>AddAfter</value>
        </prop>
        <prop oor:name="MergeFallback">
         <value>AddPath</value>
        </prop>
        <prop oor:name="MergeContext" oor:type="xs:string">
          <value>com.sun.star.frame.StartModule</value>
        </prop>
        <node oor:name="MenuItems">
         <node oor:name="M1" oor:op="replace">
              <prop oor:name="URL" oor:type="xs:string">
            <value>vnd.sun.star.script:QRcodeJS.QRcodeJS.Main?language=Basic&amp;location=application</value>
         </prop>
         <prop oor:name="Title" oor:type="xs:string">
            <value>Foo wizard...</value>
         </prop>
         <prop oor:name="Target" oor:type="xs:string">
            <value>_self</value>
         </prop>
         </node>
        </node>
      </node>
      </node>
    </node>
</node>
</oor:component-data>

But this creates item below Wizards and not in sub menu :(

Thanks to advice me
Last edited by Mr.Dandy on Fri Dec 25, 2020 12:04 pm, edited 1 time in total.
OpenOffice 4.1.10 - Windows 10
User avatar
Mr.Dandy
 
Posts: 339
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Postby Villeroy » Thu Dec 10, 2020 9:05 pm

IMHO, all this UI rubbish is not worth the pain. However, you can try to manipulate the menu manually via Tools>Customize... Just add some dummy pointing to anything. Then have a look which configuration file changed in which ways.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29922
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Add item in File / Wizards menu

Postby Mr.Dandy » Fri Dec 11, 2020 11:27 am

Sorry, this menu is not present in the dialog to be customize:
Capture.PNG


I guess that exist an xml or xcu to give this list.
But I have not find it.
OpenOffice 4.1.10 - Windows 10
User avatar
Mr.Dandy
 
Posts: 339
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Postby RoryOF » Fri Dec 11, 2020 11:52 am

I have not time to look in depth at this, but I know that the MRI extension uses an addons.xcu to place its entries onto /Tools /Addons menu. If you open the MRI-1.3.4.oxt with an archive manager you should be able to extract addons.xcu and examine its structure.
Apache OpenOffice 4.1.10 on Xubuntu 20.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 32709
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add item in File / Wizards menu

Postby Villeroy » Fri Dec 11, 2020 12:14 pm

Tools>AddOns is what you get when you define entries below <node oor:name="AddonMenu"> (kind of "default menu").
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29922
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Add item in File / Wizards menu

Postby Mr.Dandy » Sun Dec 13, 2020 3:06 pm

Wizards items menu can be listed with ConfigurationProvider.

Another approach with:
Code: Select all   Expand viewCollapse view
Sub Main
   Dim oCfg as Object, oList as Object, oElem as Object
   Dim aNode(0) As new com.sun.star.beans.PropertyValue
   Dim sProvider$, sAccess$, sNode$, sName$
   sName = "Dandy"
   sProvider = "com.sun.star.configuration.ConfigurationProvider"
   sAccess = "com.sun.star.configuration.ConfigurationUpdateAccess"
   sNode = "/org.openoffice.Office.Common/Menus/Wizard/" 'org.openoffice.Office.Common"
   oCfg = createUnoService(sProvider)
   aNode(0).name= "nodepath"
   aNode(0).Value = sNode
   oList = oCfg.createInstanceWithArguments(sAccess, aNode())
   
   oItem = oList.getElementNames()
   For i = 0 to UBound(oItem)
      If oItem(i) = sName then exit sub
   Next i
   oElem = oList.createInstance()

End sub

But it crash :(
OpenOffice 4.1.10 - Windows 10
User avatar
Mr.Dandy
 
Posts: 339
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Postby RoryOF » Sun Dec 13, 2020 3:15 pm

With the crash do you get any error message?
Apache OpenOffice 4.1.10 on Xubuntu 20.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 32709
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add item in File / Wizards menu

Postby Mr.Dandy » Sat Dec 19, 2020 4:48 pm

No error, just crash at the last line.
Unable to create instance.

You can try the script above to see this.
OpenOffice 4.1.10 - Windows 10
User avatar
Mr.Dandy
 
Posts: 339
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Postby RoryOF » Sat Dec 19, 2020 5:19 pm

If you expand your last line it gives

oElem = oCfg.createInstanceWithArguments(sAccess, aNode()).createInstance()

Does that make sense?
Apache OpenOffice 4.1.10 on Xubuntu 20.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 32709
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add item in File / Wizards menu

Postby Mr.Dandy » Sun Dec 20, 2020 12:04 pm

RoryOF wrote:Does that make sense?

I'm try to get this menu like this code snippet:
viewtopic.php?f=21&t=7128&p=33605

Do you see another way?
OpenOffice 4.1.10 - Windows 10
User avatar
Mr.Dandy
 
Posts: 339
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Postby JeJe » Sun Dec 20, 2020 12:50 pm

Your "Another approach with:" code doesn't crash for me on 4.1.6 on Windows 8

Edit: but "Dandy" won't be found. Having you tried exploring with MRI on olist without running the end bit?
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1567
Joined: Wed Mar 09, 2016 2:40 pm

Re: Add item in File / Wizards menu

Postby Mr.Dandy » Sun Dec 20, 2020 6:10 pm

JeJe wrote:Having you tried exploring with MRI on olist without running the end bit?

Yes, you can execute MRI on oList and run its createInstance method.

But if you try to see its properties: this crashes.
OpenOffice 4.1.10 - Windows 10
User avatar
Mr.Dandy
 
Posts: 339
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Postby JeJe » Sun Dec 20, 2020 11:14 pm

Yeah, and its a nasty crash, I have to go into Window's Task Manager and clear OO before I can load it again.

There's another menu example here:

https://wiki.openoffice.org/wiki/API/Sa ... rites-Menu
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1567
Joined: Wed Mar 09, 2016 2:40 pm

Re: Add item in File / Wizards menu

Postby Mr.Dandy » Fri Dec 25, 2020 12:04 pm

JeJe wrote:There's another menu example here:

This works!

Thanks
OpenOffice 4.1.10 - Windows 10
User avatar
Mr.Dandy
 
Posts: 339
Joined: Tue Dec 11, 2012 4:22 pm

Re: [Solved] Add item in File / Wizards menu

Postby Villeroy » Fri Dec 25, 2020 12:13 pm

Holy shit.
I mean: Merry Christmas!

But this is far too complicated. And why can't this be inserted with an entry in the XML configuration?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29922
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Extensions

Who is online

Users browsing this forum: No registered users and 1 guest