2010-10-12 15:57:08 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-09-27 13:52:10 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2007-06-27 14:32:58 +00:00
|
|
|
|
2016-05-27 10:56:17 +03:00
|
|
|
#include "extended/accessiblelistboxentry.hxx"
|
2012-10-11 16:13:12 -04:00
|
|
|
#include <svtools/treelistbox.hxx>
|
2007-06-27 14:32:58 +00:00
|
|
|
#include <svtools/stringtransfer.hxx>
|
2013-11-25 15:24:55 +00:00
|
|
|
#include <svtools/svlbitm.hxx>
|
2007-06-27 14:32:58 +00:00
|
|
|
#include <com/sun/star/awt/Point.hpp>
|
|
|
|
#include <com/sun/star/awt/Rectangle.hpp>
|
|
|
|
#include <com/sun/star/awt/Size.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
|
2008-07-22 06:33:13 +00:00
|
|
|
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
|
2007-06-27 14:32:58 +00:00
|
|
|
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/controllayout.hxx>
|
2014-01-02 23:52:37 +01:00
|
|
|
#include <vcl/settings.hxx>
|
2007-06-27 14:32:58 +00:00
|
|
|
#include <toolkit/awt/vclxwindow.hxx>
|
|
|
|
#include <toolkit/helper/convert.hxx>
|
|
|
|
#include <unotools/accessiblestatesethelper.hxx>
|
|
|
|
#include <unotools/accessiblerelationsethelper.hxx>
|
2012-09-14 19:27:00 +02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2007-06-27 14:32:58 +00:00
|
|
|
#include <cppuhelper/typeprovider.hxx>
|
|
|
|
#include <comphelper/sequence.hxx>
|
|
|
|
#include <comphelper/accessibleeventnotifier.hxx>
|
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
2016-05-27 10:56:17 +03:00
|
|
|
#include <helper/accresmgr.hxx>
|
|
|
|
#include <helper/accessiblestrings.hrc>
|
2013-11-25 15:24:55 +00:00
|
|
|
#include <com/sun/star/accessibility/XAccessibleValue.hpp>
|
2007-06-27 14:32:58 +00:00
|
|
|
#define ACCESSIBLE_ACTION_COUNT 1
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
2017-01-19 18:01:19 +01:00
|
|
|
/// @throws css::lang::IndexOutOfBoundsException
|
2017-01-26 12:28:58 +01:00
|
|
|
void checkActionIndex_Impl( sal_Int32 _nIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
if ( _nIndex < 0 || _nIndex >= ACCESSIBLE_ACTION_COUNT )
|
|
|
|
// only three actions
|
2015-07-17 14:34:04 +02:00
|
|
|
throw css::lang::IndexOutOfBoundsException();
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-25 16:37:07 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
namespace accessibility
|
|
|
|
{
|
|
|
|
// class AccessibleListBoxEntry -----------------------------------------------------
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::accessibility;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star;
|
2013-11-25 15:24:55 +00:00
|
|
|
using namespace ::comphelper;
|
2007-06-27 14:32:58 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// Ctor() and Dtor()
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
AccessibleListBoxEntry::AccessibleListBoxEntry( SvTreeListBox& _rListBox,
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* _pEntry,
|
2007-06-27 14:32:58 +00:00
|
|
|
const Reference< XAccessible >& _xParent ) :
|
|
|
|
|
|
|
|
AccessibleListBoxEntry_BASE ( m_aMutex ),
|
|
|
|
ListBoxAccessibleBase( _rListBox ),
|
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
m_pSvLBoxEntry ( _pEntry ),
|
2007-06-27 14:32:58 +00:00
|
|
|
m_nClientId ( 0 ),
|
|
|
|
m_aParent ( _xParent )
|
|
|
|
|
|
|
|
{
|
|
|
|
_rListBox.FillEntryPath( _pEntry, m_aEntryPath );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
AccessibleListBoxEntry::~AccessibleListBoxEntry()
|
|
|
|
{
|
|
|
|
if ( IsAlive_Impl() )
|
|
|
|
{
|
|
|
|
// increment ref count to prevent double call of Dtor
|
2012-09-22 01:51:12 -05:00
|
|
|
osl_atomic_increment( &m_refCount );
|
2007-06-27 14:32:58 +00:00
|
|
|
dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
void AccessibleListBoxEntry::NotifyAccessibleEvent( sal_Int16 _nEventId,
|
2015-07-17 14:34:04 +02:00
|
|
|
const css::uno::Any& _aOldValue,
|
|
|
|
const css::uno::Any& _aNewValue )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
Reference< uno::XInterface > xSource( *this );
|
|
|
|
AccessibleEventObject aEventObj( xSource, _nEventId, _aNewValue, _aOldValue );
|
|
|
|
|
|
|
|
if (m_nClientId)
|
|
|
|
comphelper::AccessibleEventNotifier::addEvent( m_nClientId, aEventObj );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
Rectangle AccessibleListBoxEntry::GetBoundingBox_Impl() const
|
|
|
|
{
|
|
|
|
Rectangle aRect;
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( pEntry )
|
|
|
|
{
|
|
|
|
aRect = getListBox()->GetBoundingRect( pEntry );
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pParent = getListBox()->GetParent( pEntry );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( pParent )
|
|
|
|
{
|
|
|
|
// position relative to parent entry
|
|
|
|
Point aTopLeft = aRect.TopLeft();
|
|
|
|
aTopLeft -= getListBox()->GetBoundingRect( pParent ).TopLeft();
|
|
|
|
aRect = Rectangle( aTopLeft, aRect.GetSize() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRect;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
Rectangle AccessibleListBoxEntry::GetBoundingBoxOnScreen_Impl() const
|
|
|
|
{
|
|
|
|
Rectangle aRect;
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( pEntry )
|
|
|
|
{
|
|
|
|
aRect = getListBox()->GetBoundingRect( pEntry );
|
|
|
|
Point aTopLeft = aRect.TopLeft();
|
2015-11-10 10:09:45 +01:00
|
|
|
aTopLeft += getListBox()->GetWindowExtentsRelative( nullptr ).TopLeft();
|
2007-06-27 14:32:58 +00:00
|
|
|
aRect = Rectangle( aTopLeft, aRect.GetSize() );
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRect;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-14 16:38:33 +02:00
|
|
|
bool AccessibleListBoxEntry::IsAlive_Impl() const
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
return ( !rBHelper.bDisposed && !rBHelper.bInDispose && isAlive() );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-14 16:38:33 +02:00
|
|
|
bool AccessibleListBoxEntry::IsShowing_Impl() const
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
Reference< XAccessible > xParent = implGetParentAccessible( );
|
|
|
|
|
2014-04-14 16:38:33 +02:00
|
|
|
bool bShowing = false;
|
2016-04-20 10:34:01 +02:00
|
|
|
Reference< XAccessibleContext > xParentContext =
|
2007-06-27 14:32:58 +00:00
|
|
|
xParent.is() ? xParent->getAccessibleContext() : Reference< XAccessibleContext >();
|
2016-04-20 10:34:01 +02:00
|
|
|
if( xParentContext.is() )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2016-04-20 10:34:01 +02:00
|
|
|
Reference< XAccessibleComponent > xParentComp( xParentContext, uno::UNO_QUERY );
|
2007-06-27 14:32:58 +00:00
|
|
|
if( xParentComp.is() )
|
|
|
|
bShowing = GetBoundingBox_Impl().IsOver( VCLRectangle( xParentComp->getBounds() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return bShowing;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-01-27 20:09:02 +00:00
|
|
|
Rectangle AccessibleListBoxEntry::GetBoundingBox()
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
return GetBoundingBox_Impl();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-01-27 20:09:02 +00:00
|
|
|
Rectangle AccessibleListBoxEntry::GetBoundingBoxOnScreen()
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
return GetBoundingBoxOnScreen_Impl();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void AccessibleListBoxEntry::EnsureIsAlive() const
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
if ( !IsAlive_Impl() )
|
|
|
|
throw lang::DisposedException();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2012-09-07 03:36:42 -03:00
|
|
|
OUString AccessibleListBoxEntry::implGetText()
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2012-09-07 03:36:42 -03:00
|
|
|
OUString sRet;
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( pEntry )
|
2013-11-25 15:24:55 +00:00
|
|
|
sRet = getListBox()->SearchEntryTextWithHeadTitle( pEntry );
|
2007-06-27 14:32:58 +00:00
|
|
|
return sRet;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
Locale AccessibleListBoxEntry::implGetLocale()
|
|
|
|
{
|
|
|
|
Locale aLocale;
|
2012-11-22 12:26:52 +01:00
|
|
|
aLocale = Application::GetSettings().GetUILanguageTag().getLocale();
|
2007-06-27 14:32:58 +00:00
|
|
|
|
|
|
|
return aLocale;
|
|
|
|
}
|
|
|
|
void AccessibleListBoxEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
|
|
|
|
{
|
|
|
|
nStartIndex = 0;
|
|
|
|
nEndIndex = 0;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XTypeProvider
|
2014-02-22 21:20:15 +01:00
|
|
|
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< sal_Int8 > AccessibleListBoxEntry::getImplementationId()
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2014-03-10 11:03:11 +01:00
|
|
|
return css::uno::Sequence<sal_Int8>();
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XComponent/ListBoxAccessibleBase
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL AccessibleListBoxEntry::dispose()
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
AccessibleListBoxEntry_BASE::dispose();
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XComponent
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
void SAL_CALL AccessibleListBoxEntry::disposing()
|
|
|
|
{
|
2016-05-16 08:44:45 +02:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
Reference< XAccessible > xKeepAlive( this );
|
|
|
|
|
|
|
|
// Send a disposing to all listeners.
|
|
|
|
if ( m_nClientId )
|
|
|
|
{
|
|
|
|
::comphelper::AccessibleEventNotifier::TClientId nId = m_nClientId;
|
|
|
|
m_nClientId = 0;
|
|
|
|
::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// clean up
|
|
|
|
{
|
|
|
|
|
|
|
|
ListBoxAccessibleBase::disposing();
|
|
|
|
}
|
2015-10-29 15:48:45 +02:00
|
|
|
m_aParent.clear();
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XServiceInfo
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL AccessibleListBoxEntry::getImplementationName()
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2016-11-01 14:53:41 +02:00
|
|
|
return OUString( "com.sun.star.comp.svtools.AccessibleTreeListBoxEntry" );
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL AccessibleListBoxEntry::getSupportedServiceNames()
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2016-09-13 13:48:00 +02:00
|
|
|
return {"com.sun.star.accessibility.AccessibleContext",
|
|
|
|
"com.sun.star.accessibility.AccessibleComponent",
|
|
|
|
"com.sun.star.awt.AccessibleTreeListBoxEntry"};
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL AccessibleListBoxEntry::supportsService( const OUString& _rServiceName )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2016-11-01 14:53:41 +02:00
|
|
|
return cppu::supportsService(this, _rServiceName);
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XAccessible
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Reference< XAccessibleContext > SAL_CALL AccessibleListBoxEntry::getAccessibleContext( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
EnsureIsAlive();
|
|
|
|
return this;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XAccessibleContext
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleChildCount( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
sal_Int32 nCount = 0;
|
|
|
|
if ( pEntry )
|
|
|
|
nCount = getListBox()->GetLevelChildCount( pEntry );
|
|
|
|
|
|
|
|
return nCount;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleChild( sal_Int32 i )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
SvTreeListEntry* pEntry = GetRealChild(i);
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !pEntry )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
return new AccessibleListBoxEntry( *getListBox(), pEntry, this );
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
Reference< XAccessible > AccessibleListBoxEntry::implGetParentAccessible( ) const
|
|
|
|
{
|
2014-09-29 10:26:14 +02:00
|
|
|
Reference< XAccessible > xParent(m_aParent);
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !xParent.is() )
|
|
|
|
{
|
2011-08-21 09:13:24 +02:00
|
|
|
OSL_ENSURE( m_aEntryPath.size(), "AccessibleListBoxEntry::getAccessibleParent: invalid path!" );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( 1 == m_aEntryPath.size() )
|
|
|
|
{ // we're a top level entry
|
|
|
|
// -> our parent is the tree listbox itself
|
|
|
|
if ( getListBox() )
|
|
|
|
xParent = getListBox()->GetAccessible( );
|
|
|
|
}
|
|
|
|
else
|
2014-04-10 19:59:38 +03:00
|
|
|
{ // we have a entry as parent -> get its accessible
|
2007-06-27 14:32:58 +00:00
|
|
|
|
|
|
|
// shorten our access path by one
|
|
|
|
::std::deque< sal_Int32 > aParentPath( m_aEntryPath );
|
|
|
|
aParentPath.pop_back();
|
|
|
|
|
|
|
|
// get the entry for this shortened access path
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pParentEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2011-08-21 09:13:24 +02:00
|
|
|
OSL_ENSURE( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!" );
|
2007-06-27 14:32:58 +00:00
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
if ( pParentEntry )
|
|
|
|
pParentEntry = getListBox()->GetParent(pParentEntry);
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( pParentEntry )
|
2015-11-10 10:09:45 +01:00
|
|
|
xParent = new AccessibleListBoxEntry( *getListBox(), pParentEntry, nullptr );
|
2007-06-27 14:32:58 +00:00
|
|
|
// note that we pass NULL here as parent-accessible:
|
2014-04-10 19:59:38 +03:00
|
|
|
// this is allowed, as the AccessibleListBoxEntry class will create its parent
|
2007-06-27 14:32:58 +00:00
|
|
|
// when needed
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return xParent;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleParent( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
|
|
|
return implGetParentAccessible( );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleIndexInParent( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2011-08-21 09:13:24 +02:00
|
|
|
OSL_ENSURE( !m_aEntryPath.empty(), "empty path" );
|
2007-06-27 14:32:58 +00:00
|
|
|
return m_aEntryPath.empty() ? -1 : m_aEntryPath.back();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-10 21:08:07 +01:00
|
|
|
sal_Int32 AccessibleListBoxEntry::GetRoleType()
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nCase = 0;
|
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntry(0);
|
|
|
|
if ( pEntry )
|
|
|
|
{
|
|
|
|
if( pEntry->HasChildrenOnDemand() || getListBox()->GetChildCount(pEntry) > 0 )
|
|
|
|
{
|
|
|
|
nCase = 1;
|
|
|
|
return nCase;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-14 16:38:33 +02:00
|
|
|
bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0;
|
2015-04-20 15:50:47 +02:00
|
|
|
if( !(getListBox()->GetTreeFlags() & SvTreeFlags::CHKBTN) )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
if( bHasButtons )
|
|
|
|
nCase = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( bHasButtons )
|
|
|
|
nCase = 2;
|
|
|
|
else
|
|
|
|
nCase = 3;
|
|
|
|
}
|
|
|
|
return nCase;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int16 SAL_CALL AccessibleListBoxEntry::getAccessibleRole( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2014-02-10 21:08:07 +01:00
|
|
|
SolarMutexGuard aSolarGuard;
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
SvTreeListBox* pBox = getListBox();
|
|
|
|
if(pBox)
|
|
|
|
{
|
2015-04-21 14:38:41 +02:00
|
|
|
SvTreeAccRoleType nType = pBox->GetAllEntriesAccessibleRoleType();
|
|
|
|
if( nType == SvTreeAccRoleType::TREE)
|
2013-11-25 15:24:55 +00:00
|
|
|
return AccessibleRole::TREE_ITEM;
|
2015-04-21 14:38:41 +02:00
|
|
|
else if( nType == SvTreeAccRoleType::LIST)
|
2013-11-25 15:24:55 +00:00
|
|
|
return AccessibleRole::LIST_ITEM;
|
|
|
|
|
2015-04-20 15:50:47 +02:00
|
|
|
SvTreeFlags treeFlag = pBox->GetTreeFlags();
|
|
|
|
if(treeFlag & SvTreeFlags::CHKBTN )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
2014-01-19 14:59:29 -06:00
|
|
|
SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath );
|
|
|
|
SvButtonState eState = pBox->GetCheckButtonState( pEntry );
|
|
|
|
switch( eState )
|
|
|
|
{
|
2016-03-18 12:46:20 +02:00
|
|
|
case SvButtonState::Checked:
|
|
|
|
case SvButtonState::Unchecked:
|
2013-11-25 15:24:55 +00:00
|
|
|
return AccessibleRole::CHECK_BOX;
|
2016-03-18 12:46:20 +02:00
|
|
|
case SvButtonState::Tristate:
|
2013-11-25 15:24:55 +00:00
|
|
|
default:
|
|
|
|
return AccessibleRole::LABEL;
|
2014-01-19 14:59:29 -06:00
|
|
|
}
|
2013-11-25 15:24:55 +00:00
|
|
|
}
|
2014-02-10 21:08:07 +01:00
|
|
|
if (GetRoleType() == 0)
|
2014-01-19 14:59:29 -06:00
|
|
|
return AccessibleRole::LIST_ITEM;
|
|
|
|
else
|
|
|
|
//o is: return AccessibleRole::LABEL;
|
|
|
|
return AccessibleRole::TREE_ITEM;
|
2013-11-25 15:24:55 +00:00
|
|
|
}
|
2014-01-19 14:59:29 -06:00
|
|
|
return AccessibleRole::UNKNOWN;
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2014-02-10 21:08:07 +01:00
|
|
|
SolarMutexGuard aSolarGuard;
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
|
|
|
if( getAccessibleRole() == AccessibleRole::TREE_ITEM )
|
|
|
|
{
|
|
|
|
return getListBox()->GetEntryLongDescription( pEntry );
|
|
|
|
}
|
|
|
|
//want to cout the real column nubmer in the list box.
|
|
|
|
sal_uInt16 iRealItemCount = 0;
|
|
|
|
sal_uInt16 iCount = 0;
|
|
|
|
sal_uInt16 iTotleItemCount = pEntry->ItemCount();
|
|
|
|
while( iCount < iTotleItemCount )
|
|
|
|
{
|
2015-07-03 11:31:14 +02:00
|
|
|
const SvLBoxItem& rItem = pEntry->GetItem( iCount );
|
2016-08-26 01:26:38 +02:00
|
|
|
if ( rItem.GetType() == SvLBoxItemType::String &&
|
2015-07-03 11:31:14 +02:00
|
|
|
!static_cast<const SvLBoxString&>( rItem ).GetText().isEmpty() )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
iRealItemCount++;
|
|
|
|
}
|
|
|
|
iCount++;
|
|
|
|
}
|
|
|
|
if(iRealItemCount<=1 )
|
|
|
|
{
|
|
|
|
return OUString();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return getListBox()->SearchEntryTextWithHeadTitle( pEntry );
|
|
|
|
}
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
2013-11-25 15:24:55 +00:00
|
|
|
|
|
|
|
OUString sRet(implGetText());
|
|
|
|
|
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
|
|
|
|
|
|
|
OUString altText = getListBox()->GetEntryAltText( pEntry );
|
|
|
|
if (!altText.isEmpty())
|
|
|
|
{
|
|
|
|
sRet += " ";
|
|
|
|
sRet += altText;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sRet;
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Reference< XAccessibleRelationSet > SAL_CALL AccessibleListBoxEntry::getAccessibleRelationSet( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2008-07-22 06:33:13 +00:00
|
|
|
Reference< XAccessibleRelationSet > xRelSet;
|
|
|
|
Reference< XAccessible > xParent;
|
|
|
|
if ( m_aEntryPath.size() > 1 ) // not a root entry
|
|
|
|
xParent = implGetParentAccessible();
|
|
|
|
if ( xParent.is() )
|
|
|
|
{
|
|
|
|
utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
|
2015-10-29 13:57:50 +02:00
|
|
|
Sequence< Reference< XInterface > > aSequence { xParent };
|
2008-07-22 06:33:13 +00:00
|
|
|
pRelationSetHelper->AddRelation(
|
|
|
|
AccessibleRelation( AccessibleRelationType::NODE_CHILD_OF, aSequence ) );
|
|
|
|
xRelSet = pRelationSetHelper;
|
|
|
|
}
|
|
|
|
return xRelSet;
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Reference< XAccessibleStateSet > SAL_CALL AccessibleListBoxEntry::getAccessibleStateSet( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
|
|
|
|
Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
|
|
|
|
|
|
|
|
if ( IsAlive_Impl() )
|
|
|
|
{
|
2013-11-25 15:24:55 +00:00
|
|
|
switch(getAccessibleRole())
|
|
|
|
{
|
|
|
|
case AccessibleRole::LABEL:
|
2014-03-13 16:01:23 +00:00
|
|
|
pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
|
|
|
|
pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
|
|
|
|
pStateSetHelper->AddState( AccessibleStateType::ENABLED );
|
|
|
|
if (getListBox()->IsInplaceEditingEnabled())
|
|
|
|
pStateSetHelper->AddState( AccessibleStateType::EDITABLE );
|
|
|
|
if (IsShowing_Impl())
|
|
|
|
pStateSetHelper->AddState( AccessibleStateType::SHOWING );
|
2013-11-25 15:24:55 +00:00
|
|
|
break;
|
|
|
|
case AccessibleRole::CHECK_BOX:
|
2014-03-13 16:01:23 +00:00
|
|
|
pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
|
|
|
|
pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
|
|
|
|
pStateSetHelper->AddState( AccessibleStateType::ENABLED );
|
|
|
|
if (IsShowing_Impl())
|
|
|
|
pStateSetHelper->AddState( AccessibleStateType::SHOWING );
|
2013-11-25 15:24:55 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-03-13 16:01:23 +00:00
|
|
|
SvTreeListEntry *pEntry = getListBox()->GetEntryFromPath(m_aEntryPath);
|
|
|
|
if (pEntry)
|
|
|
|
getListBox()->FillAccessibleEntryStateSet(pEntry, *pStateSetHelper);
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
|
|
|
|
|
|
|
|
return xStateSet;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Locale SAL_CALL AccessibleListBoxEntry::getLocale( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
return implGetLocale();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XAccessibleComponent
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL AccessibleListBoxEntry::containsPoint( const awt::Point& rPoint )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
return Rectangle( Point(), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleAtPoint( const awt::Point& _aPoint )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntry( VCLPoint( _aPoint ) );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !pEntry )
|
|
|
|
throw RuntimeException();
|
|
|
|
|
|
|
|
Reference< XAccessible > xAcc;
|
|
|
|
AccessibleListBoxEntry* pAccEntry = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
|
|
|
|
Rectangle aRect = pAccEntry->GetBoundingBox_Impl();
|
|
|
|
if ( aRect.IsInside( VCLPoint( _aPoint ) ) )
|
|
|
|
xAcc = pAccEntry;
|
|
|
|
return xAcc;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
awt::Rectangle SAL_CALL AccessibleListBoxEntry::getBounds( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
return AWTRectangle( GetBoundingBox() );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
awt::Point SAL_CALL AccessibleListBoxEntry::getLocation( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
return AWTPoint( GetBoundingBox().TopLeft() );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
awt::Point SAL_CALL AccessibleListBoxEntry::getLocationOnScreen( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
awt::Size SAL_CALL AccessibleListBoxEntry::getSize( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
return AWTSize( GetBoundingBox().GetSize() );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL AccessibleListBoxEntry::grabFocus( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
// do nothing, because no focus for each item
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 AccessibleListBoxEntry::getForeground( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
sal_Int32 nColor = 0;
|
|
|
|
Reference< XAccessible > xParent = getAccessibleParent();
|
|
|
|
if ( xParent.is() )
|
|
|
|
{
|
|
|
|
Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
|
|
|
|
if ( xParentComp.is() )
|
|
|
|
nColor = xParentComp->getForeground();
|
|
|
|
}
|
|
|
|
|
|
|
|
return nColor;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 AccessibleListBoxEntry::getBackground( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
sal_Int32 nColor = 0;
|
|
|
|
Reference< XAccessible > xParent = getAccessibleParent();
|
|
|
|
if ( xParent.is() )
|
|
|
|
{
|
|
|
|
Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
|
|
|
|
if ( xParentComp.is() )
|
|
|
|
nColor = xParentComp->getBackground();
|
|
|
|
}
|
|
|
|
|
|
|
|
return nColor;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XAccessibleText
|
2014-02-22 21:20:15 +01:00
|
|
|
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
awt::Rectangle SAL_CALL AccessibleListBoxEntry::getCharacterBounds( sal_Int32 nIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
|
|
|
if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
awt::Rectangle aBounds( 0, 0, 0, 0 );
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( pEntry )
|
|
|
|
{
|
2015-04-28 23:09:13 +03:00
|
|
|
vcl::ControlLayoutData aLayoutData;
|
2007-06-27 14:32:58 +00:00
|
|
|
Rectangle aItemRect = GetBoundingBox();
|
|
|
|
getListBox()->RecordLayoutData( &aLayoutData, aItemRect );
|
|
|
|
Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex );
|
|
|
|
aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
|
|
|
|
aBounds = AWTRectangle( aCharRect );
|
|
|
|
}
|
|
|
|
|
|
|
|
return aBounds;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL AccessibleListBoxEntry::getIndexAtPoint( const awt::Point& aPoint )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
2013-11-25 15:24:55 +00:00
|
|
|
if(aPoint.X==0 && aPoint.Y==0) return 0;
|
2007-06-27 14:32:58 +00:00
|
|
|
|
|
|
|
sal_Int32 nIndex = -1;
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( pEntry )
|
|
|
|
{
|
2015-04-28 23:09:13 +03:00
|
|
|
vcl::ControlLayoutData aLayoutData;
|
2007-06-27 14:32:58 +00:00
|
|
|
Rectangle aItemRect = GetBoundingBox();
|
|
|
|
getListBox()->RecordLayoutData( &aLayoutData, aItemRect );
|
|
|
|
Point aPnt( VCLPoint( aPoint ) );
|
|
|
|
aPnt += aItemRect.TopLeft();
|
|
|
|
nIndex = aLayoutData.GetIndexForPoint( aPnt );
|
|
|
|
}
|
|
|
|
|
|
|
|
return nIndex;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL AccessibleListBoxEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2013-09-16 09:11:03 +02:00
|
|
|
OUString sText = getText();
|
|
|
|
if ( ( 0 > nStartIndex ) || ( sText.getLength() <= nStartIndex )
|
|
|
|
|| ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) )
|
2007-06-27 14:32:58 +00:00
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
sal_Int32 nLen = nEndIndex - nStartIndex + 1;
|
2013-09-16 09:11:03 +02:00
|
|
|
::svt::OStringTransfer::CopyString( sText.copy( nStartIndex, nLen ), getListBox() );
|
2007-06-27 14:32:58 +00:00
|
|
|
|
2014-09-15 17:24:50 +02:00
|
|
|
return true;
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XAccessibleEventBroadcaster
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL AccessibleListBoxEntry::addAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
if (xListener.is())
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
if (!m_nClientId)
|
|
|
|
m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
|
|
|
|
comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener );
|
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL AccessibleListBoxEntry::removeAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
if (xListener.is())
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
|
|
|
|
if ( !nListenerCount )
|
|
|
|
{
|
|
|
|
// no listeners anymore
|
|
|
|
// -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
|
|
|
|
// and at least to us not firing any events anymore, in case somebody calls
|
|
|
|
// NotifyAccessibleEvent, again
|
|
|
|
sal_Int32 nId = m_nClientId;
|
|
|
|
m_nClientId = 0;
|
|
|
|
comphelper::AccessibleEventNotifier::revokeClient( nId );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XAccessibleAction
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleActionCount( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
// three actions supported
|
2013-11-25 15:24:55 +00:00
|
|
|
SvTreeListBox* pBox = getListBox();
|
2015-04-20 15:50:47 +02:00
|
|
|
SvTreeFlags treeFlag = pBox->GetTreeFlags();
|
2014-04-14 16:38:33 +02:00
|
|
|
bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0;
|
2015-04-20 15:50:47 +02:00
|
|
|
if( (treeFlag & SvTreeFlags::CHKBTN) && !bHasButtons)
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
sal_Int16 role = getAccessibleRole();
|
|
|
|
if ( role == AccessibleRole::CHECK_BOX )
|
|
|
|
return 2;
|
|
|
|
else if ( role == AccessibleRole::LABEL )
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return ACCESSIBLE_ACTION_COUNT;
|
|
|
|
return 0;
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL AccessibleListBoxEntry::doAccessibleAction( sal_Int32 nIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2014-04-14 16:38:33 +02:00
|
|
|
bool bRet = false;
|
2007-06-27 14:32:58 +00:00
|
|
|
checkActionIndex_Impl( nIndex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2015-04-20 15:50:47 +02:00
|
|
|
SvTreeFlags treeFlag = getListBox()->GetTreeFlags();
|
|
|
|
if( nIndex == 0 && (treeFlag & SvTreeFlags::CHKBTN) )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2013-11-25 15:24:55 +00:00
|
|
|
if(getAccessibleRole() == AccessibleRole::CHECK_BOX)
|
|
|
|
{
|
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
|
|
|
SvButtonState state = getListBox()->GetCheckButtonState( pEntry );
|
2016-03-18 12:46:20 +02:00
|
|
|
if ( state == SvButtonState::Checked )
|
|
|
|
getListBox()->SetCheckButtonState(pEntry, SvButtonState::Unchecked);
|
|
|
|
else if (state == SvButtonState::Unchecked)
|
|
|
|
getListBox()->SetCheckButtonState(pEntry, SvButtonState::Checked);
|
2013-11-25 15:24:55 +00:00
|
|
|
}
|
|
|
|
}
|
2015-04-20 15:50:47 +02:00
|
|
|
else if( (nIndex == 1 && (treeFlag & SvTreeFlags::CHKBTN) ) || (nIndex == 0) )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
|
|
|
if ( pEntry )
|
|
|
|
{
|
|
|
|
if ( getListBox()->IsExpanded( pEntry ) )
|
|
|
|
getListBox()->Collapse( pEntry );
|
|
|
|
else
|
|
|
|
getListBox()->Expand( pEntry );
|
2014-04-14 16:38:33 +02:00
|
|
|
bRet = true;
|
2013-11-25 15:24:55 +00:00
|
|
|
}
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL AccessibleListBoxEntry::getAccessibleActionDescription( sal_Int32 nIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
checkActionIndex_Impl( nIndex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
// sal_Bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0;
|
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
|
|
|
SvButtonState state = getListBox()->GetCheckButtonState( pEntry );
|
2015-04-20 15:50:47 +02:00
|
|
|
SvTreeFlags treeFlag = getListBox()->GetTreeFlags();
|
|
|
|
if(nIndex == 0 && (treeFlag & SvTreeFlags::CHKBTN))
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
if(getAccessibleRole() == AccessibleRole::CHECK_BOX)
|
|
|
|
{
|
2016-03-18 12:46:20 +02:00
|
|
|
if ( state == SvButtonState::Checked )
|
2016-11-07 15:59:37 +02:00
|
|
|
return OUString("UnCheck");
|
2016-03-18 12:46:20 +02:00
|
|
|
else if (state == SvButtonState::Unchecked)
|
2016-11-07 15:59:37 +02:00
|
|
|
return OUString("Check");
|
2013-11-25 15:24:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Sometimes, a List or Tree may have both checkbox and label at the same time
|
|
|
|
return OUString();
|
|
|
|
}
|
2015-04-20 15:50:47 +02:00
|
|
|
}else if( (nIndex == 1 && (treeFlag & SvTreeFlags::CHKBTN)) || nIndex == 0 )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
if( pEntry->HasChildren() || pEntry->HasChildrenOnDemand() )
|
2016-12-28 12:43:31 +01:00
|
|
|
return getListBox()->IsExpanded( pEntry ) ?
|
2013-11-25 15:24:55 +00:00
|
|
|
OUString(TK_RES_STRING(STR_SVT_ACC_ACTION_COLLAPSE)) :
|
|
|
|
OUString(TK_RES_STRING(STR_SVT_ACC_ACTION_EXPAND));
|
|
|
|
return OUString();
|
|
|
|
|
|
|
|
}
|
|
|
|
throw IndexOutOfBoundsException();
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Reference< XAccessibleKeyBinding > AccessibleListBoxEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
Reference< XAccessibleKeyBinding > xRet;
|
|
|
|
checkActionIndex_Impl( nIndex );
|
|
|
|
// ... which key?
|
|
|
|
return xRet;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
// XAccessibleSelection
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL AccessibleListBoxEntry::selectAccessibleChild( sal_Int32 nChildIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
SvTreeListEntry* pEntry = GetRealChild(nChildIndex);
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !pEntry )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
2015-08-11 08:41:02 +02:00
|
|
|
getListBox()->Select( pEntry );
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL AccessibleListBoxEntry::isAccessibleChildSelected( sal_Int32 nChildIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
|
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !pEntry )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
return getListBox()->IsSelected( pEntry );
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL AccessibleListBoxEntry::clearAccessibleSelection( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !pParent )
|
|
|
|
throw RuntimeException();
|
2012-09-15 13:34:50 +02:00
|
|
|
sal_Int32 nCount = getListBox()->GetLevelChildCount( pParent );
|
|
|
|
for ( sal_Int32 i = 0; i < nCount; ++i )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntry( pParent, i );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( getListBox()->IsSelected( pEntry ) )
|
2014-03-24 15:42:28 +02:00
|
|
|
getListBox()->Select( pEntry, false );
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL AccessibleListBoxEntry::selectAllAccessibleChildren( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !pParent )
|
|
|
|
throw RuntimeException();
|
2012-09-15 13:34:50 +02:00
|
|
|
sal_Int32 nCount = getListBox()->GetLevelChildCount( pParent );
|
|
|
|
for ( sal_Int32 i = 0; i < nCount; ++i )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntry( pParent, i );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !getListBox()->IsSelected( pEntry ) )
|
2015-08-11 08:41:02 +02:00
|
|
|
getListBox()->Select( pEntry );
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChildCount( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
|
|
|
sal_Int32 i, nSelCount = 0, nCount = 0;
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !pParent )
|
|
|
|
throw RuntimeException();
|
|
|
|
nCount = getListBox()->GetLevelChildCount( pParent );
|
|
|
|
for ( i = 0; i < nCount; ++i )
|
|
|
|
{
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntry( pParent, i );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( getListBox()->IsSelected( pEntry ) )
|
|
|
|
++nSelCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nSelCount;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
|
|
|
if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
Reference< XAccessible > xChild;
|
|
|
|
sal_Int32 i, nSelCount = 0, nCount = 0;
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !pParent )
|
|
|
|
throw RuntimeException();
|
|
|
|
nCount = getListBox()->GetLevelChildCount( pParent );
|
|
|
|
for ( i = 0; i < nCount; ++i )
|
|
|
|
{
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntry( pParent, i );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( getListBox()->IsSelected( pEntry ) )
|
|
|
|
++nSelCount;
|
|
|
|
|
|
|
|
if ( nSelCount == ( nSelectedChildIndex + 1 ) )
|
|
|
|
{
|
|
|
|
xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return xChild;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL AccessibleListBoxEntry::deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
|
|
|
|
SvTreeListEntry* pEntry = getListBox()->GetEntry( pParent, nSelectedChildIndex );
|
2007-06-27 14:32:58 +00:00
|
|
|
if ( !pEntry )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
2014-03-24 15:42:28 +02:00
|
|
|
getListBox()->Select( pEntry, false );
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL AccessibleListBoxEntry::getCaretPosition( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL AccessibleListBoxEntry::setCaretPosition ( sal_Int32 nIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
|
|
|
if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
2014-09-15 17:24:50 +02:00
|
|
|
return false;
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Unicode SAL_CALL AccessibleListBoxEntry::getCharacter( sal_Int32 nIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
return OCommonAccessibleText::getCharacter( nIndex );
|
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleListBoxEntry::getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
2012-09-07 03:36:42 -03:00
|
|
|
OUString sText( implGetText() );
|
2007-06-27 14:32:58 +00:00
|
|
|
|
|
|
|
if ( !implIsValidIndex( nIndex, sText.getLength() ) )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
2015-07-17 14:34:04 +02:00
|
|
|
return css::uno::Sequence< css::beans::PropertyValue >();
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL AccessibleListBoxEntry::getCharacterCount( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
return OCommonAccessibleText::getCharacterCount( );
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL AccessibleListBoxEntry::getSelectedText( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
return OCommonAccessibleText::getSelectedText( );
|
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionStart( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
return OCommonAccessibleText::getSelectionStart( );
|
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionEnd( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
return OCommonAccessibleText::getSelectionEnd( );
|
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL AccessibleListBoxEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
|
|
|
if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
2014-09-15 17:24:50 +02:00
|
|
|
return false;
|
2007-06-27 14:32:58 +00:00
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL AccessibleListBoxEntry::getText( )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
return OCommonAccessibleText::getText( );
|
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL AccessibleListBoxEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
|
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
css::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType);
|
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
css::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType);
|
|
|
|
}
|
2017-01-26 12:28:58 +01:00
|
|
|
css::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType )
|
2007-06-27 14:32:58 +00:00
|
|
|
{
|
2010-10-14 13:46:51 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2007-06-27 14:32:58 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
EnsureIsAlive();
|
|
|
|
|
|
|
|
return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
// XAccessibleValue
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Any AccessibleListBoxEntry::getCurrentValue( )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
Any aValue;
|
|
|
|
sal_Int32 level = ((sal_Int32) m_aEntryPath.size() - 1);
|
|
|
|
level = level < 0 ? 0: level;
|
|
|
|
aValue <<= level;
|
|
|
|
return aValue;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool AccessibleListBoxEntry::setCurrentValue( const Any& aNumber )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
|
2014-04-14 16:38:33 +02:00
|
|
|
bool bReturn = false;
|
2013-11-25 15:24:55 +00:00
|
|
|
SvTreeListBox* pBox = getListBox();
|
|
|
|
if(getAccessibleRole() == AccessibleRole::CHECK_BOX)
|
|
|
|
{
|
|
|
|
SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath );
|
|
|
|
if ( pEntry )
|
|
|
|
{
|
|
|
|
sal_Int32 nValue(0), nValueMin(0), nValueMax(0);
|
|
|
|
aNumber >>= nValue;
|
|
|
|
getMinimumValue() >>= nValueMin;
|
|
|
|
getMaximumValue() >>= nValueMax;
|
|
|
|
|
|
|
|
if ( nValue < nValueMin )
|
|
|
|
nValue = nValueMin;
|
|
|
|
else if ( nValue > nValueMax )
|
|
|
|
nValue = nValueMax;
|
|
|
|
|
|
|
|
pBox->SetCheckButtonState(pEntry, (SvButtonState) nValue );
|
2014-04-14 16:38:33 +02:00
|
|
|
bReturn = true;
|
2013-11-25 15:24:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bReturn;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Any AccessibleListBoxEntry::getMaximumValue( )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
Any aValue;
|
|
|
|
// SvTreeListBox* pBox = getListBox();
|
|
|
|
switch(getAccessibleRole())
|
|
|
|
{
|
|
|
|
case AccessibleRole::CHECK_BOX:
|
|
|
|
aValue <<= (sal_Int32)1;
|
|
|
|
break;
|
|
|
|
case AccessibleRole::LABEL:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return aValue;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Any AccessibleListBoxEntry::getMinimumValue( )
|
2013-11-25 15:24:55 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
Any aValue;
|
|
|
|
// SvTreeListBox* pBox = getListBox();
|
|
|
|
switch(getAccessibleRole())
|
|
|
|
{
|
|
|
|
case AccessibleRole::CHECK_BOX:
|
|
|
|
aValue <<= (sal_Int32)0;
|
|
|
|
break;
|
|
|
|
case AccessibleRole::LABEL:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return aValue;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 15:24:55 +00:00
|
|
|
SvTreeListEntry* AccessibleListBoxEntry::GetRealChild(sal_Int32 nIndex)
|
|
|
|
{
|
2015-11-10 10:09:45 +01:00
|
|
|
SvTreeListEntry* pEntry = nullptr;
|
2013-11-25 15:24:55 +00:00
|
|
|
SvTreeListEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
|
|
|
|
if (pParent)
|
|
|
|
{
|
|
|
|
pEntry = getListBox()->GetEntry( pParent, nIndex );
|
|
|
|
if ( !pEntry && getAccessibleChildCount() > 0 )
|
|
|
|
{
|
|
|
|
getListBox()->RequestingChildren(pParent);
|
|
|
|
pEntry = getListBox()->GetEntry( pParent, nIndex );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pEntry;
|
|
|
|
}
|
2014-02-25 16:37:07 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
}// namespace accessibility
|
2014-02-25 16:37:07 +01:00
|
|
|
|
2007-06-27 14:32:58 +00:00
|
|
|
|
2010-10-12 15:57:08 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|