diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-04 10:06:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-04 13:56:46 +0200 |
commit | 3b7db802731826b6cc3b55100470b0c61c1f2dfa (patch) | |
tree | 8b972dd3697e88a1d306626f28a177366b8de27a | |
parent | fd02cdd4b5ef0fc96225501ba8f6758af8b6c69e (diff) |
tdf#105404 [API CHANGE] add index to accessiblity change event
Which shaves 80% off the time off breaking up a vector image on Linux.
Change-Id: Id8e7daad001b6120d1fb98e382357da5b55e92ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151352
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
21 files changed, 88 insertions, 56 deletions
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index 826d9f54cb1e..013bb940ca80 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -116,7 +116,7 @@ namespace accessibility const css::uno::Any& _aNewValue ) { Reference< uno::XInterface > xSource( *this ); - AccessibleEventObject aEventObj( xSource, _nEventId, _aNewValue, _aOldValue ); + AccessibleEventObject aEventObj( xSource, _nEventId, _aNewValue, _aOldValue, -1 ); if (m_nClientId) comphelper::AccessibleEventNotifier::addEvent( m_nClientId, aEventObj ); diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index eedf5e5eb393..ab24cc6a0cf8 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -119,7 +119,7 @@ void Paragraph::notifyEvent(::sal_Int16 nEventId, if (m_nClientId) comphelper::AccessibleEventNotifier::addEvent( m_nClientId, css::accessibility::AccessibleEventObject( getXWeak(), - nEventId, rNewValue, rOldValue) ); + nEventId, rNewValue, rOldValue, -1) ); } // virtual diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index b7ae9a67ebe0..29a3eb23b426 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -350,7 +350,7 @@ void AccessibleBase::BroadcastAccEvent( // the const cast is needed, because UNO parameters are never const const AccessibleEventObject aEvent( const_cast< uno::XWeak * >( static_cast< const uno::XWeak * >( this )), - nId, rNew, rOld ); + nId, rNew, rOld, -1 ); // let the notifier handle this event ::comphelper::AccessibleEventNotifier::addEvent( m_nEventNotifierId, aEvent ); diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx index 2b6d08bfa842..6ef2fe654548 100644 --- a/editeng/source/accessibility/AccessibleContextBase.cxx +++ b/editeng/source/accessibility/AccessibleContextBase.cxx @@ -89,7 +89,7 @@ bool AccessibleContextBase::SetState (sal_Int64 aState) CommitChange( AccessibleEventId::STATE_CHANGED, aNewValue, - uno::Any()); + uno::Any(), -1); } return true; } @@ -112,7 +112,7 @@ bool AccessibleContextBase::ResetState (sal_Int64 aState) CommitChange( AccessibleEventId::STATE_CHANGED, uno::Any(), - aOldValue); + aOldValue, -1); return true; } else @@ -144,7 +144,7 @@ void AccessibleContextBase::SetRelationSet ( for (int i=0; aRelationDescriptors[i].first!=AccessibleRelationType::INVALID; i++) if (mxRelationSet->containsRelation(aRelationDescriptors[i].first) != rxNewRelationSet->containsRelation(aRelationDescriptors[i].first)) - CommitChange (aRelationDescriptors[i].second, uno::Any(), uno::Any()); + CommitChange (aRelationDescriptors[i].second, uno::Any(), uno::Any(), -1); mxRelationSet = rxNewRelationSet; } @@ -425,7 +425,7 @@ void AccessibleContextBase::SetAccessibleDescription ( CommitChange( AccessibleEventId::DESCRIPTION_CHANGED, aNewValue, - aOldValue); + aOldValue, -1); } @@ -447,7 +447,7 @@ void AccessibleContextBase::SetAccessibleName ( CommitChange( AccessibleEventId::NAME_CHANGED, aNewValue, - aOldValue); + aOldValue, -1); } @@ -460,7 +460,8 @@ OUString AccessibleContextBase::CreateAccessibleName() void AccessibleContextBase::CommitChange ( sal_Int16 nEventId, const uno::Any& rNewValue, - const uno::Any& rOldValue) + const uno::Any& rOldValue, + sal_Int32 nValueIndex) { // Do not call FireEvent and do not even create the event object when no // listener has been registered yet. Creating the event object can @@ -471,7 +472,8 @@ void AccessibleContextBase::CommitChange ( static_cast<XAccessibleContext*>(this), nEventId, rNewValue, - rOldValue); + rOldValue, + nValueIndex); FireEvent (aEvent); } diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index ee2f47254765..9ad4ce46de5a 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -551,7 +551,7 @@ namespace accessibility { uno::Reference < XAccessibleContext > xThis( const_cast< AccessibleEditableTextPara* > (this)->getAccessibleContext() ); - AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue); + AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue, -1); // #106234# Delegate to EventNotifier if( getNotifierClientId() != -1 ) diff --git a/editeng/source/accessibility/AccessibleImageBullet.cxx b/editeng/source/accessibility/AccessibleImageBullet.cxx index 58ac8f989561..55c85d87ff17 100644 --- a/editeng/source/accessibility/AccessibleImageBullet.cxx +++ b/editeng/source/accessibility/AccessibleImageBullet.cxx @@ -408,7 +408,7 @@ namespace accessibility uno::Reference < XAccessibleContext > xThis( const_cast< AccessibleImageBullet* > (this)->getAccessibleContext() ); - AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue); + AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue, -1); // #106234# Delegate to EventNotifier ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(), diff --git a/include/editeng/AccessibleContextBase.hxx b/include/editeng/AccessibleContextBase.hxx index 6c9dd48323eb..c5257fdb9e6d 100644 --- a/include/editeng/AccessibleContextBase.hxx +++ b/include/editeng/AccessibleContextBase.hxx @@ -82,7 +82,8 @@ public: */ void CommitChange (sal_Int16 aEventId, const css::uno::Any& rNewValue, - const css::uno::Any& rOldValue); + const css::uno::Any& rOldValue, + sal_Int32 nValueIndex); /** Set a new description and, provided that the new name differs from the old one, broadcast an accessibility event. diff --git a/offapi/com/sun/star/accessibility/AccessibleEventObject.idl b/offapi/com/sun/star/accessibility/AccessibleEventObject.idl index 6ccc14cb4308..b662787c568a 100644 --- a/offapi/com/sun/star/accessibility/AccessibleEventObject.idl +++ b/offapi/com/sun/star/accessibility/AccessibleEventObject.idl @@ -48,6 +48,13 @@ struct AccessibleEventObject: ::com::sun::star::lang::EventObject Depending on the #EventId, this can be void. */ any OldValue; + + /** + For events like add/remove/update of a child, this specifies the index of the object. + For anything else, it should be -1. + @since LibreOffice 7.6 + */ + long IndexHint; }; }; }; }; }; diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 304c8932b1b7..6d5dacede496 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -1452,7 +1452,7 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) static_cast< ::accessibility::AccessibleShape* >(xAccessible.get())-> CommitChange(AccessibleEventId::STATE_CHANGED, aNewValue, - uno::Any() ); + uno::Any(), -1 ); } else { diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index 5c5ad0b5ea67..410d75deabe2 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -599,7 +599,7 @@ void AccessibleDocumentViewBase::SetAccessibleOLEObject ( CommitChange ( AccessibleEventId::CHILD, uno::Any(), - uno::Any (mxAccessibleOLEObject)); + uno::Any (mxAccessibleOLEObject), -1); // Assume that the accessible OLE Object disposes itself correctly. @@ -613,7 +613,7 @@ void AccessibleDocumentViewBase::SetAccessibleOLEObject ( CommitChange ( AccessibleEventId::CHILD, uno::Any (mxAccessibleOLEObject), - uno::Any()); + uno::Any(), -1); } //===== methods from AccessibleSelectionBase ================================================== diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx index 690a8c865f2c..82f692bb272a 100644 --- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx +++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx @@ -314,7 +314,7 @@ void SAL_CALL } else SAL_WARN("sd", "View invalid"); - CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue); + CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue, -1); } else if ( rEventObject.PropertyName == "VisibleArea" ) { @@ -323,7 +323,7 @@ void SAL_CALL } else if (rEventObject.PropertyName == "ActiveLayer") { - CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue); + CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue, -1); } else if (rEventObject.PropertyName == "UpdateAcc") { diff --git a/sd/source/ui/accessibility/AccessibleOutlineView.cxx b/sd/source/ui/accessibility/AccessibleOutlineView.cxx index d7277c74c71b..6f5ef764f12e 100644 --- a/sd/source/ui/accessibility/AccessibleOutlineView.cxx +++ b/sd/source/ui/accessibility/AccessibleOutlineView.cxx @@ -206,7 +206,7 @@ void SAL_CALL { // The current page changed. Update the children accordingly. UpdateChildren(); - CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue, rEventObject.OldValue); + CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue, rEventObject.OldValue, -1); } else if ( rEventObject.PropertyName == "VisibleArea" ) { diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index e5d937094d17..ec9ba6efa410 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -906,7 +906,7 @@ void SAL_CALL CommitChange ( AccessibleEventId::VISIBLE_DATA_CHANGED, uno::Any(), - uno::Any()); + uno::Any(), -1); // Name and Description may have changed. Update the local // values accordingly. @@ -923,7 +923,7 @@ void AccessibleShape::ViewForwarderChanged() // and/or position) of the shape has changed. CommitChange (AccessibleEventId::VISIBLE_DATA_CHANGED, uno::Any(), - uno::Any()); + uno::Any(), -1); // Tell children manager of the modified view forwarder. if (mpChildrenManager != nullptr) @@ -976,7 +976,7 @@ OUString AccessibleShape::GetFullAccessibleName (AccessibleShape *shape) CommitChange( AccessibleEventId::NAME_CHANGED, aNewValue, - aOldValue); + aOldValue, -1); } aAccName = sName; return sName; diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 27ad6747500b..d836f2ee4970 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -1406,10 +1406,10 @@ namespace accessibility if (mxFrontEnd.is()) aEvent = AccessibleEventObject(mxFrontEnd->getAccessibleContext(), nEventId, - rNewValue, rOldValue); + rNewValue, rOldValue, -1); else aEvent = AccessibleEventObject(uno::Reference<uno::XInterface>(), nEventId, - rNewValue, rOldValue); + rNewValue, rOldValue, -1); // no locking necessary, FireEvent internally copies listeners // if someone removes/adds in between Further locking, diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 36390c7a033b..8a54822796ee 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -447,7 +447,7 @@ void ChildrenManagerImpl::CreateAccessibilityObjects ( mrContext.CommitChange ( AccessibleEventId::CHILD, uno::Any(uno::Reference<XAccessible>(rChild.mxAccessibleShape)), - uno::Any()); + uno::Any(), -1); } ++nPos; } @@ -499,7 +499,8 @@ void ChildrenManagerImpl::AddShape (const Reference<drawing::XShape>& rxShape) mrContext.CommitChange ( AccessibleEventId::CHILD, aNewShape, - uno::Any()); + uno::Any(), + maVisibleChildren.size() - 1); RegisterAsDisposeListener(rxShape); } @@ -559,7 +560,7 @@ void ChildrenManagerImpl::ClearAccessibleShapeList() mrContext.CommitChange ( AccessibleEventId::INVALIDATE_ALL_CHILDREN, uno::Any(), - uno::Any()); + uno::Any(), -1); // Now the objects in the local lists can be safely disposed without // having problems with callers that want to update their child lists. @@ -770,7 +771,7 @@ bool ChildrenManagerImpl::ReplaceChild ( mrContext.CommitChange ( AccessibleEventId::CHILD, uno::Any(), - uno::Any (uno::Reference<XAccessible>(I->mxAccessibleShape))); + uno::Any (uno::Reference<XAccessible>(I->mxAccessibleShape)), -1); // Replace with replacement and send an event about existence // of the new child. @@ -787,7 +788,7 @@ bool ChildrenManagerImpl::ReplaceChild ( mrContext.CommitChange ( AccessibleEventId::CHILD, uno::Any (uno::Reference<XAccessible>(I->mxAccessibleShape)), - uno::Any()); + uno::Any(), -1); return true; } @@ -961,7 +962,7 @@ void ChildrenManagerImpl::UpdateSelection() if (nAddSelect >= 10 )//fire selection within { - mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN,uno::Any(),uno::Any()); + mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN,uno::Any(),uno::Any(), -1); nAddSelect =0 ;//not fire selection event } for (VEC_SHAPE::reverse_iterator vi = vecSelect.rbegin(), aEndVecSelect = vecSelect.rend(); vi != aEndVecSelect ;++vi) @@ -977,7 +978,7 @@ void ChildrenManagerImpl::UpdateSelection() { if ( nAddSelect > 0 ) { - mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD,anyShape,uno::Any()); + mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD,anyShape,uno::Any(), -1); } } else @@ -985,7 +986,7 @@ void ChildrenManagerImpl::UpdateSelection() //if has not selected shape ,first selected shape is fire selection event; if (nAddSelect > 0 ) { - mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED,anyShape,uno::Any()); + mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED,anyShape,uno::Any(), -1); } if (nAddSelect > 1 )//check other selected shape fire selection add event { @@ -995,7 +996,7 @@ void ChildrenManagerImpl::UpdateSelection() } else //selection remove { - mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE,anyShape,uno::Any()); + mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE,anyShape,uno::Any(), -1); } } @@ -1077,7 +1078,7 @@ void ChildDescriptor::disposeAccessibleObject (AccessibleContextBase& rParent) rParent.CommitChange ( AccessibleEventId::CHILD, uno::Any(), - aOldValue); + aOldValue, -1); // Dispose and remove the object. if (mxAccessibleShape.is()) diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 5662e1fdffc6..989d5b4650cd 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -305,7 +305,7 @@ void SvxGraphCtrlAccessibleContext::CommitChange ( static_cast<uno::XWeak*>(this), nEventId, rNewValue, - rOldValue); + rOldValue, -1); if (mnClientId) comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent ); @@ -712,7 +712,7 @@ void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster& /*rBC*/, const SfxHi rtl::Reference<AccessibleShape> pShape((*iter).second); if( pShape.is() ) - pShape->CommitChange( AccessibleEventId::VISIBLE_DATA_CHANGED, uno::Any(), uno::Any() ); + pShape->CommitChange( AccessibleEventId::VISIBLE_DATA_CHANGED, uno::Any(), uno::Any(), -1 ); } } break; diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index fc401d29fbfb..1bb1ca78482a 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -461,7 +461,7 @@ 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()); + CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any(), -1); // update our children that our screen position might have changed if( mpText ) diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx index 24880596af69..cc3a8e90b7f3 100644 --- a/svx/source/table/accessibletableshape.cxx +++ b/svx/source/table/accessibletableshape.cxx @@ -305,7 +305,7 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/ //notify bridge to update the acc cache. AccessibleTableShape *pAccTable = dynamic_cast <AccessibleTableShape *> (mxAccessible.get()); if (pAccTable) - pAccTable->CommitChange(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any()); + pAccTable->CommitChange(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any(), -1); } catch( const Exception& ) { @@ -911,17 +911,17 @@ void SAL_CALL AccessibleTableShape::selectionChanged (const EventObject& rEvent if (mnPreviousSelectionCount == 0 && nCount > 0 && bSelected) { xAccCell->SetState(AccessibleStateType::SELECTED); - xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED, Any(), Any()); + xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED, Any(), Any(), -1); } else if (bSelected) { xAccCell->SetState(AccessibleStateType::SELECTED); - xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD, Any(), Any()); + xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD, Any(), Any(), -1); } else { xAccCell->ResetState(AccessibleStateType::SELECTED); - xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, Any(), Any()); + xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, Any(), Any(), -1); } mnPreviousSelectionCount = nCount; } diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index f52542eda72a..70cc1eb27929 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1531,7 +1531,7 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=fa ::accessibility::AccessibleShape *pAccShape = rpShape.get(); if (pAccShape) { - pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any()); + pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any(), -1); } } @@ -1585,7 +1585,7 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=fa ::accessibility::AccessibleShape *pAccShape = rpShape.get(); if (pAccShape) { - pAccShape->CommitChange(nEventID, uno::Any(), uno::Any()); + pAccShape->CommitChange(nEventID, uno::Any(), uno::Any(), -1); } } } diff --git a/vcl/unx/gtk3/a11y/atklistener.cxx b/vcl/unx/gtk3/a11y/atklistener.cxx index f850f450f199..b0f091142832 100644 --- a/vcl/unx/gtk3/a11y/atklistener.cxx +++ b/vcl/unx/gtk3/a11y/atklistener.cxx @@ -163,28 +163,40 @@ void AtkListener::updateChildList( void AtkListener::handleChildAdded( const uno::Reference< accessibility::XAccessibleContext >& rxParent, - const uno::Reference< accessibility::XAccessible>& rxAccessible) + const uno::Reference< accessibility::XAccessible>& rxAccessible, + sal_Int32 nIndexHint) { AtkObject * pChild = rxAccessible.is() ? atk_object_wrapper_ref( rxAccessible ) : nullptr; - if( pChild ) + if( !pChild ) + return; + + if (nIndexHint != -1) { + sal_Int64 nStateSet = rxParent->getAccessibleStateSet(); + if( !(nStateSet & accessibility::AccessibleStateType::DEFUNC) + || (nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS) ) + { + m_aChildList.insert(m_aChildList.begin() + nIndexHint, rxAccessible); + } + } + else updateChildList(rxParent); - atk_object_wrapper_add_child( mpWrapper, pChild, - atk_object_get_index_in_parent( pChild )); + atk_object_wrapper_add_child( mpWrapper, pChild, + atk_object_get_index_in_parent( pChild )); - g_object_unref( pChild ); - } + g_object_unref( pChild ); } /*****************************************************************************/ void AtkListener::handleChildRemoved( const uno::Reference< accessibility::XAccessibleContext >& rxParent, - const uno::Reference< accessibility::XAccessible>& rxChild) + const uno::Reference< accessibility::XAccessible>& rxChild, + int nChildIndexHint) { - sal_Int32 nIndex = -1; + sal_Int32 nIndex = nChildIndexHint; // Locate the child in the children list const size_t nmax = m_aChildList.size(); @@ -231,7 +243,14 @@ void AtkListener::handleChildRemoved( xBroadcaster->removeAccessibleEventListener(xListener); } - updateChildList(rxParent); + // update child list + sal_Int64 nStateSet = rxParent->getAccessibleStateSet(); + if(!( (nStateSet & accessibility::AccessibleStateType::DEFUNC) + || (nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS) )) + { + assert( m_aChildList[nIndex] == rxParent->getAccessibleChild(nIndex) ); + m_aChildList.erase(m_aChildList.begin() + nIndex); + } AtkObject * pChild = atk_object_wrapper_ref( rxChild, false ); if( pChild ) @@ -442,10 +461,10 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven g_return_if_fail( xParent.is() ); if( aEvent.OldValue >>= xChild ) - handleChildRemoved(xParent, xChild); + handleChildRemoved(xParent, xChild, aEvent.IndexHint); if( aEvent.NewValue >>= xChild ) - handleChildAdded(xParent, xChild); + handleChildAdded(xParent, xChild, aEvent.IndexHint); break; } diff --git a/vcl/unx/gtk3/a11y/atklistener.hxx b/vcl/unx/gtk3/a11y/atklistener.hxx index 7dcd78509b38..546c5e9456fb 100644 --- a/vcl/unx/gtk3/a11y/atklistener.hxx +++ b/vcl/unx/gtk3/a11y/atklistener.hxx @@ -53,12 +53,14 @@ private: // Process CHILD_EVENT notifications with a new child added void handleChildAdded( const css::uno::Reference< css::accessibility::XAccessibleContext >& rxParent, - const css::uno::Reference< css::accessibility::XAccessible>& rxChild); + const css::uno::Reference< css::accessibility::XAccessible>& rxChild, + int nIndexHint); // Process CHILD_EVENT notifications with a child removed void handleChildRemoved( const css::uno::Reference< css::accessibility::XAccessibleContext >& rxParent, - const css::uno::Reference< css::accessibility::XAccessible>& rxChild); + const css::uno::Reference< css::accessibility::XAccessible>& rxChild, + int nIndexHint); // Process INVALIDATE_ALL_CHILDREN notification void handleInvalidateChildren( |