update dev300-m58
[ooovba.git] / bridges / source / jni_uno / jni_bridge.h
blobab21ec57e11b48e3f014c79a295956ecdca6493d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: jni_bridge.h,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #if ! defined INCLUDED_JNI_BRIDGE_H
32 #define INCLUDED_JNI_BRIDGE_H
34 #include "jni_base.h"
35 #include "jni_info.h"
36 #include "jni_helper.h"
38 #include "osl/diagnose.h"
39 #include "osl/interlck.h"
41 #include "uno/mapping.h"
42 #include "uno/dispatcher.h"
44 #include "com/sun/star/uno/XInterface.hpp"
47 namespace jni_uno
50 //==== holds environments and mappings =========================================
51 struct Bridge;
52 struct Mapping : public uno_Mapping
54 Bridge * m_bridge;
57 //==============================================================================
58 struct Bridge
60 mutable oslInterlockedCount m_ref;
62 uno_ExtEnvironment * m_uno_env;
63 uno_Environment * m_java_env;
65 Mapping m_java2uno;
66 Mapping m_uno2java;
67 bool m_registered_java2uno;
69 JNI_info const * m_jni_info;
72 ~Bridge() SAL_THROW( () );
73 explicit Bridge(
74 uno_Environment * java_env, uno_ExtEnvironment * uno_env,
75 bool registered_java2uno );
77 void acquire() const;
78 void release() const;
80 // jni_data.cxx
81 void map_to_uno(
82 JNI_context const & jni,
83 void * uno_data, jvalue java_data,
84 typelib_TypeDescriptionReference * type,
85 JNI_type_info const * info /* maybe 0 */,
86 bool assign, bool out_param,
87 bool special_wrapped_integral_types = false ) const;
88 void map_to_java(
89 JNI_context const & jni,
90 jvalue * java_data, void const * uno_data,
91 typelib_TypeDescriptionReference * type,
92 JNI_type_info const * info /* maybe 0 */,
93 bool in_param, bool out_param,
94 bool special_wrapped_integral_types = false ) const;
96 // jni_uno2java.cxx
97 void handle_uno_exc(
98 JNI_context const & jni, uno_Any * uno_exc ) const;
99 void call_java(
100 jobject javaI,
101 typelib_InterfaceTypeDescription * iface_td,
102 sal_Int32 local_member_index, sal_Int32 function_pos_offset,
103 typelib_TypeDescriptionReference * return_type,
104 typelib_MethodParameter * params, sal_Int32 nParams,
105 void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) const;
106 jobject map_to_java(
107 JNI_context const & jni,
108 uno_Interface * pUnoI, JNI_interface_type_info const * info ) const;
110 // jni_java2uno.cxx
111 void handle_java_exc(
112 JNI_context const & jni,
113 JLocalAutoRef const & jo_exc, uno_Any * uno_exc ) const;
114 jobject call_uno(
115 JNI_context const & jni,
116 uno_Interface * pUnoI, typelib_TypeDescription * member_td,
117 typelib_TypeDescriptionReference * return_tdref,
118 sal_Int32 nParams, typelib_MethodParameter const * pParams,
119 jobjectArray jo_args ) const;
120 uno_Interface * map_to_uno(
121 JNI_context const & jni,
122 jobject javaI, JNI_interface_type_info const * info ) const;
127 #endif