[Libreoffice-commits] core.git: winaccessibility/source
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 28 13:34:43 UTC 2021
winaccessibility/source/UAccCOM/MAccessible.cxx | 79 +++++++++++-------------
winaccessibility/source/UAccCOM/MAccessible.h | 6 +
2 files changed, 44 insertions(+), 41 deletions(-)
New commits:
commit 1c1aadc804f4b34b764002c23dc916530d1c7908
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Mon Jun 28 12:52:30 2021 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Jun 28 15:34:10 2021 +0200
wina11y: enum XInterfaceIndex -> enum class XInterfaceType
Convert enum 'XInterfaceIndex' to an
enum class 'XInterfaceType'.
Also, drop the explicitly assigned but unused numerical
values (indexes?) and the unused 'XI_NULL' value from the enum.
Change-Id: Ice6d33e6523b3885836f54bc486bbe90de4c3b95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118018
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index 5e0cd681381d..a15e9104b912 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -74,21 +74,20 @@ using namespace com::sun::star::accessibility::AccessibleStateType;
namespace {
-enum XInterfaceIndex {
- XI_COMPONENT = 0x01,
- XI_TEXT = 0x02,
- XI_TABLE = 0x03,
- XI_EDITABLETEXT = 0x04,
- XI_IMAGE = 0x05,
- XI_SELECTION = 0x06,
- XI_EXTENDEDCOMP = 0x07,
- XI_VALUE = 0x08,
- XI_KEYBINDING = 0x09,
- XI_ACTION = 0x0A,
- XI_HYPERTEXT = 0x0B,
- XI_HYPERLINK = 0x0C,
- XI_ATTRIBUTE = 0x0D,
- XI_NULL = -1
+enum class XInterfaceType {
+ XI_COMPONENT,
+ XI_TEXT,
+ XI_TABLE,
+ XI_EDITABLETEXT,
+ XI_IMAGE,
+ XI_SELECTION,
+ XI_EXTENDEDCOMP,
+ XI_VALUE,
+ XI_KEYBINDING,
+ XI_ACTION,
+ XI_HYPERTEXT,
+ XI_HYPERLINK,
+ XI_ATTRIBUTE
};
template <class Interface>
@@ -2500,33 +2499,33 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::Put_ActionDescription( const OLE
LEAVE_PROTECTED_BLOCK
}
-bool CMAccessible::GetXInterfaceFromXAccessible(XAccessible* pXAcc, XInterface** ppXI, int index)
+bool CMAccessible::GetXInterfaceFromXAccessible(XAccessible* pXAcc, XInterface** ppXI, XInterfaceType eType)
{
- switch(index)
+ switch(eType)
{
- case XI_COMPONENT:
+ case XInterfaceType::XI_COMPONENT:
return queryXInterface<XAccessibleComponent>(pXAcc, ppXI);
- case XI_TEXT:
+ case XInterfaceType::XI_TEXT:
return queryXInterface<XAccessibleText>(pXAcc, ppXI);
- case XI_EDITABLETEXT:
+ case XInterfaceType::XI_EDITABLETEXT:
return queryXInterface<XAccessibleEditableText>(pXAcc, ppXI);
- case XI_TABLE:
+ case XInterfaceType::XI_TABLE:
return queryXInterface<XAccessibleTable>(pXAcc, ppXI);
- case XI_SELECTION:
+ case XInterfaceType::XI_SELECTION:
return queryXInterface<XAccessibleSelection>(pXAcc, ppXI);
- case XI_EXTENDEDCOMP:
+ case XInterfaceType::XI_EXTENDEDCOMP:
return queryXInterface<XAccessibleExtendedComponent>(pXAcc, ppXI);
- case XI_KEYBINDING:
+ case XInterfaceType::XI_KEYBINDING:
return queryXInterface<XAccessibleKeyBinding>(pXAcc, ppXI);
- case XI_ACTION:
+ case XInterfaceType::XI_ACTION:
return queryXInterface<XAccessibleAction>(pXAcc, ppXI);
- case XI_VALUE:
+ case XInterfaceType::XI_VALUE:
return queryXInterface<XAccessibleValue>(pXAcc, ppXI);
- case XI_HYPERTEXT:
+ case XInterfaceType::XI_HYPERTEXT:
return queryXInterface<XAccessibleHypertext>(pXAcc, ppXI);
- case XI_HYPERLINK:
+ case XInterfaceType::XI_HYPERLINK:
return queryXInterface<XAccessibleHyperlink>(pXAcc, ppXI);
- case XI_IMAGE:
+ case XInterfaceType::XI_IMAGE:
return queryXInterface<XAccessibleImage>(pXAcc, ppXI);
default:
return false;
@@ -2553,21 +2552,21 @@ struct AggMapEntry
{
const IID* piid;
AggCreatorFunc* pfnCreateInstance;
- int XIFIndex;
+ const XInterfaceType eXInterfaceType;
};
}
static AggMapEntry g_CMAccessible_AggMap[] = {
- { &IID_IAccessibleComponent, &createAggInstance<CAccComponent>, XI_COMPONENT },
- { &IID_IAccessibleText, &createAggInstance<CAccText>, XI_TEXT },
- { &IID_IAccessibleEditableText, &createAggInstance<CAccEditableText>, XI_EDITABLETEXT },
- { &IID_IAccessibleImage, &createAggInstance<CAccImage>, XI_IMAGE },
- { &IID_IAccessibleTable, &createAggInstance<CAccTable>, XI_TABLE },
- { &IID_IAccessibleAction, &createAggInstance<CAccAction>, XI_ACTION },
- { &IID_IAccessibleValue, &createAggInstance<CAccValue>, XI_VALUE },
- { &IID_IAccessibleHypertext, &createAggInstance<CAccHypertext>, XI_HYPERTEXT },
- { &IID_IAccessibleHyperlink, &createAggInstance<CAccHyperLink>, XI_HYPERLINK }
+ { &IID_IAccessibleComponent, &createAggInstance<CAccComponent>, XInterfaceType::XI_COMPONENT },
+ { &IID_IAccessibleText, &createAggInstance<CAccText>, XInterfaceType::XI_TEXT },
+ { &IID_IAccessibleEditableText, &createAggInstance<CAccEditableText>, XInterfaceType::XI_EDITABLETEXT },
+ { &IID_IAccessibleImage, &createAggInstance<CAccImage>, XInterfaceType::XI_IMAGE },
+ { &IID_IAccessibleTable, &createAggInstance<CAccTable>, XInterfaceType::XI_TABLE },
+ { &IID_IAccessibleAction, &createAggInstance<CAccAction>, XInterfaceType::XI_ACTION },
+ { &IID_IAccessibleValue, &createAggInstance<CAccValue>, XInterfaceType::XI_VALUE },
+ { &IID_IAccessibleHypertext, &createAggInstance<CAccHypertext>, XInterfaceType::XI_HYPERTEXT },
+ { &IID_IAccessibleHyperlink, &createAggInstance<CAccHyperLink>, XInterfaceType::XI_HYPERLINK }
};
@@ -2593,7 +2592,7 @@ HRESULT WINAPI CMAccessible::SmartQI(void* /*pv*/, REFIID iid, void** ppvObject)
XInterface* pXI = nullptr;
bool bFound = GetXInterfaceFromXAccessible(m_xAccessible.get(),
- &pXI, rEntry.XIFIndex);
+ &pXI, rEntry.eXInterfaceType);
if(!bFound)
{
return E_FAIL;
diff --git a/winaccessibility/source/UAccCOM/MAccessible.h b/winaccessibility/source/UAccCOM/MAccessible.h
index 4a388a3943f5..cb47a7db69c4 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.h
+++ b/winaccessibility/source/UAccCOM/MAccessible.h
@@ -29,6 +29,10 @@
#include "acccommon.h"
#include <rtl/ustring.hxx>
+namespace {
+enum class XInterfaceType;
+}
+
#define OBJID_WINDOW ((LONG)0x00000000)
#define OBJID_SYSMENU ((LONG)0xFFFFFFFF)
#define OBJID_TITLEBAR ((LONG)0xFFFFFFFE)
@@ -218,7 +222,7 @@ private:
css::uno::Reference<css::accessibility::XAccessibleSelection> GetSelection();
// end accSelect implementation methods
static bool GetXInterfaceFromXAccessible(css::accessibility::XAccessible*,
- css::uno::XInterface**, int);
+ css::uno::XInterface**, XInterfaceType);
HRESULT WINAPI SmartQI(void* pv, REFIID iid, void** ppvObject);
public:
More information about the Libreoffice-commits
mailing list