bump product version to 5.0.4.1
[LibreOffice.git] / bridges / source / jni_uno / jni_bridge.h
blob8a216e01c46d2d099b7db7e4681bd0bd64e880e9
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_BRIDGES_SOURCE_JNI_UNO_JNI_BRIDGE_H
21 #define INCLUDED_BRIDGES_SOURCE_JNI_UNO_JNI_BRIDGE_H
23 #include "jni_base.h"
24 #include "jni_helper.h"
26 #include "osl/diagnose.h"
27 #include "osl/interlck.h"
29 #include "uno/mapping.h"
30 #include "uno/dispatcher.h"
32 #include "com/sun/star/uno/XInterface.hpp"
35 namespace jni_uno
38 class JNI_info;
39 struct Bridge;
41 struct Mapping : public uno_Mapping
43 Bridge * m_bridge;
46 // Holds environments and mappings:
47 struct Bridge
49 mutable oslInterlockedCount m_ref;
51 uno_ExtEnvironment * m_uno_env;
52 uno_Environment * m_java_env;
54 Mapping m_java2uno;
55 Mapping m_uno2java;
56 bool m_registered_java2uno;
58 ~Bridge();
59 explicit Bridge(
60 uno_Environment * java_env, uno_ExtEnvironment * uno_env,
61 bool registered_java2uno );
63 void acquire() const;
64 void release() const;
66 // jni_data.cxx
67 void map_to_uno(
68 JNI_context const & jni,
69 void * uno_data, jvalue java_data,
70 typelib_TypeDescriptionReference * type,
71 JNI_type_info const * info /* maybe 0 */,
72 bool assign, bool out_param,
73 bool special_wrapped_integral_types = false ) const;
74 void map_to_java(
75 JNI_context const & jni,
76 jvalue * java_data, void const * uno_data,
77 typelib_TypeDescriptionReference * type,
78 JNI_type_info const * info /* maybe 0 */,
79 bool in_param, bool out_param,
80 bool special_wrapped_integral_types = false ) const;
82 // jni_uno2java.cxx
83 void handle_uno_exc(
84 JNI_context const & jni, uno_Any * uno_exc ) const;
85 void call_java(
86 jobject javaI,
87 typelib_InterfaceTypeDescription * iface_td,
88 sal_Int32 local_member_index, sal_Int32 function_pos_offset,
89 typelib_TypeDescriptionReference * return_type,
90 typelib_MethodParameter * params, sal_Int32 nParams,
91 void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) const;
92 jobject map_to_java(
93 JNI_context const & jni,
94 uno_Interface * pUnoI, JNI_interface_type_info const * info ) const;
96 // jni_java2uno.cxx
97 void handle_java_exc(
98 JNI_context const & jni,
99 JLocalAutoRef const & jo_exc, uno_Any * uno_exc ) const;
100 jobject call_uno(
101 JNI_context const & jni,
102 uno_Interface * pUnoI, typelib_TypeDescription * member_td,
103 typelib_TypeDescriptionReference * return_tdref,
104 sal_Int32 nParams, typelib_MethodParameter const * pParams,
105 jobjectArray jo_args ) const;
106 uno_Interface * map_to_uno(
107 JNI_context const & jni,
108 jobject javaI, JNI_interface_type_info const * info ) const;
110 JNI_info const * getJniInfo() const;
115 #endif
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */