summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2013-11-18 15:41:26 +0000
committerMichael Meeks <michael.meeks@collabora.com>2013-11-19 10:02:27 +0000
commit448727e598ca0c35ee9cd6f2c25a847c8147943b (patch)
tree7379fabae33030487350fc58286e2aa95f5c9349 /vcl
parentfd035fe61604042609c21aba06eb2d8ffed32dda (diff)
uia: merge VCL pieces of IAccessible2 work.
Original code from: Author: Steve Yin <steve_y@apache.org> Date: Sat Nov 16 23:58:19 2013 +0100 Integrate branch of IAccessible2 With these improvements: Make IAccessible2 an experimental feature, with fallback to Java a11y. Move initial setup of windows into the bridge and clean, remove conditionals Check for presence of AT in the bridge as well to clean. Merge VCL events extensions and their handling. Clean and split WB_GETOBJECT handling out to it's own method. Add component prefix namespacing. Cleanup msaa service info, and implement XComponent to share mxAccessBridge. Add suitable debugging output, remove VCL dependency from UAccCOM causing registration issues. Change-Id: Ib19e38ddca71182018df438df27dcdb555d91402
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/svdata.cxx16
-rw-r--r--vcl/source/window/window.cxx34
-rw-r--r--vcl/win/source/window/salframe.cxx58
3 files changed, 101 insertions, 7 deletions
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index b42eeea45e45..cb24f027108f 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -52,6 +52,8 @@
#include "com/sun/star/java/MissingJavaRuntimeException.hpp"
#include "com/sun/star/java/JavaDisabledException.hpp"
+#include "officecfg/Office/Common.hxx"
+
#include <stdio.h>
using namespace com::sun::star::uno;
@@ -321,6 +323,20 @@ bool ImplInitAccessBridge(bool bAllowCancel, bool &rCancelled)
{
css::uno::Reference< XComponentContext > xContext(comphelper::getProcessComponentContext());
+ bool bTryIAcc2 = ( officecfg::Office::Common::Misc::ExperimentalMode::get( xContext ) &&
+ !getenv ("SAL_DISABLE_IACCESSIBLE2") );
+
+ if ( bTryIAcc2 ) // Windows only really
+ {
+ // FIXME: convert to service ... pSVData->mxAccessBridge = css::accessibility::MSAAService::create( xContext );
+ pSVData->mxAccessBridge = Reference< XComponent >( xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.accessibility.MSAAService", xContext ), UNO_QUERY );
+
+ SAL_INFO( "vcl", "IAccessible2 bridge is: " << (int)(pSVData->mxAccessBridge.is()) );
+ return pSVData->mxAccessBridge.is();
+ }
+ else
+ SAL_INFO( "vcl", "IAccessible2 disabled, falling back to java" );
+
css::uno::Reference< XExtendedToolkit > xToolkit =
css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 64664b167c15..1ef62c1d36cb 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -8818,10 +8818,10 @@ sal_uInt16 Window::getDefaultAccessibleRole() const
case WINDOW_CANCELBUTTON:
case WINDOW_HELPBUTTON:
case WINDOW_IMAGEBUTTON:
- case WINDOW_MENUBUTTON:
case WINDOW_MOREBUTTON:
case WINDOW_SPINBUTTON:
case WINDOW_BUTTON: nRole = accessibility::AccessibleRole::PUSH_BUTTON; break;
+ case WINDOW_MENUBUTTON: nRole = accessibility::AccessibleRole::BUTTON_MENU; break;
case WINDOW_PATHDIALOG: nRole = accessibility::AccessibleRole::DIRECTORY_PANE; break;
case WINDOW_FILEDIALOG: nRole = accessibility::AccessibleRole::FILE_CHOOSER; break;
@@ -8835,10 +8835,6 @@ sal_uInt16 Window::getDefaultAccessibleRole() const
case WINDOW_MULTILINEEDIT: nRole = accessibility::AccessibleRole::SCROLL_PANE; break;
case WINDOW_PATTERNFIELD:
- case WINDOW_NUMERICFIELD:
- case WINDOW_METRICFIELD:
- case WINDOW_CURRENCYFIELD:
- case WINDOW_LONGCURRENCYFIELD:
case WINDOW_CALCINPUTLINE:
case WINDOW_EDIT: nRole = ( GetStyle() & WB_PASSWORD ) ? (accessibility::AccessibleRole::PASSWORD_TEXT) : (accessibility::AccessibleRole::TEXT); break;
@@ -8855,7 +8851,13 @@ sal_uInt16 Window::getDefaultAccessibleRole() const
case WINDOW_TREELISTBOX: nRole = accessibility::AccessibleRole::TREE; break;
case WINDOW_FIXEDTEXT: nRole = accessibility::AccessibleRole::LABEL; break;
- case WINDOW_FIXEDLINE: nRole = accessibility::AccessibleRole::SEPARATOR; break;
+ case WINDOW_FIXEDLINE:
+ if( !GetText().isEmpty() )
+ nRole = accessibility::AccessibleRole::LABEL;
+ else
+ nRole = accessibility::AccessibleRole::SEPARATOR;
+ break;
+
case WINDOW_FIXEDBITMAP:
case WINDOW_FIXEDIMAGE: nRole = accessibility::AccessibleRole::ICON; break;
case WINDOW_GROUPBOX: nRole = accessibility::AccessibleRole::GROUP_BOX; break;
@@ -8870,6 +8872,10 @@ sal_uInt16 Window::getDefaultAccessibleRole() const
case WINDOW_DATEFIELD:
case WINDOW_TIMEFIELD: nRole = accessibility::AccessibleRole::DATE_EDITOR; break;
+ case WINDOW_NUMERICFIELD:
+ case WINDOW_METRICFIELD:
+ case WINDOW_CURRENCYFIELD:
+ case WINDOW_LONGCURRENCYFIELD:
case WINDOW_SPINFIELD: nRole = accessibility::AccessibleRole::SPIN_BOX; break;
case WINDOW_TOOLBOX: nRole = accessibility::AccessibleRole::TOOL_BAR; break;
@@ -8933,8 +8939,12 @@ void Window::SetAccessibleName( const OUString& rName )
if ( !mpWindowImpl->mpAccessibleInfos )
mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
+ OUString oldName = GetAccessibleName();
+
delete mpWindowImpl->mpAccessibleInfos->pAccessibleName;
mpWindowImpl->mpAccessibleInfos->pAccessibleName = new OUString( rName );
+
+ ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldName );
}
OUString Window::GetAccessibleName() const
@@ -8975,6 +8985,8 @@ OUString Window::getDefaultAccessibleName() const
Window *pLabel = GetAccessibleRelationLabeledBy();
if ( pLabel && pLabel != this )
aAccessibleName = pLabel->GetText();
+ if (aAccessibleName.isEmpty())
+ aAccessibleName = GetQuickHelpText();
}
break;
@@ -8989,6 +9001,16 @@ OUString Window::getDefaultAccessibleName() const
}
break;
+ case WINDOW_TOOLBOX:
+ aAccessibleName = GetText();
+ if( aAccessibleName.isEmpty() )
+ aAccessibleName = "Tool Bar";
+ break;
+
+ case WINDOW_MOREBUTTON:
+ aAccessibleName = mpWindowImpl->maText;
+ break;
+
default:
aAccessibleName = GetText();
break;
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 87e5c1a2ec92..8ee2cae0a3c4 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -77,6 +77,12 @@ using ::std::max;
#include <com/sun/star/uno/Exception.hpp>
+#include <oleacc.h>
+#include <com/sun/star/accessibility/XMSAAService.hpp>
+#ifndef WM_GETOBJECT // TESTME does this ever happen ?
+# define WM_GETOBJECT 0x003D
+#endif
+
#include <time.h>
#if defined ( __MINGW32__ )
@@ -5178,7 +5184,7 @@ static sal_Bool ImplHandleIMEStartComposition( HWND hWnd )
// -----------------------------------------------------------------------
static sal_Bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
- HIMC hIMC, LPARAM lParam )
+ HIMC hIMC, LPARAM lParam )
{
sal_Bool bDef = TRUE;
@@ -5478,6 +5484,46 @@ static void ImplHandleIMENotify( HWND hWnd, WPARAM wParam )
// -----------------------------------------------------------------------
+static bool ImplHandleGetObject( HWND hWnd, LPARAM lParam, WPARAM wParam, long &nRet )
+{
+ // IA2 should be enabled automatically
+ AllSettings aSettings = Application::GetSettings();
+ MiscSettings aMisc = aSettings.GetMiscSettings();
+ aMisc.SetEnableATToolSupport( sal_True );
+ aSettings.SetMiscSettings( aMisc );
+ Application::SetSettings( aSettings );
+
+ if (!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
+ return false; // locked down somehow ?
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Make sure to launch Accessibiliity only the following criterias are satisfied
+ // to avoid RFT interrupts regular accessibility processing
+ if ( !pSVData->mxAccessBridge.is() )
+ {
+ bool bCancelled = false;
+ InitAccessBridge( false, bCancelled );
+ if( bCancelled )
+ return false;
+ }
+
+ uno::Reference< accessibility::XMSAAService > xMSAA( pSVData->mxAccessBridge, uno::UNO_QUERY );
+ if ( xMSAA.is() )
+ {
+ // mhOnSetTitleWnd not set to reasonable value anywhere...
+ if ( lParam == OBJID_CLIENT )
+ {
+ nRet = xMSAA->getAccObjectPtr( (long)hWnd, lParam, wParam );
+ if( nRet != 0 )
+ return true;
+ }
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------
+
static LRESULT ImplHandleIMEReconvertString( HWND hWnd, LPARAM lParam )
{
WinSalFrame* pFrame = GetWindowPtr( hWnd );
@@ -6005,6 +6051,16 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
case WM_IME_NOTIFY:
ImplHandleIMENotify( hWnd, wParam );
break;
+
+ case WM_GETOBJECT:
+ long nRet;
+ if ( ImplHandleGetObject( hWnd, lParam, wParam, nRet ) )
+ {
+ rDef = false;
+ return (HRESULT) nRet;
+ }
+ break;
+
case WM_APPCOMMAND:
if( ImplHandleAppCommand( hWnd, lParam ) )
{