2009-05-18 08:35:21 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2009-05-18 08:35:21 +00:00
|
|
|
|
2012-04-09 10:18:03 +00:00
|
|
|
#ifndef MOZILLA_A11Y_ARIAGridAccessible_h_
|
|
|
|
#define MOZILLA_A11Y_ARIAGridAccessible_h_
|
2009-05-18 08:35:21 +00:00
|
|
|
|
|
|
|
#include "nsIAccessibleTable.h"
|
|
|
|
|
2012-05-31 08:04:41 +00:00
|
|
|
#include "HyperTextAccessibleWrap.h"
|
2012-03-28 00:53:58 +00:00
|
|
|
#include "TableAccessible.h"
|
2012-07-24 15:58:25 +00:00
|
|
|
#include "TableCellAccessible.h"
|
2012-03-28 00:53:58 +00:00
|
|
|
#include "xpcAccessibleTable.h"
|
2012-07-24 15:58:25 +00:00
|
|
|
#include "xpcAccessibleTableCell.h"
|
2009-05-18 08:35:21 +00:00
|
|
|
|
2012-04-09 10:18:03 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2009-05-18 08:35:21 +00:00
|
|
|
/**
|
|
|
|
* Accessible for ARIA grid and treegrid.
|
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
class ARIAGridAccessible : public AccessibleWrap,
|
2012-04-09 10:18:03 +00:00
|
|
|
public xpcAccessibleTable,
|
|
|
|
public nsIAccessibleTable,
|
|
|
|
public TableAccessible
|
2009-05-18 08:35:21 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 09:01:40 +00:00
|
|
|
ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2009-05-18 08:35:21 +00:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIAccessibleTable
|
2012-07-12 23:28:53 +00:00
|
|
|
NS_FORWARD_NSIACCESSIBLETABLE(xpcAccessibleTable::)
|
2012-03-28 00:53:58 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2012-06-15 08:03:51 +00:00
|
|
|
virtual TableAccessible* AsTable() { return this; }
|
2012-03-28 00:53:58 +00:00
|
|
|
virtual void Shutdown();
|
2009-05-18 08:35:21 +00:00
|
|
|
|
2012-04-19 21:32:11 +00:00
|
|
|
// TableAccessible
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint32_t ColCount();
|
|
|
|
virtual uint32_t RowCount();
|
|
|
|
virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex);
|
|
|
|
virtual bool IsColSelected(uint32_t aColIdx);
|
|
|
|
virtual bool IsRowSelected(uint32_t aRowIdx);
|
|
|
|
virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx);
|
|
|
|
virtual uint32_t SelectedCellCount();
|
|
|
|
virtual uint32_t SelectedColCount();
|
|
|
|
virtual uint32_t SelectedRowCount();
|
2012-06-29 08:14:22 +00:00
|
|
|
virtual void SelectedCells(nsTArray<Accessible*>* aCells);
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells);
|
|
|
|
virtual void SelectedColIndices(nsTArray<uint32_t>* aCols);
|
|
|
|
virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows);
|
|
|
|
virtual void SelectCol(uint32_t aColIdx);
|
|
|
|
virtual void SelectRow(uint32_t aRowIdx);
|
|
|
|
virtual void UnselectCol(uint32_t aColIdx);
|
|
|
|
virtual void UnselectRow(uint32_t aRowIdx);
|
2012-08-09 06:24:31 +00:00
|
|
|
virtual Accessible* AsAccessible() { return this; }
|
2012-04-19 21:32:11 +00:00
|
|
|
|
2009-05-18 08:35:21 +00:00
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~ARIAGridAccessible() {}
|
2012-08-28 13:13:59 +00:00
|
|
|
|
2009-06-12 12:52:29 +00:00
|
|
|
/**
|
|
|
|
* Return true if the given row index is valid.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
bool IsValidRow(int32_t aRow);
|
2009-06-12 12:52:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrn true if the given column index is valid.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
bool IsValidColumn(int32_t aColumn);
|
2009-06-12 12:52:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return row accessible at the given row index.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
Accessible* GetRowAt(int32_t aRow);
|
2009-06-12 12:52:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return cell accessible at the given column index in the row.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
Accessible* GetCellInRowAt(Accessible* aRow, int32_t aColumn);
|
2009-06-12 12:52:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set aria-selected attribute value on DOM node of the given accessible.
|
|
|
|
*
|
|
|
|
* @param aAccessible [in] accessible
|
|
|
|
* @param aIsSelected [in] new value of aria-selected attribute
|
|
|
|
* @param aNotify [in, optional] specifies if DOM should be notified
|
|
|
|
* about attribute change (used internally).
|
|
|
|
*/
|
2012-05-29 01:18:45 +00:00
|
|
|
nsresult SetARIASelected(Accessible* aAccessible, bool aIsSelected,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNotify = true);
|
2009-05-18 08:35:21 +00:00
|
|
|
};
|
|
|
|
|
2009-06-12 12:52:29 +00:00
|
|
|
|
2009-05-18 08:35:21 +00:00
|
|
|
/**
|
|
|
|
* Accessible for ARIA gridcell and rowheader/columnheader.
|
|
|
|
*/
|
2012-05-31 08:04:41 +00:00
|
|
|
class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
|
2012-07-24 15:58:25 +00:00
|
|
|
public nsIAccessibleTableCell,
|
|
|
|
public TableCellAccessible,
|
|
|
|
public xpcAccessibleTableCell
|
2009-05-18 08:35:21 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 09:01:40 +00:00
|
|
|
ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2009-05-18 08:35:21 +00:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2009-09-11 01:07:56 +00:00
|
|
|
// nsIAccessibleTableCell
|
2012-08-09 06:24:31 +00:00
|
|
|
NS_FORWARD_NSIACCESSIBLETABLECELL(xpcAccessibleTableCell::)
|
2009-09-11 01:07:56 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2012-08-09 06:24:31 +00:00
|
|
|
virtual TableCellAccessible* AsTableCell() { return this; }
|
2012-07-24 15:58:25 +00:00
|
|
|
virtual void Shutdown();
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void ApplyARIAState(uint64_t* aState) const;
|
2012-10-19 07:15:23 +00:00
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
|
2012-08-28 13:13:59 +00:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~ARIAGridCellAccessible() {}
|
2012-08-28 13:13:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a containing row.
|
|
|
|
*/
|
|
|
|
Accessible* Row() const
|
|
|
|
{
|
|
|
|
Accessible* row = Parent();
|
|
|
|
return row && row->Role() == roles::ROW ? row : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a table for the given row.
|
|
|
|
*/
|
|
|
|
Accessible* TableFor(Accessible* aRow) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index of the given row.
|
|
|
|
*/
|
|
|
|
int32_t RowIndexFor(Accessible* aRow) const;
|
2012-08-09 06:24:31 +00:00
|
|
|
|
|
|
|
// TableCellAccessible
|
|
|
|
virtual TableAccessible* Table() const MOZ_OVERRIDE;
|
|
|
|
virtual uint32_t ColIdx() const MOZ_OVERRIDE;
|
|
|
|
virtual uint32_t RowIdx() const MOZ_OVERRIDE;
|
|
|
|
virtual bool Selected() MOZ_OVERRIDE;
|
2009-05-18 08:35:21 +00:00
|
|
|
};
|
|
|
|
|
2012-04-09 10:18:03 +00:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2009-05-18 08:35:21 +00:00
|
|
|
#endif
|