Need help in getting the design right with Openoffice.org

2012-12-19 Thread Shukla, Mangesh
Hi ,
I am new to OpenOffice development and need some ideas on the following 
implementation.   I am working on an C++ application which needs to interact 
with OpenOffice.org. The interaction will comprise of populating data in the 
spreadsheet application. The Calc application is intended to be used as UI for 
displaying values to the user, and allowing him to make changes. This 
interaction between the C++ application is required on Windows, Linux and Mac 
as well.

I have the following questions:
1] I think I need to implement a UNO component which will implement a service 
to handle the interactions with the OpenOffice Calc application. This UNO 
component will be compiled as a shared library. My question is how does a C++ 
application interact with the shared library of the component.

2] I also need inputs on how I can pass function pointers (in the C++ 
application) during the Add-On menu creation, so that they get called when the 
user clicks on the Add-on menu items.

Please let me know if you need more inputs.

Thanks,
Mangesh.



RE: Registering EventListeners on Add-on Menu item

2013-01-08 Thread Shukla, Mangesh
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:arie...@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 +, 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


RE: communicating with a connected external application using OOBasic macro

2013-02-21 Thread Shukla, Mangesh
Hi Ariel,
 Thanks for sharing the information and the sample code. At the moment, I 
am just exploring the concepts, that will be required to build my application. 
Your inputs are certainly helping me make good progress on this.

Warm regards,
Mangesh


-Original Message-
From: Ariel Constenla-Haile [mailto:arie...@apache.org] 
Sent: Thursday, February 21, 2013 3:59 PM
To: api@openoffice.apache.org
Subject: Re: communicating with a connected external application using OOBasic 
macro

Hi Mangesh,

On Wed, Feb 20, 2013 at 10:47:16AM +, Shukla, Mangesh wrote:
 Hi Ariel, Based on your suggestion below, I have implemented a Socket 
 server in my external application dll , and now listen to it on a 
 different port than the one that it connects with OOo.  I have been 
 able to connect with it from the OOBasic macro function. I am even 
 able to send across a string to the external application using the 
 socket connection. However  I am facing some issues which I have 
 posted on the openoffice forum.  Could you please have a look and let 
 me know if you have any suggestions to make it work.
 
 http://forum.openoffice.org/en/forum/viewtopic.php?f=44t=59806

Unless there is a typo, there is an error in the macro

nBytesRead =  oConnection.read()(aByteArray, 200) 

read() takes two arguments, you have read()(ByteArray, 200)


You should be aware that read() blocks until it reads the amount you specify or 
the connection in closed. If your socket server writes 100, the macro will wait 
for other 100.

On the socket code, the logic for reading looks wrong too: 

read(buffer, 256) will return after 256 bytes are read, or the connection is 
closed. With the exception thrown due to your Basic code, the connection gets 
closed by the clean-up performed by the OOo Basic engine, that's why it 
returns; but if the macro writes 200 bytes, read() will wait for the remaining 
6. You better use recv, that tries to read up to some bytes, and you should 
read in a loop (if your buffer is 256 and the peer writes 300, the first recv 
will return 256, the second recv will return 44, -1 on error, and
0 when the peer closed the connection).

Unfortunately, in AOO API the connector uses internally only read(), this means 
that unless you will read/write in a fixed size, you will need to use another 
language, and not AOO API, but the tools provided by that language.
http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/io/source/connector/ctr_socket.cxx#127
(Side note, flush() does nothing, obviously it does not make sense when they 
use read/write)


Another point, your socket server should be accepting on its own thread, 
otherwise acceptConnection() will block your application.

Attached is a dummy, untested example. It accepts only one connection at the 
time, and after reading the first peer's write, it closes the connection (for 
something more realistic, you'll need a multi-threaded server - I'd use 
boost::asio instead of AOO C++ language binding).


Regards
--
Ariel Constenla-Haile
La Plata, Argentina


RE: UNO API

2013-04-02 Thread Shukla, Mangesh
Hi Misha,
Have you succeeded in setting up the build environment using the scripts. 
Are you able to build the C++  samples given in the SDK. I ask this, because it 
is important that you follow the steps mentioned in the wiki. 
http://wiki.openoffice.org/wiki/SDKInstallation

Here you will also find instructions to build the C++ samples under VC++ .

Once you are able to do this, let me know if you have any specific query on the 
use of UNO Api's.

Thanks,
Mangesh.

-Original Message-
From: k.misha [mailto:mi...@4k.com.ua] 
Sent: Tuesday, April 02, 2013 4:01 PM
To: api@openoffice.apache.org
Subject: RE: UNO API

But where can I get some examples in visual studio C++? That documentation 
don't have enough examples =(неинеи-Original Message-неиFrom: 
Andreas Säger [mailto:ville...@t-online.de] неиSent: Tuesday, April 02, 2013 
1:06 PMнеиTo: api@openoffice.apache.orgнеиSubject: Re: UNO 
APIнеинеи-BEGIN PGP SIGNED MESSAGE-неиHash: SHA1неинеиAm 
02.04.2013 12:00, k.misha wrote:неи 
http://wiki.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_GuideнеинеиThisнеи
 page is empty!неинеи-неинеиThis page is far from empty. It contains 
lots of text with an index toнеиthousands of documentation pages covering each 
and every aspect.неинеи-BEGIN PGP SIGNATURE-неиVersion: GnuPG 
v1.4.11 (GNU/Linux)неиComment: Using GnuPG with undefined - 
http://www.enigmail.net/неинеиiQEcBAEBAgAGBQJRWq2SAAoJEGTlfXWiA5oe3AYIAIGRa5YHm+15dnarzkZn3PSbнеиVOM8GiRPLh+TzaXwGixtAgpO9PVgDZumHCEbPNBXMf5yjKOHdqz1NxiF84+HWvmKнеи8TCOuJg8tuQ2fKjaRALu+cB9/tfHviSFWeKJ3EXx6kMsN3w5fCzGBSuFdklIYSBIнеиLi2LtVQ1BtIKV6oLUIxZ+rjM9w4CU+5I6Y+s7AnlW1JHGAirGSzehXmUhpdhUNibнеиxqHjQKQpSfrr5bbKM2dJVRL9a92G6q/bpVhEQnlGvMJtVTb9ccK7sdo9X/2n8akyнеиJAunOebYotihDNANgAjMX0MUQRpeTSJitIoKhrREZIxo2Pcj0H4wFZb2tub3Oj8=неи=Za7Hнеи-END
 PGP 
SIGNATURE-неинеи-неиTo
 unsubscribe, e-mail: api-unsubscr...@openoffice.apache.orgнеиFor additional 
commands, e-mail: api-h...@openoffice.apache.orgнеинеи


-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org