jfw::isAccessibilitySupportDesired is obsolete

There's no platform left that would require java accessibility.

Change-Id: I2149f619e20aae70d7713d223985f8016ade8e77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93600
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
diff --git a/jvmfwk/inc/fwkutil.hxx b/jvmfwk/inc/fwkutil.hxx
index f2f6fcb..60ffa9f 100644
--- a/jvmfwk/inc/fwkutil.hxx
+++ b/jvmfwk/inc/fwkutil.hxx
@@ -89,8 +89,6 @@ enum FileStatus
 */
FileStatus checkFileURL(const OUString & path);

bool isAccessibilitySupportDesired();

}
#endif

diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 67b65ac..d008b5d 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -153,32 +153,6 @@ javaFrameworkError jfw_startVM(
                if (!aInfo)
                    return JFW_E_NO_SELECT;

#ifdef _WIN32
                //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())
                {
                    // If no JRE has been selected then we do not select one. This function shall then
                    //return JFW_E_NO_SELECT
                    if (aInfo &&
                        (aInfo->nFeatures & JFW_FEATURE_ACCESSBRIDGE) == 0)
                    {
                        //has the user manually selected a JRE?
                        if (settings.getJavaInfoAttrAutoSelect())
                        {
                            // if not then the automatism has previously selected a JRE
                            //without accessibility support. We return JFW_E_NO_SELECT
                            //to cause that we search for another JRE. The search code will
                            //then prefer a JRE with accessibility support.
                            return JFW_E_NO_SELECT;
                        }
                    }
                }
#endif
                //check if the javavendors.xml has changed after a Java was selected
                OString sVendorUpdate = jfw::getElementUpdated();

@@ -304,12 +278,7 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
        osl::MutexGuard guard(jfw::FwkMutex::get());
        if (jfw::getMode() == jfw::JFW_MODE_DIRECT)
            return JFW_E_DIRECT_MODE;
        sal_uInt64 nFeatureFlags = 0;
        std::unique_ptr<JavaInfo> aCurrentInfo;
        //Determine if accessibility support is needed
        bool bSupportAccessibility = jfw::isAccessibilitySupportDesired();
        nFeatureFlags = bSupportAccessibility ?
            JFW_FEATURE_ACCESSBRIDGE : 0;


        // 'bInfoFound' indicates whether a Java installation has been found
@@ -327,13 +296,7 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
                aVendorSettings, &aCurrentInfo, infos)
            == javaPluginError::NONE)
        {
            // compare features
            // if the user does not require any features (nFeatureFlags = 0)
            // or the Java installation provides all features, then this installation is used
            if ((aCurrentInfo->nFeatures & nFeatureFlags) == nFeatureFlags)
            {
                bInfoFound = true;
            }
            bInfoFound = true;
        }

        // if no Java installation providing all features was detected by using JAVA_HOME,
@@ -345,24 +308,9 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
                    aVendorSettings, vecJavaInfosFromPath, infos)
                == javaPluginError::NONE)
            {
                for (auto & pJInfo: vecJavaInfosFromPath)
                {
                    // if the current Java installation implements all required features: use it
                    if ((pJInfo->nFeatures & nFeatureFlags) == nFeatureFlags)
                    {
                        aCurrentInfo = std::move(pJInfo);
                        bInfoFound = true;
                        break;
                    }
                    else if (!aCurrentInfo)
                    {
                        // current Java installation does not provide all features
                        // but no Java installation has been detected before
                        // -> remember the current one until one is found
                        // that provides all features
                        aCurrentInfo = std::move(pJInfo);
                    }
                }
                assert(!vecJavaInfosFromPath.empty());
                aCurrentInfo = std::move(vecJavaInfosFromPath[0]);
                bInfoFound = true;
            }
        }

@@ -382,27 +330,8 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)

            if (plerr == javaPluginError::NONE)
            {
                //iterate over all installations to find the best which has
                //all features
                for (auto & pJInfo: arInfos)
                {
                    // compare features
                    // If the user does not require any features (nFeatureFlags = 0)
                    // then the first installation is used
                    if ((pJInfo->nFeatures & nFeatureFlags) == nFeatureFlags)
                    {
                        //the just found Java implements all required features
                        //currently there is only accessibility!!!
                        aCurrentInfo = std::move(pJInfo);
                        break;
                    }
                    else if (!aCurrentInfo)
                    {
                        // We remember the first installation in aCurrentInfo if
                        // no JavaInfo has been found before:
                        aCurrentInfo = std::move(pJInfo);
                    }
                }
                assert(!arInfos.empty());
                aCurrentInfo = std::move(arInfos[0]);
            }

            if (!aCurrentInfo)
@@ -430,22 +359,10 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)

                    if (aInfo)
                    {
                        // compare features
                        // If the user does not require any features (nFeatureFlags = 0)
                        // then the first installation is used
                        if ((aInfo->nFeatures & nFeatureFlags) == nFeatureFlags)
                        {
                            //the just found Java implements all required features
                            //currently there is only accessibility!!!
                            aCurrentInfo = std::move(aInfo);
                            break;
                        }
                        else if (!aCurrentInfo)
                        {
                            // We remember the very first installation in
                            // aCurrentInfo:
                            aCurrentInfo = std::move(aInfo);
                        }
                        //the just found Java implements all required features
                        //currently there is only accessibility!!!
                        aCurrentInfo = std::move(aInfo);
                        break;
                    }
                }//end iterate over paths
            }
diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx
index fad1268..a3be17e 100644
--- a/jvmfwk/source/fwkutil.cxx
+++ b/jvmfwk/source/fwkutil.cxx
@@ -41,54 +41,6 @@ using namespace osl;
namespace jfw
{

bool isAccessibilitySupportDesired()
{
#ifdef _WIN32
    bool retVal = false;
    HKEY    hKey = nullptr;
    if (RegOpenKeyExA(HKEY_CURRENT_USER,
                      "Software\\LibreOffice\\Accessibility\\AtToolSupport",
                      0, KEY_READ, &hKey) == ERROR_SUCCESS)
    {
        DWORD   dwType = 0;
        DWORD   dwLen = 16;
        unsigned char arData[16];
        if( RegQueryValueExA(hKey, "SupportAssistiveTechnology", nullptr, &dwType, arData,
                             &dwLen)== ERROR_SUCCESS)
        {
            if (dwType == REG_SZ)
            {
                arData[std::min(dwLen, DWORD(15))] = 0;
                if (strcmp(reinterpret_cast<char*>(arData), "true") == 0
                    || strcmp(reinterpret_cast<char*>(arData), "1") == 0)
                    retVal = true;
                else if (strcmp(reinterpret_cast<char*>(arData), "false") == 0
                         || strcmp(reinterpret_cast<char*>(arData), "0") == 0)
                    retVal = false;
                else
                    SAL_WARN("jfw", "bad registry value " << arData);
            }
            else if (dwType == REG_DWORD)
            {
                if (arData[0] == 1)
                    retVal = true;
                else if (arData[0] == 0)
                    retVal = false;
                else
                    SAL_WARN(
                        "jfw", "bad registry value " << unsigned(arData[0]));
            }
        }
        RegCloseKey(hKey);
    }
#elif defined UNX
    // Java is no longer required for a11y - we use atk directly.
    bool retVal = false;
#endif

    return retVal;
}

rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData)
{
    static const char EncodingTable[] =