RE: [libreoffice-dev] -calling a service function from BASIC macro

2013-02-15 Thread Rai, Neeraj
I was able to fix the macro to use the same service with startThr and stopThr 
buttons.
Thanks for your help Stephan and Michael.

Neeraj

-Original Message-
From: Rai, Neeraj [ICG-MKTS]
Sent: Wednesday, February 13, 2013 1:03 PM
To: 'Michael Stahl'
Cc: 'Stephan Bergmann'; 'libreoffice@lists.freedesktop.org'
Subject: RE: [libreoffice-dev] -calling a service function from BASIC macro

Hi Michael,

The links clear up some doubts in my mind.
I am still having trouble with having 2 buttons to act on the same service 
(this is a new problem report).
I created 2 buttons which calls startThr() and stopThr() on my service.
The start works as expected. However, the stop call seems to create a new 
service and fails to stop it.

I tried using a global service variable (button.macros attached), but it is 
giving me syntax error on line 1 expected Sub .
I used the attached burger_samples.macros as sample for my macro but I might 
have made some obvious mistakes as this is my 1st macro.
I have also found a book on macros by Andrew Pitonyak and going through it.
Are there are any other resources I could use?

thanks
Neeraj
 please read this chapter: 
 http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/C%2B%2B/C%2B%2B_Language_Binding
 and especially: 
 http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/C%2B%2B/Mapping_of_Interface_Types

 it is generally unsound to retain a plain C++ pointer to an object after
 the first uno::Reference for it has been constructed.  (you may retain a
 rtl::Reference however, which is often convenient because it can contain
 your implementation class directly and not just some UNO interface).



startThr.macros
Description: startThr.macros
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] -calling a service function from BASIC macro

2013-02-13 Thread Rai, Neeraj
Hi Michael,

The links clear up some doubts in my mind.
I am still having trouble with having 2 buttons to act on the same service 
(this is a new problem report).
I created 2 buttons which calls startThr() and stopThr() on my service.
The start works as expected. However, the stop call seems to create a new 
service and fails to stop it.

I tried using a global service variable (button.macros attached), but it is 
giving me syntax error on line 1 expected Sub .
I used the attached burger_samples.macros as sample for my macro but I might 
have made some obvious mistakes as this is my 1st macro.
I have also found a book on macros by Andrew Pitonyak and going through it.
Are there are any other resources I could use?

thanks
Neeraj
 please read this chapter: 
 http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/C%2B%2B/C%2B%2B_Language_Binding
 and especially: 
 http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/C%2B%2B/Mapping_of_Interface_Types

 it is generally unsound to retain a plain C++ pointer to an object after
 the first uno::Reference for it has been constructed.  (you may retain a
 rtl::Reference however, which is often convenient because it can contain
 your implementation class directly and not just some UNO interface).



burger_samples.macros
Description: burger_samples.macros


button.macros
Description: button.macros
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] -calling a service function from BASIC macro

2013-02-12 Thread Rai, Neeraj
Hi Stephan,

Is there any example of using uno calls from the forms bundled with LO ?
I am not very familiar with the Reference  and googling uno::Reference is not 
helping me either.
I also couldn't find usage in sdk dir and examples dir. Would it be possible to 
point out a dir/file or a web link.

I  also wanted to understand the lifetime of uno objects .
Does the CalcAddimThr_impl object live for the life of open doc ?
I tried to keep my object without reference counting as there is only one 
instance of it and I am unfamiliar with Reference.
The runThread was passed the same pointer that I assumed with live for the life 
of open scalc doc.
But you seem to be suggesting that some other reference counted object is going 
out of scope making the pointer dangling.

I'll keep reading about this. If you find time, would appreciate if you could 
give me any pointers to web.

Thanks
Neeraj

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] -calling a service function from BASIC macro

2013-02-12 Thread Rai, Neeraj
Actually, never mind! I think I have a work around even without Reference.
I made my CalcAddinThr a pointer, so it is independent of lifetime of  
CalcAddimThr_impl . Seems to work through button as well.

I think you might have been refereeing to the object created in Basic macro 
that goes out of scope.

Thanks again for taking time to help out on this.
Neeraj
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] -calling a service function from BASIC macro

2013-02-11 Thread Rai, Neeraj
Hi Stephan,

The function is getting called now, however, I get a crash a bit later when 
sheet_ is being accessed.
I also added a button and attached the macro to it for conveninece of calling.
There seems to be some difference between the direct call and call via 
button/macro.

You need to issue make run to test the crash. It invokes the uno exe with 
calc.uno.so
The code is triggered when calc.uno.so connects and tries to access the sheet.
I added print statements in the function insertIntoCellS to highlight the crash.
It prints creating the header but never gets inside the function insertIntoCellS

It doesn't happen if I call the function directly by typing =startthr() in the 
sheet and start calc.uno.so.

I have gotten rid of _writeinfo.
The new .ods file with button and new code is attached.

Thanks for investing time into this.
Neeraj



CalcAddinThr.tgz
Description: CalcAddinThr.tgz
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] -calling a service function from BASIC macro

2013-02-08 Thread Rai, Neeraj
Hi Stephan,

Appreciate you taking time to debug this.

 So the org.openoffice.sheet.addin.CalcAddinSock service you specified
 implements a new UNO interface that you added (and which has a method
 startThr), right?
Yes.

 Did you bundle in your extension a types.rdb that
 contains the information about that new interface?
No. But tried to change fundamentalrc SERVICE/TYPES rows to add 
$ORIGIN/CalcAddinThr.rdb.  scalc complained about duplicate entry.
I assumed that installing the extension informs scalc about my rdb. Maybe not?
I know about CORBA at conceptual level and how UNO works almost like 
CORBA just better.
I don't understand how the unopkg and .rdb achieve that theory. 
Specifically, where types.rdb fits.
I thought maybe unopkg add is similar to adding in types.rdb ?

 Helping you would probably be easiest if you gave the full source code of 
 your extension,
 along with short instructions how to build it (e.g., call make from
 within a configured LO SDK environment).

attaching the code, makefile, and readme with instructions. to extract :
tar -zxvf CalcAddinThr.tgz

Thanks
Neeraj


CalcAddinThr.tgz
Description: CalcAddinThr.tgz
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[libreoffice-dev] -calling a service function from BASIC macro

2013-02-07 Thread Rai, Neeraj
Hi,

I am having trouble trying to wrap UNO function call in BASIC macro.

I got the macro from the following SimpleCalcAddin example.
http://wiki.openoffice.org/wiki/SimpleCalcAddIn#Building_.26_Testing

1.  mgr = getProcessServiceManager()
2.  o = mgr.createInstance(org.openoffice.sheet.addin.CalcAddinSock)
3.  o.startThr()
 (where my idl service returned by getServiceName() is 
org.openoffice.sheet.addin.CalcAddinSock
and it defines a function startThr)

I can call the funciton startThr() using = in the spread sheet.
Also, the original example RNG is callable from macro by following the example.
One difference from the example is that I am using extension.

Please advise how to call UNO functions from BASIC macro.
I intend to call it on a button click. It seems like invoking macro on button 
click is simple (Form control to add button and assign macro using the event 
tab).

Thanks
Neeraj

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - libreoffice 4.0 - waiting on multiple sockets

2013-01-29 Thread Rai, Neeraj
Hi Stephan,

Thanks for the tip - that solved it.
The symbol __dso_handle__ was undefined.
I was using ld to link the shared lib.
Switching to g++ for linking solved the undefined symbol issue.

I think I understand the thread issue as well.
The UNO IPC slow is probably my bad usage, but I'll defer solving that for a 
while.

The regular sockets usage that you have helped me implement now, would help me 
reuse a lot of my existing application code.
I am planning to stick with Linux for sometime, and it is good to know that UNO 
IPC would work when I am ready to expand later.

Thanks for your help again.
Neeraj


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - libreoffice 4.0 - waiting on multiple sockets

2013-01-28 Thread Rai, Neeraj
Hi Stephan,

I had tried interprocess communication before and found it to be slow (12 sec 
vs 14ms).
Somewhere in the docs, there was a mention that it has latency of 2ms.
However, if you can point me to samples or provide other advise that make it as 
fast as osl::socket, I'd be happy to switch back to it.

Q1.  I think you answered the question.
I was hoping to keep single thread to manage multiple scalc but it 
seems like that would not be possible.

Q2.  Instead of using osl::AcceptorSocket and osl::ConnectorSocket,
I tried to use
#include sys/socket.h
int socket = (PF_INET, SOCK_STREAM, 0);
bind(socket, addr, addrlen);
listen (socket, 5);
This would allow me use scalable epoll but I had trouble compiling it.

Q3. I would like to understand more about how these threads interact with 
connection::read/write.
Is there an extra thread created for me per connection ?
  write would be called in my user thread. Is the data queued for 
writer thread ?
  read is called in my user thread. Is it listening on some UNO queue 
to which the dedicated reader thread queues data ?
Or did you mean that I should create a dedicated thread per connection 
because read/write are blocking calls ?


Thanks
Neeraj

-Original Message-
From: Stephan Bergmann [mailto:sberg...@redhat.com]
Sent: Monday, January 28, 2013 7:07 AM
To: Rai, Neeraj [ICG-MKTS]
Cc: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - libreoffice 4.0 - waiting on multiple sockets

On 01/26/2013 12:01 AM, Rai, Neeraj wrote:
 I have an extension that is communicating with a a standalone shared lib
 running via uno exe. I start a background thread in scalc and use
 osl::socket (client/server) to pass data.

In general, I would not recommend to create an own communication
protocol there.  As both processes are apparently able to speak UNO, you
can use that for remote communication.

On the uno exe side, you would need to invent some new UNO service that
is running there and listening on a specific connection (you run the uno
exe as uno -s XXX -u uno:YYY;urp, where XXX is the name of your new
service and YYY is the connection details, like
socket,host=localhost,port=1234).  The service could implement the
rather generic com.sun.star.task.XJob interface, or you could even
design one or more new UNO interface types that model your communication
patterns more acurately.

Let me dig for some useful examples if you want to go that route.

 Q1. I need multiple scalc instances to connect to this uno exe. Is there
 a way to achieve select or epoll functionality in osl::socket

No.  The way UNO uses this is to have a dedicated reader thread for each
accepted (socket) connection.

 Q2. I tried to use plain socket in uno shared lib but the scalc
 extension did not respond. Then I tried compiling scalc extension using
 plain sockets but had compilation issues.
  It seems the bind/listen etc are renamed in sal layer.

Not sure what you mean with the above.

Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - libreoffice 4.0 - waiting on multiple sockets

2013-01-28 Thread Rai, Neeraj
Hi Stephan,

I misspoke on Q2. It wasn't compilation error but a register error 
CannotRegisterImplementationException:loading component library failed:.
I am not sure how to debug this as same code with osl::socket registers. Do I 
need to link with certain libs?

regcomp -register -r CalcAddinThr.rdb -c libCalcAddinThr.so
libCalcAddinThr.so
register component 'libCalcAddinThr.so' in registry 'CalcAddinThr.rdb' 
failed!
error (CannotRegisterImplementationException): loading component 
library failed: libCalcAddinThr.so
make: *** [regcomp.flag] Error 1

Thanks
Neeraj

-Original Message-
From: Stephan Bergmann [mailto:sberg...@redhat.com]
Sent: Monday, January 28, 2013 11:43 AM
To: Rai, Neeraj [ICG-MKTS]
Cc: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - libreoffice 4.0 - waiting on multiple sockets

On 01/28/2013 04:04 PM, Rai, Neeraj wrote:
 I had tried interprocess communication before and found it to be slow (12 sec 
 vs 14ms).
 Somewhere in the docs, there was a mention that it has latency of 2ms.
 However, if you can point me to samples or provide other advise that make it 
 as fast as osl::socket, I'd be happy to switch back to it.

Generic UNO IPC with all its bells and whistles easily introduces more
overhead than any solution tailored to one specific use-case, but 12
sec vs 14ms surely sounds broken.  Hard to tell what's gone wrong there
from a high-level perspective.

 Q2.  Instead of using osl::AcceptorSocket and osl::ConnectorSocket,
  I tried to use
 #include sys/socket.h
 int socket = (PF_INET, SOCK_STREAM, 0);
 bind(socket, addr, addrlen);
 listen (socket, 5);
  This would allow me use scalable epoll but I had trouble compiling 
 it.

There should be no general reason this should not work.  (It would mean
the code is platform-specific, of course.)

 Q3. I would like to understand more about how these threads interact with 
 connection::read/write.
  Is there an extra thread created for me per connection ?
write would be called in my user thread. Is the data queued for 
 writer thread ?
read is called in my user thread. Is it listening on some UNO 
 queue to which the dedicated reader thread queues data ?
  Or did you mean that I should create a dedicated thread per 
 connection because read/write are blocking calls ?

Reading/writing are blocking operations at the OSL socket level.

Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[libreoffice-dev] - libreoffice 4.0 - waiting on multiple sockets

2013-01-25 Thread Rai, Neeraj
Hi ,


I have an extension that is communicating with a a standalone shared lib 
running via uno exe. I start a background thread in scalc and use osl::socket 
(client/server) to pass data.
Q1. I need multiple scalc instances to connect to this uno exe. Is there a way 
to achieve select or epoll functionality in osl::socket
Q2. I tried to use plain socket in uno shared lib but the scalc extension did 
not respond. Then I tried compiling scalc extension using plain sockets but had 
compilation issues.
It seems the bind/listen etc are renamed in sal layer.
If I intend to restrict my extension and uno server to linux, is there 
a work around to use plain sockets ?

Thanks
Neeraj

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - trouble with building libreoffice 4.0 from source

2013-01-18 Thread Rai, Neeraj
Hi Caolan,

I am using version 1.7.1 and your suggestion of manually editing g, worked.
I ran into trouble with firewall and had to update .git/config to the http url. 
Make fetch finished successfully.

Thanks for your inputs.
Neeraj

-Original Message-
From: Caolán McNamara [mailto:caol...@redhat.com]
Sent: Friday, January 18, 2013 6:05 AM
To: Rai, Neeraj [ICG-MKTS]
Cc: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - trouble with building libreoffice 4.0 from 
source

On Thu, 2013-01-17 at 21:58 +, Rai, Neeraj wrote:
 Hi ,

 I am trying to build libreoffice preview release 4.0.0 RC1 from source
 but having some trouble with make fetch and need some advice.

 It fails on cmd : git config --local --get submodule.dictionaries.url
 Complaining that local is not a valid option

What's the output of git --version, I suppose its too old to have
--local so manually editing g to remove --local might work

C.


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[libreoffice-dev] - trouble with building libreoffice 4.0 from source

2013-01-17 Thread Rai, Neeraj
Hi ,

I am trying to build libreoffice preview release 4.0.0 RC1 from source but 
having some trouble with make fetch and need some advice.

It fails on cmd : git config --local --get submodule.dictionaries.url
Complaining that local is not a valid option

I cloned the git repo based on building from source guide
git clone http://anongit.freedesktop.org/git/libreoffice/core.git
git checkout libreoffice-4.0  # switch to 4.0.0
## auto gen succeeds
./autogen.sh  --prefix=/work/loc1/libreoffice-4.0 --without-junit --enable-debug

# the following fails at ./g -f clone
make fetch

The output of bash script g with set -x is attached below

Thanks
Neeraj
bash -x g -f clone




+ '[' -n '' ']'
+ SUBMODULES_ALL='dictionaries helpcontent2 translations'
++ dirname g
+ pushd .
++ pwd
+ COREDIR=/data1/libreoffice-core-git
+ popd
+ '[' 2 -eq 0 ']'
++ type -p git
+ '[' '!' /usr/bin/git ']'
+ get_active_submodules
+ SUBMODULES_ACTIVE=
+ local repo
+ for repo in '${SUBMODULES_ALL?}'
+ '[' -d dictionaries/.git ']'
+ for repo in '${SUBMODULES_ALL?}'
+ '[' -d helpcontent2/.git ']'
+ for repo in '${SUBMODULES_ALL?}'
+ '[' -d translations/.git ']'
+ get_configured_submodules
+ SUBMODULES_CONFIGURED=
+ '[' -f config_host.mk ']'
++ cat config_host.mk
++ grep GIT_NEEDED_SUBMODULES
++ sed -e 's/.*=//'
+ SUBMODULES_CONFIGURED='dictionaries helpcontent2 '
+ EXTRA=
+ COMMAND=-f
+ PAGER=
+ RELATIVIZE=1
+ PUSH_ALL=
+ PUSH_USER=
+ PUSH_NOTES=
+ LAST_WORKING=
+ SET_LAST_WORKING=
+ ALLOW_EMPTY=
+ KEEP_GOING=
+ REPORT_REPOS=1
+ REPORT_COMMANDS=0
+ REPORT_COMPACT=0
+ DO_HOOK_REFRESH=false
+ '[' - = - ']'
+ case $COMMAND in
+ KEEP_GOING='||:'
+ shift
+ COMMAND=clone
+ '[' c = - ']'
+ shift
+ case $COMMAND in
+ do_init_modules
+ local module
+ local configured
+ do_shortcut_update
+ local module
+ local repo
+ for module in '$SUBMODULES_CONFIGURED'
+ '[' '!' -d dictionaries/.git ']'
+ case ${module?} in
+ '[' -d clone/dictionaries/.git ']'
+ '[' -n '' ']'
+ for module in '$SUBMODULES_CONFIGURED'
+ '[' '!' -d helpcontent2/.git ']'
+ case ${module?} in
+ '[' -d clone/help/.git ']'
+ '[' -n '' ']'
+ for module in '$SUBMODULES_CONFIGURED'
++ git config --local --get submodule.dictionaries.url
error: unknown option `local'
usage: git config [options]

Config file location
--global  use global config file
--system  use system config file
-f, --file FILE use given config file

Action
--get get value: name [value-regex]
--get-all get all values: key [value-regex]
--get-regexp  get values for regexp: name-regex [value-regex]
--replace-all replace all matching variables: name value 
[value_regex]
--add adds a new variable: name value
--unset   removes a variable: name [value-regex]
--unset-all   removes all matches: name [value-regex]
--rename-section  rename section: old-name new-name
--remove-section  remove a section: name
-l, --listlist all
-e, --editopens an editor
--get-color slotfind the color configured: [default]
--get-colorbool slot
  find the color setting: [stdout-is-tty]

Type
--boolvalue is true or false
--int value is decimal number
--bool-or-int value is --bool or --int
--pathvalue is a path (file or directory name)

Other
-z, --nullterminate values with NUL byte

+ configured=
+ '[' -z '' ']'
+ git submodule init dictionaries
+ for module in '$SUBMODULES_CONFIGURED'
++ git config --local --get submodule.helpcontent2.url
error: unknown option `local'
usage: git config [options]

Config file location
--global  use global config file
--system  use system config file
-f, --file FILE use given config file

Action
--get get value: name [value-regex]
--get-all get all values: key [value-regex]
--get-regexp  get values for regexp: name-regex [value-regex]
--replace-all replace all matching variables: name value 
[value_regex]
--add adds a new variable: name value
--unset   removes a variable: name [value-regex]
--unset-all   removes all matches: name [value-regex]
--rename-section  rename section: old-name new-name
--remove-section  remove a section: name
-l, --listlist all
-e, --editopens an editor
--get-color slotfind the color configured: [default]
--get-colorbool slot
  find the color setting: [stdout-is-tty]

Type
--boolvalue is true or false
--int value is decimal number
--bool-or-int value is --bool or --int
--pathvalue is a path (file or directory name)

Other
-z, --nullterminate values with 

[libreoffice-dev] - Scalc extension ported to accept data over socket

2013-01-11 Thread Rai, Neeraj
Hi All,

I was able to extend the earlier simple extension using Scalc.java ported to 
C++ , with a lot of help from all of you.
It now accepts data over socket from a standalone uno client (based on 
examples/cpp/remoteclient.cxx)
I have used the osl::socket for communication. There is a macro startThr that 
starts accepting connection and another macro to stopThr.
Sample application connects multiple times and sends row+col, followed by data 
elements (int).
The sample application accepts row , col size and then loops to accept the data 
elements. For the same 60K test size that I tried within extension, this takes 
~400ms.
This is good for my purpose, though I am sure the ninjas can speed it up 
considerably by using better cache aligned structs and batching.

I just wanted to put this out there as a smallest sample alternative to 
interprocess communication that I initially used (rejected for slowness).
I want to thank you all for the support in helping me speed it up.

Neeraj



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - questions about calc extension

2013-01-10 Thread Rai, Neeraj
Hi Stephan,

I am unable to find XDesktop2. Your sample below looks really simple and right 
way to go.
I am working with release version 3.6.4.3 - built it from tar files.
I don't mind upgrading to latest tip, but I had trouble building the git 
checkout version.
Being fairly new to this large and comprehensive product, I decided to take the 
easy way to begin.

I would also be curious to know how to find out about such api - unfortunately, 
right now I am reading only specific emails on dev group and unable to follow 
conversations on other topics. Is reading docs the best way ? Is it possible to 
find some sample code ?

Kohei seems to have a working version with source below. I had trouble finding 
source for the other calc extensions listed on site.
I understand that situation is complicated with taking over working code and 
existing docs. It may take some time to get those things in order.
I am a user of LO api and don't want to look like demanding regime change (like 
LO spring driven by nabble instead of facebook :-))
If it is feasible to dedicate space for source of extensions, I have a feeling 
space requirements there might grow quickly.
That said, I know it may take time getting these one off things done with 
everyone having current deadlines and some of you are working on this part time.
The current examples that come bundled are all great. They focus on single 
feature and demonstrate it well. All the ones I tried, compiled.

Thanks
Neeraj

-Original Message-
From: libreoffice-bounces+neeraj.rai=citi@lists.freedesktop.org 
[mailto:libreoffice-bounces+neeraj.rai=citi@lists.freedesktop.org] On 
Behalf Of Stephan Bergmann
Sent: Thursday, January 10, 2013 3:45 AM
To: libreoffice@lists.freedesktop.org
Subject: Re: [libreoffice-dev] - questions about calc extension

On 01/09/2013 07:41 PM, Kohei Yoshida wrote:
 On 01/09/2013 01:12 PM, Rai, Neeraj wrote:
 What is the correct way to get a
 handle to spreadsheet in extension code.

 I don't want you to look too close to this (since I no longer maintain
 this), bug this code of mine

 http://code.google.com/p/scsolver/source/browse/source/ui/xcalc.cxx

 may give you some hint, especially the top 3 methods,
 getCurrentComponent(), updateCurrentComponent(), and getServiceManager()
 should give you how to get the current component object from the current
 context object.  As an extension, you are given access to the current
 context object, and you can reach the current component from that one
 way or another.

Some comments on the above code, for the benefit of fresh development:

Obtaining the com.sun.star.frame.Desktop service (variable xDesktop) in
updateCurrentComponent can be greatly simplified through the use of
so-called new-style service constructors (and Noel's ongoing work of
changing existing old-style services into new-style ones in UNOIDL):

   Reference frame::XDesktop2  xDesktop(
   frame::Desktop::create(m_xCC));

- It already returns the proper interface of the service (in this case
XDesktop2, derived from XDesktop), so no need for querying from
XInterface to the correct type.

- It directly uses the component context, no need for the service
manager.  (In general, demand for explicitly using the service manager
should go away more and more over time.)

Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - questions about calc extension

2013-01-10 Thread Rai, Neeraj
Hi Kohei,

Using unlockController/lock brought down the time from 12sec to 3sec. Using 
DataArray brought it down to 14ms!
 Thanks for the tips. Great thing about starting with bad code is that I get to 
