xpcAccessibleTable.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* -*- Mode: C++ final; tab-width: 2 final; indent-tabs-mode: nil final; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  4. * You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_a11y_xpcAccessibleTable_h_
  6. #define mozilla_a11y_xpcAccessibleTable_h_
  7. #include "nsIAccessibleTable.h"
  8. #include "xpcAccessibleGeneric.h"
  9. namespace mozilla {
  10. namespace a11y {
  11. /**
  12. * XPCOM wrapper around TableAccessible class.
  13. */
  14. class xpcAccessibleTable : public xpcAccessibleGeneric,
  15. public nsIAccessibleTable
  16. {
  17. public:
  18. explicit xpcAccessibleTable(Accessible* aIntl) :
  19. xpcAccessibleGeneric(aIntl) { }
  20. xpcAccessibleTable(ProxyAccessible* aProxy, uint32_t aInterfaces) :
  21. xpcAccessibleGeneric(aProxy, aInterfaces) {}
  22. NS_DECL_ISUPPORTS_INHERITED
  23. // nsIAccessibleTable
  24. NS_IMETHOD GetCaption(nsIAccessible** aCaption) final override;
  25. NS_IMETHOD GetSummary(nsAString& aSummary) final override;
  26. NS_IMETHOD GetColumnCount(int32_t* aColumnCount) final override;
  27. NS_IMETHOD GetRowCount(int32_t* aRowCount) final override;
  28. NS_IMETHOD GetCellAt(int32_t aRowIndex, int32_t aColumnIndex,
  29. nsIAccessible** aCell) final override;
  30. NS_IMETHOD GetCellIndexAt(int32_t aRowIndex, int32_t aColumnIndex,
  31. int32_t* aCellIndex) final override;
  32. NS_IMETHOD GetColumnIndexAt(int32_t aCellIndex, int32_t* aColumnIndex)
  33. final override;
  34. NS_IMETHOD GetRowIndexAt(int32_t aCellIndex, int32_t* aRowIndex)
  35. final override;
  36. NS_IMETHOD GetRowAndColumnIndicesAt(int32_t aCellIndex, int32_t* aRowIndex,
  37. int32_t* aColumnIndex)
  38. final override;
  39. NS_IMETHOD GetColumnExtentAt(int32_t row, int32_t column,
  40. int32_t* aColumnExtent) final override;
  41. NS_IMETHOD GetRowExtentAt(int32_t row, int32_t column,
  42. int32_t* aRowExtent) final override;
  43. NS_IMETHOD GetColumnDescription(int32_t aColIdx, nsAString& aDescription)
  44. final override;
  45. NS_IMETHOD GetRowDescription(int32_t aRowIdx, nsAString& aDescription)
  46. final override;
  47. NS_IMETHOD IsColumnSelected(int32_t aColIdx, bool* _retval)
  48. final override;
  49. NS_IMETHOD IsRowSelected(int32_t aRowIdx, bool* _retval)
  50. final override;
  51. NS_IMETHOD IsCellSelected(int32_t aRowIdx, int32_t aColIdx, bool* _retval)
  52. final override;
  53. NS_IMETHOD GetSelectedCellCount(uint32_t* aSelectedCellCount)
  54. final override;
  55. NS_IMETHOD GetSelectedColumnCount(uint32_t* aSelectedColumnCount)
  56. final override;
  57. NS_IMETHOD GetSelectedRowCount(uint32_t* aSelectedRowCount)
  58. final override;
  59. NS_IMETHOD GetSelectedCells(nsIArray** aSelectedCell) final override;
  60. NS_IMETHOD GetSelectedCellIndices(uint32_t* aCellsArraySize,
  61. int32_t** aCellsArray)
  62. final override;
  63. NS_IMETHOD GetSelectedColumnIndices(uint32_t* aColsArraySize,
  64. int32_t** aColsArray)
  65. final override;
  66. NS_IMETHOD GetSelectedRowIndices(uint32_t* aRowsArraySize,
  67. int32_t** aRowsArray) final override;
  68. NS_IMETHOD SelectColumn(int32_t aColIdx) final override;
  69. NS_IMETHOD SelectRow(int32_t aRowIdx) final override;
  70. NS_IMETHOD UnselectColumn(int32_t aColIdx) final override;
  71. NS_IMETHOD UnselectRow(int32_t aRowIdx) final override;
  72. NS_IMETHOD IsProbablyForLayout(bool* aIsForLayout) final override;
  73. protected:
  74. virtual ~xpcAccessibleTable() {}
  75. private:
  76. TableAccessible* Intl()
  77. { return mIntl.IsAccessible() ? mIntl.AsAccessible()->AsTable() : nullptr; }
  78. xpcAccessibleTable(const xpcAccessibleTable&) = delete;
  79. xpcAccessibleTable& operator =(const xpcAccessibleTable&) = delete;
  80. };
  81. } // namespace a11y
  82. } // namespace mozilla
  83. #endif // mozilla_a11y_xpcAccessibleTable_h_