2002-02-14 16:23:20 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: vclxaccessiblecomponent.cxx,v $
|
|
|
|
*
|
2002-03-12 06:52:27 +00:00
|
|
|
* $Revision: 1.8 $
|
2002-02-14 16:23:20 +00:00
|
|
|
*
|
2002-03-12 06:52:27 +00:00
|
|
|
* last change: $Author: obr $ $Date: 2002-03-12 07:52:27 $
|
2002-02-14 16:23:20 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (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.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
|
|
|
|
#include <drafts/com/sun/star/accessibility/AccessibleRole.hpp>
|
|
|
|
#endif
|
2002-02-15 09:31:54 +00:00
|
|
|
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
|
|
|
|
#include <drafts/com/sun/star/accessibility/AccessibleStateType.hpp>
|
|
|
|
#endif
|
2002-03-04 14:47:34 +00:00
|
|
|
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_
|
|
|
|
#include <drafts/com/sun/star/accessibility/AccessibleEventId.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEVENTLISTENER_HPP_
|
|
|
|
#include <drafts/com/sun/star/accessibility/XAccessibleEventListener.hpp>
|
|
|
|
#endif
|
|
|
|
|
2002-02-14 16:23:20 +00:00
|
|
|
|
|
|
|
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
|
|
|
|
#include <toolkit/awt/vclxwindow.hxx>
|
|
|
|
#include <toolkit/helper/convert.hxx>
|
|
|
|
#include <vcl/window.hxx>
|
2002-02-27 08:40:21 +00:00
|
|
|
#include <tools/debug.hxx>
|
2002-02-14 16:23:20 +00:00
|
|
|
|
|
|
|
#include <unotools/accessiblestatesethelper.hxx>
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::drafts::com::sun::star;
|
|
|
|
|
|
|
|
|
2002-02-14 16:23:20 +00:00
|
|
|
// ----------------------------------------------------
|
|
|
|
// class VCLXAccessibleComponent
|
|
|
|
// ----------------------------------------------------
|
|
|
|
VCLXAccessibleComponent::VCLXAccessibleComponent( VCLXWindow* pVCLXindow )
|
2002-03-04 14:47:34 +00:00
|
|
|
: maEventListeners( GetMutex() ), VCLXAccessibleComponentBase( GetMutex() )
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
mpVCLXindow = pVCLXindow;
|
|
|
|
mxWindow = pVCLXindow;
|
2002-02-27 08:40:21 +00:00
|
|
|
|
|
|
|
DBG_ASSERT( pVCLXindow->GetWindow(), "VCLXAccessibleComponent - no window!" );
|
|
|
|
if ( pVCLXindow->GetWindow() )
|
|
|
|
pVCLXindow->GetWindow()->AddEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
|
2002-02-14 16:23:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VCLXAccessibleComponent::~VCLXAccessibleComponent()
|
|
|
|
{
|
2002-02-27 08:40:21 +00:00
|
|
|
if ( mpVCLXindow && mpVCLXindow->GetWindow() )
|
|
|
|
mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK( VCLXAccessibleComponent, WindowEventListener, VclSimpleEvent*, pEvent )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
|
|
|
|
if ( pEvent && pEvent->ISA( VclWindowEvent ) )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow() && GetWindow(), "Window???" );
|
|
|
|
ProcessWindowEvent( *(VclWindowEvent*)pEvent );
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
|
|
|
|
{
|
|
|
|
switch ( rVclWindowEvent.GetId() )
|
|
|
|
{
|
2002-03-04 14:47:34 +00:00
|
|
|
case VCLEVENT_WINDOW_SHOW:
|
|
|
|
case VCLEVENT_WINDOW_HIDE:
|
|
|
|
case VCLEVENT_WINDOW_ACTIVATE:
|
|
|
|
case VCLEVENT_WINDOW_DEACTIVATE:
|
|
|
|
case VCLEVENT_WINDOW_CLOSE:
|
|
|
|
case VCLEVENT_WINDOW_GETFOCUS:
|
|
|
|
case VCLEVENT_WINDOW_LOSEFOCUS:
|
|
|
|
case VCLEVENT_WINDOW_MINIMIZE:
|
|
|
|
case VCLEVENT_WINDOW_NORMALIZE:
|
|
|
|
case VCLEVENT_CONTROL_GETFOCUS:
|
|
|
|
case VCLEVENT_CONTROL_LOSEFOCUS:
|
|
|
|
{
|
|
|
|
NotifyAccessibleEvent( accessibility::AccessibleEventId::ACCESSIBLE_STATE_EVENT, uno::Any(), uno::Any() );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_MOVE:
|
|
|
|
case VCLEVENT_WINDOW_RESIZE:
|
|
|
|
{
|
|
|
|
// ???
|
|
|
|
}
|
|
|
|
break;
|
2002-02-27 08:40:21 +00:00
|
|
|
}
|
2002-02-14 16:23:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXAccessibleComponent::disposing()
|
|
|
|
{
|
2002-02-27 08:40:21 +00:00
|
|
|
if ( mpVCLXindow && mpVCLXindow->GetWindow() )
|
|
|
|
mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
NotifyAccessibleEvent( accessibility::AccessibleEventId::ACCESSIBLE_STATE_EVENT, uno::Any(), uno::Any() );
|
|
|
|
|
|
|
|
lang::EventObject aEvt( *this );
|
|
|
|
maEventListeners.disposeAndClear( aEvt );
|
|
|
|
|
2002-02-14 16:23:20 +00:00
|
|
|
mxWindow.clear();
|
2002-02-27 08:40:21 +00:00
|
|
|
mpVCLXindow = NULL;
|
2002-02-14 16:23:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Window* VCLXAccessibleComponent::GetWindow() const
|
|
|
|
{
|
|
|
|
return GetVCLXWindow() ? GetVCLXWindow()->GetWindow() : NULL;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
void VCLXAccessibleComponent::NotifyAccessibleEvent( sal_Int16 nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
|
|
|
|
{
|
|
|
|
accessibility::AccessibleEventObject aEvt;
|
|
|
|
aEvt.Source = *this;
|
|
|
|
aEvt.EventId = nEventId;
|
|
|
|
aEvt.OldValue = rOldValue;
|
|
|
|
aEvt.NewValue = rNewValue;
|
|
|
|
|
|
|
|
::cppu::OInterfaceIteratorHelper aIter( maEventListeners );
|
|
|
|
while ( aIter.hasMoreElements() )
|
|
|
|
{
|
|
|
|
uno::Reference< accessibility::XAccessibleEventListener > xEL( aIter.next(), uno::UNO_QUERY );
|
|
|
|
if ( xEL.is() )
|
|
|
|
xEL->notifyEvent( aEvt );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// accessibility::XAccessibleEventBroadcaster
|
|
|
|
void SAL_CALL VCLXAccessibleComponent::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
if ( rxListener.is() )
|
|
|
|
maEventListeners.addInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL VCLXAccessibleComponent::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
if ( rxListener.is() )
|
|
|
|
maEventListeners.removeInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
// accessibility::XAccessible
|
|
|
|
uno::Reference< accessibility::XAccessibleContext > VCLXAccessibleComponent::getAccessibleContext( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessibleContext > xAcc( (::cppu::OWeakObject*)this, uno::UNO_QUERY );
|
2002-02-14 16:23:20 +00:00
|
|
|
return xAcc;
|
|
|
|
}
|
|
|
|
|
2002-02-14 18:45:43 +00:00
|
|
|
void VCLXAccessibleComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
2002-02-15 09:31:54 +00:00
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
if ( pWindow->IsVisible() )
|
|
|
|
{
|
|
|
|
rStateSet.AddState( accessibility::AccessibleStateType::VISIBLE );
|
|
|
|
rStateSet.AddState( accessibility::AccessibleStateType::SHOWING );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rStateSet.AddState( accessibility::AccessibleStateType::INVALID );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pWindow->IsEnabled() )
|
|
|
|
rStateSet.AddState( accessibility::AccessibleStateType::ENABLED );
|
|
|
|
|
|
|
|
if ( pWindow->HasChildPathFocus() )
|
|
|
|
rStateSet.AddState( accessibility::AccessibleStateType::ACTIVE );
|
|
|
|
|
|
|
|
if ( pWindow->HasFocus() )
|
|
|
|
rStateSet.AddState( accessibility::AccessibleStateType::FOCUSED );
|
|
|
|
|
|
|
|
if ( pWindow->IsWait() )
|
|
|
|
rStateSet.AddState( accessibility::AccessibleStateType::BUSY );
|
|
|
|
|
|
|
|
if ( pWindow->GetStyle() & WB_SIZEABLE )
|
|
|
|
rStateSet.AddState( accessibility::AccessibleStateType::RESIZABLE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rStateSet.AddState( accessibility::AccessibleStateType::DEFUNC );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
MUST BE SET FROM DERIVED CLASSES:
|
|
|
|
|
|
|
|
CHECKED
|
|
|
|
COLLAPSED
|
|
|
|
EXPANDED
|
|
|
|
EXPANDABLE
|
|
|
|
EDITABLE
|
|
|
|
FOCUSABLE
|
|
|
|
HORIZONTAL
|
|
|
|
VERTICAL
|
|
|
|
ICONIFIED
|
|
|
|
MODAL
|
|
|
|
MULTILINE
|
|
|
|
MULTISELECTABLE
|
|
|
|
PRESSED
|
|
|
|
SELECTABLE
|
|
|
|
SELECTED
|
|
|
|
SINGLE_LINE
|
|
|
|
TRANSIENT
|
|
|
|
|
|
|
|
*/
|
2002-02-14 16:23:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
// accessibility::XAccessibleContext
|
|
|
|
sal_Int32 VCLXAccessibleComponent::getAccessibleChildCount() throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
sal_Int32 nChildren = 0;
|
|
|
|
if ( GetWindow() )
|
2002-02-14 16:48:20 +00:00
|
|
|
nChildren = GetWindow()->GetAccessibleChildWindowCount();
|
2002-02-14 16:23:20 +00:00
|
|
|
|
|
|
|
return nChildren;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
2002-02-14 18:45:43 +00:00
|
|
|
if ( i >= getAccessibleChildCount() )
|
2002-03-04 14:47:34 +00:00
|
|
|
throw lang::IndexOutOfBoundsException();
|
2002-02-14 18:45:43 +00:00
|
|
|
|
2002-02-14 16:23:20 +00:00
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > xAcc;
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
Window* pChild = GetWindow()->GetAccessibleChildWindow( (USHORT)i );
|
|
|
|
if ( pChild )
|
|
|
|
xAcc = pChild->GetAccessible();
|
|
|
|
}
|
|
|
|
|
|
|
|
return xAcc;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleParent( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > xAcc;
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
Window* pParent = GetWindow()->GetAccessibleParentWindow();
|
|
|
|
if ( pParent )
|
2002-02-14 18:45:43 +00:00
|
|
|
xAcc = pParent->GetAccessible();
|
2002-02-14 16:23:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return xAcc;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
sal_Int32 VCLXAccessibleComponent::getAccessibleIndexInParent( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
sal_Int32 nIndex = 0;
|
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
Window* pParent = GetWindow()->GetAccessibleParentWindow();
|
|
|
|
if ( pParent )
|
|
|
|
{
|
2002-02-14 18:45:43 +00:00
|
|
|
for ( USHORT n = pParent->GetAccessibleChildWindowCount(); n; )
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
2002-02-14 18:45:43 +00:00
|
|
|
Window* pChild = pParent->GetAccessibleChildWindow( --n );
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( pChild == GetWindow() )
|
|
|
|
{
|
|
|
|
nIndex = n;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nIndex;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
sal_Int16 VCLXAccessibleComponent::getAccessibleRole( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
sal_Int16 nRole = 0;
|
2002-02-14 18:45:43 +00:00
|
|
|
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( GetWindow() )
|
2002-02-14 18:45:43 +00:00
|
|
|
nRole = GetWindow()->GetAccessibleRole();
|
2002-02-14 16:23:20 +00:00
|
|
|
|
|
|
|
return nRole;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
::rtl::OUString VCLXAccessibleComponent::getAccessibleDescription( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
::rtl::OUString aDescription;
|
2002-02-14 18:45:43 +00:00
|
|
|
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( GetWindow() )
|
2002-02-14 18:45:43 +00:00
|
|
|
aDescription = GetWindow()->GetAccessibleDescription();
|
|
|
|
|
2002-02-14 16:23:20 +00:00
|
|
|
return aDescription;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
::rtl::OUString VCLXAccessibleComponent::getAccessibleName( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
::rtl::OUString aName;
|
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
2002-02-14 18:45:43 +00:00
|
|
|
aName = GetWindow()->GetAccessibleName();
|
2002-02-14 16:23:20 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
aName += String( RTL_CONSTASCII_USTRINGPARAM( " (Type = " ) );
|
|
|
|
aName += String::CreateFromInt32( GetWindow()->GetType() );
|
|
|
|
aName += String( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return aName;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessibleRelationSet > VCLXAccessibleComponent::getAccessibleRelationSet( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessibleStateSet > VCLXAccessibleComponent::getAccessibleStateSet( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
2002-02-14 18:45:43 +00:00
|
|
|
utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessibleStateSet > xSet = pStateSetHelper;
|
2002-02-14 18:45:43 +00:00
|
|
|
FillAccessibleStateSet( *pStateSetHelper );
|
2002-02-15 09:31:54 +00:00
|
|
|
return xSet;
|
|
|
|
// return NULL;
|
2002-02-14 16:23:20 +00:00
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
lang::Locale VCLXAccessibleComponent::getLocale() throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
lang::Locale aLocale;
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( GetWindow() )
|
|
|
|
aLocale = GetWindow()->GetSettings().GetUILocale();
|
|
|
|
|
|
|
|
return aLocale;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
// accessibility::XAccessibleComponent
|
|
|
|
sal_Bool VCLXAccessibleComponent::contains( const awt::Point& rPoint ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
2002-03-04 14:47:34 +00:00
|
|
|
|
|
|
|
sal_Bool bInside = sal_False;
|
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
Rectangle aRect( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() );
|
|
|
|
bInside = aRect.IsInside( VCLPoint( rPoint ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return bInside;
|
2002-02-14 16:23:20 +00:00
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleAt( const awt::Point& rPoint ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > xAcc;
|
2002-02-14 16:23:20 +00:00
|
|
|
|
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
Window* pWindow = GetWindow()->FindWindow( VCLPoint( rPoint ) );
|
2002-03-12 06:52:27 +00:00
|
|
|
if ( pWindow && pWindow != GetWindow() )
|
|
|
|
xAcc = pWindow->GetAccessible();
|
2002-02-14 16:23:20 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
return xAcc;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
awt::Size VCLXAccessibleComponent::getSize() throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
2002-03-04 14:47:34 +00:00
|
|
|
awt::Size aSize;
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( GetWindow() )
|
|
|
|
aSize = AWTSize( GetWindow()->GetSizePixel() );
|
|
|
|
return aSize;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
awt::Rectangle VCLXAccessibleComponent::getBounds() throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
2002-03-04 14:47:34 +00:00
|
|
|
awt::Rectangle aBounds;
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( mxWindow.is() )
|
|
|
|
aBounds = mxWindow->getPosSize();
|
|
|
|
return aBounds;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
awt::Point VCLXAccessibleComponent::getLocation() throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
awt::Point aPos;
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
Point aVclPos = GetWindow()->GetPosPixel();
|
|
|
|
aPos.X = aVclPos.X();
|
|
|
|
aPos.Y = aVclPos.Y();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aPos;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
awt::Point VCLXAccessibleComponent::getLocationOnScreen( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
awt::Point aPos;
|
2002-02-14 16:23:20 +00:00
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
Rectangle aRect = GetWindow()->GetWindowExtentsRelative( NULL );
|
|
|
|
aPos.X = aRect.Left();
|
|
|
|
aPos.Y = aRect.Top();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aPos;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
sal_Bool VCLXAccessibleComponent::isShowing() throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
sal_Bool bShowing = sal_False;
|
|
|
|
if ( GetWindow() && GetWindow()->IsVisible() )
|
|
|
|
bShowing = GetWindow()->IsReallyVisible(); // I hope IsReallyVisible is doing everything I need?
|
|
|
|
|
|
|
|
return bShowing;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
sal_Bool VCLXAccessibleComponent::isVisible() throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
sal_Bool bVisible = sal_False;
|
|
|
|
if ( GetWindow() )
|
|
|
|
bVisible = GetWindow()->IsVisible();
|
|
|
|
|
|
|
|
return bVisible;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
sal_Bool VCLXAccessibleComponent::isFocusTraversable() throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
void VCLXAccessibleComponent::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( mxWindow.is() )
|
|
|
|
mxWindow->addFocusListener( xListener );
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
void VCLXAccessibleComponent::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( mxWindow.is() )
|
|
|
|
mxWindow->removeFocusListener( xListener );
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
void VCLXAccessibleComponent::grabFocus( ) throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( mxWindow.is() && isFocusTraversable() )
|
|
|
|
mxWindow->setFocus();
|
|
|
|
}
|
|
|
|
|
2002-03-04 14:47:34 +00:00
|
|
|
uno::Any VCLXAccessibleComponent::getAccessibleKeyBinding() throw (uno::RuntimeException)
|
2002-02-14 16:23:20 +00:00
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
2002-03-04 14:47:34 +00:00
|
|
|
return uno::Any();
|
2002-02-14 16:23:20 +00:00
|
|
|
}
|
2002-03-05 07:27:51 +00:00
|
|
|
|
|
|
|
// XAccessibleExtendedComponent
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL VCLXAccessibleComponent::getForeground( ) throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
sal_Int32 nColor = 0;
|
|
|
|
if ( GetWindow() )
|
|
|
|
nColor = GetWindow()->GetControlForeground().GetColor();
|
|
|
|
|
|
|
|
return nColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL VCLXAccessibleComponent::getBackground( ) throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
sal_Int32 nColor = 0;
|
|
|
|
if ( GetWindow() )
|
|
|
|
nColor = GetWindow()->GetControlBackground().GetColor();
|
|
|
|
|
|
|
|
return nColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( ) throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return uno::Reference< awt::XFont >();
|
|
|
|
}
|
|
|
|
|
|
|
|
awt::FontDescriptor SAL_CALL VCLXAccessibleComponent::getFontMetrics( const uno::Reference< awt::XFont >& xFont ) throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return xFont->getFontDescriptor();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL VCLXAccessibleComponent::isEnabled( ) throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
sal_Bool bEnabled = sal_False;
|
|
|
|
if ( GetWindow() )
|
|
|
|
bEnabled = GetWindow()->IsEnabled();
|
|
|
|
|
|
|
|
return bEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL VCLXAccessibleComponent::getTitledBorderText( ) throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
::rtl::OUString sRet;
|
|
|
|
if ( GetWindow() )
|
|
|
|
sRet = GetWindow()->GetText();
|
|
|
|
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL VCLXAccessibleComponent::getToolTipText( ) throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
|
|
|
|
|
|
|
|
::rtl::OUString sRet;
|
|
|
|
if ( GetWindow() )
|
|
|
|
sRet = GetWindow()->GetQuickHelpText();
|
|
|
|
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
|