feel happy when it improves :-)

Hi Michael,

Who would have thought it was a script :-) Maybe 0 bytes callgrind should have 
given me a hint.
I am running callgrind now. Although, I don't need to based on above numbers, I 
am sure I'll write the next code as badly and will need it soon.
I never said in the email that I was running the wrapper but you figured it out 
anyway.
Thanks for catching it.

You guys are great.
Neeraj

-Original Message-
From: Michael Meeks [mailto:michael.me...@suse.com]
Sent: Thursday, January 10, 2013 11:34 AM
To: Rai, Neeraj [ICG-MKTS]
Cc: 'libreoffice@lists.freedesktop.org'; Kohei Yoshida
Subject: Re: [libreoffice-dev] - questions about calc extension


  What's your hunch about how long it should take to update 60K cells with 
  {getCellByPosition(ii,jj) and setValue() } ?

It should be ~instant - sub-second anyhow; it's an analog of loading
values from ODS. Kohei's suggestions are great:

 On Thu, 2013-01-10 at 10:59 -0500, Kohei Yoshida wrote:
 2) Try lockControllers() and unlockControllers() to disable/enable
 repainting while updating cell values.  The example of these methods
 should be in my xcalc.cxx file I referenced earlier.

You'd need to run callgrind like this:

export OOO_DISABLE_RECOVERY=1
valgrind --tool=callgrind --simulate-cache=yes --dump-instr=yes ./soffice.bin

ie. on the soffice.bin not the wrapper script ;-)

HTH,

Michael.

--
michael.me...@suse.com  , Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - questions about calc extension

2013-01-10 Thread Rai, Neeraj
Hi Michael,

That's loads of good info. Looking at your link below and browsing around, I 
realised what Stephen meant when he used EasyHacks in one of the replies.
For now I'll stick with the 3.6.4.3 and refer to release notes as I upgrade to 
newer versions.

Thanks
Neeraj

-Original Message-
From: Michael Stahl [mailto:mst...@redhat.com]
Sent: Thursday, January 10, 2013 11:59 AM
To: Rai, Neeraj [ICG-MKTS]
Cc: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - questions about calc extension

On 10/01/13 16:42, Rai, Neeraj wrote:
 Hi Stephan,

 I am unable to find XDesktop2. Your sample below looks really simple
 and right way to go. I am working with release version 3.6.4.3 -
 built it from tar files.

XDesktop2 was only added a month ago, so it's only in 4.0.

of course when using the newest features it's always a problem that it
doesn't allow deploying your extension or whatever on older versions then...

 I don't mind upgrading to latest tip, but I had trouble building the
 git checkout version. Being fairly new to this large and
 comprehensive product, I decided to take the easy way to begin.

you can also download 4.0 beta releases, actually there should be a RC1
now even; i would expect those also have the SDK available.

 I would also be curious to know how to find out about such api -
 unfortunately, right now I am reading only specific emails on dev
 group and unable to follow conversations on other topics. Is reading
 docs the best way ? Is it possible to find some sample code ?

good question... currently the only real info for developers who don't
follow the git commits, which is probably no extension or macro
developer does, is the 4.0 release notes, which has a section on API
Changes:

https://wiki.documentfoundation.org/ReleaseNotes/4.0#API_Changes

but that doesn't talk much about what is added, mostly it's about what
is changed or removed.

of course you can also search in the API reference (or the IDL files)
for since tags with a particular version.

the OOo project had a interface-announce mailing list, which was used
both for API changes and additions, and for internal implementation
interface changes; i wonder how many extension developers actually read
that list in its time.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - building difficulties with C++ extension,addIn

2013-01-09 Thread Rai, Neeraj
Hi Stephan,

Thanks for taking this up. I wasn't aware that examples didn't get built with 
make or make check.
Time is not a big issue as long as it gets to the right place, and it seems 
like you are pushing it in right direction.
I noticed that you are listed UNO,sal,config contact. Hope it is ok if I 
address future issues to you. I'll try to limit my spam to once a day.

After my last email, I noticed some issues with the cxx file I attached. 
attaching an updated version. Also Makefile uses more standard env vars.

This is not a complete Calc add and I'm still working to incorporate other 
functionality from Scalc.java.
But as a standalone calc extension took me 8 days, I thought this might be 
worth sharing already.
If I am ready with the richer functionality by the time right place is decided, 
I'll share that too.

I think myRNG.tar is also very good example, as it works out of the box, as 
long as sdk is installed and env is set.
The extension docs looked overwhelming when Michael 1st mentioned it, but 
thanks to myRNG examples, I was able to get past that.
Hope that also finds a place in your new scheme of things.

Not sure if this is related to any restructuring you guys are planning, but as 
of this moment, the wiki I used is down.
http://wiki.openoffice.org
This may be legacy and the info may belong elsewhere, or maybe Oracle owns it 
and finally decided to take openoffice closed source:-)

Thanks
Neeraj

-Original Message-
From: Stephan Bergmann [mailto:sberg...@redhat.com]
Sent: Wednesday, January 09, 2013 5:28 AM
To: 'libreoffice@lists.freedesktop.org'
Cc: Rai, Neeraj [ICG-MKTS]
Subject: Re: [libreoffice-dev] - building difficulties with C++ extension,addIn

Hi Neeraj,

Thank you for taking the trouble of making your Calc addin example work.
  The SDK is indeed an area that could benefit from more maintenance
help, lots of the documentation goes stale over time etc.

That said, I'm not sure we'll improve the overall situation by adding
more examples directly to the SDK.  The content of the SDK is backed by
module odk in the core LO git repo, so the example code ends up in the
core repo, where greps and wholesale code-cleaning activities (like some
EasyHacks) stumble upon it, modify it, etc.  But due to the awkward way
the SDK needs to be set up for use (another area that would benefit from
additional help), those examples do not routinely get tested (e.g., are
not compiled and run during a build, not even a make check one).

Therefore, I wonder whether it would not make more sense to have some
place of its own for such additional examples to reside in, like in a
wiki or some repository similar to LO's extensions and templates sites.
  I'll see to get that issue addressed and come back here.

Thanks again for your work and for your patience,
Stephan

On 01/08/2013 08:45 PM, Rai, Neeraj wrote:
 Hi Michael,

 I was able to work around the problem below by removing the platform tag.
 For now, I am happy with legacy active registration.
 I now have a working example of Calc extension in C++ (on lines of 
 example/java/SpreadSheet/CalcAddins)
 Thanks for your help.


 I noticed that you are listed as one of the developers for soffice. Would you 
 be able to take this code and introduce it as part of package ?
 Same might be done for myRNG.tar.gz.
 I think calc is an important part of soffice and having a c++ extension 
 readily available would attract more users to it.
 It took me days to get this working, but for anyone henceforth it should be 
 15 min.

 Unfortunately, I am behind firewall and can't access gerrit. I am attaching 
 the file with this email.
 If there is a better way to get it as part of installation, I'll be happy to 
 contribute.

 Thanks
 Neeraj
 -Original Message-
 From: Rai, Neeraj [ICG-MKTS]
 Sent: Monday, January 07, 2013 7:30 PM
 To: Michael Stahl
 Cc: 'libreoffice@lists.freedesktop.org'
 Subject: [libreoffice-dev] - building difficulties with C++ extension,addIn

 Hi Michael,

 I tried your extension suggestion to convert 
 examples/java/SpreadSheet/CalcAddins.java to C++.
 I am having problem installing my extension using unpkg.
 Error : The extension my simple extension does not work on this computer.
 I tried various values in META-INF/manifest.xml : platform=linux_x86_64 and 
 platform=all but I get the same error.

 I probably did something wrong transporting the xml files or oxt files from 
 the example.
 The original example in java works for me.
 Would you happen to have expertise in this area and time to help me out ?

 I also came across the following link which states that regmerge is legacy. 
 However, the CalcAddIn was using it, so I went with it too.
 http://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Deployment_Options_for_Components
 If that is the not the right way forward, please point me in the right 
 direction.

 Thanks
 Neeraj

 -Original Message-
 From: Michael Stahl [mailto:mst...@redhat.com]
 Sent

