Kaydet (Commit) b44ed4c4 authored tarafından Michael Stahl's avatar Michael Stahl

vcl: check if AT is running before loading the library

... which should result in faster startup if it's disabled.

Change-Id: I39774b0a56f186d08270c2f17b2b20a823f21dc2
üst fabca737
......@@ -297,6 +297,9 @@ com::sun::star::uno::Any AccessBridgeCurrentContext::getValueByName( const OUStr
return ret;
}
#ifdef _WIN32
bool HasAtHook();
#endif
bool ImplInitAccessBridge(bool bAllowCancel, bool &rCancelled)
{
......@@ -324,25 +327,35 @@ bool ImplInitAccessBridge(bool bAllowCancel, bool &rCancelled)
{
css::uno::Reference< XComponentContext > xContext(comphelper::getProcessComponentContext());
#ifdef _WIN32
bool bTryIAcc2 = ( officecfg::Office::Common::Misc::ExperimentalMode::get( xContext ) &&
!getenv ("SAL_DISABLE_IACCESSIBLE2") );
if ( bTryIAcc2 ) // Windows only really
{
try {
pSVData->mxAccessBridge
= css::accessibility::MSAAService::create(xContext);
SAL_INFO("vcl", "got IAccessible2 bridge");
return true;
} catch (css::uno::DeploymentException & e) {
SAL_INFO(
"vcl",
"got no IAccessible2 bridge, \"" << e.Message
<< "\", falling back to java");
if (!HasAtHook() && !getenv("SAL_FORCE_IACCESSIBLE2"))
{
SAL_INFO("vcl", "Apparently no running AT -> "
"not enabling IAccessible2 integration");
}
else
{
try {
pSVData->mxAccessBridge
= css::accessibility::MSAAService::create(xContext);
SAL_INFO("vcl", "got IAccessible2 bridge");
return true;
} catch (css::uno::DeploymentException & e) {
SAL_INFO(
"vcl",
"got no IAccessible2 bridge, \"" << e.Message
<< "\", falling back to java");
}
}
}
else
SAL_INFO( "vcl", "IAccessible2 disabled, falling back to java" );
#endif
css::uno::Reference< XExtendedToolkit > xToolkit =
css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
......
......@@ -6257,4 +6257,14 @@ sal_Bool ImplWriteLastError( DWORD lastError, const char *szApiCall )
// -----------------------------------------------------------------------
#ifdef _WIN32
bool HasAtHook()
{
BOOL bIsRunning = FALSE;
// pvParam must be BOOL
return SystemParametersInfo(SPI_GETSCREENREADER, 0, &bIsRunning, 0)
&& bIsRunning;
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -237,21 +237,6 @@ static void AccessBridgeUpdateOldTopWindows( const Reference< XMSAAService > &xA
}
}
static bool HasAtHook()
{
sal_Int32 bIsRuning=0;
// BOOL WINAPI SystemParametersInfo(
// __in UINT uiAction,
// __in UINT uiParam,
// __inout PVOID pvParam,
// __in UINT fWinIni
// );
// pvParam must be BOOL (defined in MFC as int)
// End
return SystemParametersInfo( SPI_GETSCREENREADER, 0,
&bIsRuning, 0) && bIsRuning;
}
/**
* Static method that can create an entity of our MSAA Service
* @param xContext No use here.
......@@ -259,17 +244,6 @@ static bool HasAtHook()
*/
Reference< XInterface > SAL_CALL create_MSAAServiceImpl( Reference< XComponentContext > const & /*xContext*/ ) SAL_THROW( () )
{
bool bRunWithoutAt = getenv("SAL_FORCE_IACCESSIBLE2");
if ( !HasAtHook() )
{
if ( !bRunWithoutAt )
{
SAL_INFO("iacc2", "Apparently no running AT -> not enabling IAccessible2 integration");
return Reference< XMSAAService >();
}
}
Reference< XMSAAService > xAccMgr( new MSAAServiceImpl() );
AccessBridgeUpdateOldTopWindows( xAccMgr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment