[Libreoffice-commits] core.git: Branch 'feature/ia2.4' - 2 commits - vcl/source winaccessibility/Library_winaccessibility.mk winaccessibility/source
Michael Meeks
michael.meeks at collabora.com
Mon Nov 18 07:43:05 PST 2013
vcl/source/app/svdata.cxx | 7 +
winaccessibility/Library_winaccessibility.mk | 2
winaccessibility/source/service/msaaservice_impl.cxx | 109 ++++++++++++++++---
3 files changed, 100 insertions(+), 18 deletions(-)
New commits:
commit 016188ad3cf23346e3f5299610942acf6aec4e4a
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Nov 18 15:41:26 2013 +0000
uia: move accessibility init into component to avoid platform conditionals
Code from Steve Yin <steve_y at apache.org>, "Integrate branch of IAccessible2"
Change-Id: Ib19e38ddca71182018df438df27dcdb555d91402
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index b42eeea..072aa9e 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -321,6 +321,13 @@ bool ImplInitAccessBridge(bool bAllowCancel, bool &rCancelled)
{
css::uno::Reference< XComponentContext > xContext(comphelper::getProcessComponentContext());
+ // Windows only but safe here
+ if ( !getenv ("SAL_DISABLE_IACCESSIBLE2") )
+ {
+ pSVData->mxAccessBridge = css::accessibility::MSAAService::create( xContext );
+ return pSVData->mxAccessBridge.is();
+ }
+
css::uno::Reference< XExtendedToolkit > xToolkit =
css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx
index ce720c3..3378437 100755
--- a/winaccessibility/source/service/msaaservice_impl.cxx
+++ b/winaccessibility/source/service/msaaservice_impl.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/awt/XExtendedToolkit.hpp>
#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
using namespace ::rtl; // for OUString
using namespace ::com::sun::star; // for odk interfaces
@@ -49,16 +50,11 @@ extern void handleWindowOpened_impl( long pAcc);
namespace my_sc_impl
{
- //extern Sequence< OUString > SAL_CALL getSupportedServiceNames_MSAAServiceImpl();
- //static OUString SAL_CALL getImplementationName_MSAAServiceImpl();
- //static Reference< XInterface > SAL_CALL create_MSAAServiceImpl(
- // Reference< XComponentContext > const & xContext )
- // SAL_THROW( () );
/**
- * Method that returns the service name.
- * @param
- * @return Name sequence.
- */
+ * Method that returns the service name.
+ * @param
+ * @return Name sequence.
+ */
static Sequence< OUString > getSupportedServiceNames_MSAAServiceImpl()
{
static Sequence < OUString > *pNames = 0;
@@ -197,6 +193,89 @@ Sequence< OUString > MSAAServiceImpl::getSupportedServiceNames() throw (RuntimeE
return getSupportedServiceNames_MSAAServiceImpl();
}
+void AccessBridgehandleExistingWindow(const Reference<MSAAServiceImpl> &xAccMgr,
+ Window * pWindow, bool bShow)
+{
+ if ( pWindow )
+ {
+ css::uno::Reference< css::accessibility::XAccessible > xAccessible;
+
+ // Test for combo box - drop down floating windows first
+ Window * pParentWindow = pWindow->GetParent();
+
+ if ( pParentWindow )
+ {
+ try
+ {
+ // The parent window of a combo box floating window should have the role COMBO_BOX
+ css::uno::Reference< css::accessibility::XAccessible > xParentAccessible(pParentWindow->GetAccessible());
+ if ( xParentAccessible.is() )
+ {
+ css::uno::Reference< css::accessibility::XAccessibleContext > xParentAC( xParentAccessible->getAccessibleContext() );
+ if ( xParentAC.is() && (css::accessibility::AccessibleRole::COMBO_BOX == xParentAC->getAccessibleRole()) )
+ {
+ // O.k. - this is a combo box floating window corresponding to the child of role LIST of the parent.
+ // Let's not rely on a specific child order, just search for the child with the role LIST
+ sal_Int32 nCount = xParentAC->getAccessibleChildCount();
+ for ( sal_Int32 n = 0; (n < nCount) && !xAccessible.is(); n++)
+ {
+ css::uno::Reference< css::accessibility::XAccessible > xChild = xParentAC->getAccessibleChild(n);
+ if ( xChild.is() )
+ {
+ css::uno::Reference< css::accessibility::XAccessibleContext > xChildAC = xChild->getAccessibleContext();
+ if ( xChildAC.is() && (css::accessibility::AccessibleRole::LIST == xChildAC->getAccessibleRole()) )
+ {
+ xAccessible = xChild;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (::com::sun::star::uno::RuntimeException e)
+ {
+ // Ignore show events that throw DisposedExceptions in getAccessibleContext(),
+ // but keep revoking these windows in hide(s).
+ if (bShow)
+ return;
+ }
+ }
+
+ // We have to rely on the fact that Window::GetAccessible()->getAccessibleContext() returns a valid XAccessibleContext
+ // also for other menus than menubar or toplevel popup window. Otherwise we had to traverse the hierarchy to find the
+ // context object to this menu floater. This makes the call to Window->IsMenuFloatingWindow() obsolete.
+ if ( ! xAccessible.is() )
+ xAccessible = pWindow->GetAccessible();
+
+ if ( xAccessible.is() && xAccMgr.is() )
+ xAccMgr->handleWindowOpened( (long)xAccessible.get() );
+ }
+}
+
+/*
+ * Setup and notify the OS of Accessible peers for all existing windows.
+ */
+void AccessBridgeupdateOldTopWindows( const Reference<MSAAServiceImpl> &xAccMgr )
+{
+ sal_uInt16 nTopWindowCount = (sal_uInt16)Application::GetTopWindowCount();
+
+ for ( sal_uInt16 i = 0; i < nTopWindowCount; i++ )
+ {
+ Window* pTopWindow = Application::GetTopWindow( i );
+ css::uno::Reference< css::accessibility::XAccessible > xAccessible = pTopWindow->GetAccessible();
+ if ( xAccessible.is() )
+ {
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAC( xAccessible->getAccessibleContext() );
+ if ( xAC.is())
+ {
+ short role = xAC->getAccessibleRole();
+ if ( xAC->getAccessibleName().getLength() > 0 )
+ AccessBridgehandleExistingWindow( xAccMgr, pTopWindow, true );
+ }
+ }
+ }
+}
+
/**
* Static method that can create an entity of our MSAA Service
* @param xContext No use here.
@@ -204,9 +283,10 @@ Sequence< OUString > MSAAServiceImpl::getSupportedServiceNames() throw (RuntimeE
*/
Reference< XInterface > SAL_CALL create_MSAAServiceImpl( Reference< XComponentContext > const & /*xContext*/ ) SAL_THROW( () )
{
- MSAAServiceImpl* xxx = new MSAAServiceImpl();
- //return static_cast< lang::XTypeProvider * >( xxx );
- Reference< XMSAAService > p( xxx );
+ Reference< XMSAAService > p( new MSAAServiceImpl() );
+
+ AccessBridgeupdateOldTopWindows(p);
+
return p;
}
commit 69e735276e8b3def179c53ad5e95e8b59a4c8ea2
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Nov 18 15:28:19 2013 +0000
uia: remove redundant component registration.
Change-Id: I913e6498d09021cca78be27b542421251f258535
diff --git a/winaccessibility/Library_winaccessibility.mk b/winaccessibility/Library_winaccessibility.mk
index 0f1558c..55057c3 100755
--- a/winaccessibility/Library_winaccessibility.mk
+++ b/winaccessibility/Library_winaccessibility.mk
@@ -55,7 +55,7 @@ $(eval $(call gb_Library_use_externals,winaccessibility,\
$(eval $(call gb_Library_use_libraries,winaccessibility,\
cppu \
cppuhelper \
- vcl \
+ vcl \
sal \
tk \
uwinapi \
diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx
index 8606069..ce720c3 100755
--- a/winaccessibility/source/service/msaaservice_impl.cxx
+++ b/winaccessibility/source/service/msaaservice_impl.cxx
@@ -261,11 +261,6 @@ static struct ::cppu::ImplementationEntry s_component_entries [] =
getSupportedServiceNames_MSAAServiceImpl, ::cppu::createSingleComponentFactory,
0, 0
},
- {
- create_MSAAServiceImpl, getImplementationName_MSAAServiceImpl,
- getSupportedServiceNames_MSAAServiceImpl, ::cppu::createSingleComponentFactory,
- 0, 0
- },
{ 0, 0, 0, 0, 0, 0 }
};
}
More information about the Libreoffice-commits
mailing list