Inserting a value into a XComponentContext

Stephan Bergmann sbergman at redhat.com
Mon Dec 1 03:06:22 PST 2014


On 11/30/2014 01:31 PM, Chris Sherlock wrote:
> How do you insert a value to be retrieved later into an
> XComponentContext reference?
>
> I see there is a XNameContainer, which is created
> by comphelper::NameContainer_createInstance(::cppu::UnoType<sal_Int32>::get())
> or whatever value you want. From here you then do insertByName.
>
> However, how do you then insert this into the component context?

You can query a component context for the XNameContainer interface, and 
use that.  See e.g. cppuhelper::ServiceManager::insertExtraData 
(cppuhelper/source/servicemanager.cxx) inserting information about 
singletons into the component context.  (Which also shows the intended 
structure of the key namespace, using hierarchical paths like 
"/singletons/...")


More information about the LibreOffice mailing list