Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.