1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: jni_bridge.h,v $
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
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"
50 //==== holds environments and mappings =========================================
52 struct Mapping
: public uno_Mapping
57 //==============================================================================
60 mutable oslInterlockedCount m_ref
;
62 uno_ExtEnvironment
* m_uno_env
;
63 uno_Environment
* m_java_env
;
67 bool m_registered_java2uno
;
69 JNI_info
const * m_jni_info
;
72 ~Bridge() SAL_THROW( () );
74 uno_Environment
* java_env
, uno_ExtEnvironment
* uno_env
,
75 bool registered_java2uno
);
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;
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;
98 JNI_context
const & jni
, uno_Any
* uno_exc
) const;
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;
107 JNI_context
const & jni
,
108 uno_Interface
* pUnoI
, JNI_interface_type_info
const * info
) const;
111 void handle_java_exc(
112 JNI_context
const & jni
,
113 JLocalAutoRef
const & jo_exc
, uno_Any
* uno_exc
) const;
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;