Add first function pointer integration to webclient for StarOffice.
This is necessary to allow events to be sent from mozilla to
StarOffice.
This commit is contained in:
edburns%acm.org 2000-04-13 00:12:50 +00:00
parent 6d95fdddec
commit 1176c0f8b4
3 changed files with 47 additions and 0 deletions

View File

@ -91,6 +91,12 @@ void util_SendEventToJava(JNIEnv *yourEnv, jobject nativeEventThread,
jobject webclientEventListener,
jlong eventType)
{
#ifdef BAL_INTERFACE
if (nsnull != externalEventOccurred) {
externalEventOccurred((void *) yourEnv, (void *) nativeEventThread,
(void *) webclientEventListener, eventType);
}
#else
if (nsnull == gVm) {
return;
}
@ -119,6 +125,7 @@ void util_SendEventToJava(JNIEnv *yourEnv, jobject nativeEventThread,
("cannot call the Java Method!\n"));
}
}
#endif
}
/**
@ -173,6 +180,8 @@ jobject util_NewGlobalRef(JNIEnv *env, jobject obj)
{
jobject result = nsnull;
#ifdef BAL_INTERFACE
// PENDING(edburns): do we need to do anything here?
result = obj;
#else
result = env->NewGlobalRef(obj);
#endif
@ -211,6 +220,13 @@ jclass util_FindClass(JNIEnv *env, const char *fullyQualifiedClassName)
{
jclass result = nsnull;
#ifdef BAL_INTERFACE
// PENDING(edburns): there will be a function in jni_util_export
// that UNO can use to populate a 2d array with const char *, type
// pairs. The const char* will be the fullyQualifiedClassName
// argument, the type will be returned from this function.
// For now we just return the argument
result = (jclass) fullyQualifiedClassName;
#else
result = env->FindClass(fullyQualifiedClassName);
#endif
@ -243,6 +259,12 @@ jboolean util_IsInstanceOf(JNIEnv *env, jobject obj, jclass clazz)
{
jboolean result = JNI_FALSE;
#ifdef BAL_INTERFACE
// PENDING(edburns): the user will set the value of a function
// pointer. This function will do QI type stuff. This function
// pointer must be initialized at startup.
// for now we just return JNI_TRUE
result = JNI_TRUE;
#else
result = env->IsInstanceOf(obj, clazz);
#endif

View File

@ -29,6 +29,8 @@
#include "ns_globals.h" // for prLogModuleInfo
fpEventOccurredType externalEventOccurred = nsnull;
JNIEXPORT const char * JNICALL util_GetStringUTFChars(JNIEnv *env,
jstring inString)
{
@ -135,3 +137,9 @@ JNIEXPORT void JNICALL util_DeleteString(JNIEnv *env, jstring toDelete)
#endif
}
JNIEXPORT void JNICALL util_SetEventOccurredFunction(fpEventOccurredType fp)
{
externalEventOccurred = fp;
}

View File

@ -61,6 +61,23 @@ JNIEXPORT jstring JNICALL util_NewString(JNIEnv *env, const jchar *inString,
JNIEXPORT void JNICALL util_DeleteString(JNIEnv *env, jstring toDelete);
typedef JNIEXPORT void (JNICALL * fpEventOccurredType) (void *env,
void *nativeEventThread,
void *webclientEventListener,
jlong eventType);
JNIEXPORT void JNICALL util_SetEventOccurredFunction(fpEventOccurredType fp);
/**
* defined in jni_util_export.cpp
* The function pointer set with util_SetEventOccurredFunction.
*/
extern fpEventOccurredType externalEventOccurred;
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */