openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shukla, Mangesh" <mangesh.shu...@siemens.com>
Subject RE: Registering EventListeners on Add-on Menu item
Date Tue, 08 Jan 2013 11:18:17 GMT
Hi Ariel,
    Thanks for the quick reply.  Actually I intend to implement this just as you describe.
I intend to create an Extension to add my own Menu and toolbar items. Also I will be adding
some Macros (functions which appear in the functions wizard), to the extension. The intention
to add these UI items, is to transfer the call to the external application, so that the data
from the external application can be populated in the spreadsheet. The actual functionality
lies in the external application, and I need to get the calls redirected to the external application
as and when the user invokes the menu items/toolbar items/macros in the extension.

I have checked the link about the dispatch framework. However it is not clear to me, how it
could be made to work with a C++ client. Could you direct me to some samples to illustrate
the behavior.

Regards,
Mangesh

-----Original Message-----
From: Ariel Constenla-Haile [mailto:arielch@apache.org] 
Sent: Tuesday, January 08, 2013 4:33 PM
To: api@openoffice.apache.org
Subject: Re: Registering EventListeners on Add-on Menu item

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":
http://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Dispatch_Interception

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).


Regards
--
Ariel Constenla-Haile
La Plata, Argentina

Mime
View raw message