2002-02-25 09:52:14 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: valueacc.cxx,v $
|
|
|
|
*
|
2002-11-20 15:35:31 +00:00
|
|
|
* $Revision: 1.9 $
|
2002-02-25 09:52:14 +00:00
|
|
|
*
|
2002-11-20 15:35:31 +00:00
|
|
|
* last change: $Author: af $ $Date: 2002-11-20 16:35:31 $
|
2002-02-25 09:52:14 +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): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#define _SV_VALUESET_CXX
|
|
|
|
#define private public
|
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
#include <unotools/accessiblestatesethelper.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
2002-02-25 09:52:14 +00:00
|
|
|
#include "valueset.hxx"
|
|
|
|
#include "valueimp.hxx"
|
|
|
|
|
|
|
|
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
|
|
|
|
#include <drafts/com/sun/star/accessibility/AccessibleRole.hpp>
|
|
|
|
#endif
|
2002-06-05 14:41:43 +00:00
|
|
|
#ifndef _DRAFTS_COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
|
|
|
|
#include <drafts/com/sun/star/accessibility/AccessibleStateType.hpp>
|
|
|
|
#endif
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::drafts::com::sun::star;
|
|
|
|
|
|
|
|
// ----------------
|
|
|
|
// - ValueSetItem -
|
|
|
|
// ----------------
|
|
|
|
|
|
|
|
ValueSetItem::ValueSetItem( ValueSet& rParent ) :
|
|
|
|
mrParent( rParent ),
|
|
|
|
mnId( 0 ),
|
|
|
|
mnBits( 0 ),
|
|
|
|
mpData( NULL ),
|
|
|
|
mpxAcc( NULL )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
ValueSetItem::~ValueSetItem()
|
|
|
|
{
|
|
|
|
if( mpxAcc )
|
|
|
|
{
|
|
|
|
static_cast< ValueItemAcc* >( mpxAcc->get() )->ParentDestroyed();
|
|
|
|
delete mpxAcc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Reference< accessibility::XAccessible > ValueSetItem::GetAccessible()
|
|
|
|
{
|
|
|
|
if( !mpxAcc )
|
|
|
|
mpxAcc = new uno::Reference< accessibility::XAccessible >( new ValueItemAcc( this ) );
|
|
|
|
|
|
|
|
return *mpxAcc;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ValueSetItem::ClearAccessible()
|
|
|
|
{
|
|
|
|
if( mpxAcc )
|
|
|
|
delete mpxAcc, mpxAcc = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
// ---------------
|
|
|
|
// - ValueSetAcc -
|
|
|
|
// ---------------
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
ValueSetAcc::ValueSetAcc( ValueSet* pParent ) :
|
2002-11-20 15:35:31 +00:00
|
|
|
ValueSetAccComponentBase (m_aMutex),
|
2002-02-25 15:39:54 +00:00
|
|
|
mpParent( pParent )
|
2002-02-25 09:52:14 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
ValueSetAcc::~ValueSetAcc()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
|
|
|
|
{
|
|
|
|
if( nEventId )
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
::std::vector< uno::Reference< accessibility::XAccessibleEventListener > > aTmpListeners( mxEventListeners );
|
2002-02-25 15:39:54 +00:00
|
|
|
::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() );
|
|
|
|
accessibility::AccessibleEventObject aEvtObject;
|
|
|
|
|
|
|
|
aEvtObject.EventId = nEventId;
|
|
|
|
aEvtObject.NewValue = rNewValue;
|
|
|
|
aEvtObject.OldValue = rOldValue;
|
|
|
|
|
|
|
|
while( aIter != aTmpListeners.end() )
|
2002-03-05 14:28:18 +00:00
|
|
|
{
|
2002-09-02 13:25:24 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
(*aIter)->notifyEvent( aEvtObject );
|
|
|
|
}
|
|
|
|
catch( uno::Exception& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-03-05 14:28:18 +00:00
|
|
|
aIter++;
|
|
|
|
}
|
2002-02-25 15:39:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
const uno::Sequence< sal_Int8 >& ValueSetAcc::getUnoTunnelId()
|
|
|
|
{
|
|
|
|
static uno::Sequence< sal_Int8 > aSeq;
|
|
|
|
|
|
|
|
if( !aSeq.getLength() )
|
|
|
|
{
|
|
|
|
static osl::Mutex aCreateMutex;
|
|
|
|
osl::Guard< osl::Mutex > aGuard( aCreateMutex );
|
|
|
|
|
|
|
|
aSeq.realloc( 16 );
|
|
|
|
rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
|
|
|
|
}
|
|
|
|
|
|
|
|
return aSeq;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData )
|
|
|
|
throw()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
|
|
|
|
return( xUnoTunnel.is() ? ( (ValueSetAcc*)(void*) xUnoTunnel->getSomething( ValueSetAcc::getUnoTunnelId() ) ) : NULL );
|
|
|
|
}
|
|
|
|
catch( const ::com::sun::star::uno::Exception& )
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAccessibleContext()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
sal_Int32 SAL_CALL ValueSetAcc::getAccessibleChildCount()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
return( mpParent->ImplGetVisibleItemCount() );
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleChild( sal_Int32 i )
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > xRet;
|
2002-02-25 15:39:54 +00:00
|
|
|
ValueSetItem* pItem = mpParent->ImplGetVisibleItem( static_cast< USHORT >( i ) );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
if( pItem )
|
|
|
|
xRet = pItem->GetAccessible();
|
|
|
|
else
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
return xRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleParent()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
Window* pParent = mpParent->GetParent();
|
2002-02-25 09:52:14 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > xRet;
|
|
|
|
|
|
|
|
if( pParent )
|
|
|
|
xRet = pParent->GetAccessible();
|
|
|
|
|
|
|
|
return xRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
sal_Int32 SAL_CALL ValueSetAcc::getAccessibleIndexInParent()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
Window* pParent = mpParent->GetParent();
|
2002-02-25 09:52:14 +00:00
|
|
|
sal_Int32 nRet = 0;
|
|
|
|
|
|
|
|
if( pParent )
|
|
|
|
{
|
|
|
|
sal_Bool bFound = sal_False;
|
|
|
|
|
|
|
|
for( USHORT i = 0, nCount = pParent->GetChildCount(); ( i < nCount ) && !bFound; i++ )
|
|
|
|
{
|
2002-02-25 15:39:54 +00:00
|
|
|
if( pParent->GetChild( i ) == mpParent )
|
2002-02-25 09:52:14 +00:00
|
|
|
{
|
|
|
|
nRet = i;
|
|
|
|
bFound = sal_True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return accessibility::AccessibleRole::UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleDescription()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
|
|
|
String aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet" ) );
|
|
|
|
|
|
|
|
return aRet;
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleName()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
|
|
|
String aRet;
|
|
|
|
|
|
|
|
if( mpParent )
|
|
|
|
aRet = mpParent->GetText();
|
|
|
|
|
|
|
|
if( !aRet.Len() )
|
|
|
|
aRet = getAccessibleDescription();
|
|
|
|
|
|
|
|
return aRet;
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::getAccessibleRelationSet()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return uno::Reference< accessibility::XAccessibleRelationSet >();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAccessibleStateSet()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return uno::Reference< accessibility::XAccessibleStateSet >();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
lang::Locale SAL_CALL ValueSetAcc::getLocale()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
const ::rtl::OUString aEmptyStr;
|
|
|
|
uno::Reference< accessibility::XAccessible > xParent( getAccessibleParent() );
|
|
|
|
lang::Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
|
|
|
|
|
|
|
|
if( xParent.is() )
|
|
|
|
{
|
|
|
|
uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
|
|
|
|
|
|
|
|
if( xParentContext.is() )
|
|
|
|
aRet = xParentContext->getLocale ();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
void SAL_CALL ValueSetAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-11-20 15:35:31 +00:00
|
|
|
::osl::MutexGuard aGuard (m_aMutex);
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
if( rxListener.is() )
|
|
|
|
{
|
|
|
|
::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
|
|
|
|
sal_Bool bFound = sal_False;
|
|
|
|
|
|
|
|
while( !bFound && ( aIter != mxEventListeners.end() ) )
|
|
|
|
{
|
2002-03-05 14:28:18 +00:00
|
|
|
if( *aIter == rxListener )
|
2002-02-25 09:52:14 +00:00
|
|
|
bFound = sal_True;
|
2002-03-05 14:28:18 +00:00
|
|
|
else
|
|
|
|
aIter++;
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!bFound)
|
|
|
|
mxEventListeners.push_back( rxListener );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
void SAL_CALL ValueSetAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-11-20 15:35:31 +00:00
|
|
|
::osl::MutexGuard aGuard (m_aMutex);
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
if( rxListener.is() )
|
|
|
|
{
|
|
|
|
::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin();
|
|
|
|
sal_Bool bFound = sal_False;
|
|
|
|
|
|
|
|
while( !bFound && ( aIter != mxEventListeners.end() ) )
|
|
|
|
{
|
|
|
|
if( *aIter == rxListener )
|
|
|
|
{
|
|
|
|
mxEventListeners.erase( aIter );
|
|
|
|
bFound = sal_True;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aIter++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
sal_Bool SAL_CALL ValueSetAcc::contains( const awt::Point& aPoint )
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const awt::Rectangle aRect( getBounds() );
|
|
|
|
const Point aSize( aRect.Width, aRect.Height );
|
|
|
|
const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleAt( const awt::Point& aPoint )
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
const USHORT nItemId = mpParent->GetItemId( Point( aPoint.X, aPoint.Y ) );
|
2002-02-25 09:52:14 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > xRet;
|
|
|
|
|
|
|
|
if( VALUESET_ITEM_NOTFOUND != nItemId )
|
|
|
|
{
|
2002-02-25 15:39:54 +00:00
|
|
|
const USHORT nItemPos = mpParent->GetItemPos( nItemId );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
if( VALUESET_ITEM_NONEITEM != nItemPos )
|
|
|
|
{
|
2002-02-25 15:39:54 +00:00
|
|
|
ValueSetItem* pItem = mpParent->mpItemList->GetObject( nItemPos );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
if( ( pItem->meType != VALUESETITEM_SPACE ) && !pItem->maRect.IsEmpty() )
|
|
|
|
xRet = pItem->GetAccessible();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return xRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
awt::Rectangle SAL_CALL ValueSetAcc::getBounds()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
const Point aOutPos( mpParent->GetPosPixel() );
|
|
|
|
const Size aOutSize( mpParent->GetOutputSizePixel() );
|
2002-02-25 09:52:14 +00:00
|
|
|
awt::Rectangle aRet;
|
|
|
|
|
|
|
|
aRet.X = aOutPos.X();
|
|
|
|
aRet.Y = aOutPos.Y();
|
|
|
|
aRet.Width = aOutSize.Width();
|
|
|
|
aRet.Height = aOutSize.Height();
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
awt::Point SAL_CALL ValueSetAcc::getLocation()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const awt::Rectangle aRect( getBounds() );
|
|
|
|
awt::Point aRet;
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
aRet.X = aRect.X;
|
|
|
|
aRet.Y = aRect.Y;
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
awt::Point SAL_CALL ValueSetAcc::getLocationOnScreen()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
const Point aScreenPos( mpParent->OutputToAbsoluteScreenPixel( Point() ) );
|
2002-02-25 09:52:14 +00:00
|
|
|
awt::Point aRet;
|
|
|
|
|
|
|
|
aRet.X = aScreenPos.X();
|
|
|
|
aRet.Y = aScreenPos.Y();
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
awt::Size SAL_CALL ValueSetAcc::getSize()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const awt::Rectangle aRect( getBounds() );
|
|
|
|
awt::Size aRet;
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
aRet.Width = aRect.Width;
|
|
|
|
aRet.Height = aRect.Height;
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
void SAL_CALL ValueSetAcc::grabFocus()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
mpParent->GrabFocus();
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
uno::Any SAL_CALL ValueSetAcc::getAccessibleKeyBinding()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return uno::Any();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-10-29 07:53:29 +00:00
|
|
|
sal_Int32 SAL_CALL ValueSetAcc::getForeground( )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
UINT32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
|
|
|
|
return static_cast<sal_Int32>(nColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL ValueSetAcc::getBackground( )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
UINT32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
|
|
|
|
return static_cast<sal_Int32>(nColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
void SAL_CALL ValueSetAcc::selectAccessibleChild( sal_Int32 nChildIndex )
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
ValueSetItem* pItem = mpParent->ImplGetVisibleItem( static_cast< USHORT >( nChildIndex ) );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
if( pItem )
|
2002-02-25 15:39:54 +00:00
|
|
|
mpParent->SelectItem( pItem->mnId );
|
2002-02-25 09:52:14 +00:00
|
|
|
else
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex )
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
ValueSetItem* pItem = mpParent->ImplGetVisibleItem( static_cast< USHORT >( nChildIndex ) );
|
2002-02-25 09:52:14 +00:00
|
|
|
sal_Bool bRet = sal_False;
|
|
|
|
|
|
|
|
if( pItem )
|
2002-02-25 15:39:54 +00:00
|
|
|
bRet = mpParent->IsItemSelected( pItem->mnId );
|
2002-02-25 09:52:14 +00:00
|
|
|
else
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
void SAL_CALL ValueSetAcc::clearAccessibleSelection()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 15:39:54 +00:00
|
|
|
mpParent->SetNoSelection();
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
void SAL_CALL ValueSetAcc::selectAllAccessible()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
// unsupported due to single selection only
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
sal_Int32 SAL_CALL ValueSetAcc::getSelectedAccessibleChildCount()
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
sal_Int32 nRet = 0;
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
for( USHORT i = 0, nCount = mpParent->ImplGetVisibleItemCount(); i < nCount; i++ )
|
2002-02-25 09:52:14 +00:00
|
|
|
{
|
2002-02-25 15:39:54 +00:00
|
|
|
ValueSetItem* pItem = mpParent->ImplGetVisibleItem( i );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
if( pItem && mpParent->IsItemSelected( pItem->mnId ) )
|
2002-02-25 09:52:14 +00:00
|
|
|
++nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > xRet;
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
for( USHORT i = 0, nCount = mpParent->ImplGetVisibleItemCount(), nSel = 0; ( i < nCount ) && !xRet.is(); i++ )
|
2002-02-25 09:52:14 +00:00
|
|
|
{
|
2002-02-25 15:39:54 +00:00
|
|
|
ValueSetItem* pItem = mpParent->ImplGetVisibleItem( i );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
if( pItem && mpParent->IsItemSelected( pItem->mnId ) && ( nSelectedChildIndex == static_cast< sal_Int32 >( nSel++ ) ) )
|
2002-02-25 09:52:14 +00:00
|
|
|
xRet = pItem->GetAccessible();
|
|
|
|
}
|
|
|
|
|
|
|
|
return xRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
void SAL_CALL ValueSetAcc::deselectSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
|
2002-02-25 09:52:14 +00:00
|
|
|
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
sal_Bool bDone = sal_False;
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
for( USHORT i = 0, nCount = mpParent->ImplGetVisibleItemCount(), nSel = 0; ( i < nCount ) && !bDone; i++ )
|
2002-02-25 09:52:14 +00:00
|
|
|
{
|
2002-02-25 15:39:54 +00:00
|
|
|
ValueSetItem* pItem = mpParent->ImplGetVisibleItem( i );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
if( pItem && mpParent->IsItemSelected( pItem->mnId ) && ( nSelectedChildIndex == static_cast< sal_Int32 >( nSel++ ) ) )
|
2002-02-25 09:52:14 +00:00
|
|
|
{
|
2002-02-25 15:39:54 +00:00
|
|
|
mpParent->SetNoSelection();
|
2002-02-25 09:52:14 +00:00
|
|
|
bDone = sal_True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-25 15:39:54 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int64 SAL_CALL ValueSetAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
sal_Int64 nRet;
|
|
|
|
|
|
|
|
if( ( rId.getLength() == 16 ) && ( 0 == rtl_compareMemory( ValueSetAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
|
|
|
|
nRet = reinterpret_cast< sal_Int64 >( this );
|
|
|
|
else
|
|
|
|
nRet = 0;
|
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
2002-11-20 15:35:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL ValueSetAcc::disposing (void)
|
|
|
|
{
|
|
|
|
::std::vector<uno::Reference<accessibility::XAccessibleEventListener> > aListenerListCopy;
|
|
|
|
|
|
|
|
{
|
|
|
|
// Make a copy of the list and clear the original.
|
|
|
|
::osl::MutexGuard aGuard (m_aMutex);
|
|
|
|
aListenerListCopy = mxEventListeners;
|
|
|
|
mxEventListeners.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inform all listeners that this objects is disposing.
|
|
|
|
::std::vector<uno::Reference<accessibility::XAccessibleEventListener> >::const_iterator
|
|
|
|
aListenerIterator (aListenerListCopy.begin());
|
|
|
|
lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this));
|
|
|
|
while (aListenerIterator != aListenerListCopy.end())
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
(*aListenerIterator)->disposing (aEvent);
|
|
|
|
}
|
|
|
|
catch( uno::Exception& )
|
|
|
|
{
|
|
|
|
// Ignore exceptions.
|
|
|
|
}
|
|
|
|
|
|
|
|
++aListenerIterator;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-25 09:52:14 +00:00
|
|
|
// ----------------
|
|
|
|
// - ValueItemAcc -
|
|
|
|
// ----------------
|
|
|
|
|
|
|
|
ValueItemAcc::ValueItemAcc( ValueSetItem* pParent ) :
|
|
|
|
mpParent( pParent )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
ValueItemAcc::~ValueItemAcc()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
|
|
|
|
{
|
|
|
|
if( nEventId )
|
|
|
|
{
|
|
|
|
::std::vector< uno::Reference< accessibility::XAccessibleEventListener > > aTmpListeners( mxEventListeners );
|
|
|
|
::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() );
|
|
|
|
accessibility::AccessibleEventObject aEvtObject;
|
|
|
|
|
|
|
|
aEvtObject.EventId = nEventId;
|
|
|
|
aEvtObject.NewValue = rNewValue;
|
|
|
|
aEvtObject.OldValue = rOldValue;
|
|
|
|
|
|
|
|
while( aIter != aTmpListeners.end() )
|
|
|
|
{
|
|
|
|
(*aIter)->notifyEvent( aEvtObject );
|
|
|
|
aIter++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-25 09:52:14 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ValueItemAcc::ParentDestroyed()
|
|
|
|
{
|
|
|
|
const ::vos::OGuard aGuard( maMutex );
|
|
|
|
mpParent = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
const uno::Sequence< sal_Int8 >& ValueItemAcc::getUnoTunnelId()
|
|
|
|
{
|
|
|
|
static uno::Sequence< sal_Int8 > aSeq;
|
|
|
|
|
|
|
|
if( !aSeq.getLength() )
|
|
|
|
{
|
|
|
|
static osl::Mutex aCreateMutex;
|
|
|
|
osl::Guard< osl::Mutex > aGuard( aCreateMutex );
|
|
|
|
|
|
|
|
aSeq.realloc( 16 );
|
|
|
|
rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
|
|
|
|
}
|
|
|
|
|
|
|
|
return aSeq;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
ValueItemAcc* ValueItemAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData )
|
|
|
|
throw()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
|
|
|
|
return( xUnoTunnel.is() ? ( (ValueItemAcc*)(void*) xUnoTunnel->getSomething( ValueItemAcc::getUnoTunnelId() ) ) : NULL );
|
|
|
|
}
|
|
|
|
catch( const ::com::sun::star::uno::Exception& )
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-02-25 09:52:14 +00:00
|
|
|
uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueItemAcc::getAccessibleContext()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL ValueItemAcc::getAccessibleChildCount()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleChild( sal_Int32 i )
|
|
|
|
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
return uno::Reference< accessibility::XAccessible >();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleParent()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > xRet;
|
|
|
|
|
|
|
|
if( mpParent )
|
|
|
|
xRet = mpParent->mrParent.GetAccessible();
|
|
|
|
|
|
|
|
return xRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
sal_Int32 nRet = 0;
|
|
|
|
|
|
|
|
if( mpParent )
|
|
|
|
{
|
|
|
|
sal_Bool bDone = sal_False;
|
|
|
|
|
|
|
|
for( USHORT i = 0, nCount = mpParent->mrParent.ImplGetVisibleItemCount(); ( i < nCount ) && !bDone; i++ )
|
|
|
|
{
|
|
|
|
ValueSetItem* pItem = mpParent->mrParent.ImplGetVisibleItem( i );
|
|
|
|
|
|
|
|
if( pItem && ( pItem->GetAccessible().get() == this ) )
|
|
|
|
{
|
|
|
|
nRet = i;
|
|
|
|
bDone = sal_True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int16 SAL_CALL ValueItemAcc::getAccessibleRole()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return accessibility::AccessibleRole::UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleDescription()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
|
|
|
String aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet item" ) );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleName()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
|
|
|
String aRet;
|
|
|
|
|
|
|
|
if( mpParent )
|
|
|
|
{
|
|
|
|
aRet = mpParent->maText;
|
|
|
|
|
|
|
|
if( !aRet.Len() )
|
|
|
|
{
|
|
|
|
aRet = String( RTL_CONSTASCII_USTRINGPARAM( "Item " ) );
|
|
|
|
aRet += String::CreateFromInt32( mpParent->mnId );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueItemAcc::getAccessibleRelationSet()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return uno::Reference< accessibility::XAccessibleRelationSet >();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueItemAcc::getAccessibleStateSet()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
|
|
|
::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
|
|
|
|
|
|
|
|
if( mpParent )
|
|
|
|
{
|
|
|
|
// SELECTABLE
|
|
|
|
pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
|
|
|
|
pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
|
|
|
|
|
|
|
|
// SELECTED
|
|
|
|
if( mpParent->mrParent.GetSelectItemId() == mpParent->mnId )
|
|
|
|
{
|
|
|
|
pStateSet->AddState( accessibility::AccessibleStateType::SELECTED );
|
|
|
|
pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pStateSet;
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
lang::Locale SAL_CALL ValueItemAcc::getLocale()
|
|
|
|
throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
const ::rtl::OUString aEmptyStr;
|
|
|
|
uno::Reference< accessibility::XAccessible > xParent( getAccessibleParent() );
|
|
|
|
lang::Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
|
|
|
|
|
|
|
|
if( xParent.is() )
|
|
|
|
{
|
|
|
|
uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
|
|
|
|
|
|
|
|
if( xParentContext.is() )
|
|
|
|
aRet = xParentContext->getLocale();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL ValueItemAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
const ::vos::OGuard aGuard( maMutex );
|
|
|
|
|
|
|
|
if( rxListener.is() )
|
|
|
|
{
|
|
|
|
::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
|
|
|
|
sal_Bool bFound = sal_False;
|
|
|
|
|
|
|
|
while( !bFound && ( aIter != mxEventListeners.end() ) )
|
|
|
|
{
|
2002-03-05 14:28:18 +00:00
|
|
|
if( *aIter == rxListener )
|
2002-02-25 09:52:14 +00:00
|
|
|
bFound = sal_True;
|
2002-03-05 14:28:18 +00:00
|
|
|
else
|
|
|
|
aIter++;
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!bFound)
|
|
|
|
mxEventListeners.push_back( rxListener );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL ValueItemAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
const ::vos::OGuard aGuard( maMutex );
|
|
|
|
|
|
|
|
if( rxListener.is() )
|
|
|
|
{
|
|
|
|
::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin();
|
|
|
|
sal_Bool bFound = sal_False;
|
|
|
|
|
|
|
|
while( !bFound && ( aIter != mxEventListeners.end() ) )
|
|
|
|
{
|
|
|
|
if( *aIter == rxListener )
|
|
|
|
{
|
|
|
|
mxEventListeners.erase( aIter );
|
|
|
|
bFound = sal_True;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aIter++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL ValueItemAcc::contains( const awt::Point& aPoint )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const awt::Rectangle aRect( getBounds() );
|
|
|
|
const Point aSize( aRect.Width, aRect.Height );
|
|
|
|
const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleAt( const awt::Point& aPoint )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-03-05 14:32:10 +00:00
|
|
|
uno::Reference< accessibility::XAccessible > xRet;
|
|
|
|
return xRet;
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
awt::Rectangle SAL_CALL ValueItemAcc::getBounds()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
awt::Rectangle aRet;
|
|
|
|
|
|
|
|
if( mpParent )
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
Rectangle aRect( mpParent->maRect );
|
|
|
|
Point aOrigin;
|
|
|
|
Rectangle aParentRect( aOrigin, mpParent->mrParent.GetOutputSizePixel() );
|
|
|
|
|
|
|
|
aRect.Intersection( aParentRect );
|
|
|
|
|
|
|
|
aRet.X = aRect.Left();
|
|
|
|
aRet.Y = aRect.Top();
|
|
|
|
aRet.Width = aRect.GetWidth();
|
|
|
|
aRet.Height = aRect.GetHeight();
|
2002-02-25 09:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
awt::Point SAL_CALL ValueItemAcc::getLocation()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const awt::Rectangle aRect( getBounds() );
|
|
|
|
awt::Point aRet;
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
aRet.X = aRect.X;
|
|
|
|
aRet.Y = aRect.Y;
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
awt::Point SAL_CALL ValueItemAcc::getLocationOnScreen()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2002-02-25 09:52:14 +00:00
|
|
|
awt::Point aRet;
|
|
|
|
|
|
|
|
if( mpParent )
|
|
|
|
{
|
|
|
|
const Point aScreenPos( mpParent->mrParent.OutputToAbsoluteScreenPixel( mpParent->maRect.TopLeft() ) );
|
|
|
|
|
|
|
|
aRet.X = aScreenPos.X();
|
|
|
|
aRet.Y = aScreenPos.Y();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
awt::Size SAL_CALL ValueItemAcc::getSize()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2002-06-05 14:41:43 +00:00
|
|
|
const awt::Rectangle aRect( getBounds() );
|
|
|
|
awt::Size aRet;
|
2002-02-25 09:52:14 +00:00
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
aRet.Width = aRect.Width;
|
|
|
|
aRet.Height = aRect.Height;
|
2002-02-25 09:52:14 +00:00
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL ValueItemAcc::grabFocus()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Any SAL_CALL ValueItemAcc::getAccessibleKeyBinding()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return uno::Any();
|
|
|
|
}
|
2002-06-05 14:41:43 +00:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-10-29 07:53:29 +00:00
|
|
|
sal_Int32 SAL_CALL ValueItemAcc::getForeground( )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
UINT32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
|
|
|
|
return static_cast<sal_Int32>(nColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL ValueItemAcc::getBackground( )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
UINT32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
|
|
|
|
return static_cast<sal_Int32>(nColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-06-05 14:41:43 +00:00
|
|
|
sal_Int64 SAL_CALL ValueItemAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
sal_Int64 nRet;
|
|
|
|
|
|
|
|
if( ( rId.getLength() == 16 ) && ( 0 == rtl_compareMemory( ValueItemAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
|
|
|
|
nRet = reinterpret_cast< sal_Int64 >( this );
|
|
|
|
else
|
|
|
|
nRet = 0;
|
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|