winaccessibility/source/UAccCOM/AccActionBase.cxx | 3 -- winaccessibility/source/UAccCOM/MAccessible.cxx | 27 +++++++++++++--------- winaccessibility/source/UAccCOM/MAccessible.h | 3 +- winaccessibility/source/UAccCOM/acccommon.h | 14 ----------- 4 files changed, 19 insertions(+), 28 deletions(-)
New commits: commit 5ba7e1586f03b8227f9c5a09d0b85587412ee2ae Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Oct 1 11:25:59 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Oct 1 17:47:56 2024 +0200 wina11y: Use enum class for navigation direction Switch the `DM_NIR` enum to an enum class `NavigationDirection` and move it to MAccessible.{h,cxx} which is the only place where it's used. The param name of "flags" previously used in CMAccessible::GetNavigateChildForDM was misleading, as any of the values can only be handled exclusively. Change-Id: I39d8d6afc5c8c845b3aa0add7bd314501f4c91b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174320 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index 8763b48dd3a3..814f13c1ea7d 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -88,6 +88,13 @@ enum class XInterfaceType { XI_ATTRIBUTE }; +enum class NavigationDirection { + FIRST_CHILD, + LAST_CHILD, + NEXT_CHILD, + PREVIOUS_CHILD, +}; + template <class Interface> bool queryXInterface(XAccessible* pXAcc, XInterface** ppXI) { @@ -1315,10 +1322,10 @@ IMAccessible* CMAccessible::GetChildInterface(long dChildID)//for test /** * for descendantmanager circumstance,provide child interface when navigate * @param varCur, the current child. -* @param flags, the navigation direction. +* @param eDirection, the navigation direction. * @return IMAccessible*, the child of the end up node. */ -IMAccessible* CMAccessible::GetNavigateChildForDM(VARIANT varCur, short flags) +IMAccessible* CMAccessible::GetNavigateChildForDM(VARIANT varCur, NavigationDirection eDirection) { XAccessibleContext* pXContext = GetContextByXAcc(m_xAccessible.get()); @@ -1334,16 +1341,16 @@ IMAccessible* CMAccessible::GetNavigateChildForDM(VARIANT varCur, short flags) } Reference<XAccessible> pRChildXAcc; - switch(flags) + switch(eDirection) { - case DM_FIRSTCHILD: + case NavigationDirection::FIRST_CHILD: pRChildXAcc = pXContext->getAccessibleChild(0); break; - case DM_LASTCHILD: + case NavigationDirection::LAST_CHILD: pRChildXAcc = pXContext->getAccessibleChild(count-1); break; - case DM_NEXTCHILD: - case DM_PREVCHILD: + case NavigationDirection::NEXT_CHILD: + case NavigationDirection::PREVIOUS_CHILD: { IMAccessible* pCurChild = GetChildInterface(varCur.lVal); if(pCurChild==nullptr) @@ -1361,7 +1368,7 @@ IMAccessible* CMAccessible::GetNavigateChildForDM(VARIANT varCur, short flags) { return nullptr; } - const sal_Int64 delta = (flags == DM_NEXTCHILD) ? 1 : -1; + const sal_Int64 delta = (eDirection == NavigationDirection::NEXT_CHILD) ? 1 : -1; //currently, getAccessibleIndexInParent is error in UNO for //some kind of List,such as ValueSet, the index will be less 1 than //what should be, need to fix UNO code @@ -1411,7 +1418,7 @@ HRESULT CMAccessible::GetFirstChild(VARIANT varStart,VARIANT* pvarEndUpAt) return E_INVALIDARG; } - pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_FIRSTCHILD); + pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, NavigationDirection::FIRST_CHILD); if(pvarEndUpAt->pdispVal) { pvarEndUpAt->pdispVal->AddRef(); @@ -1448,7 +1455,7 @@ HRESULT CMAccessible::GetLastChild(VARIANT varStart,VARIANT* pvarEndUpAt) return E_INVALIDARG; } - pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_LASTCHILD); + pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, NavigationDirection::LAST_CHILD); if(pvarEndUpAt->pdispVal) { pvarEndUpAt->pdispVal->AddRef(); diff --git a/winaccessibility/source/UAccCOM/MAccessible.h b/winaccessibility/source/UAccCOM/MAccessible.h index 7bd2153bf344..2a4f792fd88a 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.h +++ b/winaccessibility/source/UAccCOM/MAccessible.h @@ -33,6 +33,7 @@ namespace { enum class XInterfaceType; +enum class NavigationDirection; } /** @@ -183,7 +184,7 @@ private: // the helper methods in order to implement the above public methods IMAccessible* GetChildInterface(long dChildIndex);//notice here the parameter is child index,not child id - IMAccessible* GetNavigateChildForDM(VARIANT varCur,short flags);//for descendant manage + IMAccessible* GetNavigateChildForDM(VARIANT varCur, NavigationDirection eDirection); HRESULT GetFirstChild(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation HRESULT GetLastChild(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation HRESULT GetNextSibling(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation diff --git a/winaccessibility/source/UAccCOM/acccommon.h b/winaccessibility/source/UAccCOM/acccommon.h index d0ce6200614b..0de27ea9c794 100644 --- a/winaccessibility/source/UAccCOM/acccommon.h +++ b/winaccessibility/source/UAccCOM/acccommon.h @@ -46,13 +46,6 @@ struct ltComp } }; -enum DM_NIR { - DM_FIRSTCHILD = 0x00, - DM_LASTCHILD = 0x01, - DM_NEXTCHILD = 0x02, - DM_PREVCHILD = 0x03 -}; - template<typename T, typename Ifc> HRESULT createInstance(REFIID iid, Ifc ** ppIfc) { commit 8e0a3ee310fa361ffee5b4f4c86a4c19512ebf7d Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Oct 1 11:02:36 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Oct 1 17:47:49 2024 +0200 wina11y: Drop unused defines Change-Id: Ic16f46b19b3478069cc9bafb4e6605f9a88733d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174319 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/winaccessibility/source/UAccCOM/acccommon.h b/winaccessibility/source/UAccCOM/acccommon.h index 44003292be7f..d0ce6200614b 100644 --- a/winaccessibility/source/UAccCOM/acccommon.h +++ b/winaccessibility/source/UAccCOM/acccommon.h @@ -53,13 +53,6 @@ enum DM_NIR { DM_PREVCHILD = 0x03 }; - -#define SELECT_STR L"Select" -#define PRESS_STR L"Press" -#define UNCHECK_STR L"UnCheck" -#define CHECK_STR L"Check" -//End - template<typename T, typename Ifc> HRESULT createInstance(REFIID iid, Ifc ** ppIfc) { commit d7e2dd82f3216c9f2b055a782c9d712c8a66394b Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Oct 1 10:55:26 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Oct 1 17:47:42 2024 +0200 wina11y: Drop unused includes + "using namespace" Change-Id: I3006690efbedd75970eea34412392a36847db8d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174318 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/winaccessibility/source/UAccCOM/AccActionBase.cxx b/winaccessibility/source/UAccCOM/AccActionBase.cxx index 81165464cc8b..4a05296ad1f5 100644 --- a/winaccessibility/source/UAccCOM/AccActionBase.cxx +++ b/winaccessibility/source/UAccCOM/AccActionBase.cxx @@ -24,8 +24,6 @@ #include "AccActionBase.h" #include <com/sun/star/accessibility/XAccessible.hpp> -#include <com/sun/star/accessibility/AccessibleStateType.hpp> -#include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <vcl/svapp.hxx> @@ -35,7 +33,6 @@ #include "acccommon.h" -using namespace com::sun::star::accessibility::AccessibleRole; using namespace com::sun::star::accessibility; using namespace com::sun::star::uno; using namespace com::sun::star::awt;