openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Alcock <>
Subject Re: Manipulate menu item titles (text) defined in Addons.xcu
Date Thu, 16 Oct 2014 14:25:02 GMT

Thank you very much!  I was already manipulating FeatureStateEvent to
enable and disable the menu items, but I didn't realize that State
holds the text of the menu item.  I added just a line of code and now
it works!


2014-10-16 14:16 GMT+02:00 Ariel Constenla-Haile <>:
> Hello Keith,
> On Thu, Oct 16, 2014 at 11:13:19AM +0200, Keith Alcock wrote:
>> API experts,
>> This question below couldn't be answered in the forums, so I'll try here:
>> I have a very nice addon programmed in C++ and the related menu items
>> are stored in Addons.xcu. The addon would be even nicer if I could
>> adjust the menu item texts as the user works, similarly to how the
>> undo, redo, and repeat items function in the edit menu. I can't figure
>> out how to get ahold of the XMenu associated with my addon. From there
>> it seems that I could use setItemText(). Who knows how to get that
>> XMenu and is willing to tell? Thanks.
>> Additional information:
>> I've seen examples (e.g.,
>> and
>> of how so
>> search through the standard OpenOffice menus, but I don't think that
>> the addon menu items are included based on the popupCount I get from
> You should *not* use the configuration API in order to change the text of
> the menu item (a single change will cause the whole menubar to be
> updated, and this is rather inefficient).
> The text of the menu items can be changed at runtime by sending a status
> update where the css.frame.FeatureStateEvent.State holds the string with
> the new menu item text.
> How does it work? The menu item is controlled in the application
> framework by an object that listens for status updates at the dispatch object
> you return in your ProtocolHandler implementation.
> For this to work, you may need to modify your implementation of the
> ProtocolHandler; usually, in most examples, like the ones on the SDK [1],
> the dispatch provider and the dispatch object are implemented in the
> same class and status listeners are not tracked.
> [1] For example
> <sdk>/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message