2009-05-18 01:35:21 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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 01:35:21 -07:00
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
#ifndef MOZILLA_A11Y_ARIAGridAccessible_h_
|
|
|
|
#define MOZILLA_A11Y_ARIAGridAccessible_h_
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
#include "nsIAccessibleTable.h"
|
|
|
|
|
2012-05-31 01:04:41 -07:00
|
|
|
#include "HyperTextAccessibleWrap.h"
|
2012-03-27 17:53:58 -07:00
|
|
|
#include "TableAccessible.h"
|
2012-07-24 08:58:25 -07:00
|
|
|
#include "TableCellAccessible.h"
|
2012-03-27 17:53:58 -07:00
|
|
|
#include "xpcAccessibleTable.h"
|
2012-07-24 08:58:25 -07:00
|
|
|
#include "xpcAccessibleTableCell.h"
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2009-05-18 01:35:21 -07:00
|
|
|
/**
|
|
|
|
* Accessible for ARIA grid and treegrid.
|
|
|
|
*/
|
2012-05-28 18:18:45 -07:00
|
|
|
class ARIAGridAccessible : public AccessibleWrap,
|
2012-04-09 03:18:03 -07:00
|
|
|
public xpcAccessibleTable,
|
|
|
|
public nsIAccessibleTable,
|
|
|
|
public TableAccessible
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 02:01:40 -07:00
|
|
|
ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIAccessibleTable
|
2012-07-12 16:28:53 -07:00
|
|
|
NS_FORWARD_NSIACCESSIBLETABLE(xpcAccessibleTable::)
|
2012-03-27 17:53:58 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2012-06-15 01:03:51 -07:00
|
|
|
virtual TableAccessible* AsTable() { return this; }
|
2012-03-27 17:53:58 -07:00
|
|
|
virtual void Shutdown();
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2012-04-19 14:32:11 -07:00
|
|
|
// TableAccessible
|
2012-08-22 08:56:38 -07: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 01:14:22 -07:00
|
|
|
virtual void SelectedCells(nsTArray<Accessible*>* aCells);
|
2012-08-22 08:56:38 -07: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-08 23:24:31 -07:00
|
|
|
virtual Accessible* AsAccessible() { return this; }
|
2012-04-19 14:32:11 -07:00
|
|
|
|
2009-05-18 01:35:21 -07:00
|
|
|
protected:
|
2012-08-28 06:13:59 -07:00
|
|
|
|
2009-06-12 05:52:29 -07:00
|
|
|
/**
|
|
|
|
* Return true if the given row index is valid.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
bool IsValidRow(int32_t aRow);
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrn true if the given column index is valid.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
bool IsValidColumn(int32_t aColumn);
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return row accessible at the given row index.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
Accessible* GetRowAt(int32_t aRow);
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return cell accessible at the given column index in the row.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
Accessible* GetCellInRowAt(Accessible* aRow, int32_t aColumn);
|
2009-06-12 05:52:29 -07: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-28 18:18:45 -07:00
|
|
|
nsresult SetARIASelected(Accessible* aAccessible, bool aIsSelected,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aNotify = true);
|
2009-05-18 01:35:21 -07:00
|
|
|
};
|
|
|
|
|
2009-06-12 05:52:29 -07:00
|
|
|
|
2009-05-18 01:35:21 -07:00
|
|
|
/**
|
|
|
|
* Accessible for ARIA gridcell and rowheader/columnheader.
|
|
|
|
*/
|
2012-05-31 01:04:41 -07:00
|
|
|
class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
|
2012-07-24 08:58:25 -07:00
|
|
|
public nsIAccessibleTableCell,
|
|
|
|
public TableCellAccessible,
|
|
|
|
public xpcAccessibleTableCell
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 02:01:40 -07:00
|
|
|
ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
// nsIAccessibleTableCell
|
2012-08-08 23:24:31 -07:00
|
|
|
NS_FORWARD_NSIACCESSIBLETABLECELL(xpcAccessibleTableCell::)
|
2009-09-10 18:07:56 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2012-08-08 23:24:31 -07:00
|
|
|
virtual TableCellAccessible* AsTableCell() { return this; }
|
2012-07-24 08:58:25 -07:00
|
|
|
virtual void Shutdown();
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void ApplyARIAState(uint64_t* aState) const;
|
2012-10-19 00:15:23 -07:00
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
|
2012-08-28 06:13:59 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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-08 23:24:31 -07: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 01:35:21 -07:00
|
|
|
};
|
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2009-05-18 01:35:21 -07:00
|
|
|
#endif
|