[libreoffice-dev] - questions about calc extension

2013-01-09 Thread Rai, Neeraj

Q1. When I try to use the xContext = cppu::bootstrap() in a calc extension, app 
terminate with throwing an exception :
cppu::BootstrapException
 It works well in standalone exec. What is the correct way to get a handle 
to spreadsheet in extension code.

Q2. I came across an example extension code that registers 4 methods. One of 
the methods takes sequence of sequence
and returns a sequence of sequence after adding 4 to it.
  When I call this example by hitting F2 (insert function) and choosing 
that funcname, and giving it a range of cell, the cell is populated with the 
value of 1st  cell + 4
 How can I update multiple cells using a custom written function.

Thanks
Neeraj

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [libreoffice-dev] - questions about calc extension

2013-01-09 Thread Rai, Neeraj
Hi Kohei,

1. I think I see what you are doing, but having trouble making it work.
--- my understanding of your code and the issue I face below -
The create_XXX is passed the ComponentContext and you store it for future.
I tried the same but the calls to xContext-getServiceManager() aborts my 
program.
Interestingly,
when the create_XXX is called, I try a fake 
xContext-getServiceManager() and it works.
when I store it in my object , in the ctor, I try another fake 
xContext-getServiceManager() and it works.
its only when I choose my custom function from menu and invoke this 
again, that the app terminates.
  Is there anything special about functions calls from menu.

Also, if the above commentary is misleading, you could look at the code
create_CalcAddinCpp_impl is parallel to your create_SolverImpl (line 
520: success)
CalcAddinCpp_impl is parallel to your CalcInterface 
(line 88: success)
methodTwo   
(line 159: calc terminates)

Is xcalc.cxx a working extension code that I can download and use ?
If not, do you know of other working samples ?
I would greatly appreciate any sample LO calc extension code to get my env 
working.

2. Your sample code answered my 2nd question .
If I can get a context and spreadsheet, I can access different cells. I 
was trying to update different cells from single menu based function call.
appreciate your time.
The sample I based on was on wiki.openoffice.org which seems to be down

Thanks
Neeraj


CalcAddinCpp_impl.cxx
Description: CalcAddinCpp_impl.cxx
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - questions about calc extension

2013-01-09 Thread Rai, Neeraj
Hi Kohei,

I figured out my bug. I was storing the context in a const Reference   const 
and it was going out of scope and being reclaimed after the constructor.
After changing it to normal Reference , everything is fine.
Thanks again for your time and patience. Hope you didn't have to waste any time 
based on last reply.

I tested updating 60K cells using this extension. It takes 90s. Is that 
acceptable performance ? Seems slow.
Anyway, that is a separate discussion and not critical. The main part was 
solved by your code.

Thanks
Neeraj

-Original Message-
From: Rai, Neeraj [ICG-MKTS]
Sent: Wednesday, January 09, 2013 4:28 PM
To: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - questions about calc extension

Hi Kohei,

1. I think I see what you are doing, but having trouble making it work.
--- my understanding of your code and the issue I face below -
The create_XXX is passed the ComponentContext and you store it for future.
I tried the same but the calls to xContext-getServiceManager() aborts my 
program.
Interestingly,
when the create_XXX is called, I try a fake 
xContext-getServiceManager() and it works.
when I store it in my object , in the ctor, I try another fake 
xContext-getServiceManager() and it works.
its only when I choose my custom function from menu and invoke this 
again, that the app terminates.
  Is there anything special about functions calls from menu.

Also, if the above commentary is misleading, you could look at the code
create_CalcAddinCpp_impl is parallel to your create_SolverImpl (line 
520: success)
CalcAddinCpp_impl is parallel to your CalcInterface 
(line 88: success)
methodTwo   
(line 159: calc terminates)

Is xcalc.cxx a working extension code that I can download and use ?
If not, do you know of other working samples ?
I would greatly appreciate any sample LO calc extension code to get my env 
working.

2. Your sample code answered my 2nd question .
If I can get a context and spreadsheet, I can access different cells. I 
was trying to update different cells from single menu based function call.
appreciate your time.
The sample I based on was on wiki.openoffice.org which seems to be down

Thanks
Neeraj
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - questions about calc extension

2013-01-09 Thread Rai, Neeraj
Hi Kohei,

I looked a little more into your code and copied the getactiveSheet function. 
Now it takes 12s. I am happy.
Sorry for the spam - you have good code sitting there.

Thanks
Neeraj

-Original Message-
From: Rai, Neeraj [ICG-MKTS]
Sent: Wednesday, January 09, 2013 6:03 PM
To: 'libreoffice@lists.freedesktop.org'
Subject: RE: [libreoffice-dev] - questions about calc extension

Hi Kohei,

I figured out my bug. I was storing the context in a const Reference   const 
and it was going out of scope and being reclaimed after the constructor.
After changing it to normal Reference , everything is fine.
Thanks again for your time and patience. Hope you didn't have to waste any time 
based on last reply.

I tested updating 60K cells using this extension. It takes 90s. Is that 
acceptable performance ? Seems slow.
Anyway, that is a separate discussion and not critical. The main part was 
solved by your code.

Thanks
Neeraj

-Original Message-
From: Rai, Neeraj [ICG-MKTS]
Sent: Wednesday, January 09, 2013 4:28 PM
To: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - questions about calc extension

Hi Kohei,

1. I think I see what you are doing, but having trouble making it work.
--- my understanding of your code and the issue I face below -
The create_XXX is passed the ComponentContext and you store it for future.
I tried the same but the calls to xContext-getServiceManager() aborts my 
program.
Interestingly,
when the create_XXX is called, I try a fake 
xContext-getServiceManager() and it works.
when I store it in my object , in the ctor, I try another fake 
xContext-getServiceManager() and it works.
its only when I choose my custom function from menu and invoke this 
again, that the app terminates.
  Is there anything special about functions calls from menu.

Also, if the above commentary is misleading, you could look at the code
create_CalcAddinCpp_impl is parallel to your create_SolverImpl (line 
520: success)
CalcAddinCpp_impl is parallel to your CalcInterface 
(line 88: success)
methodTwo   
(line 159: calc terminates)

Is xcalc.cxx a working extension code that I can download and use ?
If not, do you know of other working samples ?
I would greatly appreciate any sample LO calc extension code to get my env 
working.

2. Your sample code answered my 2nd question .
If I can get a context and spreadsheet, I can access different cells. I 
was trying to update different cells from single menu based function call.
appreciate your time.
The sample I based on was on wiki.openoffice.org which seems to be down

Thanks
Neeraj
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - building difficulties with C++ extension,addIn

2013-01-09 Thread Rai, Neeraj
Hi Stephan,

I was able to get a complete addin working with help from sample code from 
Kohei.
Please find the example attached. It is just a dummy update to 60K entries 
(12sec).
Much faster than DocumentLoader and SimpleBootsrap mechanism that I tried 
earlier.

Thanks all for help.
Neeraj
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - building difficulties with C++ extension,addIn

2013-01-08 Thread Rai, Neeraj
Hi Michael,

I was able to work around the problem below by removing the platform tag.
For now, I am happy with legacy active registration.
I now have a working example of Calc extension in C++ (on lines of 
example/java/SpreadSheet/CalcAddins)
Thanks for your help.


I noticed that you are listed as one of the developers for soffice. Would you 
be able to take this code and introduce it as part of package ?
Same might be done for myRNG.tar.gz.
I think calc is an important part of soffice and having a c++ extension readily 
available would attract more users to it.
It took me days to get this working, but for anyone henceforth it should be 15 
min.

Unfortunately, I am behind firewall and can't access gerrit. I am attaching the 
file with this email.
If there is a better way to get it as part of installation, I'll be happy to 
contribute.

