summaryrefslogtreecommitdiffstats
path: root/accessible/windows/ia2/ia2AccessibleTableCell.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /accessible/windows/ia2/ia2AccessibleTableCell.cpp
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'accessible/windows/ia2/ia2AccessibleTableCell.cpp')
-rw-r--r--accessible/windows/ia2/ia2AccessibleTableCell.cpp257
1 files changed, 257 insertions, 0 deletions
diff --git a/accessible/windows/ia2/ia2AccessibleTableCell.cpp b/accessible/windows/ia2/ia2AccessibleTableCell.cpp
new file mode 100644
index 000000000..e625a7049
--- /dev/null
+++ b/accessible/windows/ia2/ia2AccessibleTableCell.cpp
@@ -0,0 +1,257 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:expandtab:shiftwidth=2:tabstop=2:
+ */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "ia2AccessibleTableCell.h"
+
+#include "Accessible2.h"
+#include "AccessibleTable2_i.c"
+#include "AccessibleTableCell_i.c"
+
+#include "AccessibleWrap.h"
+#include "TableAccessible.h"
+#include "TableCellAccessible.h"
+#include "IUnknownImpl.h"
+
+#include "nsCOMPtr.h"
+#include "nsString.h"
+
+using namespace mozilla::a11y;
+
+// IUnknown
+
+STDMETHODIMP
+ia2AccessibleTableCell::QueryInterface(REFIID iid, void** ppv)
+{
+ if (!ppv)
+ return E_INVALIDARG;
+
+ *ppv = nullptr;
+
+ if (IID_IAccessibleTableCell == iid) {
+ *ppv = static_cast<IAccessibleTableCell*>(this);
+ (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
+ return S_OK;
+ }
+
+ return E_NOINTERFACE;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// IAccessibleTableCell
+
+STDMETHODIMP
+ia2AccessibleTableCell::get_table(IUnknown** aTable)
+{
+ A11Y_TRYBLOCK_BEGIN
+
+ if (!aTable)
+ return E_INVALIDARG;
+
+ *aTable = nullptr;
+ if (!mTableCell)
+ return CO_E_OBJNOTCONNECTED;
+
+ TableAccessible* table = mTableCell->Table();
+ if (!table)
+ return E_FAIL;
+
+ AccessibleWrap* wrap = static_cast<AccessibleWrap*>(table->AsAccessible());
+ *aTable = static_cast<IAccessible*>(wrap);
+ (*aTable)->AddRef();
+ return S_OK;
+
+ A11Y_TRYBLOCK_END
+}
+
+STDMETHODIMP
+ia2AccessibleTableCell::get_columnExtent(long* aSpan)
+{
+ A11Y_TRYBLOCK_BEGIN
+
+ if (!aSpan)
+ return E_INVALIDARG;
+
+ *aSpan = 0;
+ if (!mTableCell)
+ return CO_E_OBJNOTCONNECTED;
+
+ *aSpan = mTableCell->ColExtent();
+
+ return S_OK;
+
+ A11Y_TRYBLOCK_END
+}
+
+STDMETHODIMP
+ia2AccessibleTableCell::get_columnHeaderCells(IUnknown*** aCellAccessibles,
+ long* aNColumnHeaderCells)
+{
+ A11Y_TRYBLOCK_BEGIN
+
+ if (!aCellAccessibles || !aNColumnHeaderCells)
+ return E_INVALIDARG;
+
+ *aCellAccessibles = nullptr;
+ *aNColumnHeaderCells = 0;
+ if (!mTableCell)
+ return CO_E_OBJNOTCONNECTED;
+
+ AutoTArray<Accessible*, 10> cells;
+ mTableCell->ColHeaderCells(&cells);
+
+ *aNColumnHeaderCells = cells.Length();
+ *aCellAccessibles =
+ static_cast<IUnknown**>(::CoTaskMemAlloc(sizeof(IUnknown*) *
+ cells.Length()));
+
+ if (!*aCellAccessibles)
+ return E_OUTOFMEMORY;
+
+ for (uint32_t i = 0; i < cells.Length(); i++) {
+ AccessibleWrap* cell = static_cast<AccessibleWrap*>(cells[i]);
+ (*aCellAccessibles)[i] = static_cast<IAccessible*>(cell);
+ (*aCellAccessibles)[i]->AddRef();
+ }
+
+ return S_OK;
+
+ A11Y_TRYBLOCK_END
+}
+
+STDMETHODIMP
+ia2AccessibleTableCell::get_columnIndex(long* aColIdx)
+{
+ A11Y_TRYBLOCK_BEGIN
+
+ if (!aColIdx)
+ return E_INVALIDARG;
+
+ *aColIdx = -1;
+ if (!mTableCell)
+ return CO_E_OBJNOTCONNECTED;
+
+ *aColIdx = mTableCell->ColIdx();
+ return S_OK;
+
+ A11Y_TRYBLOCK_END
+}
+
+STDMETHODIMP
+ia2AccessibleTableCell::get_rowExtent(long* aSpan)
+{
+ A11Y_TRYBLOCK_BEGIN
+
+ if (!aSpan)
+ return E_INVALIDARG;
+
+ *aSpan = 0;
+ if (!mTableCell)
+ return CO_E_OBJNOTCONNECTED;
+
+ *aSpan = mTableCell->RowExtent();
+ return S_OK;
+
+ A11Y_TRYBLOCK_END
+}
+
+STDMETHODIMP
+ia2AccessibleTableCell::get_rowHeaderCells(IUnknown*** aCellAccessibles,
+ long* aNRowHeaderCells)
+{
+ A11Y_TRYBLOCK_BEGIN
+
+ if (!aCellAccessibles || !aNRowHeaderCells)
+ return E_INVALIDARG;
+
+ *aCellAccessibles = nullptr;
+ *aNRowHeaderCells = 0;
+ if (!mTableCell)
+ return CO_E_OBJNOTCONNECTED;
+
+ AutoTArray<Accessible*, 10> cells;
+ mTableCell->RowHeaderCells(&cells);
+
+ *aNRowHeaderCells = cells.Length();
+ *aCellAccessibles =
+ static_cast<IUnknown**>(::CoTaskMemAlloc(sizeof(IUnknown*) *
+ cells.Length()));
+ if (!*aCellAccessibles)
+ return E_OUTOFMEMORY;
+
+ for (uint32_t i = 0; i < cells.Length(); i++) {
+ AccessibleWrap* cell = static_cast<AccessibleWrap*>(cells[i]);
+ (*aCellAccessibles)[i] = static_cast<IAccessible*>(cell);
+ (*aCellAccessibles)[i]->AddRef();
+ }
+
+ return S_OK;
+
+ A11Y_TRYBLOCK_END
+}
+
+STDMETHODIMP
+ia2AccessibleTableCell::get_rowIndex(long* aRowIdx)
+{
+ A11Y_TRYBLOCK_BEGIN
+
+ if (!aRowIdx)
+ return E_INVALIDARG;
+
+ *aRowIdx = -1;
+ if (!mTableCell)
+ return CO_E_OBJNOTCONNECTED;
+
+ *aRowIdx = mTableCell->RowIdx();
+ return S_OK;
+
+ A11Y_TRYBLOCK_END
+}
+
+STDMETHODIMP
+ia2AccessibleTableCell::get_rowColumnExtents(long* aRowIdx, long* aColIdx,
+ long* aRowExtents,
+ long* aColExtents,
+ boolean* aIsSelected)
+{
+ A11Y_TRYBLOCK_BEGIN
+
+ if (!aRowIdx || !aColIdx || !aRowExtents || !aColExtents || !aIsSelected)
+ return E_INVALIDARG;
+
+ *aRowIdx = *aColIdx = *aRowExtents = *aColExtents = 0;
+ *aIsSelected = false;
+ if (!mTableCell)
+ return CO_E_OBJNOTCONNECTED;
+
+ *aRowIdx = mTableCell->RowIdx();
+ *aColIdx = mTableCell->ColIdx();
+ *aRowExtents = mTableCell->RowExtent();
+ *aColExtents = mTableCell->ColExtent();
+ *aIsSelected = mTableCell->Selected();
+
+ return S_OK;
+
+ A11Y_TRYBLOCK_END
+}
+
+STDMETHODIMP
+ia2AccessibleTableCell::get_isSelected(boolean* aIsSelected)
+{
+ A11Y_TRYBLOCK_BEGIN
+
+ if (!aIsSelected)
+ return E_INVALIDARG;
+
+ *aIsSelected = false;
+ if (!mTableCell)
+ return CO_E_OBJNOTCONNECTED;
+
+ *aIsSelected = mTableCell->Selected();
+ return S_OK;
+
+ A11Y_TRYBLOCK_END
+}