From api-return-752-apmail-openoffice-api-archive=openoffice.apache.org@openoffice.apache.org Thu Oct 16 12:16:47 2014 Return-Path: X-Original-To: apmail-openoffice-api-archive@www.apache.org Delivered-To: apmail-openoffice-api-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 14C0D174D8 for ; Thu, 16 Oct 2014 12:16:47 +0000 (UTC) Received: (qmail 40509 invoked by uid 500); 16 Oct 2014 12:16:46 -0000 Delivered-To: apmail-openoffice-api-archive@openoffice.apache.org Received: (qmail 40459 invoked by uid 500); 16 Oct 2014 12:16:46 -0000 Mailing-List: contact api-help@openoffice.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: api@openoffice.apache.org Delivered-To: mailing list api@openoffice.apache.org Received: (qmail 40448 invoked by uid 99); 16 Oct 2014 12:16:46 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Oct 2014 12:16:46 +0000 Received: from localhost (HELO localhost.localhost) (127.0.0.1) (smtp-auth username arielch, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Oct 2014 12:16:45 +0000 Date: Thu, 16 Oct 2014 09:16:42 -0300 From: Ariel Constenla-Haile To: api@openoffice.apache.org Subject: Re: Manipulate menu item titles (text) defined in Addons.xcu Message-ID: <20141016121642.GA8718@localhost.localhost> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wRRV7LY7NUeQGEoC" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Keith, On Thu, Oct 16, 2014 at 11:13:19AM +0200, Keith Alcock wrote: > API experts, >=20 > This question below couldn't be answered in the forums, so I'll try here: >=20 > 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. >=20 > Additional information: >=20 > I've seen examples (e.g., > https://issues.apache.org/ooo/show_bug.cgi?id=3D6778 and > http://www.libreoffice-forum.de/viewtopic.php?f=3D12&t=3D12691) 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 obje= ct 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 /examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/a= ddon.cxx https://svn.apache.org/viewvc/openoffice/trunk/main/odk/examples/Developers= Guide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx?revision=3D14134= 71&view=3Dmarkup Regards --=20 Ariel Constenla-Haile La Plata, Argentina --wRRV7LY7NUeQGEoC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJUP7cqAAoJEE6VHKmdT1BX1h0P/j6oByVHxvTEAZMwo0JM+oA+ NMlGTvVV6A2VNRmxUMP8ibKAuq1JpPuWsSe/Rq1lq5EPr/AfmterVbqk3iupiQFw 9iwwbkbUjyArqPDicK/zDqAx/t0oPxx+U8bYd6mcrnf43a1pEzW/nx9JI+jObFlf Ed+Nl/ie80c5ANB46EzB/8+YBlNdtdDvmebhenODYVVnt2+rihoan8IodFtmdzxg wSYPL5LO6x7i5APJ77caDDsSNZdhIIx7owZBjsSMRFCO8YiAZXddplwMJoUsEJ62 tKOZav0ldM91RMH/4jhrZ+B0wqZSMDEvf7ZFZ73VQDlvEckRRqnj3vfP+Ils+nxz OYc0YBCP7K7sQcgrEVC4H3TRBY6GrLkz8ky8Dsg4YOnUHrLOWRUze2bPwy/6WjhH a6YBzatGlyeK9cG6fdogWsDqjr7pfsStTOzfVtLly5Fl2k1tGwIoMqEl+/s1VvT0 kqg5pO9wMZ7zc2vO3S+plSXEED49UQuuUofgpN2nlX4cnGrFagdQr3U+AnXtvFO1 afbVPzFQWHs5918IBnz/+jVyvN9WWvLqEe6xcCSnS2BqKhnLa17JP064G9/HXQyd nRKHeGOaXsiXw72Tlkb4QrakbOhsbVUISCIxJ1UxdzT7lYW/jBHVDeUxFPrx7yIV sGvilAhVtx3GOGF4QOQ7 =uMfa -----END PGP SIGNATURE----- --wRRV7LY7NUeQGEoC--