sw a11y: clang-format SidebarWinAccessible code
[LibreOffice.git] / cli_ure / source / uno_bridge / cli_bridge.h
blob95ddb03943d481b33fbed9828b5325c453fd5880
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_URE_SOURCE_UNO_BRIDGE_CLI_BRIDGE_H
21 #define INCLUDED_CLI_URE_SOURCE_UNO_BRIDGE_CLI_BRIDGE_H
22 #include <vcclr.h>
23 #include "osl/interlck.h"
24 #include "uno/mapping.h"
25 #include "uno/environment.h"
26 #include "uno/dispatcher.h"
27 #include "cli_base.h"
28 #include "cli_environment.h"
29 //#using <cli_uretypes.dll>
30 #using <cli_basetypes.dll>
31 #using <system.dll>
33 namespace sr = System::Reflection;
35 namespace cli_uno
39 // holds environments and mappings
40 struct Bridge;
41 struct Mapping : public uno_Mapping
43 Bridge* m_bridge;
46 // The environment will be created in uno_initEnvironment. See also the remarks there
47 //Managed cli environment for cli objects a 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;
54 /** An instance of Bridge represents exactly one mapping therefore either
55 m_cli2uno or m_uno2cli is valid.
57 struct Bridge
59 mutable oslInterlockedCount m_ref;
60 uno_ExtEnvironment * m_uno_env;
61 uno_Environment * m_uno_cli_env;
63 Mapping m_cli2uno;
64 Mapping m_uno2cli;
65 bool m_registered_cli2uno;
67 ~Bridge();
68 Bridge( uno_Environment * java_env, uno_ExtEnvironment * uno_env, bool registered_java2uno );
70 void acquire() const;
71 void release() const;
73 void map_to_uno(
74 void * uno_data, System::Object^ cli_data,
75 typelib_TypeDescriptionReference * type,
76 bool assign) const;
78 /**
79 @param info
80 the type of the converted data. It may be a byref type.
82 void map_to_cli(
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;
97 void call_cli(
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
111 #endif
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */