vcl/source/app/svdata.cxx | 33 +++++++---- vcl/win/source/window/salframe.cxx | 20 +++++- winaccessibility/inc/AccObjectManagerAgent.hxx | 9 ++- winaccessibility/inc/AccObjectWinManager.hxx | 2 winaccessibility/inc/AccTopWindowListener.hxx | 2 winaccessibility/inc/g_msacc.hxx | 27 --------- winaccessibility/source/UAccCOM/MAccessible.cxx | 33 +++++------ winaccessibility/source/UAccCOM/UAccCOM.cxx | 4 - winaccessibility/source/service/AccObjectManagerAgent.cxx | 22 ++++--- winaccessibility/source/service/AccObjectWinManager.cxx | 33 ----------- winaccessibility/source/service/AccTopWindowListener.cxx | 6 ++ winaccessibility/source/service/msaaservice_impl.cxx | 41 +------------- 12 files changed, 89 insertions(+), 143 deletions(-)
New commits: commit b44ed4c408d92f7a1a3f2390c056d518c137ddd0 Author: Michael Stahl <mst...@redhat.com> Date: Fri Nov 29 23:03:37 2013 +0100 vcl: check if AT is running before loading the library ... which should result in faster startup if it's disabled. Change-Id: I39774b0a56f186d08270c2f17b2b20a823f21dc2 diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 97116d4..aa58484 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -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); diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 913d539..f7c3086 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -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: */ diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx index 219eaee..961a012 100644 --- a/winaccessibility/source/service/msaaservice_impl.cxx +++ b/winaccessibility/source/service/msaaservice_impl.cxx @@ -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 ); commit fabca7370e22f96ae041dc179475b35c87ac53ec Author: Michael Stahl <mst...@redhat.com> Date: Fri Nov 29 22:39:33 2013 +0100 winaccessibility: remove global g_acc_manager It is possible to retrieve it via the AccTopWindowListener. Change-Id: I6cc5ab25bc937d0d9f4de54a1bed09a76ce27491 diff --git a/winaccessibility/inc/AccObjectManagerAgent.hxx b/winaccessibility/inc/AccObjectManagerAgent.hxx index fd61c40..5aa9f81 100644 --- a/winaccessibility/inc/AccObjectManagerAgent.hxx +++ b/winaccessibility/inc/AccObjectManagerAgent.hxx @@ -20,9 +20,9 @@ #ifndef __ACCOBJECTMANAGERAGENT_HXX #define __ACCOBJECTMANAGERAGENT_HXX -#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_ +#include <boost/scoped_ptr.hpp> + #include <com/sun/star/accessibility/XAccessible.hpp> -#endif struct IMAccessible; struct IAccessible; @@ -37,7 +37,7 @@ class AccObjectManagerAgent { private: - AccObjectWinManager* pWinManager; + boost::scoped_ptr<AccObjectWinManager> pWinManager; public: @@ -96,6 +96,9 @@ public: bool IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc ); bool IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pXAcc); + + sal_Int64 Get_ToATInterface(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam); + }; #endif diff --git a/winaccessibility/inc/AccObjectWinManager.hxx b/winaccessibility/inc/AccObjectWinManager.hxx index f58a858..84bfca6 100644 --- a/winaccessibility/inc/AccObjectWinManager.hxx +++ b/winaccessibility/inc/AccObjectWinManager.hxx @@ -97,8 +97,6 @@ public: void DeleteAccObj( com::sun::star::accessibility::XAccessible* pXAcc ); void DeleteChildrenAccObj(com::sun::star::accessibility::XAccessible* pAccObj); - static AccObjectWinManager* CreateAccObjectWinManagerInstance(AccObjectManagerAgent* Agent); - sal_Bool NotifyAccEvent( com::sun::star::accessibility::XAccessible* pXAcc,short state = 0 ); LPARAM Get_ToATInterface(HWND hWnd, long lParam, WPARAM wParam); diff --git a/winaccessibility/inc/AccTopWindowListener.hxx b/winaccessibility/inc/AccTopWindowListener.hxx index 9babd67..2782320 100644 --- a/winaccessibility/inc/AccTopWindowListener.hxx +++ b/winaccessibility/inc/AccTopWindowListener.hxx @@ -59,6 +59,8 @@ public: virtual void AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWND ); //for On-Demand load. virtual void HandleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible ); + + sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam); }; #endif diff --git a/winaccessibility/inc/g_msacc.hxx b/winaccessibility/inc/g_msacc.hxx deleted file mode 100644 index b9670cf..0000000 --- a/winaccessibility/inc/g_msacc.hxx +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef __G_MSACC_HXX -#define __G_MSACC_HXX - -extern sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/source/service/AccObjectManagerAgent.cxx b/winaccessibility/source/service/AccObjectManagerAgent.cxx index 1c76360..d4f4dab 100644 --- a/winaccessibility/source/service/AccObjectManagerAgent.cxx +++ b/winaccessibility/source/service/AccObjectManagerAgent.cxx @@ -30,19 +30,13 @@ using namespace com::sun::star::accessibility; * @param * @return */ -AccObjectManagerAgent::AccObjectManagerAgent(): - pWinManager(NULL) +AccObjectManagerAgent::AccObjectManagerAgent() + : pWinManager(new AccObjectWinManager(this)) { - if( pWinManager == NULL ) - { - pWinManager = AccObjectWinManager::CreateAccObjectWinManagerInstance(this); - } } AccObjectManagerAgent::~AccObjectManagerAgent() { - delete pWinManager; - pWinManager = NULL; } /** @@ -388,4 +382,16 @@ bool AccObjectManagerAgent::IsStateManageDescendant(XAccessible* pXAcc) return false; } +/** + * Implementation of interface XMSAAService's method getAccObjectPtr() + * that returns the corresponding COM interface with the MS event. + * @return Com interface. + */ +sal_Int64 AccObjectManagerAgent::Get_ToATInterface( + sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam) +{ + return static_cast<sal_Int64>(pWinManager->Get_ToATInterface( + static_cast<HWND>(reinterpret_cast<void*>(hWnd)), lParam, wParam)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx b/winaccessibility/source/service/AccObjectWinManager.cxx index cd51b7e..779f201 100644 --- a/winaccessibility/source/service/AccObjectWinManager.cxx +++ b/winaccessibility/source/service/AccObjectWinManager.cxx @@ -53,23 +53,6 @@ using namespace com::sun::star::accessibility::AccessibleRole; using namespace com::sun::star::accessibility::AccessibleStateType; using namespace com::sun::star::uno; -AccObjectWinManager* g_acc_manager = NULL; - -/** - * Implementation of interface XMSAAService's method getAccObjectPtr() that return the - * corresponding com interface with the MS event. - * - * @param - * @return Com interface. - */ -sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam) -{ - if (!g_acc_manager) - return 0; - return static_cast<sal_Int64>(g_acc_manager->Get_ToATInterface( - static_cast<HWND>(reinterpret_cast<void*>(hWnd)), lParam, wParam)); -} - /** * constructor * @param Agent The agent kept in all listeners,it's the sole interface by which @@ -89,22 +72,6 @@ AccObjectWinManager::AccObjectWinManager( AccObjectManagerAgent* Agent ): } /** - * Public method to produce manager - * @param Agent The agent kept in all listeners,it's the sole interface by which - * listener communicate with windows manager. - * @return - */ -AccObjectWinManager* AccObjectWinManager::CreateAccObjectWinManagerInstance( AccObjectManagerAgent* Agent ) -{ - if (!g_acc_manager) - { - g_acc_manager = new AccObjectWinManager( Agent ); - } - return g_acc_manager; -} - - -/** * Destructor,clear all resource. * @param * @return diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx index ca8a1c0..db87f23 100644 --- a/winaccessibility/source/service/AccTopWindowListener.cxx +++ b/winaccessibility/source/service/AccTopWindowListener.cxx @@ -255,4 +255,10 @@ void AccTopWindowListener::disposing( const ::com::sun::star::lang::EventObject& { } +sal_Int64 AccTopWindowListener::GetMSComPtr( + sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam) +{ + return accManagerAgent.Get_ToATInterface(hWnd, lParam, wParam); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx index 950ef9b..219eaee 100644 --- a/winaccessibility/source/service/msaaservice_impl.cxx +++ b/winaccessibility/source/service/msaaservice_impl.cxx @@ -42,7 +42,6 @@ using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::awt; #include "AccTopWindowListener.hxx" -#include "g_msacc.hxx" namespace my_sc_impl { @@ -96,7 +95,11 @@ throw (RuntimeException) { SolarMutexGuard g; - return GetMSComPtr( hWnd, lParam, wParam ); + if (!m_pTopWindowListener.is()) + { + return 0; + } + return m_pTopWindowListener->GetMSComPtr(hWnd, lParam, wParam); } /** commit b54d441ad728ffce8e543de10bd897f0900422b5 Author: Michael Stahl <mst...@redhat.com> Date: Fri Nov 29 21:43:42 2013 +0100 Revert "winaccessibility: let CoCreateInstance calls find the components" This only works partially: the ClassObjects are only registered on the main thread; CoCreateInstance on other threads still fails. This reverts commit 29c6216af8c502f220bb84857d3dda901ddfd234. diff --git a/winaccessibility/source/UAccCOM/UAccCOM.cxx b/winaccessibility/source/UAccCOM/UAccCOM.cxx index 6a8a86b..4cf9f10 100644 --- a/winaccessibility/source/UAccCOM/UAccCOM.cxx +++ b/winaccessibility/source/UAccCOM/UAccCOM.cxx @@ -67,14 +67,10 @@ extern "C" if (dwReason == DLL_PROCESS_ATTACH) { _Module.Init(ObjectMap, hInstance, &LIBID_UACCCOMLib); - _Module.RegisterClassObjects(CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE); DisableThreadLibraryCalls(hInstance); } else if (dwReason == DLL_PROCESS_DETACH) - { - _Module.RevokeClassObjects(); _Module.Term(); - } return TRUE; // ok } diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx index 6dc1b25..950ef9b 100644 --- a/winaccessibility/source/service/msaaservice_impl.cxx +++ b/winaccessibility/source/service/msaaservice_impl.cxx @@ -267,14 +267,6 @@ Reference< XInterface > SAL_CALL create_MSAAServiceImpl( Reference< XComponentCo } } - // load UAccCOM library so its DllMain can register its COM components - static HMODULE h = LoadLibrary("UAccCOM.dll"); - if (!h) - { - assert(false); - return 0; - } - Reference< XMSAAService > xAccMgr( new MSAAServiceImpl() ); AccessBridgeUpdateOldTopWindows( xAccMgr ); commit d0e8e6e3cd51736583603e37f0ba2ff7bdf29f5c Author: Michael Stahl <mst...@redhat.com> Date: Fri Nov 29 19:17:33 2013 +0100 winaccessibility: fix my stupid mistake in createAggInstance Change-Id: I7701021befcf1dbad85557c2095fe4bf0b4e0ff1 diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index 6e5f018..73897c4 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -2560,14 +2560,15 @@ BOOL CMAccessible::GetXInterfaceFromXAccessible(XAccessible* pXAcc, XInterface** } template<typename T> HRESULT -createAggInstance(CMAccessible &rOuter, REFIID iid, void ** ppvObject) +createAggInstance(CMAccessible &rOuter, void ** ppvObject) { -// return CComCreator< CComAggObject<T> >::CreateInstance( -// XXX: do not use CComAggObject - the aggregation is hand-crafted! -// the SmartQI method must not call itself recursively - -// which it will do if CComAggObject redirects QueryInterface. - return CComCreator< CComObject<T> >::CreateInstance( - rOuter.GetControllingUnknown(), iid, ppvObject); + // Note: CComAggObject has special handling for IUnknown - must + // query for that when creating it! Otherwise we get a T member of it + // which will redirect QueryInterface back to CMAccessible infinitely. + // (CComAggObject has its own ref-count too which is not a problem + // since it is inserted in m_containedObjects.) + return CComCreator< CComAggObject<T> >::CreateInstance( + rOuter.GetControllingUnknown(), IID_IUnknown, ppvObject); } HRESULT WINAPI CMAccessible::SmartQI(void* /*pv*/, REFIID iid, void** ppvObject) @@ -2606,31 +2607,31 @@ HRESULT WINAPI CMAccessible::SmartQI(void* /*pv*/, REFIID iid, void** ppvObject) switch (pMap->XIFIndex) { case XI_COMPONENT: - hr = createAggInstance<CAccComponent>(*this, iid, ppvObject); + hr = createAggInstance<CAccComponent>(*this, ppvObject); break; case XI_TEXT: - hr = createAggInstance<CAccText>(*this, iid, ppvObject); + hr = createAggInstance<CAccText>(*this, ppvObject); break; case XI_EDITABLETEXT: - hr = createAggInstance<CAccEditableText>(*this, iid, ppvObject); + hr = createAggInstance<CAccEditableText>(*this, ppvObject); break; case XI_IMAGE: - hr = createAggInstance<CAccImage>(*this, iid, ppvObject); + hr = createAggInstance<CAccImage>(*this, ppvObject); break; case XI_TABLE: - hr = createAggInstance<CAccTable>(*this, iid, ppvObject); + hr = createAggInstance<CAccTable>(*this, ppvObject); break; case XI_ACTION: - hr = createAggInstance<CAccAction>(*this, iid, ppvObject); + hr = createAggInstance<CAccAction>(*this, ppvObject); break; case XI_VALUE: - hr = createAggInstance<CAccValue>(*this, iid, ppvObject); + hr = createAggInstance<CAccValue>(*this, ppvObject); break; case XI_HYPERTEXT: - hr = createAggInstance<CAccHypertext>(*this, iid, ppvObject); + hr = createAggInstance<CAccHypertext>(*this, ppvObject); break; case XI_HYPERLINK: - hr = createAggInstance<CAccHyperLink>(*this, iid, ppvObject); + hr = createAggInstance<CAccHyperLink>(*this, ppvObject); break; default: assert(false); commit db214684057e3ff2fa32d57c00507309dd6c24d6 Author: Michael Stahl <mst...@redhat.com> Date: Thu Nov 28 20:12:12 2013 +0100 vcl: fix crashes when retrieving objects for MSAA The ImplHandleGetObject() function modifies the Application Settings and must take the SolarMutex for this; otherwise we get crashes when another thread calls StyleSettings::GetPersonaHeader() during some unoapi test. Also fix another HWND to long cast; use LRESULT which is Win32 for intptr_t. Change-Id: I5580f88ed0a8e9955697655ace94584e2307982d diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 8ee2cae..913d539 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -5484,7 +5484,8 @@ static void ImplHandleIMENotify( HWND hWnd, WPARAM wParam ) // ----------------------------------------------------------------------- -static bool ImplHandleGetObject( HWND hWnd, LPARAM lParam, WPARAM wParam, long &nRet ) +static bool +ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet) { // IA2 should be enabled automatically AllSettings aSettings = Application::GetSettings(); @@ -5514,7 +5515,8 @@ static bool ImplHandleGetObject( HWND hWnd, LPARAM lParam, WPARAM wParam, long & // mhOnSetTitleWnd not set to reasonable value anywhere... if ( lParam == OBJID_CLIENT ) { - nRet = xMSAA->getAccObjectPtr( (long)hWnd, lParam, wParam ); + nRet = xMSAA->getAccObjectPtr( + reinterpret_cast<sal_Int64>(hWnd), lParam, wParam); if( nRet != 0 ) return true; } @@ -6053,12 +6055,12 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP break; case WM_GETOBJECT: - long nRet; + ImplSalYieldMutexAcquireWithWait(); if ( ImplHandleGetObject( hWnd, lParam, wParam, nRet ) ) { rDef = false; - return (HRESULT) nRet; } + ImplSalYieldMutexRelease(); break; case WM_APPCOMMAND: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits