summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMalte Timmermann <mt@openoffice.org>2002-01-29 11:54:56 +0000
committerMalte Timmermann <mt@openoffice.org>2002-01-29 11:54:56 +0000
commiteb0e9af6874f7313dfe44e671d38f7d514f1eac8 (patch)
tree5be47101e7789af812f9c3fb010475690cbe05bd /toolkit
parent2933930ae9a54a0186850c22d4c7e4e31c41d76a (diff)
#97032# Start with UAA implementation
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindow.hxx22
-rw-r--r--toolkit/source/awt/vclxwindow.cxx239
2 files changed, 238 insertions, 23 deletions
diff --git a/toolkit/inc/toolkit/awt/vclxwindow.hxx b/toolkit/inc/toolkit/awt/vclxwindow.hxx
index aee01b2e284d..6086def62a2d 100644
--- a/toolkit/inc/toolkit/awt/vclxwindow.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: vclxwindow.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: mt $ $Date: 2002-01-15 16:19:29 $
+ * last change: $Author: mt $ $Date: 2002-01-29 12:54:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -278,6 +278,24 @@ public:
::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
};
+/* ----------------------------------------------------------
+ Accessibility only for the Window hierarchy!
+ Maybe derived classes must overwrite these Accessibility interfaces:
+
+ // XAccessibleContext:
+ sal_Int16 getAccessibleRole()
+ OUString getAccessibleDescription()
+ OUString getAccessibleName() // Default is Window::GetText()
+ Reference< XAccessibleRelationSet > getAccessibleRelationSet()
+ Reference< XAccessibleStateSet > getAccessibleStateSet()
+ void addPropertyChangeListener( Reference< XPropertyChangeListener > )
+ void removePropertyChangeListener( Reference< XPropertyChangeListener > )
+
+// ::drafts::com::sun::star::accessibility::XAccessibleComponent
+ sal_Bool isFocusTraversable()
+ Any getAccessibleKeyBinding()
+
+ ---------------------------------------------------------- */
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 1ebd8f967cf8..a413739cae5a 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: vclxwindow.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: mt $ $Date: 2002-01-15 16:19:01 $
+ * last change: $Author: mt $ $Date: 2002-01-29 12:54:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,6 +82,11 @@
#include <com/sun/star/awt/Style.hpp>
#endif
+#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
+#include <drafts/com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+
+
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/awt/vclxpointer.hxx>
#include <toolkit/helper/macros.hxx>
@@ -97,7 +102,6 @@
#include <vcl/window.hxx>
#include <tools/color.hxx>
-
struct AccessibilityInfos
{
String aAccName;
@@ -106,6 +110,28 @@ struct AccessibilityInfos
// Mit Out-Parameter besser als Rueckgabewert, wegen Ref-Objekt...
+Window* ImplGetAccessibleParentWindow( Window* pWindow )
+{
+ Window* pParent = pWindow->GetParent();
+ if ( pParent && ( pParent->GetType() == WINDOW_BORDERWINDOW ) )
+ {
+ DBG_ASSERT( pParent->GetChildCount() == 1, "BorderWindow with more than 1 child?" );
+ pParent = pParent->GetParent();
+ }
+ return pParent;
+}
+
+Window* ImplGetAccessibleChildWindow( Window* pWindow, USHORT n )
+{
+ Window* pChild = pWindow->GetChild( n );
+ if ( pChild && ( pChild->GetType() == WINDOW_BORDERWINDOW ) )
+ {
+ DBG_ASSERT( pChild->GetChildCount() == 1, "BorderWindow with more than 1 child?" );
+ pChild = pChild->GetChild( 0 );
+ }
+ return pChild;
+}
+
void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent& rEvent, Window* pWindow )
{
Point aPos = pWindow->GetPosPixel();
@@ -1385,13 +1411,14 @@ void VCLXWindow::setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::u
}
// ::drafts::com::sun::star::accessibility::XAccessibleContext
-sal_Int32 VCLXWindow::getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException)
+sal_Int32 VCLXWindow::getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
sal_Int32 nChildren = 0;
if ( GetWindow() )
nChildren = GetWindow()->GetChildCount();
+
return nChildren;
}
@@ -1402,7 +1429,7 @@ sal_Int32 VCLXWindow::getAccessibleChildCount( ) throw (::com::sun::star::uno::
::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > xAcc;
if ( GetWindow() )
{
- Window* pChild = GetWindow()->GetChild( (USHORT)i );
+ Window* pChild = ImplGetAccessibleChildWindow( GetWindow(), (USHORT)i );
if ( pChild )
xAcc = pChild->GetAccessible();
}
@@ -1415,8 +1442,12 @@ sal_Int32 VCLXWindow::getAccessibleChildCount( ) throw (::com::sun::star::uno::
::vos::OGuard aGuard( GetMutex() );
::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > xAcc;
- if ( GetWindow() && GetWindow()->GetParent() )
- xAcc = GetWindow()->GetParent()->GetAccessible();
+ if ( GetWindow() )
+ {
+ Window* pParent = ImplGetAccessibleParentWindow( GetWindow() );
+ if ( pParent )
+ xAcc = GetWindow()->GetParent()->GetAccessible();
+ }
return xAcc;
}
@@ -1424,13 +1455,136 @@ sal_Int32 VCLXWindow::getAccessibleChildCount( ) throw (::com::sun::star::uno::
sal_Int32 VCLXWindow::getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- return 0;
+
+ sal_Int32 nIndex = 0;
+ if ( GetWindow() )
+ {
+ Window* pParent = ImplGetAccessibleParentWindow( GetWindow() );
+ if ( pParent )
+ {
+ for ( USHORT n = pParent->GetChildCount(); n; )
+ {
+ Window* pChild = pParent->GetChild( --n );
+ if ( pChild == GetWindow() )
+ {
+ nIndex = n;
+ break;
+ }
+ }
+ }
+ }
+ return nIndex;
}
sal_Int16 VCLXWindow::getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- return 0;
+
+ // MT: Move to VCL Window, so that everybody can overwrite the role!
+
+ using namespace ::drafts::com::sun::star;
+
+ sal_Int16 nRole = 0;
+ if ( GetWindow() )
+ {
+ switch ( GetWindow()->GetType() )
+ {
+ case WINDOW_MESSBOX: // MT: Would be nice to have special roles!
+ case WINDOW_INFOBOX:
+ case WINDOW_WARNINGBOX:
+ case WINDOW_ERRORBOX:
+ case WINDOW_QUERYBOX: nRole = accessibility::AccessibleRole::OPTIONPANE; break;
+
+ case WINDOW_MODELESSDIALOG:
+ case WINDOW_MODALDIALOG:
+ case WINDOW_SYSTEMDIALOG:
+ case WINDOW_PRINTERSETUPDIALOG:
+ case WINDOW_PRINTDIALOG:
+ case WINDOW_TABDIALOG:
+ case WINDOW_BUTTONDIALOG:
+ case WINDOW_DIALOG: nRole = accessibility::AccessibleRole::DIALOG; break;
+
+ case WINDOW_PUSHBUTTON:
+ case WINDOW_OKBUTTON:
+ case WINDOW_CANCELBUTTON:
+ case WINDOW_HELPBUTTON:
+ case WINDOW_IMAGEBUTTON:
+ case WINDOW_MENUBUTTON:
+ case WINDOW_MOREBUTTON:
+ case WINDOW_SPINBUTTON:
+ case WINDOW_BUTTON: nRole = accessibility::AccessibleRole::PUSHBUTTON; break;
+
+ case WINDOW_PATHDIALOG: nRole = accessibility::AccessibleRole::DIRECTORYPANE; break;
+ case WINDOW_FILEDIALOG: nRole = accessibility::AccessibleRole::FILECHOOSER; break;
+ case WINDOW_COLORDIALOG: nRole = accessibility::AccessibleRole::COLORCHOOSER; break;
+ case WINDOW_FONTDIALOG: nRole = accessibility::AccessibleRole::FONTCHOOSER; break;
+
+ case WINDOW_IMAGERADIOBUTTON:
+ case WINDOW_RADIOBUTTON: nRole = accessibility::AccessibleRole::RADIOBUTTON; break;
+ case WINDOW_TRISTATEBOX:
+ case WINDOW_CHECKBOX: nRole = accessibility::AccessibleRole::CHECKBOX; break;
+
+ case WINDOW_MULTILINEEDIT:
+ case WINDOW_PATTERNFIELD:
+ case WINDOW_NUMERICFIELD:
+ case WINDOW_METRICFIELD:
+ case WINDOW_CURRENCYFIELD:
+ case WINDOW_LONGCURRENCYFIELD:
+ case WINDOW_EDIT: nRole = ( GetWindow()->GetStyle() & WB_PASSWORD ) ? (accessibility::AccessibleRole::PASSWORDTEXT) : (accessibility::AccessibleRole::TEXT); break;
+
+ case WINDOW_PATTERNBOX:
+ case WINDOW_NUMERICBOX:
+ case WINDOW_METRICBOX:
+ case WINDOW_CURRENCYBOX:
+ case WINDOW_LONGCURRENCYBOX:
+ case WINDOW_COMBOBOX: nRole = accessibility::AccessibleRole::COMBOBOX; break;
+
+ case WINDOW_LISTBOX:
+ case WINDOW_MULTILISTBOX: nRole = accessibility::AccessibleRole::LIST; break;
+
+ case WINDOW_FIXEDTEXT: nRole = accessibility::AccessibleRole::LABEL; break;
+ case WINDOW_FIXEDBORDER:
+ case WINDOW_FIXEDLINE: nRole = accessibility::AccessibleRole::SEPARATOR; break;
+ case WINDOW_FIXEDBITMAP:
+ case WINDOW_FIXEDIMAGE: nRole = accessibility::AccessibleRole::ICON; break;
+ case WINDOW_GROUPBOX: nRole = accessibility::AccessibleRole::GROUPBOX; break;
+ case WINDOW_SCROLLBAR: nRole = accessibility::AccessibleRole::SCROLLBAR; break;
+
+ case WINDOW_SLIDER:
+ case WINDOW_SPLITTER:
+ case WINDOW_SPLITWINDOW: nRole = accessibility::AccessibleRole::SPLITPANE; break;
+
+ case WINDOW_DATEBOX:
+ case WINDOW_TIMEBOX:
+ case WINDOW_DATEFIELD:
+ case WINDOW_TIMEFIELD: nRole = accessibility::AccessibleRole::DATEEDITOR; break;
+
+ case WINDOW_SPINFIELD: nRole = accessibility::AccessibleRole::SPINBOX; break;
+
+ case WINDOW_TOOLBOX: nRole = accessibility::AccessibleRole::TOOLBAR; break;
+ case WINDOW_STATUSBAR: nRole = accessibility::AccessibleRole::STATUSBAR; break;
+
+ case WINDOW_TABPAGE: nRole = accessibility::AccessibleRole::PAGETAB; break;
+ case WINDOW_TABCONTROL: nRole = accessibility::AccessibleRole::PAGETABLIST; break;
+
+ case WINDOW_DOCKINGWINDOW:
+ case WINDOW_SYSWINDOW:
+ case WINDOW_FLOATINGWINDOW: nRole = accessibility::AccessibleRole::LAYEREDPANE; break;
+
+ case WINDOW_WORKWINDOW: nRole = accessibility::AccessibleRole::FRAME; break;
+
+
+ case WINDOW_SCROLLBARBOX: nRole = accessibility::AccessibleRole::FILLER; break;
+
+ case WINDOW_WINDOW:
+ case WINDOW_CONTROL:
+ case WINDOW_BORDERWINDOW:
+ case WINDOW_SYSTEMCHILDWINDOW:
+ default: nRole = accessibility::AccessibleRole::WINDOW;
+
+ }
+ }
+ return nRole;
}
::rtl::OUString VCLXWindow::getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException)
@@ -1439,7 +1593,9 @@ sal_Int16 VCLXWindow::getAccessibleRole( ) throw (::com::sun::star::uno::Runtim
::rtl::OUString aDescription;
if ( GetWindow() )
- aDescription = GetWindow()->GetText();
+ {
+// aDescription = GetWindow()->GetText();
+ }
return aDescription;
}
@@ -1449,7 +1605,14 @@ sal_Int16 VCLXWindow::getAccessibleRole( ) throw (::com::sun::star::uno::Runtim
::rtl::OUString aName;
if ( GetWindow() )
+ {
aName = GetWindow()->GetText();
+#ifdef DEBUG
+ aName += String( RTL_CONSTASCII_USTRINGPARAM( " (Type = " ) );
+ aName += String::CreateFromInt32( GetWindow()->GetType() );
+ aName += String( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
+#endif
+ }
return aName;
}
@@ -1465,10 +1628,15 @@ sal_Int16 VCLXWindow::getAccessibleRole( ) throw (::com::sun::star::uno::Runtim
return NULL;
}
-::com::sun::star::lang::Locale VCLXWindow::getLocale( ) throw (::drafts::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException)
+::com::sun::star::lang::Locale VCLXWindow::getLocale() throw (::drafts::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- return ::com::sun::star::lang::Locale();
+
+ ::com::sun::star::lang::Locale aLocale;
+ if ( GetWindow() )
+ aLocale = GetWindow()->GetSettings().GetUILocale();
+
+ return aLocale;
}
void VCLXWindow::addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
@@ -1494,45 +1662,74 @@ sal_Bool VCLXWindow::contains( const ::com::sun::star::awt::Point& aPoint ) thro
return NULL;
}
-::com::sun::star::awt::Rectangle VCLXWindow::getBounds( ) throw (::com::sun::star::uno::RuntimeException)
+::com::sun::star::awt::Rectangle VCLXWindow::getBounds() throw (::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( GetMutex() );
- return ::com::sun::star::awt::Rectangle();
+ return getPosSize();
}
-::com::sun::star::awt::Point VCLXWindow::getLocation( ) throw (::com::sun::star::uno::RuntimeException)
+::com::sun::star::awt::Point VCLXWindow::getLocation() throw (::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- return ::com::sun::star::awt::Point();
+
+ ::com::sun::star::awt::Point aPos;
+ if ( GetWindow() )
+ {
+ Point aVclPos = GetWindow()->GetPosPixel();
+ aPos.X = aVclPos.X();
+ aPos.Y = aVclPos.Y();
+ }
+
+ return aPos;
}
::com::sun::star::awt::Point VCLXWindow::getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- return ::com::sun::star::awt::Point();
+
+ ::com::sun::star::awt::Point aPos;
+ if ( GetWindow() )
+ {
+ Rectangle aRect = GetWindow()->GetWindowExtentsRelative( NULL );
+ aPos.X = aRect.Left();
+ aPos.Y = aRect.Top();
+ }
+
+ return aPos;
}
sal_Bool VCLXWindow::isShowing( ) throw (::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- return FALSE;
+
+ sal_Bool bShowing = sal_False;
+ if ( GetWindow() && GetWindow()->IsVisible() )
+ bShowing = GetWindow()->IsReallyVisible(); // I hope IsReallyVisible is doing everything I need?
+
+ return bShowing;
}
sal_Bool VCLXWindow::isVisible( ) throw (::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
- return FALSE;
+
+ sal_Bool bVisible = sal_False;
+ if ( GetWindow() )
+ bVisible = GetWindow()->IsVisible();
+
+ return bVisible;
}
sal_Bool VCLXWindow::isFocusTraversable( ) throw (::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( GetMutex() );
return FALSE;
}
void VCLXWindow::grabFocus( ) throw (::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
+
+ if ( isFocusTraversable() )
+ setFocus();
}
::com::sun::star::uno::Any VCLXWindow::getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException)