// create AccessibleTextHelper to handle this shape's text if( mxCell->CanCreateEditOutlinerParaObject() || mxCell->GetOutlinerParaObject() != nullptr )
{ // non-empty text -> use full-fledged edit source right away
if (aState == AccessibleStateType::FOCUSED && mpText != nullptr)
{ // Try to remove FOCUSED state from the edit engine and detect // whether the state changes. bool bIsFocused = mpText->HaveFocus ();
mpText->SetFocus (false);
bStateHasChanged = (bIsFocused != mpText->HaveFocus ());
} else
bStateHasChanged = AccessibleContextBase::ResetState (aState);
return bStateHasChanged;
}
// XAccessibleContext
/** The children of this cell come from the paragraphs of text.
*/
sal_Int64 SAL_CALL AccessibleCell::getAccessibleChildCount()
{
SolarMutexGuard aSolarGuard;
ensureAlive(); return mpText != nullptr ? mpText->GetChildCount () : 0;
}
/** Forward the request to the shape. Return the requested shape or throw anexceptionforawrongindex.
*/
Reference<XAccessible> SAL_CALL AccessibleCell::getAccessibleChild (sal_Int64 nIndex)
{
SolarMutexGuard aSolarGuard;
ensureAlive();
return mpText->GetChild (nIndex);
}
/** Return a copy of the state set. Possiblestatesare: ENABLED SHOWING VISIBLE
*/
sal_Int64 SAL_CALL AccessibleCell::getAccessibleStateSet()
{
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (m_aMutex);
sal_Int64 nStateSet = 0;
if (rBHelper.bDisposed || mpText == nullptr)
{ // Return a minimal state set that only contains the DEFUNC state.
nStateSet = AccessibleContextBase::getAccessibleStateSet ();
} else
{ // Merge current FOCUSED state from edit engine. if (mpText != nullptr)
{ if (mpText->HaveFocus())
mnStateSet |= AccessibleStateType::FOCUSED; else
mnStateSet &= ~AccessibleStateType::FOCUSED;
} // Set the invisible state for merged cell if (mxCell.is() && mxCell->isMerged())
mnStateSet &= ~AccessibleStateType::VISIBLE; else
mnStateSet |= AccessibleStateType::VISIBLE;
//Just when the parent table is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE
css::uno::Reference<XAccessible> xTempAcc = getAccessibleParent(); if( xTempAcc.is() )
{
css::uno::Reference<XAccessibleContext>
xTempAccContext = xTempAcc->getAccessibleContext(); if( xTempAccContext.is() )
{ if (xTempAccContext->getAccessibleStateSet() & AccessibleStateType::EDITABLE)
{
mnStateSet |= AccessibleStateType::EDITABLE;
mnStateSet |= AccessibleStateType::RESIZABLE;
mnStateSet |= AccessibleStateType::MOVEABLE;
}
}
}
nStateSet = mnStateSet;
}
return nStateSet;
}
// XAccessibleComponent
/** The implementation below is at the moment straightforward. It iterates overallchildren(andtherebyinstancesallchildrenwhichhavenot beenalreadyinstantiated)untilachildcoveringthespecifiedpointis found. Thisleavesroomforimprovement.Forinstance,firstiterateonlyover thealreadyinstantiatedchildrenandonlyifnomatchisfound instantiatetheremainingones.
*/
Reference<XAccessible > SAL_CALL AccessibleCell::getAccessibleAtPoint ( const css::awt::Point& aPoint)
{
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (m_aMutex);
sal_Int64 nChildCount = getAccessibleChildCount (); for (sal_Int64 i = 0; i < nChildCount; ++i)
{
Reference<XAccessible> xChild (getAccessibleChild (i)); if (xChild.is())
{
Reference<XAccessibleComponent> xChildComponent (xChild->getAccessibleContext(), uno::UNO_QUERY); if (xChildComponent.is())
{
awt::Rectangle aBBox (xChildComponent->getBounds()); if ( (aPoint.X >= aBBox.X)
&& (aPoint.Y >= aBBox.Y)
&& (aPoint.X < aBBox.X+aBBox.Width)
&& (aPoint.Y < aBBox.Y+aBBox.Height) ) return xChild;
}
}
}
// Have not found a child under the given point. Returning empty // reference to indicate this. return uno::Reference<XAccessible>();
}
css::awt::Rectangle AccessibleCell::implGetBounds()
{
css::awt::Rectangle aBoundingBox; if( mxCell.is() )
{ // Get the cell's bounding box in internal coordinates (in 100th of mm) const ::tools::Rectangle aCellRect( mxCell->getCellRect() );
// Transform coordinates from internal to pixel. if (maShapeTreeInfo.GetViewForwarder() == nullptr) throw uno::RuntimeException (u"AccessibleCell has no valid view forwarder"_ustr, getXWeak());
// Clip the shape's bounding box with the bounding box of its parent.
Reference<XAccessibleComponent> xParentComponent ( getAccessibleParent(), uno::UNO_QUERY); if (xParentComponent.is())
{ // Make the coordinates relative to the parent.
awt::Point aParentLocation (xParentComponent->getLocationOnScreen()); int x = aPixelPosition.getX() - aParentLocation.X; int y = aPixelPosition.getY() - aParentLocation.Y;
// Clip with parent (with coordinates relative to itself).
::tools::Rectangle aBBox ( x, y, x + aPixelSize.getWidth(), y + aPixelSize.getHeight());
awt::Size aParentSize (xParentComponent->getSize());
::tools::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height);
aBBox = aBBox.GetIntersection (aParentBBox);
aBoundingBox = awt::Rectangle ( aBBox.Left(), aBBox.Top(), aBBox.getOpenWidth(), aBBox.getOpenHeight());
} else
{
SAL_INFO("svx", "parent does not support component");
aBoundingBox = awt::Rectangle (aPixelPosition.getX(), aPixelPosition.getY(),aPixelSize.getWidth(), aPixelSize.getHeight());
}
}
void AccessibleCell::ViewForwarderChanged()
{ // Inform all listeners that the graphical representation (i.e. size // and/or position) of the shape has changed.
CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any(), -1);
// update our children that our screen position might have changed if( mpText )
mpText->UpdateChildren();
}
void AccessibleCell::UpdateChildren()
{ if (mpText)
mpText->UpdateChildren();
}
/* MT: Above getAccessibleName was introduced with IA2 CWS, while below was introduce in 3.3 meanwhile. Check which one is correct +Ifthisiscorrect,wealsodon'tneedsdr::table::CellRefgetCellRef(),UpdateChildren(),getCellName(sal_Int32nCol,sal_Int32nRow)above +
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.