Issue 57289

Summary: getting the process' component context in URE
Product: udk Reporter: Daniel Boelzle [:dbo] <openoffice>
Component: codeAssignee: Daniel Boelzle [:dbo] <openoffice>
Status: CLOSED WONT_FIX QA Contact: issues@udk <issues>
Severity: Trivial    
Priority: P3 CC: issues
Version: current   
Target Milestone: AOO PleaseHelp   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Latest Confirmation in: ---
Developer Difficulty: ---

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