1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CLI_BRIDGE_H
21 #define INCLUDED_CLI_BRIDGE_H
23 #include "osl/interlck.h"
24 #include "uno/mapping.h"
25 #include "uno/environment.h"
26 #include "uno/dispatcher.h"
28 #include "cli_environment.h"
29 //#using <cli_uretypes.dll>
30 #using <cli_basetypes.dll>
33 namespace sr
= System::Reflection
;
39 //==== holds environments and mappings =============================================================
41 struct Mapping
: public uno_Mapping
46 // The environment will be created in uno_initEnvironment. See also the remarks there
47 //Managed cli environment for cli objects an UNO proxies (which are cli
48 //objects. The uno_Environment is not used for cli objects.
49 ref
struct CliEnvHolder
{
50 static Cli_environment
^ g_cli_env
= nullptr;
53 //==================================================================================================
54 /** An instance of Bridge represents exactly one mapping therefore either
55 m_cli2uno or m_uno2cli is valid.
59 mutable oslInterlockedCount m_ref
;
60 uno_ExtEnvironment
* m_uno_env
;
61 uno_Environment
* m_uno_cli_env
;
65 bool m_registered_cli2uno
;
67 ~Bridge() SAL_THROW(());
68 Bridge( uno_Environment
* java_env
, uno_ExtEnvironment
* uno_env
, bool registered_java2uno
);
70 void acquire() const SAL_THROW(());
71 void release() const SAL_THROW(());
74 void * uno_data
, System::Object
^ cli_data
,
75 typelib_TypeDescriptionReference
* type
,
80 the type of the converted data. It may be a byref type.
83 System::Object
^ *cli_data
, void const * uno_data
,
84 typelib_TypeDescriptionReference
* type
, System::Type
^ info
/* maybe 0 */,
85 bool bDontCreateObj
) const;
87 System::Object
^ map_uno2cli(uno_Interface
* pUnoI
, typelib_InterfaceTypeDescription
* pTD
) const;
89 System::Object
^ call_uno(uno_Interface
* pUnoI
,
90 typelib_TypeDescription
* member_td
,
91 typelib_TypeDescriptionReference
* return_type
,
92 sal_Int32 nParams
, typelib_MethodParameter
const * pParams
,
93 array
<System::Object
^>^ args
, array
<System::Type
^>^ argTypes
,
94 System::Object
^* pException
) const;
98 System::Object
^ cliI
, sr::MethodInfo
^ method
,
99 typelib_TypeDescriptionReference
* return_type
,
100 typelib_MethodParameter
* params
, int nParams
,
101 void * uno_ret
, void * uno_args
[], uno_Any
** uno_exc
) const;
103 uno_Interface
* map_cli2uno(
104 System::Object
^ cliI
, typelib_TypeDescription
* pTD
) const;
108 } //namespace cli_uno
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */