[libreoffice-dev] - questions about calc extension

Rai, Neeraj neeraj.rai at citi.com
Thu Jan 10 07:42:11 PST 2013


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.com at lists.freedesktop.org [mailto:libreoffice-bounces+neeraj.rai=citi.com at lists.freedesktop.org] On Behalf Of Stephan Bergmann
Sent: Thursday, January 10, 2013 3:45 AM
To: libreoffice at 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 at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


More information about the LibreOffice mailing list