Thanks
Neeraj
-Original Message-
From: Rai, Neeraj [ICG-MKTS]
Sent: Monday, January 07, 2013 7:30 PM
To: Michael Stahl
Cc: 'libreoffice@lists.freedesktop.org'
Subject: [libreoffice-dev] - building difficulties with C++ extension,addIn

Hi Michael,

I tried your extension suggestion to convert 
examples/java/SpreadSheet/CalcAddins.java to C++.
I am having problem installing my extension using unpkg.
Error : The extension my simple extension does not work on this computer.
I tried various values in META-INF/manifest.xml : platform=linux_x86_64 and 
platform=all but I get the same error.

I probably did something wrong transporting the xml files or oxt files from the 
example.
The original example in java works for me.
Would you happen to have expertise in this area and time to help me out ?

I also came across the following link which states that regmerge is legacy. 
However, the CalcAddIn was using it, so I went with it too.
http://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Deployment_Options_for_Components
If that is the not the right way forward, please point me in the right 
direction.

Thanks
Neeraj

-Original Message-
From: Michael Stahl [mailto:mst...@redhat.com]
Sent: Thursday, January 03, 2013 3:44 PM
To: Rai, Neeraj [ICG-MKTS]
Cc: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - architecture question about 
interproces,extension,addIn

hi Neeraj,

On 03/01/13 16:54, Rai, Neeraj wrote:

 Based on above text, I looked at addIns but it doesn't seem like what I
 need.  I don't want to be restricted to a function call. I need a
 component running in scalc.

 _http://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Spreadsheet_Add-Ins_

 Can someone please advise what is the fastest code as a C++ UNO
 component  mean and where can I find more docs related to it.

C++ UNO components that are instantiated in-process currently do not go
through a bridge when interacting with the LO API (although there have
been varying opinions about changing that, since it makes maintaining
backward compatibility more difficult): for such components, calling a
LO API method (or being called from LO itself) is just a C++ virtual
function call.

the best documented way to get this performance benefit is to implement
your client code as an extension.

http://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extensions

there may also be a way to get there with less efforts, there are some
variables to add additional service rdbs to the soffice process
(URE_MORE_SERVICES/URE_MORE_TYPES) but i don't have any experience with
them; probably there is some way to implement what you want to do as a
service and then start it from inside soffice, if all else fails via a
trivial BASIC macro :)



make.log
Description: make.log


Makefile
Description: Makefile


setenv
Description: setenv
component_getImplementationEnvironment
component_writeInfo
component_getFactory


CalcAddinCpp.components
Description: CalcAddinCpp.components


CalcAddinCpp.idl
Description: CalcAddinCpp.idl


CalcAddinCpp_impl.cxx
Description: CalcAddinCpp_impl.cxx
?xml version=1.0 encoding=UTF-8?
!DOCTYPE manifest:manifest PUBLIC -//OpenOffice.org//DTD Manifest 1.0//EN Manifest.dtd
manifest:manifest xmlns:manifest=http://openoffice.org/2001/manifest;
  manifest:file-entry manifest:media-type=application/vnd.sun.star.uno-typelibrary;type=RDB
   manifest:full-path=CalcAddinCpp.rdb/
  manifest:file-entry manifest:media-type=application/vnd.sun.star.uno-components
   manifest:full-path=CalcAddinCpp.components/
/manifest:manifest
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[libreoffice-dev] - building difficulties with C++ extension,addIn

2013-01-07 Thread Rai, Neeraj
Hi Michael,

I tried your extension suggestion to convert 
examples/java/SpreadSheet/CalcAddins.java to C++.
I am having problem installing my extension using unpkg.
Error : The extension my simple extension does not work on this computer.
I tried various values in META-INF/manifest.xml : platform=linux_x86_64 and 
platform=all but I get the same error.

I probably did something wrong transporting the xml files or oxt files from the 
example.
The original example in java works for me.
Would you happen to have expertise in this area and time to help me out ?

I also came across the following link which states that regmerge is legacy. 
However, the CalcAddIn was using it, so I went with it too.
http://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Deployment_Options_for_Components
If that is the not the right way forward, please point me in the right 
direction.

Thanks
Neeraj

-Original Message-
From: Michael Stahl [mailto:mst...@redhat.com]
Sent: Thursday, January 03, 2013 3:44 PM
To: Rai, Neeraj [ICG-MKTS]
Cc: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - architecture question about 
interproces,extension,addIn

hi Neeraj,

On 03/01/13 16:54, Rai, Neeraj wrote:

 Based on above text, I looked at addIns but it doesn't seem like what I
 need.  I don't want to be restricted to a function call. I need a
 component running in scalc.

 _http://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Spreadsheet_Add-Ins_

 Can someone please advise what is the fastest code as a C++ UNO
 component  mean and where can I find more docs related to it.

C++ UNO components that are instantiated in-process currently do not go
through a bridge when interacting with the LO API (although there have
been varying opinions about changing that, since it makes maintaining
backward compatibility more difficult): for such components, calling a
LO API method (or being called from LO itself) is just a C++ virtual
function call.

the best documented way to get this performance benefit is to implement
your client code as an extension.

http://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extensions

there may also be a way to get there with less efforts, there are some
variables to add additional service rdbs to the soffice process
(URE_MORE_SERVICES/URE_MORE_TYPES) but i don't have any experience with
them; probably there is some way to implement what you want to do as a
service and then start it from inside soffice, if all else fails via a
trivial BASIC macro :)

?xml version=1.0 encoding=UTF-8?
description xmlns=http://openoffice.org/extensions/description/2006; 
	 xmlns:d=http://openoffice.org/extensions/description/2006;
	 xmlns:xlink=http://www.w3.org/1999/xlink;
  
  identifier value=org.openoffice.sheet.addin.CalcAddinCpp /
  
  version value=1.0 /   
  
  platform value=linux_x86 /
  
  registration
simple-license accept-by=admin suppress-on-update=true 
  license-text xlink:href=registration/license_de-DE.txt lang=de-DE /
  license-text xlink:href=registration/license_en-GB.txt lang=en-GB /
  license-text xlink:href=registration/license_en-NZ.txt lang=en-NZ /
  license-text xlink:href=registration/license_en-US.txt lang=en-US /
/simple-license
  /registration
  
  dependencies
OpenOffice.org-minimal-version value=3.3 d:name=OpenOffice.org 3.3/
  /dependencies
  
  update-information
src xlink:href=http://extensions.openoffice.org/testarea/desktop/license/update/lic3.update.xml; /
  /update-information
  
  publisher
name xlink:href=http://extensions.openoffice.org/testarea/desktop/publisher/publisher_de.html;
	  lang=deMy OpenOffice de/name
name xlink:href=http://extensions.openoffice.org/testarea/desktop/publisher/publisher_en.html; 
	  lang=enMy OpenOffice en/name
  /publisher
  
  release-notes
src xlink:href=http://extensions.openoffice.org/testarea/desktop/publisher/release-notes_de.txt; lang=de /
src xlink:href=http://extensions.openoffice.org/testarea/desktop/publisher/release-notes_en.txt; lang=en /
  /release-notes
  
  display-name
name lang=deCalcAddinCpp/name
name lang=enMy simple extension/name
  /display-name
  
  extension-description
src xlink:href=description/desc_de.txt lang=de /
src xlink:href=description/desc_en.txt lang=en /
  /extension-description

/description



CalcAddinCpp.oxt
Description: CalcAddinCpp.oxt
?xml version=1.0 encoding=UTF-8?
!DOCTYPE manifest:manifest PUBLIC -//OpenOffice.org//DTD Manifest 1.0//EN Manifest.dtd
manifest:manifest xmlns:manifest=http://openoffice.org/2001/manifest;
  manifest:file-entry manifest:media-type=application/vnd.sun.star.uno-typelibrary;type=RDB
   manifest:full-path=CalcAddinCpp.rdb/
  manifest:file-entry manifest:media-type=application/vnd.sun.star.uno-components
   manifest:full-path=description.xml/
  manifest:file-entry manifest:media-type= application/vnd.sun.star.uno-component

