using ::com::sun::star::accessibility::XAccessible; using ::com::sun::star::accessibility::XAccessibleContext; using ::com::sun::star::accessibility::XAccessibleSelection;
if (nChildIndex < 0 || nChildIndex >= m_rContext.GetChildCount(*(m_rContext.GetMap())))
throwIndexOutOfBoundsException();
// Get the respective child as SwFrame (also do index checking), ... const SwAccessibleChild aChild = m_rContext.GetChild( *(m_rContext.GetMap()),
nChildIndex ); if( !aChild.IsValid() )
throwIndexOutOfBoundsException();
// we can only select fly frames, so we ignore (should: return // false) all other attempts at child selection if (GetFEShell())
{ const SdrObject *pObj = aChild.GetDrawObject(); if( pObj )
m_rContext.Select( const_cast< SdrObject *>( pObj ), nullptr==aChild.GetSwFrame());
} // no frame shell, or no frame, or no fly frame -> can't select
}
//When the selected state of the SwFrameOrObj is set, return true. staticbool lcl_getSelectedState(const SwAccessibleChild& aChild,
SwAccessibleContext* pContext,
SwAccessibleMap* pMap)
{
Reference< XAccessible > xAcc; if ( aChild.GetSwFrame() )
{
xAcc = pMap->GetContext( aChild.GetSwFrame(), false );
} elseif ( aChild.GetDrawObject() )
{
xAcc = pMap->GetContext( aChild.GetDrawObject(), pContext, false );
}
if (nChildIndex < 0 || nChildIndex >= m_rContext.GetChildCount(*(m_rContext.GetMap())))
throwIndexOutOfBoundsException();
// Get the respective child as SwFrame (also do index checking), ... const SwAccessibleChild aChild = m_rContext.GetChild( *(m_rContext.GetMap()),
nChildIndex ); if( !aChild.IsValid() )
throwIndexOutOfBoundsException();
// ... and compare to the currently selected frame bool bRet = false; if (const SwFEShell* pFEShell = GetFEShell())
{ if ( aChild.GetSwFrame() != nullptr )
{
bRet = (pFEShell->GetSelectedFlyFrame() == aChild.GetSwFrame());
} elseif ( aChild.GetDrawObject() )
{
bRet = pFEShell->IsObjSelected( *aChild.GetDrawObject() );
} //If the SwFrameOrObj is not selected directly in the UI, we should check whether it is selected in the selection cursor. if( !bRet )
{ if( lcl_getSelectedState( aChild, &m_rContext, m_rContext.GetMap() ) )
bRet = true;
}
}
const SwFEShell* pFEShell = GetFEShell(); if (!pFEShell) return0;
// Only one frame can be selected at a time, and we only frames // for selectable children. const SwFlyFrame* pFlyFrame = pFEShell->GetSelectedFlyFrame(); if ( pFlyFrame ) return1;
//If the SwFrameOrObj is not selected directly in the UI, //we should check whether it is selected in the selection cursor. if( nCount == 0 )
{
nCount = static_cast<sal_Int32>(std::count_if(aChildren.begin(), aChildren.end(),
[this](const SwAccessibleChild& aChild) { return lcl_getSelectedState(aChild, &m_rContext, m_rContext.GetMap()); }));
} return nCount;
}
// 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 // lang::IndexOutOfBoundsException
SwFEShell* pFEShell = GetFEShell(); if (!pFEShell)
throwIndexOutOfBoundsException();
// index has to be treated as global child index. void SwAccessibleSelectionHelper::deselectAccessibleChild(
sal_Int64 nChildIndex )
{
SolarMutexGuard g;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.