[Solved] Add item in File / Wizards menu

Discussions about using 3rd party extension with OpenOffice.org
Post Reply
User avatar
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

[Solved] Add item in File / Wizards menu

Post by Mr.Dandy »

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

<?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&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.12 - Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Add item in File / Wizards menu

Post by Villeroy »

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
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Post by Mr.Dandy »

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

Re: Add item in File / Wizards menu

Post by RoryOF »

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.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Add item in File / Wizards menu

Post by Villeroy »

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
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Post by Mr.Dandy »

Wizards items menu can be listed with ConfigurationProvider.

Another approach with:

Code: Select all

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

Re: Add item in File / Wizards menu

Post by RoryOF »

With the crash do you get any error message?
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Post by Mr.Dandy »

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

You can try the script above to see this.
OpenOffice 4.1.12 - Windows 10
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Add item in File / Wizards menu

Post by RoryOF »

If you expand your last line it gives

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

Does that make sense?
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Post by Mr.Dandy »

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.12 - Windows 10
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Add item in File / Wizards menu

Post by JeJe »

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?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Post by Mr.Dandy »

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.12 - Windows 10
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Add item in File / Wizards menu

Post by JeJe »

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
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

Re: Add item in File / Wizards menu

Post by Mr.Dandy »

JeJe wrote:There's another menu example here:
This works!

Thanks
OpenOffice 4.1.12 - Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Post by Villeroy »

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