2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02: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 .
|
|
|
|
*/
|
2002-04-12 11:48:59 +00:00
|
|
|
|
2003-04-24 15:13:12 +00:00
|
|
|
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
|
2017-10-06 19:07:48 +03:00
|
|
|
#include "accselectionhelper.hxx"
|
2002-04-12 11:48:59 +00:00
|
|
|
|
2017-10-06 19:07:48 +03:00
|
|
|
#include "acccontext.hxx"
|
2002-04-12 11:48:59 +00:00
|
|
|
#include <accmap.hxx>
|
2002-05-15 12:22:47 +00:00
|
|
|
#include <svx/AccessibleShape.hxx>
|
2002-04-12 11:48:59 +00:00
|
|
|
#include <viewsh.hxx>
|
2010-02-02 15:11:26 +01:00
|
|
|
#include <fesh.hxx>
|
2013-10-22 15:58:57 +03:00
|
|
|
#include <vcl/svapp.hxx>
|
2010-02-02 15:11:26 +01:00
|
|
|
#include <flyfrm.hxx>
|
2002-04-12 11:48:59 +00:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
#include <com/sun/star/uno/Reference.hxx>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
|
|
|
|
#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
|
|
|
|
#include <fmtanchr.hxx>
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::accessibility;
|
2007-09-27 07:24:02 +00:00
|
|
|
using namespace ::com::sun::star;
|
2002-08-15 08:29:35 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
2007-09-27 07:24:02 +00:00
|
|
|
|
2003-04-24 15:13:12 +00:00
|
|
|
using ::com::sun::star::accessibility::XAccessible;
|
|
|
|
using ::com::sun::star::accessibility::XAccessibleContext;
|
|
|
|
using ::com::sun::star::accessibility::XAccessibleSelection;
|
2002-04-12 11:48:59 +00:00
|
|
|
|
2010-02-02 15:11:26 +01:00
|
|
|
using namespace ::sw::access;
|
2002-04-12 11:48:59 +00:00
|
|
|
|
|
|
|
SwAccessibleSelectionHelper::SwAccessibleSelectionHelper(
|
2015-05-11 11:04:23 +02:00
|
|
|
SwAccessibleContext& rContext ) :
|
|
|
|
m_rContext( rContext )
|
2002-04-12 11:48:59 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwAccessibleSelectionHelper::~SwAccessibleSelectionHelper()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFEShell* SwAccessibleSelectionHelper::GetFEShell()
|
|
|
|
{
|
2015-11-10 10:25:48 +01:00
|
|
|
OSL_ENSURE( m_rContext.GetMap() != nullptr, "no map?" );
|
2015-05-11 11:04:23 +02:00
|
|
|
SwViewShell* pViewShell = m_rContext.GetMap()->GetShell();
|
2015-11-10 10:25:48 +01:00
|
|
|
OSL_ENSURE( pViewShell != nullptr,
|
2002-04-12 11:48:59 +00:00
|
|
|
"No view shell? Then what are you looking at?" );
|
|
|
|
|
2015-09-30 16:10:07 +02:00
|
|
|
SwFEShell* pFEShell = dynamic_cast<SwFEShell*>( pViewShell );
|
2002-04-12 11:48:59 +00:00
|
|
|
|
|
|
|
return pFEShell;
|
|
|
|
}
|
|
|
|
|
2002-08-15 08:29:35 +00:00
|
|
|
void SwAccessibleSelectionHelper::throwIndexOutOfBoundsException()
|
|
|
|
{
|
2015-05-11 11:04:23 +02:00
|
|
|
Reference < XAccessibleContext > xThis( &m_rContext );
|
2002-08-15 08:29:35 +00:00
|
|
|
Reference < XAccessibleSelection >xSelThis( xThis, UNO_QUERY );
|
2007-09-27 07:24:02 +00:00
|
|
|
lang::IndexOutOfBoundsException aExcept(
|
2017-01-27 16:09:54 +02:00
|
|
|
"index out of bounds",
|
2016-12-28 12:43:31 +01:00
|
|
|
xSelThis );
|
2002-08-15 08:29:35 +00:00
|
|
|
throw aExcept;
|
|
|
|
}
|
|
|
|
|
2013-03-31 22:05:00 +11:00
|
|
|
// XAccessibleSelection
|
2002-04-12 11:48:59 +00:00
|
|
|
void SwAccessibleSelectionHelper::selectAccessibleChild(
|
|
|
|
sal_Int32 nChildIndex )
|
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-04-12 11:48:59 +00:00
|
|
|
|
2015-11-25 06:03:10 -05:00
|
|
|
// Get the respective child as SwFrame (also do index checking), ...
|
2015-05-11 11:04:23 +02:00
|
|
|
const SwAccessibleChild aChild = m_rContext.GetChild( *(m_rContext.GetMap()),
|
2010-02-02 15:11:26 +01:00
|
|
|
nChildIndex );
|
2002-04-12 11:48:59 +00:00
|
|
|
if( !aChild.IsValid() )
|
2002-08-15 08:29:35 +00:00
|
|
|
throwIndexOutOfBoundsException();
|
2002-04-12 11:48:59 +00:00
|
|
|
|
|
|
|
// we can only select fly frames, so we ignore (should: return
|
|
|
|
// false) all other attempts at child selection
|
|
|
|
SwFEShell* pFEShell = GetFEShell();
|
2015-11-10 10:25:48 +01:00
|
|
|
if( pFEShell != nullptr )
|
2002-04-12 11:48:59 +00:00
|
|
|
{
|
2010-02-02 15:11:26 +01:00
|
|
|
const SdrObject *pObj = aChild.GetDrawObject();
|
2002-05-15 12:22:47 +00:00
|
|
|
if( pObj )
|
2015-11-25 06:03:10 -05:00
|
|
|
m_rContext.Select( const_cast< SdrObject *>( pObj ), nullptr==aChild.GetSwFrame());
|
2002-04-12 11:48:59 +00:00
|
|
|
}
|
|
|
|
// no frame shell, or no frame, or no fly frame -> can't select
|
|
|
|
}
|
|
|
|
|
2017-03-11 00:55:48 +01:00
|
|
|
//When the selected state of the SwFrameOrObj is set, return true.
|
2014-04-25 14:00:35 +02:00
|
|
|
static bool lcl_getSelectedState(const SwAccessibleChild& aChild,
|
2013-11-29 13:03:27 +00:00
|
|
|
SwAccessibleContext* pContext,
|
|
|
|
SwAccessibleMap* pMap)
|
|
|
|
{
|
|
|
|
Reference< XAccessible > xAcc;
|
2015-11-25 06:03:10 -05:00
|
|
|
if ( aChild.GetSwFrame() )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
xAcc = pMap->GetContext( aChild.GetSwFrame(), false );
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
else if ( aChild.GetDrawObject() )
|
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
xAcc = pMap->GetContext( aChild.GetDrawObject(), pContext, false );
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( xAcc.is() )
|
|
|
|
{
|
|
|
|
Reference< XAccessibleContext > pRContext = xAcc->getAccessibleContext();
|
|
|
|
if(!pRContext.is())
|
2014-04-25 14:00:35 +02:00
|
|
|
return false;
|
2013-11-29 13:03:27 +00:00
|
|
|
Reference<XAccessibleStateSet> pRStateSet = pRContext->getAccessibleStateSet();
|
|
|
|
if( pRStateSet.is() )
|
|
|
|
{
|
2016-04-25 09:59:16 +02:00
|
|
|
Sequence<short> aStates = pRStateSet->getStates();
|
|
|
|
sal_Int32 count = aStates.getLength();
|
2015-05-29 13:34:26 +02:00
|
|
|
for( sal_Int32 i = 0; i < count; i++ )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2016-04-25 09:59:16 +02:00
|
|
|
if( aStates[i] == AccessibleStateType::SELECTED)
|
2014-04-25 14:00:35 +02:00
|
|
|
return true;
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-25 14:00:35 +02:00
|
|
|
return false;
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
|
2014-04-25 14:00:35 +02:00
|
|
|
bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
|
2002-04-12 11:48:59 +00:00
|
|
|
sal_Int32 nChildIndex )
|
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-04-12 11:48:59 +00:00
|
|
|
|
2015-11-25 06:03:10 -05:00
|
|
|
// Get the respective child as SwFrame (also do index checking), ...
|
2015-05-11 11:04:23 +02:00
|
|
|
const SwAccessibleChild aChild = m_rContext.GetChild( *(m_rContext.GetMap()),
|
2010-02-02 15:11:26 +01:00
|
|
|
nChildIndex );
|
2002-04-12 11:48:59 +00:00
|
|
|
if( !aChild.IsValid() )
|
2002-08-15 08:29:35 +00:00
|
|
|
throwIndexOutOfBoundsException();
|
2002-04-12 11:48:59 +00:00
|
|
|
|
|
|
|
// ... and compare to the currently selected frame
|
2014-04-25 14:00:35 +02:00
|
|
|
bool bRet = false;
|
2015-09-10 13:22:43 +01:00
|
|
|
const SwFEShell* pFEShell = GetFEShell();
|
2002-05-15 12:22:47 +00:00
|
|
|
if( pFEShell )
|
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
if ( aChild.GetSwFrame() != nullptr )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
bRet = (pFEShell->GetSelectedFlyFrame() == aChild.GetSwFrame());
|
2002-05-15 12:22:47 +00:00
|
|
|
}
|
2010-02-02 15:11:26 +01:00
|
|
|
else if ( aChild.GetDrawObject() )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
2010-02-02 15:11:26 +01:00
|
|
|
bRet = pFEShell->IsObjSelected( *aChild.GetDrawObject() );
|
2002-05-15 12:22:47 +00:00
|
|
|
}
|
2015-11-25 06:03:10 -05:00
|
|
|
//If the SwFrameOrObj is not selected directly in the UI, we should check whether it is selected in the selection cursor.
|
2013-11-29 13:03:27 +00:00
|
|
|
if( !bRet )
|
|
|
|
{
|
2015-05-11 11:04:23 +02:00
|
|
|
if( lcl_getSelectedState( aChild, &m_rContext, m_rContext.GetMap() ) )
|
2014-04-25 14:00:35 +02:00
|
|
|
bRet = true;
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
2002-05-15 12:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
2002-04-12 11:48:59 +00:00
|
|
|
}
|
|
|
|
|
2003-05-22 11:51:25 +00:00
|
|
|
void SwAccessibleSelectionHelper::selectAllAccessibleChildren( )
|
2002-04-12 11:48:59 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-04-12 11:48:59 +00:00
|
|
|
|
|
|
|
// We can select only one. So iterate over the children to find
|
|
|
|
// the first we can select, and select it.
|
|
|
|
|
2002-05-15 12:22:47 +00:00
|
|
|
SwFEShell* pFEShell = GetFEShell();
|
|
|
|
if( pFEShell )
|
2002-04-12 11:48:59 +00:00
|
|
|
{
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild > aChildren;
|
2015-05-11 11:04:23 +02:00
|
|
|
m_rContext.GetChildren( *(m_rContext.GetMap()), aChildren );
|
2002-05-15 12:22:47 +00:00
|
|
|
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin();
|
|
|
|
std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end();
|
2002-05-15 12:22:47 +00:00
|
|
|
while( aIter != aEndIter )
|
2002-04-12 11:48:59 +00:00
|
|
|
{
|
2010-02-02 15:11:26 +01:00
|
|
|
const SwAccessibleChild& rChild = *aIter;
|
|
|
|
const SdrObject* pObj = rChild.GetDrawObject();
|
2015-11-25 06:03:10 -05:00
|
|
|
const SwFrame* pFrame = rChild.GetSwFrame();
|
|
|
|
if( pObj && !(pFrame != nullptr && pFEShell->IsObjSelected()) )
|
2002-04-12 11:48:59 +00:00
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
m_rContext.Select( const_cast< SdrObject *>( pObj ), nullptr==pFrame );
|
|
|
|
if( pFrame )
|
2002-05-15 12:22:47 +00:00
|
|
|
break;
|
2002-04-12 11:48:59 +00:00
|
|
|
}
|
2002-05-15 12:22:47 +00:00
|
|
|
++aIter;
|
2002-04-12 11:48:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
|
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-04-12 11:48:59 +00:00
|
|
|
|
2002-05-15 12:22:47 +00:00
|
|
|
sal_Int32 nCount = 0;
|
2002-04-12 11:48:59 +00:00
|
|
|
// Only one frame can be selected at a time, and we only frames
|
|
|
|
// for selectable children.
|
2015-09-10 13:22:43 +01:00
|
|
|
const SwFEShell* pFEShell = GetFEShell();
|
2015-11-10 10:25:48 +01:00
|
|
|
if( pFEShell != nullptr )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
const SwFlyFrame* pFlyFrame = pFEShell->GetSelectedFlyFrame();
|
|
|
|
if( pFlyFrame )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
nCount = 1;
|
2002-05-15 12:22:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-06 18:35:37 +01:00
|
|
|
const size_t nSelObjs = pFEShell->IsObjSelected();
|
2002-05-15 12:22:47 +00:00
|
|
|
if( nSelObjs > 0 )
|
|
|
|
{
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild > aChildren;
|
2015-05-11 11:04:23 +02:00
|
|
|
m_rContext.GetChildren( *(m_rContext.GetMap()), aChildren );
|
2002-05-15 12:22:47 +00:00
|
|
|
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild >::const_iterator aIter =
|
2002-05-15 12:22:47 +00:00
|
|
|
aChildren.begin();
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild >::const_iterator aEndIter =
|
2002-05-15 12:22:47 +00:00
|
|
|
aChildren.end();
|
2015-01-06 18:35:37 +01:00
|
|
|
while( aIter != aEndIter && static_cast<size_t>(nCount) < nSelObjs )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
2010-02-02 15:11:26 +01:00
|
|
|
const SwAccessibleChild& rChild = *aIter;
|
2015-11-25 06:03:10 -05:00
|
|
|
if( rChild.GetDrawObject() && !rChild.GetSwFrame() &&
|
2015-05-11 11:04:23 +02:00
|
|
|
SwAccessibleFrame::GetParent(rChild, m_rContext.IsInPagePreview())
|
2015-11-25 06:03:10 -05:00
|
|
|
== m_rContext.GetFrame() &&
|
2010-02-02 15:11:26 +01:00
|
|
|
pFEShell->IsObjSelected( *rChild.GetDrawObject() ) )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
|
|
|
nCount++;
|
|
|
|
}
|
|
|
|
++aIter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-11-25 06:03:10 -05:00
|
|
|
//If the SwFrameOrObj is not selected directly in the UI,
|
2013-11-29 13:03:27 +00:00
|
|
|
//we should check whether it is selected in the selection cursor.
|
|
|
|
if( nCount == 0 )
|
|
|
|
{
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild > aChildren;
|
2015-05-11 11:04:23 +02:00
|
|
|
m_rContext.GetChildren( *(m_rContext.GetMap()), aChildren );
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild >::const_iterator aIter =
|
2013-11-29 13:03:27 +00:00
|
|
|
aChildren.begin();
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild >::const_iterator aEndIter =
|
2013-11-29 13:03:27 +00:00
|
|
|
aChildren.end();
|
|
|
|
while( aIter != aEndIter )
|
|
|
|
{
|
|
|
|
const SwAccessibleChild& aChild = *aIter;
|
2015-05-11 11:04:23 +02:00
|
|
|
if( lcl_getSelectedState( aChild, &m_rContext, m_rContext.GetMap() ) )
|
2013-11-29 13:03:27 +00:00
|
|
|
nCount++;
|
|
|
|
++aIter;
|
|
|
|
}
|
|
|
|
}
|
2002-05-15 12:22:47 +00:00
|
|
|
}
|
|
|
|
return nCount;
|
2002-04-12 11:48:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
|
|
|
|
sal_Int32 nSelectedChildIndex )
|
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-04-12 11:48:59 +00:00
|
|
|
|
|
|
|
// Since the index is relative to the selected children, and since
|
|
|
|
// there can be at most one selected frame child, the index must
|
|
|
|
// be 0, and a selection must exist, otherwise we have to throw an
|
2007-09-27 07:24:02 +00:00
|
|
|
// lang::IndexOutOfBoundsException
|
2002-05-15 12:22:47 +00:00
|
|
|
SwFEShell* pFEShell = GetFEShell();
|
2015-11-10 10:25:48 +01:00
|
|
|
if( nullptr == pFEShell )
|
2002-08-15 08:29:35 +00:00
|
|
|
throwIndexOutOfBoundsException();
|
2002-04-12 11:48:59 +00:00
|
|
|
|
2010-02-02 15:11:26 +01:00
|
|
|
SwAccessibleChild aChild;
|
2015-11-25 06:03:10 -05:00
|
|
|
const SwFlyFrame *pFlyFrame = pFEShell->GetSelectedFlyFrame();
|
|
|
|
if( pFlyFrame )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
2013-11-29 13:03:27 +00:00
|
|
|
if( 0 == nSelectedChildIndex )
|
2002-05-22 10:48:43 +00:00
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
if(SwAccessibleFrame::GetParent( SwAccessibleChild(pFlyFrame), m_rContext.IsInPagePreview()) == m_rContext.GetFrame() )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
aChild = pFlyFrame;
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
const SwFrameFormat *pFrameFormat = pFlyFrame->GetFormat();
|
2015-05-20 13:05:49 +02:00
|
|
|
if (pFrameFormat)
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2016-04-25 09:59:16 +02:00
|
|
|
const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
|
2017-03-17 14:15:30 +02:00
|
|
|
if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR )
|
2013-11-29 13:03:27 +00:00
|
|
|
{
|
2016-04-25 09:59:16 +02:00
|
|
|
const SwFrame *pParaFrame = SwAccessibleFrame::GetParent( SwAccessibleChild(pFlyFrame), m_rContext.IsInPagePreview() );
|
|
|
|
aChild = pParaFrame;
|
2013-11-29 13:03:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-05-22 10:48:43 +00:00
|
|
|
}
|
2002-05-15 12:22:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-06 18:35:37 +01:00
|
|
|
const size_t nSelObjs = pFEShell->IsObjSelected();
|
|
|
|
if( 0 == nSelObjs || static_cast<size_t>(nSelectedChildIndex) >= nSelObjs )
|
2002-08-15 08:29:35 +00:00
|
|
|
throwIndexOutOfBoundsException();
|
2002-05-15 12:22:47 +00:00
|
|
|
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild > aChildren;
|
2015-05-11 11:04:23 +02:00
|
|
|
m_rContext.GetChildren( *(m_rContext.GetMap()), aChildren );
|
2002-05-15 12:22:47 +00:00
|
|
|
|
2016-06-15 13:44:28 +01:00
|
|
|
std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin();
|
|
|
|
std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end();
|
2002-05-15 12:22:47 +00:00
|
|
|
while( aIter != aEndIter && !aChild.IsValid() )
|
|
|
|
{
|
2010-02-02 15:11:26 +01:00
|
|
|
const SwAccessibleChild& rChild = *aIter;
|
2015-11-25 06:03:10 -05:00
|
|
|
if( rChild.GetDrawObject() && !rChild.GetSwFrame() &&
|
2015-05-11 11:04:23 +02:00
|
|
|
SwAccessibleFrame::GetParent(rChild, m_rContext.IsInPagePreview()) ==
|
2015-11-25 06:03:10 -05:00
|
|
|
m_rContext.GetFrame() &&
|
2010-02-02 15:11:26 +01:00
|
|
|
pFEShell->IsObjSelected( *rChild.GetDrawObject() ) )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
|
|
|
if( 0 == nSelectedChildIndex )
|
|
|
|
aChild = rChild;
|
|
|
|
else
|
|
|
|
--nSelectedChildIndex;
|
|
|
|
}
|
|
|
|
++aIter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !aChild.IsValid() )
|
2002-08-15 08:29:35 +00:00
|
|
|
throwIndexOutOfBoundsException();
|
2002-05-15 12:22:47 +00:00
|
|
|
|
2015-11-10 10:25:48 +01:00
|
|
|
OSL_ENSURE( m_rContext.GetMap() != nullptr, "We need the map." );
|
2002-05-15 12:22:47 +00:00
|
|
|
Reference< XAccessible > xChild;
|
2015-11-25 06:03:10 -05:00
|
|
|
if( aChild.GetSwFrame() )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
2010-10-15 11:44:38 -05:00
|
|
|
::rtl::Reference < SwAccessibleContext > xChildImpl(
|
2015-11-25 06:03:10 -05:00
|
|
|
m_rContext.GetMap()->GetContextImpl( aChild.GetSwFrame() ) );
|
2010-10-15 11:44:38 -05:00
|
|
|
if( xChildImpl.is() )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
2015-05-11 11:04:23 +02:00
|
|
|
xChildImpl->SetParent( &m_rContext );
|
2010-10-15 11:44:38 -05:00
|
|
|
xChild = xChildImpl.get();
|
2002-05-15 12:22:47 +00:00
|
|
|
}
|
|
|
|
}
|
2010-02-02 15:11:26 +01:00
|
|
|
else if ( aChild.GetDrawObject() )
|
2002-05-15 12:22:47 +00:00
|
|
|
{
|
2010-10-15 11:44:38 -05:00
|
|
|
::rtl::Reference < ::accessibility::AccessibleShape > xChildImpl(
|
2015-05-11 11:04:23 +02:00
|
|
|
m_rContext.GetMap()->GetContextImpl( aChild.GetDrawObject(),
|
2015-08-20 13:18:53 +02:00
|
|
|
&m_rContext ) );
|
2010-10-15 11:44:38 -05:00
|
|
|
if( xChildImpl.is() )
|
|
|
|
xChild = xChildImpl.get();
|
2002-05-15 12:22:47 +00:00
|
|
|
}
|
|
|
|
return xChild;
|
2002-04-12 11:48:59 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 04:19:53 +09:00
|
|
|
// index has to be treated as global child index.
|
2003-04-24 15:13:12 +00:00
|
|
|
void SwAccessibleSelectionHelper::deselectAccessibleChild(
|
2004-12-23 09:02:31 +00:00
|
|
|
sal_Int32 nChildIndex )
|
2002-04-12 11:48:59 +00:00
|
|
|
{
|
2013-12-13 23:33:21 +01:00
|
|
|
SolarMutexGuard g;
|
|
|
|
|
2004-12-23 09:02:31 +00:00
|
|
|
if( nChildIndex < 0 ||
|
2015-05-11 11:04:23 +02:00
|
|
|
nChildIndex >= m_rContext.GetChildCount( *(m_rContext.GetMap()) ) )
|
2002-08-15 08:29:35 +00:00
|
|
|
throwIndexOutOfBoundsException();
|
2002-04-12 11:48:59 +00:00
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|