summaryrefslogtreecommitdiff
path: root/cppuhelper/source
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2007-05-09 12:25:10 +0000
committerKurt Zenker <kz@openoffice.org>2007-05-09 12:25:10 +0000
commit551aaefaed413dbc820d7aecf9e0d747b29d2336 (patch)
treed2212d2e7151578b7509d5dcd78a99c154c86de2 /cppuhelper/source
parent870263bd78168f38cba7c857e95fe0ed88b8cd39 (diff)
INTEGRATION: CWS bunoexttm (1.29.28); FILE MERGED
2007/02/08 11:05:53 kr 1.29.28.2: fixed: linkage 2007/01/30 14:18:31 kr 1.29.28.1: adapted: add purposed env. support
Diffstat (limited to 'cppuhelper/source')
-rw-r--r--cppuhelper/source/component_context.cxx61
1 files changed, 51 insertions, 10 deletions
diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx
index 3cbfc74b4b0e..06f44ec4c611 100644
--- a/cppuhelper/source/component_context.cxx
+++ b/cppuhelper/source/component_context.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: component_context.cxx,v $
*
- * $Revision: 1.29 $
+ * $Revision: 1.30 $
*
- * last change: $Author: obo $ $Date: 2006-09-16 12:39:56 $
+ * last change: $Author: kz $ $Date: 2007-05-09 13:25:10 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -55,6 +55,8 @@
#include <rtl/ustrbuf.hxx>
+#include <uno/mapping.hxx>
+
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/compbase2.hxx>
#include <cppuhelper/component_context.hxx>
@@ -831,33 +833,72 @@ ComponentContext::ComponentContext(
//##################################################################################################
-Reference< XComponentContext > SAL_CALL createComponentContext(
- ContextEntry_Init const * pEntries, sal_Int32 nEntries,
- Reference< XComponentContext > const & xDelegate )
- SAL_THROW( () )
+extern "C" { static void s_createComponentContext_v(va_list param)
{
+ ContextEntry_Init const * pEntries = va_arg(param, ContextEntry_Init const *);
+ sal_Int32 nEntries = va_arg(param, sal_Int32);
+ XComponentContext * pDelegatee = va_arg(param, XComponentContext *);
+ void ** ppContext = va_arg(param, void **);
+ uno::Mapping * pTarget2curr = va_arg(param, uno::Mapping *);
+
+ Reference<XComponentContext> xDelegate(pDelegatee, SAL_NO_ACQUIRE);
+ Reference<XComponentContext> xContext;
+
if (nEntries > 0)
{
try
{
ComponentContext * p = new ComponentContext( pEntries, nEntries, xDelegate );
- Reference< XComponentContext > xContext( p );
+ xContext.set(p);
// listen delegate for disposing, to dispose this (wrapping) context first.
DisposingForwarder::listen( Reference< lang::XComponent >::query( xDelegate ), p );
- return xContext;
}
catch (Exception & exc)
{
(void) exc; // avoid warning about unused variable
OSL_ENSURE( 0, OUStringToOString(
exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
- return Reference< XComponentContext >();
+ xContext.clear();
}
}
else
{
- return xDelegate;
+ xContext = xDelegate;
+ }
+
+ delete[] pEntries;
+
+ *ppContext = pTarget2curr->mapInterface(xContext.get(), ::getCppuType(&xContext));
+}}
+
+Reference< XComponentContext > SAL_CALL createComponentContext(
+ ContextEntry_Init const * pEntries, sal_Int32 nEntries,
+ Reference< XComponentContext > const & xDelegate )
+ SAL_THROW( () )
+{
+ uno::Environment curr_env(Environment::getCurrent());
+ uno::Environment source_env(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV) ":unsafe")));
+
+ uno::Mapping curr2source(curr_env, source_env);
+ uno::Mapping source2curr(source_env, curr_env);
+
+ ContextEntry_Init * mapped_entries = new ContextEntry_Init[nEntries];
+ for (sal_Int32 nPos = 0; nPos < nEntries; ++ nPos)
+ {
+ mapped_entries[nPos].bLateInitService = pEntries[nPos].bLateInitService;
+ mapped_entries[nPos].name = pEntries[nPos].name;
+
+ uno_type_any_constructAndConvert(&mapped_entries[nPos].value,
+ const_cast<void *>(pEntries[nPos].value.getValue()),
+ pEntries[nPos].value.getValueTypeRef(),
+ curr2source.get());
}
+
+ void * mapped_delegate = curr2source.mapInterface(xDelegate.get(), ::getCppuType(&xDelegate));
+ XComponentContext * pXComponentContext = NULL;
+ source_env.invoke(s_createComponentContext_v, mapped_entries, nEntries, mapped_delegate, &pXComponentContext, &source2curr);
+
+ return Reference<XComponentContext>(pXComponentContext, SAL_NO_ACQUIRE);
}
}