RE: [libreoffice-dev] - architecture question about interproces,extension,addIn

2013-01-04 Thread Rai, Neeraj
Hi,

I found an example of add-in and was able to build, deploy and run it.
http://wiki.openoffice.org/wiki/SimpleCalcAddIn  (myRNG.tar deploys RNG service)

However, the 2nd and more complete example 
http://wiki.openoffice.org/wiki/CompleteAddIn
fails at registry time with error 
(CannotRegisterImplementationException): loading component library failed: 
libsrvcCalc.so
regcomp -register -r *.rdb -c *.so
 libsrvcCalc.so
 register component 'libsrvcCalc.so' in registry 'srvcCalc.rdb' failed!
 error (CannotRegisterImplementationException): loading component library 
failed: libsrvcCalc.so

I found some discussion online where someone had same problem with RNG (the 
simple Addin) and fixed it.
http://www.oooforum.org/forum/viewtopic.phtml?t=79491#312692

Q1. Would someone happen to know if the example is supposed to work ?
How do I debug the error CannotRegisterImplementationException ? My 
LD_LIBRARY_PATH seems correct because I can build RNG from the same shell.

It seems when Eric found the problem with RNG, he moved a lot of things from 
wiki to code/makefile/setupenv files.
Q2. Is it possible to make the RNG example as part of the package? I can 
contribute the code for complete-Add-in if I can get it working.
The advantage of having it as part of build is that it doesn't break 
and requires little maintenance, while wiki can silently become outdated.
it would benefit newbies like me to get working code as part of 
distribution.
Is that the preferred way to go ? I would like to hear other opinions 
on this.

Thanks
Neeraj

-Original Message-
From: Michael Stahl [mailto:mst...@redhat.com]
Sent: Thursday, January 03, 2013 3:44 PM
To: Rai, Neeraj [ICG-MKTS]
Cc: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - architecture question about 
interproces,extension,addIn

hi Neeraj,

On 03/01/13 16:54, Rai, Neeraj wrote:

 Based on above text, I looked at addIns but it doesn't seem like what I
 need.  I don't want to be restricted to a function call. I need a
 component running in scalc.

 _http://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Spreadsheet_Add-Ins_

 Can someone please advise what is the fastest code as a C++ UNO
 component  mean and where can I find more docs related to it.

C++ UNO components that are instantiated in-process currently do not go
through a bridge when interacting with the LO API (although there have
been varying opinions about changing that, since it makes maintaining
backward compatibility more difficult): for such components, calling a
LO API method (or being called from LO itself) is just a C++ virtual
function call.

the best documented way to get this performance benefit is to implement
your client code as an extension.

http://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extensions

there may also be a way to get there with less efforts, there are some
variables to add additional service rdbs to the soffice process
(URE_MORE_SERVICES/URE_MORE_TYPES) but i don't have any experience with
them; probably there is some way to implement what you want to do as a
service and then start it from inside soffice, if all else fails via a
trivial BASIC macro :)

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[PATCH] - Scalc.java ported to C++ , uses DocumentLoader

2013-01-03 Thread Rai, Neeraj
Hi,

I am attaching the 3 files. this is a port of Scalc.java to C++.
The code is based on http://wiki.openoffice.org/wiki/Calc/API/Programming
 and borrows from examples/cpp/DocumentLoader and examples/java/Scalc.java.
It can be dropped into the dir examples/cpp/Scalcpp and build similar to 
DocumentLoader (makefile is similar).
1. scalc.ods is a dummy blank file
2. Scalcpp.cxx is a C++ program that connects to running soffice and writes 
some scalc data to it.
3. Makefile supports make ALL and prints the program to run it.

I'd appreciate if someone reviews it and incorporates it as part of dist 
examples. These are all new files. No existing files were changed.
Thanks
Neeraj


scalc.ods
Description: scalc.ods


SCalcpp.cxx
Description: SCalcpp.cxx


Makefile
Description: Makefile
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[PATCH] - Scalc.java ported to C++ , uses SimpleBootstrap_cpp.cxx

2013-01-03 Thread Rai, Neeraj
Hi,

I am attaching the 2 files. this is a port of Scalc.java to C++ using new 
bootstrap.
The code is using UNO bootstrap mentioned in 
examples/DevelopersGuide/Components/CppComponents.
It borrows from profUNO/SimpleBootstrap_cpp and examples/java/Scalc.java.
It can be dropped into the dir examples/cpp/ScalcBT and build similar to 
DocumentLoader (makefile is similar).
1. ScalcBT.cxx is a C++ program that bootstraps scalc and writes some data to 
it.
2. Makefile supports make ALL and prints the program to run it.

I'd appreciate if someone reviews it and incorporates it as part of dist 
examples. These are all new files. No existing files were changed.
Thanks
Neeraj


Makefile
Description: Makefile


SCalcBT.cxx
Description: SCalcBT.cxx
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[libreoffice-dev] - architecture question about interproces,extension,addIn

2013-01-03 Thread Rai, Neeraj
Hi ,

I need some advise on which libreoffice technology to use.
I need to update data from some of our processes to scalc. I would like to use 
sockets to transfer data.
Preference is for running my own code in scalc that can parse the data sent by 
my other processes. Speed is important to me.

Reading through the Developer's Guide, I came across the following : 
http://wiki.openoffice.org/wiki/Documentation/DevGuide/AdvUNO/Advanced_UNO
In addition to C++ being fast since it is compiled locally, it offers 
the fastest communication with OpenOffice.org because most of the essential 
parts of office have been developed in C++.
This advantage becomes less important as you call into the office 
through the interprocess bridge, because every remote call means a constant 
loss of 1 to 2 ms.
The fastest code to extend the office can be implemented as a C++ UNO 
component. It is appropriate for larger projects due to its strong type safety 
at compile time.

Based on above text, I looked at addIns but it doesn't seem like what I need.  
I don't want to be restricted to a function call. I need a component running in 
scalc.

http://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Spreadsheet_Add-Ins

Can someone please advise what is the fastest code as a C++ UNO component  
mean and where can I find more docs related to it.

Thanks
Neeraj

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - architecture question about interproces,extension,addIn

2013-01-03 Thread Rai, Neeraj
Hi Michael,

I appreciate the response.
I am fairly new to LO and so far working off a rpm installation (in process of 
building the source).
Extensions sound like something for masters - I'll try to avoid that for a few 
weeks.
However, your 2nd option looks like something I can build using examples (c++ 
service and BASIC macros).
Let me give it a shot.

Thanks
Neeraj

-Original Message-
From: Michael Stahl [mailto:mst...@redhat.com]
Sent: Thursday, January 03, 2013 3:44 PM
To: Rai, Neeraj [ICG-MKTS]
Cc: 'libreoffice@lists.freedesktop.org'
Subject: Re: [libreoffice-dev] - architecture question about 
interproces,extension,addIn

hi Neeraj,

On 03/01/13 16:54, Rai, Neeraj wrote:

 Based on above text, I looked at addIns but it doesn't seem like what I
 need.  I don't want to be restricted to a function call. I need a
 component running in scalc.

 _http://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Spreadsheet_Add-Ins_

 Can someone please advise what is the fastest code as a C++ UNO
 component  mean and where can I find more docs related to it.

C++ UNO components that are instantiated in-process currently do not go
through a bridge when interacting with the LO API (although there have
been varying opinions about changing that, since it makes maintaining
backward compatibility more difficult): for such components, calling a
LO API method (or being called from LO itself) is just a C++ virtual
function call.

the best documented way to get this performance benefit is to implement
your client code as an extension.

http://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extensions

there may also be a way to get there with less efforts, there are some
variables to add additional service rdbs to the soffice process
(URE_MORE_SERVICES/URE_MORE_TYPES) but i don't have any experience with
them; probably there is some way to implement what you want to do as a
service and then start it from inside soffice, if all else fails via a
trivial BASIC macro :)

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[libreoffice-dev] - ScalcBT.cxx C++ using new uno bootsrap is slow

