View | Details | Raw Unified | Return to issue 21932
Collapse All | Expand All

(-)source/java/jnihelp.cxx (+3 lines)
Lines 59-64 Link Here
59
 *
59
 *
60
 ************************************************************************/
60
 ************************************************************************/
61
61
62
#ifdef SOLAR_JAVA
62
#include <cstdarg>
63
#include <cstdarg>
63
#include <tools/debug.hxx>
64
#include <tools/debug.hxx>
64
#include <jni.h>       /* where everything is defined */
65
#include <jni.h>       /* where everything is defined */
Lines 99-101 Link Here
99
	_xJavaThreadRegister_11->revokeThread();
100
	_xJavaThreadRegister_11->revokeThread();
100
  }
101
  }
101
}
102
}
103
104
#endif // SOLAR_JAVA
(-)source/jscpp/sjapplet.cxx (-1 / +8 lines)
Lines 60-66 Link Here
60
 ************************************************************************/
60
 ************************************************************************/
61
61
62
#include <cstdarg>
62
#include <cstdarg>
63
#ifdef SOLAR_JAVA
63
#include <jnihelp.hxx>
64
#include <jnihelp.hxx>
65
#endif // SOLAR_JAVA
64
66
65
#include <sjapplet.hxx>
67
#include <sjapplet.hxx>
66
68
Lines 79-89 Link Here
79
81
80
using namespace ::rtl;
82
using namespace ::rtl;
81
using namespace ::utl;
83
using namespace ::utl;
84
#ifdef SOLAR_JAVA
82
using namespace ::sj2;
85
using namespace ::sj2;
86
#endif // SOLAR_JAVA
83
87
84
using namespace ::com::sun::star::lang;
88
using namespace ::com::sun::star::lang;
85
using namespace ::com::sun::star::uno;
89
using namespace ::com::sun::star::uno;
90
#ifdef SOLAR_JAVA
86
using namespace ::com::sun::star::java;
91
using namespace ::com::sun::star::java;
92
#endif // SOLAR_JAVA
87
93
88
SjApplet2::SjApplet2()
94
SjApplet2::SjApplet2()
89
  : _pImpl(new SjApplet2_Impl())
95
  : _pImpl(new SjApplet2_Impl())
Lines 346-352 Link Here
346
/*
352
/*
347
 * Java init function to invoke Java runtime using JNI invocation API.
353
 * Java init function to invoke Java runtime using JNI invocation API.
348
 */
354
 */
349
355
#ifdef SOLAR_JAVA
350
void JRE_PropertyChanged( JNIEnv * env, const SvCommandList & rCmdList )
356
void JRE_PropertyChanged( JNIEnv * env, const SvCommandList & rCmdList )
351
{
357
{
352
	jclass pClass = env->FindClass("java/util/Properties");
358
	jclass pClass = env->FindClass("java/util/Properties");
Lines 389-394 Link Here
389
	env->DeleteLocalRef( pProps );
395
	env->DeleteLocalRef( pProps );
390
	env->DeleteLocalRef( pClass );
396
	env->DeleteLocalRef( pClass );
391
}
397
}
398
#endif // SOLAR_JAVA
392
399
393
// Settings are detected by the JavaVM service
400
// Settings are detected by the JavaVM service
394
// This function is not necessary anymore
401
// This function is not necessary anymore
(-)source/jscpp/sjapplet_impl.cxx (-4 / +50 lines)
Lines 78-95 Link Here
78
#include <vcl/syschild.hxx>
78
#include <vcl/syschild.hxx>
79
#include <vcl/sysdata.hxx>
79
#include <vcl/sysdata.hxx>
80
80
81
#ifdef SOLAR_JAVA
81
#include <jnihelp.hxx>
82
#include <jnihelp.hxx>
83
#endif // SOLAR_JAVA
82
84
83
using namespace ::rtl;
85
using namespace ::rtl;
84
using namespace ::osl;
86
using namespace ::osl;
87
#ifdef SOLAR_JAVA
85
using namespace ::sj2;
88
using namespace ::sj2;
89
#endif // SOLAR_JAVA
86
using namespace ::utl;
90
using namespace ::utl;
87
91
92
#ifdef SOLAR_JAVA
88
using namespace ::com::sun::star::java;
93
using namespace ::com::sun::star::java;
94
#endif // SOLAR_JAVA
89
using namespace ::com::sun::star::lang;
95
using namespace ::com::sun::star::lang;
90
using namespace ::com::sun::star::uno;
96
using namespace ::com::sun::star::uno;
91
97
92
98
#ifdef SOLAR_JAVA
93
static void testJavaException(JNIEnv * pEnv)  throw(com::sun::star::uno::RuntimeException)
99
static void testJavaException(JNIEnv * pEnv)  throw(com::sun::star::uno::RuntimeException)
94
{
100
{
95
	jthrowable jtThrowable = pEnv->ExceptionOccurred();
101
	jthrowable jtThrowable = pEnv->ExceptionOccurred();
Lines 114-120 Link Here
114
  		throw RuntimeException(ouMessage, Reference<XInterface>());
120
  		throw RuntimeException(ouMessage, Reference<XInterface>());
115
	}
121
	}
