merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / inc / java / tools.hxx
blob098126895aa6155e9d3fe6161b1cf5d1674686c9
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: tools.hxx,v $
10 * $Revision: 1.9 $
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 #ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_
32 #define _CONNECTIVITY_JAVA_TOOLS_HXX_
34 #include <com/sun/star/beans/PropertyValue.hpp>
35 #include <com/sun/star/uno/Sequence.h>
37 #ifndef JNI_H
38 #include <jni.h>
39 #endif
40 #include "java/sql/SQLException.hxx"
41 #include <comphelper/uno3.hxx>
43 #include <com/sun/star/container/XNameAccess.hpp>
44 #include <com/sun/star/util/Time.hpp>
45 #include <com/sun/star/util/Date.hpp>
46 #include <com/sun/star/util/DateTime.hpp>
49 namespace connectivity
52 jstring convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUString& _Temp);
53 ::rtl::OUString JavaString2String(JNIEnv *pEnv,jstring _Str);
54 class java_util_Properties;
56 java_util_Properties* createStringPropertyArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
58 template<class T,class JT> ::com::sun::star::uno::Sequence< T > copyArrayAndDelete(JNIEnv *pEnv,jobjectArray _Array, const T*, const JT* )
60 ::com::sun::star::uno::Sequence< T > xOut;
61 if(_Array)
63 jsize nLen = pEnv->GetArrayLength(_Array);
64 xOut.realloc(nLen);
65 for(jsize i=0;i<nLen;++i)
67 JT xInfo(pEnv,pEnv->GetObjectArrayElement(_Array,i));
68 java_lang_Object::ThrowSQLException(pEnv,NULL);
69 xOut.getArray()[i] = xInfo;
71 pEnv->DeleteLocalRef(_Array);
73 return xOut;
76 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > Map2XNameAccess(JNIEnv *pEnv,jobject _pMap);
77 jobject convertTypeMapToJavaMap(JNIEnv *pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & _rMap);
79 /** return if a exception occured
80 @param pEnv
81 The native java env
82 @param _bClear
83 <TRUE/> if the execption should be cleared
84 @return
85 <TRUE/> if an exception is occured
87 sal_Bool isExceptionOccured(JNIEnv *pEnv,sal_Bool _bClear);
90 #endif // _CONNECTIVITY_JAVA_TOOLS_HXX_