2013-01-02 Thread Rai, Neeraj
Hi ,

Hope this is the right forum for the question below. If not, please point me in 
the right direction.

I have written a new version of Scalc.java in C++, this time using UNO 
bootstrap mentioned in examples/DevelopersGuide/Components/CppComponents.
The last version I wrote used examples/cpp/DocumentLoader and 
examples/java/Scalc.java. It expected soffice listening on a port and was too 
slow.

Even this version is not as fast as I would have expected, and I would like to 
know what may be done to speed it up.
The 500x12 cell updated 120 times in 60sec. I used gettimeofday to measure time 
for 3 cases writing same amount of data :
A) write 5000 rows of 12 cols   (~60sec)
B) write 5000x12 entries to a single cell   (~40sec)
C) write 10 rows of 50 cols, 120 times  (~60sec)
If I read a file with 100,000x12 cell from disk, it takes 20 seconds - so I am 
hopeful that this example can be speeded up.

The box is running RHEL 6.3, 2 cpu with 4 cores and 16GB of RAM.

The attached files can be dropped into any cpp example dir and built. The 
makefile is copied from DocumentLoaded.
Any pointers/googlable keywords/web links would be highly appreciated.

Thanks
Neeraj


Makefile
Description: Makefile


SCalcBT.cxx
Description: SCalcBT.cxx
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: [libreoffice-dev] - ScalcBT.cxx C++ using new uno bootsrap is slow

2013-01-02 Thread Rai, Neeraj
Hi Guys,

I tried to modified my original slow example to use array updates 
(setDataArray) based on the example in the wiki.
http://wiki.openoffice.org/wiki/Calc/API/Programming
When I call setDataArray(arr1), the program terminates with error on screen 
***Error couldn't get sheet
The relevant portion of code is pasted below. I get CellRangeData. I prepare a 
sequence of sequence and call cellrangedata-setDataArray(SofS)

Would someone be able to point out what is wrong here?

Thanks
Neeraj
 portion of attached code giving me problems:

void fillLines (Reference XSpreadsheetDocument  myDoc)
{
printf(Fill the lines\n);

Reference  XSpreadsheets  xSheets = myDoc-getSheets() ;
Reference  XIndexAccess  oIndexSheets ( xSheets, UNO_QUERY);
Any any = oIndexSheets-getByIndex(0);
Reference  XSpreadsheet  xSheet ( any, UNO_QUERY);
//Reference  XCellRange  xCellRange = xSheet-getCellRangeByPosition 
(0, 0, X, Y);
//Reference  XCellRangeData  xCellRangeData (xCellRange, UNO_QUERY);

Reference XModel  rSpreadsheetModel (myDoc, UNO_QUERY);
Reference XInterface  rInterface = 
rSpreadsheetModel-getCurrentSelection();
Reference XCellRange  xCellRange(rInterface,UNO_QUERY);
Reference XCellRangeData xCellRangeData(xCellRange, UNO_QUERY);

Sequence  Sequence  Any   arr1 (X+1);
Sequence  Any   arr2 (Y+1);

for (int ii=0; ii  120; ++ii)
{
for (int jj=0; jj  X; ++jj)
{
for (int kk=0; kk  Y; ++kk)
{
int val = jj+kk+ii+2;
arr2[kk+1] = val;
}
arr1[jj+1] = arr2;
}
printf([%d] b4 set data array\n, ii);
xCellRangeData-setDataArray(arr1);
printf([%d] set data array\n, ii);
}


//***
}


-Original Message-
From: Rai, Neeraj [ICG-MKTS]
Sent: Friday, December 28, 2012 3:56 PM
To: 'libreoffice@lists.freedesktop.org'
Subject: [libreoffice-dev] - ScalcBT.cxx C++ using new uno bootsrap is slow

Hi ,

Hope this is the right forum for the question below. If not, please point me in 
the right direction.

I have written a new version of Scalc.java in C++, this time using UNO 
bootstrap mentioned in examples/DevelopersGuide/Components/CppComponents.
The last version I wrote used examples/cpp/DocumentLoader and 
examples/java/Scalc.java. It expected soffice listening on a port and was too 
slow.

Even this version is not as fast as I would have expected, and I would like to 
know what may be done to speed it up.
The 500x12 cell updated 120 times in 60sec. I used gettimeofday to measure time 
for 3 cases writing same amount of data :
A) write 5000 rows of 12 cols   (~60sec)
B) write 5000x12 entries to a single cell   (~40sec)
C) write 10 rows of 50 cols, 120 times  (~60sec)
If I read a file with 100,000x12 cell from disk, it takes 20 seconds - so I am 
hopeful that this example can be speeded up.

The box is running RHEL 6.3, 2 cpu with 4 cores and 16GB of RAM.

The attached files can be dropped into any cpp example dir and built. The 
makefile is copied from DocumentLoaded.
Any pointers/googlable keywords/web links would be highly appreciated.

Thanks
Neeraj


Makefile
Description: Makefile


SCalcBT.cxx
Description: SCalcBT.cxx
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[libreoffice-dev] - Scalc.java ported to C++ , uses DocumentLoader

2012-11-19 Thread Rai, Neeraj
Hi Enrico and Julien,

Thanks for the feedback.
I am attaching the 3 files. As mentioned before, this is a port of Scalc.java 
to C++.
The code is mostly cut+paste from examples/cpp/DocumentLoader and 
examples/java/Scalc.java.
I am expecting it'll belong in examples/cpp/Scalcpp. I'd appreciate if someone 
reviews it and incorporates it as part of dist.

Please let me know if more is needed from my end.
Thx
Neeraj

-Original Message-
From: libreoffice-bounces+neeraj.rai=citi@lists.freedesktop.org 
[mailto:libreoffice-bounces+neeraj.rai=citi@lists.freedesktop.org] On 
Behalf Of julien2412
Sent: Saturday, November 17, 2012 9:03 AM
To: libreoffice@lists.freedesktop.org
Subject: Re: [libreoffice-users] - Scalc.java ported to C++ , uses 
DocumentLoader

Hi,

As proposed Enrico, you can use gerrit (see
http://wiki.documentfoundation.org/Development/gerrit).

You can also send a post here with a patch attached (see
http://wiki.documentfoundation.org/Development/Patch_Handling_Guidelines)

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/libreoffice-users-Scalc-java-ported-to-C-uses-DocumentLoader-tp4018993p4019174.html
Sent from the Dev mailing list archive at Nabble.com.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


scalc.ods
Description: scalc.ods


SCalcpp.cxx
Description: SCalcpp.cxx


Makefile
Description: Makefile
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[libreoffice-users] - Scalc.java ported to C++ , uses DocumentLoader

2012-11-16 Thread Rai, Neeraj

Hi ,

I have been able to merge Scalc.java and DocumentLoader.cxx.
The example expects soffice running just like in examples/cpp/DocumentLoader.
Running Scalc would connect to soffice, load scalc.ods and populate data in 
cells, just like Scalc.java

Is there any secure place to put this code for the benefit of users ? Wiki or 
being bundled with examples ?
I posted this to users list and Tom Davies kindly suggested I try the DEV list.

Thanks
Neeraj

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[libreoffice-dev] - novice question about scalc and C++ uno objects

2012-11-15 Thread Rai, Neeraj
Hi ,

I posted this to users list but now I think this is more of a developers 
questions. Please correct me if this is not the right forum.
I am trying to convert scalc.java to c++.

Scalc.java comes with libreoffice and I am able to build and run it using the 
makefile provided.
I am also able to build and run remoteclient.cxx.
I need to convert scalc.java to c++.
After a bit of googling, and some advise on users list, I am able to compile my 
version of scalc.cxx as  scalc.uno.so.
http://wiki.openoffice.org/wiki/Calc/Add-In/CompleteAddIn

I am not sure if that is the right way to compile and also how to run it.
The java version is invoked as a jar and remoteclient is invoked using uno. As 
I am currently building .so, I would guess I run it using uno.

Any links/googlable key words would be appreciated.

Thanks
Neeraj


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice