Issue 57289 - getting the process' component context in URE
Summary: getting the process' component context in URE
Status: CLOSED WONT_FIX
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: current
Hardware: All All
: P3 Trivial (vote)
Target Milestone: AOO PleaseHelp
Assignee: Daniel Boelzle [:dbo]
QA Contact: issues@udk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-03 12:30 UTC by Daniel Boelzle [:dbo]
Modified: 2005-11-03 14:43 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Daniel Boelzle [:dbo] 2005-11-03 12:30:12 UTC
If I need to access an existing (already bootstrapped) process local UNO
environment from within e.g. an XPCOM component (which has been started from
within the office process), I have currently no API to get the UNO component
context. There is such an API in comphelper (setProcessServiceFactory().

Background:
The XPCOM-UNO runtime object (i.e. a XPCOM service that is accessed in
Javascript) offers access to am UNO component context. Getting the component
context, I currently call comphelper::getProcessServiceFactory(). If no such
service factory is set, I assume that the whole process is not the running
office process, thus I bootstrap using a remote component context (calling
cppu::bootstrap()).

As an alternative, just for omitting the need to link against comphelper, I could

if (current process is soffice..exe/soffice.bin) {
#if WINDOWS
    handle = loadLib("comphelp4msc.dll");
    sym = dlsym( handle. "C++-decorated-comphelper::getProcessService" )
#else
    sym = dlsym( processHandle. "C++-decorated-comphelper::getProcessService" )
#endif
    ...

So what do you think, Stephan?
Comment 1 Stephan Bergmann 2005-11-03 14:17:06 UTC
As discussed offline, it is a questionable design to ask for "the UNO component
context of the process."  Please solve your problem in a way that does not rely
on global data.
Comment 2 Daniel Boelzle [:dbo] 2005-11-03 14:42:52 UTC
Global seems to be the only possibility here (even thread local storage won't
help), because there is no way to tunnel the component context.
So the sketched alternative way... IMO a hack.
=> closing
Comment 3 Daniel Boelzle [:dbo] 2005-11-03 14:43:49 UTC
closing