diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-01-05 13:41:53 +0000 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2022-01-06 10:10:11 +0100 |
commit | fcf4a26275d7503835f9aa23cb94938809840300 (patch) | |
tree | a0309a62d9cd949b85fe1dd391822f2b63188003 /winaccessibility | |
parent | e9b6eedd66257decf7ac36b71b06e91609f1e02e (diff) |
tdf#146306 wina11y: Retrieve accessible desc on demand
Adapt 'MAccessible::get_accDescription' to directly
retrieve the accessible description on demand via the
corresponding XAccessible, rather than keeping
track of it in a class member.
This simplifies the handling and makes it
unnecessary to "manually" update the description
on 'accessibility::AccessibleEventId::DESCRIPTION_CHANGED'
events, since the new value will
be queried next time it is needed anyway.
This also fixes the problem that a significant
amount of time was spent generating accessible
descriptions for all newly inserted a11y objects when
entering values into Calc cells with the NVDA
screen reader in use, resulting in several
seconds of delay.
Querying up-to-date values from the underlying
UNO interfaces on demand instead of doing extra
manual bookkeeping in the winaccessibility code
may be possible for more a11y attributes in addition
to the accessible description handled in this commit,
but each one will have to be looked at separately.
Change-Id: I57f4c523ca8b10afad3f9c347c8ff5e9420ad968
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128006
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'winaccessibility')
12 files changed, 9 insertions, 117 deletions
diff --git a/winaccessibility/inc/AccObject.hxx b/winaccessibility/inc/AccObject.hxx index 2a246ce43b29..6da9d6621c5e 100644 --- a/winaccessibility/inc/AccObject.hxx +++ b/winaccessibility/inc/AccObject.hxx @@ -114,7 +114,6 @@ public: void SetName( css::uno::Any newName); void SetValue( css::uno::Any pAny ); - void SetDescription( css::uno::Any newDesc ); void SetRole( short Role ); short GetRole() const; @@ -123,7 +122,6 @@ public: void UpdateName(); void UpdateValue(); void UpdateAction(); - void UpdateDescription(); void UpdateValidWindow(); void UpdateLocation(); diff --git a/winaccessibility/inc/AccObjectManagerAgent.hxx b/winaccessibility/inc/AccObjectManagerAgent.hxx index 579a785b41bb..a0f3daec579b 100644 --- a/winaccessibility/inc/AccObjectManagerAgent.hxx +++ b/winaccessibility/inc/AccObjectManagerAgent.hxx @@ -76,9 +76,6 @@ public: void UpdateAccName( css::accessibility::XAccessible* pXAcc, css::uno::Any newName); void UpdateAccName( css::accessibility::XAccessible* pXAcc); - void UpdateDescription( css::accessibility::XAccessible* pXAcc, css::uno::Any newDesc ); - void UpdateDescription( css::accessibility::XAccessible* pXAcc ); - void NotifyDestroy(css::accessibility::XAccessible* pXAcc); css::accessibility::XAccessible* GetParentXAccessible( css::accessibility::XAccessible* pXAcc ); diff --git a/winaccessibility/inc/AccObjectWinManager.hxx b/winaccessibility/inc/AccObjectWinManager.hxx index 4f35668c56ef..911c83ea2a8f 100644 --- a/winaccessibility/inc/AccObjectWinManager.hxx +++ b/winaccessibility/inc/AccObjectWinManager.hxx @@ -122,9 +122,6 @@ public: void SetAccName( css::accessibility::XAccessible* pXAcc, css::uno::Any newName); void UpdateAccName( css::accessibility::XAccessible* pXAcc ); - void SetDescription( css::accessibility::XAccessible* pXAcc, css::uno::Any newDesc ); - void UpdateDescription( css::accessibility::XAccessible* pXAcc ); - void SetRole( css::accessibility::XAccessible* pXAcc, long Role ); void UpdateAccFocus( css::accessibility::XAccessible* newFocus ); diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index 7437f8a586c9..0e3de1af1b53 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -200,7 +200,6 @@ m_pszValue(nullptr), m_pszActionDescription(nullptr), m_iRole(0x00), m_dState(0x00), -m_pszDescription(nullptr), m_pIParent(nullptr), m_dChildID(0x00), m_dFocusChildID(UACC_NO_FOCUS), @@ -227,10 +226,6 @@ CMAccessible::~CMAccessible() { SAFE_SYSFREESTRING(m_pszValue); } - if(m_pszDescription!=nullptr) - { - SAFE_SYSFREESTRING(m_pszDescription); - } if(m_pszActionDescription!=nullptr) { @@ -462,8 +457,16 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_accDescription(VARIANT varCh { if(varChild.lVal==CHILDID_SELF) { + if (!m_xAccessible.is()) + return S_FALSE; + + Reference<XAccessibleContext> xContext = m_xAccessible->getAccessibleContext(); + if (!xContext.is()) + return S_FALSE; + + const OUString sDescription = xContext->getAccessibleDescription(); SAFE_SYSFREESTRING(*pszDescription); - *pszDescription = SysAllocString(m_pszDescription); + *pszDescription = SysAllocString(o3tl::toW(sDescription.getStr())); return S_OK; } @@ -1199,34 +1202,6 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::SetState(DWORD pXSate) return S_OK; } - -/** -* Set the accessible description of the current COM object self from UNO. -* @param pszDescription, the name used to set the description of the current object. -* @return S_OK if successful and E_FAIL if failure. -*/ -COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::Put_XAccDescription(const OLECHAR __RPC_FAR *pszDescription) -{ - // internal IMAccessible - no mutex meeded - - ENTER_PROTECTED_BLOCK - ISDESTROY() - // #CHECK# - if(pszDescription == nullptr) - { - return E_INVALIDARG; - } - - SAFE_SYSFREESTRING(m_pszDescription); - m_pszDescription = SysAllocString(pszDescription); - - if(m_pszDescription==nullptr) - return E_FAIL; - return S_OK; - - LEAVE_PROTECTED_BLOCK -} - /** * Set the accessible value of the current COM object self from UNO. * @param pszAccValue, the name used to set the value of the current object. diff --git a/winaccessibility/source/UAccCOM/MAccessible.h b/winaccessibility/source/UAccCOM/MAccessible.h index 3c662c1f12fb..1d052eae5ad4 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.h +++ b/winaccessibility/source/UAccCOM/MAccessible.h @@ -139,7 +139,6 @@ public: STDMETHOD(DecreaseState)(DWORD pXSate) override; STDMETHOD(IncreaseState)(DWORD pXSate) override; STDMETHOD(SetState)(DWORD pXSate) override; - STDMETHOD(Put_XAccDescription)(const OLECHAR __RPC_FAR *pszDescription) override; STDMETHOD(Put_XAccValue)(const OLECHAR __RPC_FAR *pszAccValue) override; STDMETHOD(Put_XAccLocation)(const Location sLocation) override; STDMETHOD(Put_XAccFocus)(long dChildID) override; @@ -159,7 +158,6 @@ private: BSTR m_pszActionDescription; unsigned short m_iRole; DWORD m_dState; - BSTR m_pszDescription; IMAccessible* m_pIParent; Location m_sLocation; diff --git a/winaccessibility/source/UAccCOMIDL/UAccCOM.idl b/winaccessibility/source/UAccCOMIDL/UAccCOM.idl index da123ab7f972..bcf20686dfa7 100644 --- a/winaccessibility/source/UAccCOMIDL/UAccCOM.idl +++ b/winaccessibility/source/UAccCOMIDL/UAccCOM.idl @@ -36,7 +36,6 @@ import "defines.idl"; [id(2), helpstring("method Put_XAccRole")] HRESULT Put_XAccRole(unsigned short pRole); [id(3), helpstring("method DecreaseState")] HRESULT DecreaseState(DWORD pXSate); [id(4), helpstring("method IncreaseState")] HRESULT IncreaseState(DWORD pXSate); - [id(5), helpstring("method Put_XDescription")] HRESULT Put_XAccDescription(const OLECHAR* pszDescription); [id(6), helpstring("method Put_XAccValue")] HRESULT Put_XAccValue(const OLECHAR* pszAccValue); [id(7), helpstring("method SetState")] HRESULT SetState(DWORD pXSate); [id(8), helpstring("method Put_XAccLocation")] HRESULT Put_XAccLocation(const Location sLocation); diff --git a/winaccessibility/source/service/AccContainerEventListener.cxx b/winaccessibility/source/service/AccContainerEventListener.cxx index 9587255acd28..ae4cccba9e0e 100644 --- a/winaccessibility/source/service/AccContainerEventListener.cxx +++ b/winaccessibility/source/service/AccContainerEventListener.cxx @@ -362,10 +362,8 @@ void AccContainerEventListener::FireStateFocusedChange(bool enable) || parentRole == AccessibleRole::PANEL) // sidebar pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, m_xAccessible.get()); } - //to update ComboBox's description else if (role == AccessibleRole::COMBO_BOX ) { - pAgent->UpdateDescription(m_xAccessible.get()); //for editable combobox, send focus event on only edit control, bool bSendFocusOnCombobox = true; //send focused event to the first text child diff --git a/winaccessibility/source/service/AccEventListener.cxx b/winaccessibility/source/service/AccEventListener.cxx index 3168476c5935..1d378040ce3f 100644 --- a/winaccessibility/source/service/AccEventListener.cxx +++ b/winaccessibility/source/service/AccEventListener.cxx @@ -99,7 +99,6 @@ void AccEventListener::HandleNameChangedEvent(Any name) */ void AccEventListener::HandleDescriptionChangedEvent(Any desc) { - pAgent->UpdateDescription(m_xAccessible.get(), desc); pAgent->NotifyAccEvent(UM_EVENT_OBJECT_DESCRIPTIONCHANGE, m_xAccessible.get()); } diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index e9ca101207fe..781c58c82e71 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -285,22 +285,6 @@ void AccObject::UpdateName( ) return ; } -/** - * Update description property to com object. - * no content for update description - * @param - * @return - */ -void AccObject::UpdateDescription() -{ - if (!m_pIMAcc) - { - return; - } - - m_pIMAcc->Put_XAccDescription(o3tl::toW(m_xAccContextRef->getAccessibleDescription().getStr())); - return ; -} /** * Update default action property to com object. @@ -502,18 +486,6 @@ void AccObject::SetName( Any pAny) } /** - * Set description property via pAny. - * @param pAny New accessible description. - * @return - */ -void AccObject::SetDescription( Any pAny ) -{ - if( nullptr == m_pIMAcc ) - return ; - m_pIMAcc->Put_XAccDescription( o3tl::toW(GetMAccessibleValueFromAny(pAny).getStr()) ); -} - -/** * Set role property via pAny * @param Role New accessible role. * @return @@ -1023,8 +995,6 @@ bool AccObject:: UpdateAccessibleInfoFromUnoToMSAA ( ) UpdateValue(); - UpdateDescription(); - UpdateActionDesc(); UpdateRole(); diff --git a/winaccessibility/source/service/AccObjectContainerEventListener.cxx b/winaccessibility/source/service/AccObjectContainerEventListener.cxx index dc99d3394c4a..429e99734e78 100644 --- a/winaccessibility/source/service/AccObjectContainerEventListener.cxx +++ b/winaccessibility/source/service/AccObjectContainerEventListener.cxx @@ -52,7 +52,6 @@ void AccObjectContainerEventListener::HandleStateChangedEvent(Any oldValue, Any if (newV == AccessibleStateType::FOCUSED) { pAgent->UpdateAccName(m_xAccessible.get()); - pAgent->UpdateDescription(m_xAccessible.get()); } } AccContainerEventListener::HandleStateChangedEvent(oldValue, newValue); diff --git a/winaccessibility/source/service/AccObjectManagerAgent.cxx b/winaccessibility/source/service/AccObjectManagerAgent.cxx index 62d58f384f17..f28dd766b9e7 100644 --- a/winaccessibility/source/service/AccObjectManagerAgent.cxx +++ b/winaccessibility/source/service/AccObjectManagerAgent.cxx @@ -123,18 +123,6 @@ void AccObjectManagerAgent::UpdateLocation( XAccessible* /* pXAcc */, long /*to } /** - * Interface of updating MSAA name when UNO description_changed event occurs. - * @param pXAcc Uno XAccessible interface of control. - * @param newDesc New UNO accessible description. - * @return - */ -void AccObjectManagerAgent::UpdateDescription( XAccessible* pXAcc, Any newDesc ) -{ - if( pWinManager ) - pWinManager->SetDescription( pXAcc, newDesc ); -} - -/** * When a new UNO XAccessible object is found by listener, we create a corresponding * com object and insert it to our manager list. * @param pXAcc Uno XAccessible interface of control. @@ -333,12 +321,6 @@ short AccObjectManagerAgent::GetParentRole( XAccessible* pXAcc ) return -1; } -void AccObjectManagerAgent::UpdateDescription( XAccessible* pXAcc ) -{ - if(pWinManager) - pWinManager->UpdateDescription( pXAcc ); -} - void AccObjectManagerAgent::UpdateChildState(XAccessible* pXAcc) { if(pWinManager) diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx b/winaccessibility/source/service/AccObjectWinManager.cxx index f180127acf65..69d8af6ee65a 100644 --- a/winaccessibility/source/service/AccObjectWinManager.cxx +++ b/winaccessibility/source/service/AccObjectWinManager.cxx @@ -924,13 +924,6 @@ void AccObjectWinManager::UpdateAction( XAccessible* pXAcc ) pAccObj->UpdateAction(); } -void AccObjectWinManager::UpdateDescription( XAccessible* pXAcc ) -{ - AccObject* pAccObj = GetAccObjByXAcc( pXAcc ); - if ( pAccObj ) - pAccObj->UpdateDescription(); -} - /** * Set corresponding com object's accessible location via XAccessible interface and new * location. @@ -985,19 +978,6 @@ void AccObjectWinManager::SetAccName( XAccessible* pXAcc, Any newName) } /** - * Set corresponding com object's description via XAccessible interface and new description. - * @param pXAcc XAccessible interface. - * @param newDesc new description - * @return - */ -void AccObjectWinManager::SetDescription( XAccessible* pXAcc, Any newDesc ) -{ - AccObject* pAccObj = GetAccObjByXAcc( pXAcc ); - if( pAccObj ) - pAccObj->SetDescription( newDesc ); -} - -/** * Set corresponding com object's role via XAccessible interface and new role. * @param pXAcc XAccessible interface. * @param Role new role |