openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ariel Constenla-Haile <>
Subject Re: Registering EventListeners on Add-on Menu item
Date Tue, 08 Jan 2013 11:03:11 GMT
Hi Mangesh,

On Tue, Jan 08, 2013 at 10:31:47AM +0000, Shukla, Mangesh wrote:
> Hi Ariel, Thanks for your response. I am talking about a real client
> application. When a Add-on button is clicked (or any other actions is
> performed), I need the external client application to get
> a notification ( or a callback) so that I can populate the spreadsheet
> with information from the external application. I have read the
> information about the Automation support (which is specific to
> Windows), but I intend to have this working on Mac as well as Linux
> OS. My preferred language is C++, as the client application uses C++.
> Please let me know if you need anything else.

The first thing that comes to my mind, is why aren't you implementing
all this with an extension, it would be much simpler: 

- you define a menu/toolbar item on Addons.xcu with a custom URL

- you register a ProtocolHandler to handle this URL, the application
  framework will query your ProtocolHandler for an object that can
  dispatch this URL and provide feature updates: your Dispatch

- when the user executes the menu/toolbar item, your Dispatch will be
  invoked to dispatch the respective URL, that is, perform the action
  associated with the URL (here you will populate the spreadsheet)

Doing this with a client application is far more complex: you will have
to intercept when the application framework queries for a Dispatch
object, so that it is your client application the one that provides the
Dispatch object, instead of the original ProtocolHandler.

You can achieve this with a "dispatch interceptor":

Back to the original question: registering a menu/toolbar listener is
impossible, this is as designed, it will be a huge performance issue;
only the component in the application framework responsible for
controlling the menu/tool bar is a menu/toolbar listener (it gets
notified when the menu/toolbar item is selected/clicked, and dispatches
the respective URL using the dispatch framework).

Ariel Constenla-Haile
La Plata, Argentina

View raw message