Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / cli_ure / source / uno_bridge / cli_bridge.h
blobb9297d0bfaaf13ad7a7ca375316980eee735f611
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #if ! defined INCLUDED_CLI_BRIDGE_H
30 #define INCLUDED_CLI_BRIDGE_H
31 #include <vcclr.h>
32 #include "osl/interlck.h"
33 #include "uno/mapping.h"
34 #include "uno/environment.h"
35 #include "uno/dispatcher.h"
36 #include "cli_base.h"
37 #include "cli_environment.h"
38 #using <mscorlib.dll>
39 //#using <cli_uretypes.dll>
40 #using <cli_basetypes.dll>
41 #using <system.dll>
43 namespace sr = System::Reflection;
45 namespace cli_uno
49 //==== holds environments and mappings =============================================================
50 struct Bridge;
51 struct Mapping : public uno_Mapping
53 Bridge* m_bridge;
56 // The environment will be created in uno_initEnvironment. See also the remarks there
57 //Managed cli environment for cli objects an UNO proxies (which are cli
58 //objects. The uno_Environment is not used for cli objects.
59 __gc struct CliEnvHolder {
60 static Cli_environment * g_cli_env = NULL;
63 //==================================================================================================
64 /** An instance of Bridge represents exactly one mapping therefore either
65 m_cli2uno or m_uno2cli is valid.
67 struct Bridge
69 mutable oslInterlockedCount m_ref;
70 uno_ExtEnvironment * m_uno_env;
71 uno_Environment * m_uno_cli_env;
73 Mapping m_cli2uno;
74 Mapping m_uno2cli;
75 bool m_registered_cli2uno;
77 ~Bridge() SAL_THROW(());
78 Bridge( uno_Environment * java_env, uno_ExtEnvironment * uno_env, bool registered_java2uno );
80 void acquire() const;
81 void release() const;
83 void map_to_uno(
84 void * uno_data, System::Object* cli_data,
85 typelib_TypeDescriptionReference * type,
86 bool assign) const;
88 /**
89 @param info
90 the type of the converted data. It may be a byref type.
92 void map_to_cli(
93 System::Object* *cli_data, void const * uno_data,
94 typelib_TypeDescriptionReference * type, System::Type* info /* maybe 0 */,
95 bool bDontCreateObj) const;
97 System::Object* map_uno2cli(uno_Interface * pUnoI, typelib_InterfaceTypeDescription* pTD) const;
99 System::Object* call_uno(uno_Interface * pUnoI,
100 typelib_TypeDescription* member_td,
101 typelib_TypeDescriptionReference * return_type,
102 sal_Int32 nParams, typelib_MethodParameter const * pParams,
103 System::Object * args[], System::Type* argTypes[],
104 System::Object** pException) const;
107 void call_cli(
108 System::Object* cliI, sr::MethodInfo* method,
109 typelib_TypeDescriptionReference * return_type,
110 typelib_MethodParameter * params, int nParams,
111 void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) const;
113 uno_Interface * map_cli2uno(
114 System::Object* cliI, typelib_TypeDescription* pTD) const;
118 } //namespace cli_uno
121 #endif
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */