summaryrefslogtreecommitdiff
path: root/jvmfwk/source
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2004-05-13 10:15:02 +0000
committerJoachim Lingner <jl@openoffice.org>2004-05-13 10:15:02 +0000
commitc58b07c958e7bc70a9d337852df477f33a453433 (patch)
tree31fc549f2fb610e94efc6d319f729d509b83785c /jvmfwk/source
parent99a825569ef62227ef6f40b4b13d9d0aa4ee5096 (diff)
#i20020#
Diffstat (limited to 'jvmfwk/source')
-rw-r--r--jvmfwk/source/elements.cxx40
-rw-r--r--jvmfwk/source/elements.hxx25
-rw-r--r--jvmfwk/source/framework.cxx41
-rw-r--r--jvmfwk/source/fwkutil.cxx60
-rw-r--r--jvmfwk/source/makefile.mk8
5 files changed, 138 insertions, 36 deletions
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index d7c7e32b90e4..157a1207822c 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elements.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: jl $ $Date: 2004-05-13 08:10:46 $
+ * last change: $Author: jl $ $Date: 2004-05-13 11:15:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -284,12 +284,13 @@ javaFrameworkError createSettingsStructure(xmlDoc * document, bool * bNeedsSave)
nodeCrLf = xmlNewText((xmlChar*) "\n");
xmlAddChild(root, nodeCrLf);
- //<javaInfo xsi:nil="true">
+ //<javaInfo xsi:nil="true" autoSelect="true">
xmlNode * nodeJava = xmlNewTextChild(
root,NULL, (xmlChar*) "javaInfo", (xmlChar*) "");
if (nodeJava == NULL)
return JFW_E_ERROR;
xmlSetNsProp(nodeJava,nsXsi,(xmlChar*) "nil",(xmlChar*) "true");
+// xmlSetProp(nodeJava,(xmlChar*) "autoSelect",(xmlChar*) "true");
//add a new line
nodeCrLf = xmlNewText((xmlChar*) "\n");
xmlAddChild(root, nodeCrLf);
@@ -863,10 +864,10 @@ rtl::OUString const & CNodeJava::getUserClassPath() const
return m_sUserClassPath;
}
-void CNodeJava::setJavaInfo(const JavaInfo * pInfo)
+void CNodeJava::setJavaInfo(const JavaInfo * pInfo, bool bAutoSelect)
{
-
+ m_aInfo.bAutoSelect = bAutoSelect;
m_aInfo.bNil = false;
// m_aInfo.sAttrVendorUpdate = sVendorUpdate;
@@ -1020,9 +1021,14 @@ void CNodeJava::getJRELocations(
*size = m_arJRELocations.size();
}
+bool CNodeJava::getJavaInfoAttrAutoSelect() const
+{
+ return m_aInfo.bAutoSelect;
+}
//=====================================================================
CNodeJavaInfo::CNodeJavaInfo() :
- nFeatures(0), nRequirements(0), bNil(true), m_bEmptyNode(false)
+ nFeatures(0), nRequirements(0), bNil(true),
+ bAutoSelect(true), m_bEmptyNode(false)
{
}
@@ -1056,6 +1062,7 @@ javaFrameworkError CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInf
pJavaInfo, (xmlChar*) "nil", (xmlChar*) NS_SCHEMA_INSTANCE);
if ( ! sNil)
return JFW_E_FORMAT_STORE;
+
if (xmlStrcmp(sNil, (xmlChar*) "true") == 0)
bNil = true;
else if (xmlStrcmp(sNil, (xmlChar*) "false") == 0)
@@ -1065,6 +1072,20 @@ javaFrameworkError CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInf
if (bNil == true)
return JFW_E_NONE;
+ //Get javaInfo@manuallySelected attribute
+ CXmlCharPtr sAutoSelect;
+ sAutoSelect = xmlGetProp(
+ pJavaInfo, (xmlChar*) "autoSelect");
+ if ( ! sAutoSelect)
+ return JFW_E_FORMAT_STORE;
+
+ if (xmlStrcmp(sAutoSelect, (xmlChar*) "true") == 0)
+ bAutoSelect = true;
+ else if (xmlStrcmp(sAutoSelect, (xmlChar*) "false") == 0)
+ bAutoSelect = false;
+ else
+ return JFW_E_FORMAT_STORE;
+
xmlNode * cur = pJavaInfo->children;
while (cur != NULL)
@@ -1145,13 +1166,18 @@ javaFrameworkError CNodeJavaInfo::writeToNode(xmlDoc* pDoc,
javaFrameworkError errcode = JFW_E_NONE;
//write the attribute vendorSettings
+ //javaInfo@vendorUpdate
//creates the attribute if necessary
rtl::OString sUpdated;
errcode = getElementUpdated(sUpdated);
if (errcode != JFW_E_NONE)
return errcode;
xmlSetProp(pJavaInfoNode, (xmlChar*)"vendorUpdate",
- (xmlChar*) sUpdated.getStr());
+ (xmlChar*) sUpdated.getStr());
+
+ //javaInfo@autoSelect
+ xmlSetProp(pJavaInfoNode, (xmlChar*)"autoSelect",
+ (xmlChar*) (bAutoSelect == true ? "true" : "false"));
//Set xsi:nil in javaInfo element to false
//the xmlNs pointer must not be destroyed
diff --git a/jvmfwk/source/elements.hxx b/jvmfwk/source/elements.hxx
index 9a626491d2e6..0141e75ce215 100644
--- a/jvmfwk/source/elements.hxx
+++ b/jvmfwk/source/elements.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elements.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2004-05-05 10:14:01 $
+ * last change: $Author: jl $ $Date: 2004-05-13 11:15:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -165,6 +165,13 @@ public:
Default is true;
*/
bool bNil;
+ /** contains the value of the /java/javaInfo@autoSelect attribute.
+ Default is true. If it is false then the user has modified the JRE
+ selection by actively choosing a JRE from the options dialog. That is,
+ the function jfw_setSelectedJRE was called. Contrary, the function
+ jfw_findAndSelectJRE sets the attribute to true.
+ */
+ bool bAutoSelect;
rtl::OUString sVendor;
rtl::OUString sLocation;
rtl::OUString sVersion;
@@ -276,8 +283,11 @@ public:
*/
rtl::OUString const & getUserClassPath() const;
/** sets m_aInfo. Analog to setEnabled.
+ @param bAutoSelect
+ true- called by jfw_setSelectedJRE
+ false called by jfw_findAndSelectJRE
*/
- void setJavaInfo(const JavaInfo * pInfo);
+ void setJavaInfo(const JavaInfo * pInfo, bool bAutoSelect);
/** returns a JavaInfo structure representing the node
/java/javaInfo
If both, user and share settings are nil, then NULL is returned.
@@ -286,6 +296,14 @@ public:
/** returns the value of the attribute /java/javaInfo[@vendorUpdate].
*/
rtl::OString const & getJavaInfoAttrVendorUpdate() const;
+
+ /** returns the javaInfo@autoSelect attribute.
+ Before calling this function loadFromSettings must be called.
+ It uses the javaInfo@autoSelect attribute to determine
+ the return value;
+ */
+ bool getJavaInfoAttrAutoSelect() const;
+
/** sets the /java/vmParameters/param elements.
The values are kept in a vector m_arVmParameters. When this method is
called then the vector is cleared and the new values are inserted.
@@ -331,6 +349,7 @@ public:
*/
javaFrameworkError writeSettings() const;
+
};
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index f097ee82fca2..7c6e9b51d5fa 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: framework.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: jl $ $Date: 2004-05-12 10:33:33 $
+ * last change: $Author: jl $ $Date: 2004-05-13 11:15:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -299,8 +299,37 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti
return JFW_E_RUNNING_JVM;
if (ppVM == NULL)
return JFW_E_INVALID_ARG;
-
-
+#ifdef WNT
+ //Because on Windows there is no system setting that we can use to determine
+ //if Assistive Technology Tool support is needed, we ship a .reg file that the
+ //user can use to create a registry setting. When the user forgets to set
+ //the key before he starts the office then a JRE may be selected without access bridge.
+ //When he later sets the key then we select a JRE with accessibility support but
+ //only if the user has not manually changed the selected JRE in the options dialog.
+ if (jfw::isAccessibilitySupportDesired())
+ {
+ jfw::CJavaInfo info = NULL;
+ javaFrameworkError err = JFW_E_NONE;
+ if ((err = jfw_getSelectedJRE( & info)) != JFW_E_NONE)
+ return err;
+ // If no JRE has been selected then we do no select one. This function shall then
+ //return JFW_E_NO_SELECT
+ if (info != NULL &&
+ (info->nFeatures & JFW_FEATURE_ACCESSBRIDGE) == 0)
+ {
+ //has the user manually selected a JRE?
+ jfw::CNodeJava settings;
+ if ((errcode = settings.loadFromSettings()) != JFW_E_NONE)
+ return errcode;
+ if (settings.getJavaInfoAttrAutoSelect() == true)
+ {
+ //The currently selected JRE has no access bridge
+ if ((err = jfw_findAndSelectJRE(NULL)) != JFW_E_NONE)
+ return err;
+ }
+ }
+ }
+#endif
jfw::CNodeJava javaSettings;
if ((errcode = javaSettings.loadFromSettings()) != JFW_E_NONE)
return errcode;
@@ -631,7 +660,7 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
if ((JavaInfo*) aCurrentInfo)
{
jfw::CNodeJava javaNode;
- javaNode.setJavaInfo(aCurrentInfo);
+ javaNode.setJavaInfo(aCurrentInfo,true);
errcode = javaNode.writeSettings();
if (errcode == JFW_E_NONE && pInfo !=NULL)
@@ -823,7 +852,7 @@ javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo)
if (jfw_areEqualJavaInfo(currentInfo, pInfo) == sal_False)
{
jfw::CNodeJava node;
- node.setJavaInfo(pInfo);
+ node.setJavaInfo(pInfo, false);
errcode = node.writeSettings();
if (errcode != JFW_E_NONE)
return errcode;
diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx
index 397205711f8e..c90f4ebd6193 100644
--- a/jvmfwk/source/fwkutil.cxx
+++ b/jvmfwk/source/fwkutil.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fwkutil.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: jl $ $Date: 2004-05-12 13:42:15 $
+ * last change: $Author: jl $ $Date: 2004-05-13 11:15:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,9 @@
*
************************************************************************/
+#ifdef WNT
+#include <windows.h>
+#endif
#include "libxmlutil.hxx"
#include "osl/mutex.hxx"
@@ -82,7 +85,6 @@
#define JAVASETTINGS "javasettings"
#define VENDORSETTINGS "javavendors.xml"
-#define USE_ACCESSIBILITY_FILE "useatjava.txt"
/** The vector contains on return file urls to the plugins.
*/
namespace jfw
@@ -439,23 +441,45 @@ bool isAccessibilitySupportDesired()
{
bool retVal = false;
#ifdef WNT
- rtl::OUString usInstallDir;
- rtl::Bootstrap::get(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseInstallation")),
- usInstallDir,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("${$SYSBINDIR/"
- SAL_CONFIGFILE("bootstrap") ":BaseInstallation}")));
-
- rtl::OUString urlrcPath= usInstallDir +
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "/share/config/" USE_ACCESSIBILITY_FILE));
-
- osl::DirectoryItem testFileItem;
- if (osl::DirectoryItem::get(urlrcPath, testFileItem)
- == osl::FileBase::E_None)
+ HKEY hKey = 0;
+ if (RegOpenKeyEx(HKEY_CURRENT_USER,
+ "Software\\OpenOffice.org\\Accessibility\\AtToolSupport",
+ 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
- retVal = true;
+ DWORD dwType = 0;
+ DWORD dwLen = 16;
+ unsigned char arData[16];
+ if( RegQueryValueEx(hKey, "SupportAssistiveTechnology", NULL, &dwType, arData,
+ & dwLen)== ERROR_SUCCESS)
+ {
+ if (dwType == REG_SZ)
+ {
+ if (strcmp((char*) arData, "true") == 0
+ || strcmp((char*) arData, "1") == 0)
+ retVal = true;
+ else if (strcmp((char*) arData, "false") == 0
+ || strcmp((char*) arData, "0") == 0)
+ retVal = false;
+#if OSL_DEBUG_LEVER > 1
+ else
+ OSL_ASSERT(0);
+#endif
+ }
+ else if (dwType == REG_DWORD)
+ {
+ if (arData[0] == 1)
+ retVal = true;
+ else if (arData[0] == 0)
+ retVal = false;
+#if OSL_DEBUG_LEVER > 1
+ else
+ OSL_ASSERT(0);
+#endif
+ }
+ }
}
+ RegCloseKey(hKey);
+
#elif UNX
char buf[16];
// use 2 shells to suppress the eventual "gcontool-2 not found" message
diff --git a/jvmfwk/source/makefile.mk b/jvmfwk/source/makefile.mk
index 7256c5307b01..06b0a3f8116c 100644
--- a/jvmfwk/source/makefile.mk
+++ b/jvmfwk/source/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.5 $
+# $Revision: 1.6 $
#
-# last change: $Author: jl $ $Date: 2004-04-28 10:13:23 $
+# last change: $Author: jl $ $Date: 2004-05-13 11:15:02 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -100,6 +100,10 @@ SHL1IMPLIB = i$(FRAMEWORKLIB)
SHL1LIBS = $(SLB)$/$(TARGET).lib
SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(SALHELPERLIB) $(XML2LIB)
+.IF "$(OS)" == "WNT"
+SHL1STDLIBS += advapi32.lib
+.ENDIF # WNT
+
SHL1VERSIONMAP = framework.map
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
DEF1NAME = $(SHL1TARGET)