summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2004-04-21 11:16:19 +0000
committerJoachim Lingner <jl@openoffice.org>2004-04-21 11:16:19 +0000
commitbe59afb184a9b5595647f43a70d258f12dbb3e7e (patch)
tree95b9eb99cbd85107323e9508ca0c9f598c99029b
parente61aa88e3dffcff717e7683cf18727701fcbb360 (diff)
#i20052#
-rw-r--r--jvmfwk/inc/jvmfwk/framework.h9
-rw-r--r--jvmfwk/source/framework.cxx40
-rw-r--r--jvmfwk/source/framework.map1
3 files changed, 44 insertions, 6 deletions
diff --git a/jvmfwk/inc/jvmfwk/framework.h b/jvmfwk/inc/jvmfwk/framework.h
index 4255cc12b0ba..aa91a172cf5a 100644
--- a/jvmfwk/inc/jvmfwk/framework.h
+++ b/jvmfwk/inc/jvmfwk/framework.h
@@ -2,9 +2,9 @@
*
* $RCSfile: framework.h,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jl $ $Date: 2004-04-21 09:30:34 $
+ * last change: $Author: jl $ $Date: 2004-04-21 12:16:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -113,6 +113,11 @@ typedef struct _JavaInfo JavaInfo;
*/
void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo);
+/**
+ Both arguments must me valid JavaInfo*.
+ */
+sal_Bool SAL_CALL jfw_areEqualJavaInfo(
+ JavaInfo const * pInfoA,JavaInfo const * pInfoB);
/** When a Java is already running and a user changes the Java configuration
in the options dialog then the user must be informed that the new
settings come into effect after re-starting the office. The options dialog
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 89af27dc4d67..d482719891b4 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: framework.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jl $ $Date: 2004-04-21 09:30:36 $
+ * last change: $Author: jl $ $Date: 2004-04-21 12:16:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,6 +72,7 @@
#include "libxml/xpathinternals.h"
#include <vector>
#include <algorithm>
+#include <functional>
#include "jni.h"
#include "framework.hxx"
@@ -117,8 +118,6 @@ javaFrameworkError SAL_CALL jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSi
errcode = jfw::getVendorPluginURLs(doc, context, & vecPlugins);
if (errcode != JFW_E_NONE)
return errcode;
-
-
//Add the JavaInfos found by getAllJavaInfos to the vector
//Make sure that the contents are destroyed if this
//function returns with an error
@@ -241,6 +240,17 @@ javaFrameworkError SAL_CALL jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSi
vecInfoManual.push_back(pInfo);
}
}
+ //Check which JavaInfo from vector vecInfoManual is already
+ //contained in vecInfo. If it already exists then remove it from
+ //vecInfoManual
+ for (it_info i = vecInfo.begin(); i != vecInfo.end(); i++)
+ {
+ it_info it_duplicate =
+ std::find_if(vecInfoManual.begin(), vecInfoManual.end(),
+ std::bind2nd(std::ptr_fun(jfw_areEqualJavaInfo), *i));
+ if (it_duplicate != vecInfoManual.end())
+ vecInfoManual.erase(it_duplicate);
+ }
//create an fill the array of JavaInfo*
sal_Int32 nSize = vecInfo.size() + vecInfoManual.size();
*pparInfo = (JavaInfo**) rtl_allocateMemory(
@@ -538,6 +548,28 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJava(JavaInfo **pInfo)
}
return errcode;
}
+sal_Bool SAL_CALL jfw_areEqualJavaInfo(
+ JavaInfo const * pInfoA,JavaInfo const * pInfoB)
+{
+ OSL_ASSERT(pInfoA != NULL && pInfoB != NULL);
+ if (pInfoA == pInfoB)
+ return sal_True;
+
+ rtl::OUString sVendor(pInfoA->sVendor);
+ rtl::OUString sLocation(pInfoA->sLocation);
+ rtl::OUString sVersion(pInfoA->sVersion);
+ rtl::ByteSequence sData(pInfoA->arVendorData);
+ if (sVendor.equals(pInfoB->sVendor) == sal_True
+ && sLocation.equals(pInfoB->sLocation) == sal_True
+ && sVersion.equals(pInfoB->sVersion) == sal_True
+ && pInfoA->nFeatures == pInfoB->nFeatures
+ && pInfoA->nRequirements == pInfoB->nRequirements
+ && sData == pInfoB->arVendorData)
+ {
+ return sal_True;
+ }
+ return sal_False;
+}
void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo)
diff --git a/jvmfwk/source/framework.map b/jvmfwk/source/framework.map
index b94ddafc55bb..2aa0331eb441 100644
--- a/jvmfwk/source/framework.map
+++ b/jvmfwk/source/framework.map
@@ -2,6 +2,7 @@ UDK_3_0_0 {
global:
# jvmfwk/framework.h:
jfw_freeJavaInfo;
+ jfw_areEqualJavaInfo;
jfw_findAllJREs;
jfw_findAndSelectJava;
jfw_startJava;