116
}
122
}
123
#else // !SOLAR_JAVA
124
static void throwException() throw(com::sun::star::uno::RuntimeException)
125
{
126
	throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("Java applets not supported.")), Reference<XInterface>());
127
}
128
#endif
117
129
130
#ifdef SOLAR_JAVA
118
#ifdef UNX
131
#ifdef UNX
119
struct EmbeddedWindow {
132
struct EmbeddedWindow {
120
	jobject _joWindow;
133
	jobject _joWindow;
Lines 210-226 Link Here
210
223
211
_joWindow = 0;
224
_joWindow = 0;
212
}
225
}
226
#endif // SOLAR_JAVA
213
227
214
228
#ifdef SOLAR_JAVA
215
216
SjApplet2_Impl::SjApplet2_Impl()  throw(com::sun::star::uno::RuntimeException)
229
SjApplet2_Impl::SjApplet2_Impl()  throw(com::sun::star::uno::RuntimeException)
217
:	_pJVM(NULL),
230
:	_pJVM(NULL),
218
    _joAppletExecutionContext(0),
231
    _joAppletExecutionContext(0),
219
    _jcAppletExecutionContext(0)
232
    _jcAppletExecutionContext(0)
220
233
221
{}
234
{}
235
#else // !SOLAR_JAVA
236
SjApplet2_Impl::SjApplet2_Impl()  throw(com::sun::star::uno::RuntimeException)
237
{}
238
#endif
222
239
223
SjApplet2_Impl::~SjApplet2_Impl() throw() {
240
SjApplet2_Impl::~SjApplet2_Impl() throw() {
241
#ifdef SOLAR_JAVA
224
if (_joAppletExecutionContext) {
242
if (_joAppletExecutionContext) {
225
    TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
243
    TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
226
244
Lines 230-235 Link Here
230
    jenv.pEnv->DeleteGlobalRef(_joAppletExecutionContext);
248
    jenv.pEnv->DeleteGlobalRef(_joAppletExecutionContext);
231
    jenv.pEnv->DeleteGlobalRef(_jcAppletExecutionContext);
249
    jenv.pEnv->DeleteGlobalRef(_jcAppletExecutionContext);
232
	}
250
	}
251
#endif
233
}
252
}
234
253
235
void SjApplet2_Impl::init(Window * pParentWin,
254
void SjApplet2_Impl::init(Window * pParentWin,
Lines 238-243 Link Here
238
						  const SvCommandList & rCmdList)
257
						  const SvCommandList & rCmdList)
239
	throw(com::sun::star::uno::RuntimeException)
258
	throw(com::sun::star::uno::RuntimeException)
240
{
259
{
260
#ifdef SOLAR_JAVA
241
	_pParentWin = pParentWin;
261
	_pParentWin = pParentWin;
242
262
243
263
Lines 338-348 Link Here
338
							  joDocBase, joParameters, _pEmbeddedWindow->_joWindow, (jlong)0);                             testJavaException(jenv.pEnv);
358
							  joDocBase, joParameters, _pEmbeddedWindow->_joWindow, (jlong)0);                             testJavaException(jenv.pEnv);
339
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_init);                                   testJavaException(jenv.pEnv);
359
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_init);                                   testJavaException(jenv.pEnv);
340
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_startUp);                                testJavaException(jenv.pEnv);
360
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_startUp);                                testJavaException(jenv.pEnv);
341
361
#else // !SOLAR_JAVA
362
	throwException();
363
#endif
342
}
364
}
343
365
344
void SjApplet2_Impl::setSize(const Size & rSize) throw(com::sun::star::uno::RuntimeException)
366
void SjApplet2_Impl::setSize(const Size & rSize) throw(com::sun::star::uno::RuntimeException)
345
{
367
{
368
#ifdef SOLAR_JAVA
346
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
369
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
347
370
348
	_pParentWin->SetSizePixel(rSize);
371
	_pParentWin->SetSizePixel(rSize);
Lines 350-391 Link Here
350
	jmethodID jmAppletExecutionContext_resize = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "appletResize", "(II)V");  testJavaException(jenv.pEnv);
373
	jmethodID jmAppletExecutionContext_resize = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "appletResize", "(II)V");  testJavaException(jenv.pEnv);
351
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_resize, (jint)rSize.Width(),
374
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_resize, (jint)rSize.Width(),
352
							  (jint)rSize.Height());	                                                                     testJavaException(jenv.pEnv);
375
							  (jint)rSize.Height());	                                                                     testJavaException(jenv.pEnv);
376
#else // !SOLAR_JAVA
377
	throwException();
378
#endif
353
}
379
}
354
380
355
void SjApplet2_Impl::restart() throw(com::sun::star::uno::RuntimeException)
381
void SjApplet2_Impl::restart() throw(com::sun::star::uno::RuntimeException)
356
{
382
{
383
#ifdef SOLAR_JAVA
357
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
384
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
358
385
359
	jmethodID jmAppletExecutionContext_restart = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "restart", "()V");     testJavaException(jenv.pEnv);
386
	jmethodID jmAppletExecutionContext_restart = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "restart", "()V");     testJavaException(jenv.pEnv);
360
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_restart);	                                testJavaException(jenv.pEnv);
387
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_restart);	                                testJavaException(jenv.pEnv);
388
#else // !SOLAR_JAVA
389
	throwException();
390
#endif
361
}
391
}
362
392
363
void SjApplet2_Impl::reload() throw(com::sun::star::uno::RuntimeException)
393
void SjApplet2_Impl::reload() throw(com::sun::star::uno::RuntimeException)
364
{
394
{
395
#ifdef SOLAR_JAVA
365
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
396
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
366
397
367
	jmethodID jmAppletExecutionContext_reload = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "reload", "()V"); testJavaException(jenv.pEnv);
398
	jmethodID jmAppletExecutionContext_reload = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "reload", "()V"); testJavaException(jenv.pEnv);
368
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_reload); 	                        testJavaException(jenv.pEnv);
399
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_reload); 	                        testJavaException(jenv.pEnv);
400
#else // !SOLAR_JAVA
401
	throwException();
402
#endif
369
}
403
}
370
404
371
void SjApplet2_Impl::start() throw(com::sun::star::uno::RuntimeException)
405
void SjApplet2_Impl::start() throw(com::sun::star::uno::RuntimeException)
372
{
406
{
407
#ifdef SOLAR_JAVA
373
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
408
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
374
409
375
	jmethodID jmAppletExecutionContext_sendStart = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "sendStart", "()V"); testJavaException(jenv.pEnv);
410
	jmethodID jmAppletExecutionContext_sendStart = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "sendStart", "()V"); testJavaException(jenv.pEnv);
376
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_sendStart);	                          testJavaException(jenv.pEnv);
411
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_sendStart);	                          testJavaException(jenv.pEnv);
412
#else // !SOLAR_JAVA
413
	throwException();
