Jan Holst Jensen wrote:
Hi.

I am confused by add-on toolbars. My add-on toolbar doesn't show up when listing the LayoutManager's elements via

 Sub ListToolbars
   Dim x as Variant
   Dim s as String

For Each x in ThisComponent.GetCurrentController.GetFrame.LayoutManager.getElements()
     s = s & x.ResourceURL & CHR$(10)
   Next

   MsgBox s, 0, "Toolbars in Component"
 End Sub

All add-on toolbars show as "0" in this list instead of showing a URL. The standard toolbars are "fully equipped" as seen by

 Dim x as Variant
x = ThisComponent.GetCurrentController.GetFrame.LayoutManager.getElement("private:resource/toolbar/standardbar")
 Xray x

but if I check my own add-on toolbar in a very simple add-on "doobiedoo.my.toolbar" (or any other add-on toolbar - I tried installing a few)

 Dim x as Variant
x = ThisComponent.GetCurrentController.GetFrame.LayoutManager.getElement("private:resource/toolbar/addon_doobiedoo.my.toolbar")
 Xray x

the returned object is rather naked and lacks all the properties needed for manipulating its state. What's going on ?
Hi Jan,

What you see is intended design and correct. An add-on toolbar is defined by a XCU-file and have no settings which can be changed. This is related to the fact that changes have to be stored in the user layer. Unfortunately if you deinstall an extension these user layer data won't be removed. That would mean that your add-on toolbar won't be removed, too. Therefore we decided to disable settings for add-on toolbars. If you want to circumvent this design, what I cannot recommend, then you can use the configuration API to make direct changes to your Addons.xcu file. Please be aware that you and your users would see the negative effects that I described before!

You can enable/disable button if you have a DispatchProvider that controls the commands behind the buttons. This is a very complex task if you want to do it in Basic.


Am I unable to change the settings of an add-on toolbar that is defined by an .XCU file - e.g. disable/enable buttons ? Or is it just Basic that is stopping me ? Can I do it from e.g. Python ?

I don't know what features the current UNO Python implementation provides, but would guess that it supports all necessary things.

Regards,
Carsten

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to