winaccessibility/inc/AccObject.hxx | 3 - winaccessibility/inc/accHelper.hxx | 10 ----- winaccessibility/source/service/AccObject.cxx | 49 +++++++------------------- 3 files changed, 15 insertions(+), 47 deletions(-)
New commits: commit 7bd37ba0bfcaf8e68db562227c489db08796b641 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Sep 30 13:05:51 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Sep 30 21:40:28 2024 +0200 wina11y: Rename UNO_MSAA_UNMAPPING to MSAA_NO_STATE ... to make clear that this is a constant with no state set. Also, move the definition to the only source file where it's used. Change-Id: Iaaba8d7053f71c63caab57c2b692b8e5898d37cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174276 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/winaccessibility/inc/accHelper.hxx b/winaccessibility/inc/accHelper.hxx index 99843c0359b2..2ec5a4078585 100644 --- a/winaccessibility/inc/accHelper.hxx +++ b/winaccessibility/inc/accHelper.hxx @@ -21,8 +21,6 @@ #include "UAccCOMdllapi.h" -#define UNO_MSAA_UNMAPPING 0x00000000 - struct IMAccessible; UACCCOM_DLLPUBLIC IMAccessible* UAccCOMCreateInstance(); diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index 22b9f3311cd4..2cc9f7308a50 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -51,6 +51,8 @@ using namespace com::sun::star::uno; using namespace com::sun::star::accessibility; using namespace com::sun::star::accessibility::AccessibleRole; +constexpr DWORD MSAA_NO_STATE = 0x00000000; + namespace { /** @@ -473,12 +475,10 @@ short AccObject::GetRole() const */ DWORD AccObject::GetMSAAStateFromUNO(sal_Int64 nState) { - DWORD IState = UNO_MSAA_UNMAPPING; - if( !m_xAccContextRef.is() ) { assert(false); - return IState; + return MSAA_NO_STATE; } switch( nState ) @@ -507,11 +507,11 @@ DWORD AccObject::GetMSAAStateFromUNO(sal_Int64 nState) return STATE_SYSTEM_SIZEABLE; case AccessibleStateType::SELECTABLE: if (m_accRole == MENU || m_accRole == MENU_ITEM) - return UNO_MSAA_UNMAPPING; + return MSAA_NO_STATE; return STATE_SYSTEM_SELECTABLE; case AccessibleStateType::SELECTED: if (m_accRole == MENU || m_accRole == MENU_ITEM) - return UNO_MSAA_UNMAPPING; + return MSAA_NO_STATE; return STATE_SYSTEM_SELECTED; case AccessibleStateType::ARMED: return STATE_SYSTEM_FOCUSED; @@ -523,14 +523,14 @@ DWORD AccObject::GetMSAAStateFromUNO(sal_Int64 nState) if (!(m_xAccContextRef->getAccessibleStateSet() & AccessibleStateType::EXPANDED)) return STATE_SYSTEM_COLLAPSED; - return UNO_MSAA_UNMAPPING; + return MSAA_NO_STATE; } //Remove the SENSITIVE state mapping. There is no corresponding MSAA state. //case SENSITIVE: // IState = STATE_SYSTEM_PROTECTED; case AccessibleStateType::EDITABLE: m_pIMAcc->DecreaseState(STATE_SYSTEM_READONLY); - return UNO_MSAA_UNMAPPING; + return MSAA_NO_STATE; case AccessibleStateType::OFFSCREEN: return STATE_SYSTEM_OFFSCREEN; case AccessibleStateType::MOVEABLE: @@ -541,7 +541,7 @@ DWORD AccObject::GetMSAAStateFromUNO(sal_Int64 nState) case AccessibleStateType::DEFAULT: return STATE_SYSTEM_DEFAULT; default: - return UNO_MSAA_UNMAPPING; + return MSAA_NO_STATE; } } @@ -576,7 +576,7 @@ void AccObject::DecreaseState( sal_Int64 xState ) } DWORD msState = GetMSAAStateFromUNO(xState); - if(msState!=UNO_MSAA_UNMAPPING) + if (msState != MSAA_NO_STATE) m_pIMAcc->DecreaseState(msState); } @@ -598,7 +598,7 @@ void AccObject::IncreaseState( sal_Int64 xState ) DWORD msState = GetMSAAStateFromUNO(xState); - if(msState!=UNO_MSAA_UNMAPPING) + if (msState != MSAA_NO_STATE) m_pIMAcc->IncreaseState( msState ); } commit 7f2fe1837d01a62ae38a06496fb6bd677d31ae2b Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Sep 30 12:47:16 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Sep 30 21:40:20 2024 +0200 wina11y: Drop always default AccObject::InsertChild pos param This `pos` param never gets passed explicitly, so is always the default `LAST_CHILD`. Therefore, drop the param completely to simplify this. Change-Id: I8f51fe58b47bb2f0c18a853c81b8b6c85d4a6602 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174275 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/winaccessibility/inc/AccObject.hxx b/winaccessibility/inc/AccObject.hxx index 208403ead1cf..1811b8f9b033 100644 --- a/winaccessibility/inc/AccObject.hxx +++ b/winaccessibility/inc/AccObject.hxx @@ -86,7 +86,7 @@ public: void SetParentObj(AccObject* pParentAccObj); AccObject* GetParentObj(); - void InsertChild( AccObject* pChild,short pos = LAST_CHILD); + void InsertChild(AccObject* pChild); void DeleteChild( AccObject* pChild ); AccObject* NextChild(); diff --git a/winaccessibility/inc/accHelper.hxx b/winaccessibility/inc/accHelper.hxx index 4e2d941c418a..99843c0359b2 100644 --- a/winaccessibility/inc/accHelper.hxx +++ b/winaccessibility/inc/accHelper.hxx @@ -21,14 +21,6 @@ #include "UAccCOMdllapi.h" -enum DIRECTION -{ - FIRST_CHILD = 0, - LAST_CHILD = -1, - BEFORE_CHILD = 1, - AFTER_CHILD = 2 -}; - #define UNO_MSAA_UNMAPPING 0x00000000 struct IMAccessible; diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index 29bc4c7f6475..22b9f3311cd4 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -286,25 +286,16 @@ AccObject::~AccObject() /** * Insert a child element. * @param pChild Child element that should be inserted into child list. - * @param pos Insert position. * @return */ -void AccObject::InsertChild( AccObject* pChild,short pos ) +void AccObject::InsertChild(AccObject* pChild) { - std::vector<AccObject*>::iterator iter; iter = std::find(m_childrenList.begin(),m_childrenList.end(),pChild); if(iter!=m_childrenList.end()) return; - if(LAST_CHILD==pos) - { - m_childrenList.push_back(pChild); - } - else - { - iter=m_childrenList.begin()+pos; - m_childrenList.insert(iter,pChild); - } + + m_childrenList.push_back(pChild); pChild->SetParentObj(this); } commit fb779c2acf62332c27c4af56c54b3561adcde123 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Sep 30 12:40:05 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Sep 30 21:40:13 2024 +0200 wina11y: Move AccObject::GetExpandedState logic to only caller Change-Id: I5505abf795c1133b77b9c4ec7bb762401b9a3826 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174274 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/winaccessibility/inc/AccObject.hxx b/winaccessibility/inc/AccObject.hxx index e0ce518b0506..208403ead1cf 100644 --- a/winaccessibility/inc/AccObject.hxx +++ b/winaccessibility/inc/AccObject.hxx @@ -62,7 +62,6 @@ private: DWORD GetMSAAStateFromUNO(sal_Int64 xState);//translate state from UNO to MSAA value css::accessibility::XAccessibleSelection* GetXAccessibleSelection(); - bool GetExpandedState(); static OUString GetMAccessibleValueFromAny(css::uno::Any pAny); public: diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index 01382ca94fbb..29bc4c7f6475 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -529,8 +529,7 @@ DWORD AccObject::GetMSAAStateFromUNO(sal_Int64 nState) if (m_accRole == PUSH_BUTTON || m_accRole == TOGGLE_BUTTON || m_accRole == BUTTON_DROPDOWN) return STATE_SYSTEM_HASPOPUP; - const bool isExpanded = GetExpandedState(); - if(!isExpanded) + if (!(m_xAccContextRef->getAccessibleStateSet() & AccessibleStateType::EXPANDED)) return STATE_SYSTEM_COLLAPSED; return UNO_MSAA_UNMAPPING; @@ -851,17 +850,6 @@ void AccObject::unsetFocus() m_pIMAcc->Put_XAccFocus(UACC_NO_FOCUS); } -bool AccObject::GetExpandedState() -{ - if( !m_xAccContextRef.is() ) - { - return false; - } - - sal_Int64 nRState = m_xAccContextRef->getAccessibleStateSet(); - return (nRState & AccessibleStateType::EXPANDED); -} - void AccObject::NotifyDestroy() { m_pIMAcc->NotifyDestroy(); } void AccObject::SetParentObj(AccObject* pParentAccObj)