414
#endif
377
}
415
}
378
416
379
void SjApplet2_Impl::stop() throw(com::sun::star::uno::RuntimeException)
417
void SjApplet2_Impl::stop() throw(com::sun::star::uno::RuntimeException)
380
{
418
{
419
#ifdef SOLAR_JAVA
381
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
420
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
382
421
383
	jmethodID jmAppletExecutionContext_sendStop = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "sendStop", "()V"); testJavaException(jenv.pEnv);
422
	jmethodID jmAppletExecutionContext_sendStop = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "sendStop", "()V"); testJavaException(jenv.pEnv);
384
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_sendStop); 	                        testJavaException(jenv.pEnv);
423
	jenv.pEnv->CallVoidMethod(_joAppletExecutionContext, jmAppletExecutionContext_sendStop); 	                        testJavaException(jenv.pEnv);
424
#else // !SOLAR_JAVA
425
	throwException();
426
#endif
385
}
427
}
386
428
387
void SjApplet2_Impl::close() throw(com::sun::star::uno::RuntimeException)
429
void SjApplet2_Impl::close() throw(com::sun::star::uno::RuntimeException)
388
{
430
{
431
#ifdef SOLAR_JAVA
389
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
432
	TKTThreadAttach jenv(_pJVM, _xJavaThreadRegister_11.get());
390
433
391
	jmethodID jmAppletExecutionContext_shutdown  = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "shutdown", "()V"); testJavaException(jenv.pEnv);
434
	jmethodID jmAppletExecutionContext_shutdown  = jenv.pEnv->GetMethodID(_jcAppletExecutionContext, "shutdown", "()V"); testJavaException(jenv.pEnv);
Lines 416-420 Link Here
416
			}
459
			}
417
	  	}
460
	  	}
418
	}
461
	}
462
#else // !SOLAR_JAVA
463
	throwException();
464
#endif
419
}
465
}
420
466
(-)source/jscpp/sjapplet_impl.hxx (-2 / +8 lines)
Lines 1-13 Link Here
1
#include <cstdarg>
1
#include <cstdarg>
2
2
3
3
#ifdef SOLAR_JAVA
4
#include <jni.h>
4
#include <jni.h>
5
5
#endif // SOLAR_JAVA
6
6
7
#include <unotools/processfactory.hxx>
7
#include <unotools/processfactory.hxx>
8
8
9
#ifdef SOLAR_JAVA
9
#include <com/sun/star/java/XJavaVM.hpp>
10
#include <com/sun/star/java/XJavaVM.hpp>
10
#include <com/sun/star/java/XJavaThreadRegister_11.hpp>
11
#include <com/sun/star/java/XJavaThreadRegister_11.hpp>
12
#endif // SOLAR_JAVA
11
13
12
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
14
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
13
15
Lines 16-24 Link Here
16
class SvCommandList;
18
class SvCommandList;
17
class Size;
19
class Size;
18
20
21
#ifdef SOLAR_JAVA
19
struct EmbeddedWindow;
22
struct EmbeddedWindow;
23
#endif // SOLAR_JAVA
20
24
21
struct SjApplet2_Impl {
25
struct SjApplet2_Impl {
26
#ifdef SOLAR_JAVA
22
	Window 				* _pParentWin;
27
	Window 				* _pParentWin;
23
28
24
	JavaVM *	_pJVM;
29
	JavaVM *	_pJVM;
Lines 29-34 Link Here
29
34
30
	com::sun::star::uno::Reference<com::sun::star::java::XJavaVM> 					_xJavaVM;
35
	com::sun::star::uno::Reference<com::sun::star::java::XJavaVM> 					_xJavaVM;
31
	com::sun::star::uno::Reference<com::sun::star::java::XJavaThreadRegister_11> 	_xJavaThreadRegister_11;
36
	com::sun::star::uno::Reference<com::sun::star::java::XJavaThreadRegister_11> 	_xJavaThreadRegister_11;
37
#endif // SOLAR_JAVA
32
38
33
	SjApplet2_Impl() throw(com::sun::star::uno::RuntimeException);
39
	SjApplet2_Impl() throw(com::sun::star::uno::RuntimeException);
34
	~SjApplet2_Impl() throw();
40
	~SjApplet2_Impl() throw();

Return to issue 21932