2009-08-19 23:45:19 -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-08-19 23:45:19 -07:00
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
#ifndef mozilla_a11y_XULTreeGridAccessible_h__
|
|
|
|
#define mozilla_a11y_XULTreeGridAccessible_h__
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
#include "XULTreeAccessible.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-08-19 23:45:19 -07:00
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2014-11-05 07:46:37 -08:00
|
|
|
class XULTreeGridCellAccessible;
|
|
|
|
|
2009-08-19 23:45:19 -07:00
|
|
|
/**
|
|
|
|
* Represents accessible for XUL tree in the case when it has multiple columns.
|
|
|
|
*/
|
2012-06-08 03:28:27 -07:00
|
|
|
class XULTreeGridAccessible : public XULTreeAccessible,
|
|
|
|
public TableAccessible
|
2009-08-19 23:45:19 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-11-19 12:36:05 -08:00
|
|
|
XULTreeGridAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
|
|
|
nsTreeBodyFrame* aTreeFrame) :
|
2014-10-21 17:49:28 -07:00
|
|
|
XULTreeAccessible(aContent, aDoc, aTreeFrame)
|
2012-11-19 12:36:05 -08:00
|
|
|
{ mGenericTypes |= eTable; }
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-04-19 14:32:11 -07:00
|
|
|
// TableAccessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual uint32_t ColCount() override;
|
|
|
|
virtual uint32_t RowCount() override;
|
|
|
|
virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) override;
|
|
|
|
virtual void ColDescription(uint32_t aColIdx, nsString& aDescription) override;
|
|
|
|
virtual bool IsColSelected(uint32_t aColIdx) override;
|
|
|
|
virtual bool IsRowSelected(uint32_t aRowIdx) override;
|
|
|
|
virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx) override;
|
|
|
|
virtual uint32_t SelectedCellCount() override;
|
|
|
|
virtual uint32_t SelectedColCount() override;
|
|
|
|
virtual uint32_t SelectedRowCount() override;
|
|
|
|
virtual void SelectedCells(nsTArray<Accessible*>* aCells) override;
|
|
|
|
virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells) override;
|
|
|
|
virtual void SelectedColIndices(nsTArray<uint32_t>* aCols) override;
|
|
|
|
virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows) override;
|
|
|
|
virtual void SelectRow(uint32_t aRowIdx) override;
|
|
|
|
virtual void UnselectRow(uint32_t aRowIdx) override;
|
|
|
|
virtual Accessible* AsAccessible() override { return this; }
|
2012-04-19 14:32:11 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual TableAccessible* AsTable() override { return this; }
|
|
|
|
virtual a11y::role NativeRole() override;
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 14:23:18 -07:00
|
|
|
virtual ~XULTreeGridAccessible();
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
// XULTreeAccessible
|
2014-01-24 19:08:17 -08:00
|
|
|
virtual already_AddRefed<Accessible>
|
2015-03-21 09:28:04 -07:00
|
|
|
CreateTreeItemAccessible(int32_t aRow) const override;
|
2009-08-19 23:45:19 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents accessible for XUL tree item in the case when XUL tree has
|
|
|
|
* multiple columns.
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
class XULTreeGridRowAccessible final : public XULTreeItemAccessibleBase
|
2009-08-19 23:45:19 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-05-28 18:18:45 -07:00
|
|
|
using Accessible::GetChildAt;
|
2010-08-18 19:14:50 -07:00
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
XULTreeGridRowAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
|
|
|
Accessible* aParent, nsITreeBoxObject* aTree,
|
2012-08-22 08:56:38 -07:00
|
|
|
nsITreeView* aTreeView, int32_t aRow);
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
// nsISupports and cycle collection
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-06-08 03:28:27 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridRowAccessible,
|
|
|
|
XULTreeItemAccessibleBase)
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void Shutdown() override;
|
|
|
|
virtual a11y::role NativeRole() override;
|
|
|
|
virtual ENameValueFlag Name(nsString& aName) override;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
|
2015-03-21 09:28:04 -07:00
|
|
|
EWhichChildAtPoint aWhichChild) override;
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual Accessible* GetChildAt(uint32_t aIndex) const override;
|
|
|
|
virtual uint32_t ChildCount() const override;
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
// XULTreeItemAccessibleBase
|
2014-11-05 07:46:37 -08:00
|
|
|
virtual XULTreeGridCellAccessible* GetCellAccessible(nsITreeColumn* aColumn)
|
2015-03-21 09:28:04 -07:00
|
|
|
const override final;
|
|
|
|
virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx) override;
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 14:23:18 -07:00
|
|
|
virtual ~XULTreeGridRowAccessible();
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void CacheChildren() override;
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
// XULTreeItemAccessibleBase
|
2014-11-05 07:46:37 -08:00
|
|
|
mutable nsRefPtrHashtable<nsPtrHashKey<const void>, XULTreeGridCellAccessible>
|
|
|
|
mAccessibleCache;
|
2009-08-19 23:45:19 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents an accessible for XUL tree cell in the case when XUL tree has
|
|
|
|
* multiple columns.
|
|
|
|
*/
|
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
class XULTreeGridCellAccessible : public LeafAccessible,
|
2014-10-21 17:49:28 -07:00
|
|
|
public TableCellAccessible
|
2009-08-19 23:45:19 -07:00
|
|
|
{
|
|
|
|
public:
|
2010-08-18 19:14:50 -07:00
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
XULTreeGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
|
|
|
XULTreeGridRowAccessible* aRowAcc,
|
|
|
|
nsITreeBoxObject* aTree, nsITreeView* aTreeView,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aRow, nsITreeColumn* aColumn);
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-06-08 03:28:27 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridCellAccessible,
|
2012-06-04 05:32:29 -07:00
|
|
|
LeafAccessible)
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual TableCellAccessible* AsTableCell() override { return this; }
|
|
|
|
virtual nsIntRect Bounds() const override;
|
|
|
|
virtual ENameValueFlag Name(nsString& aName) override;
|
|
|
|
virtual Accessible* FocusedChild() override;
|
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
|
|
|
|
virtual int32_t IndexInParent() const override;
|
|
|
|
virtual Relation RelationByType(RelationType aType) override;
|
|
|
|
virtual a11y::role NativeRole() override;
|
|
|
|
virtual uint64_t NativeState() override;
|
|
|
|
virtual uint64_t NativeInteractiveState() const override;
|
2011-06-05 12:35:43 -07:00
|
|
|
|
|
|
|
// ActionAccessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual uint8_t ActionCount() override;
|
|
|
|
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
|
|
|
virtual bool DoAction(uint8_t aIndex) override;
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-08-08 23:24:31 -07:00
|
|
|
// TableCellAccessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual TableAccessible* Table() const override;
|
|
|
|
virtual uint32_t ColIdx() const override;
|
|
|
|
virtual uint32_t RowIdx() const override;
|
|
|
|
virtual void ColHeaderCells(nsTArray<Accessible*>* aHeaderCells) override;
|
|
|
|
virtual void RowHeaderCells(nsTArray<Accessible*>* aCells) override { }
|
|
|
|
virtual bool Selected() override;
|
2012-08-08 23:24:31 -07:00
|
|
|
|
2009-08-19 23:45:19 -07:00
|
|
|
/**
|
|
|
|
* Fire name or state change event if the accessible text or value has been
|
|
|
|
* changed.
|
2014-03-14 11:22:08 -07:00
|
|
|
* @return true if name has changed
|
2009-08-19 23:45:19 -07:00
|
|
|
*/
|
2014-03-14 11:22:08 -07:00
|
|
|
bool CellInvalidated();
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 14:23:18 -07:00
|
|
|
virtual ~XULTreeGridCellAccessible();
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsresult* aError = nullptr) const override;
|
|
|
|
virtual void DispatchClickEvent(nsIContent* aContent, uint32_t aActionIndex) override;
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
// XULTreeGridCellAccessible
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if value of cell can be modified.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsEditable() const;
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
enum { eAction_Click = 0 };
|
|
|
|
|
|
|
|
nsCOMPtr<nsITreeBoxObject> mTree;
|
2012-04-27 00:56:49 -07:00
|
|
|
nsITreeView* mTreeView;
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mRow;
|
2009-08-19 23:45:19 -07:00
|
|
|
nsCOMPtr<nsITreeColumn> mColumn;
|
|
|
|
|
|
|
|
nsString mCachedTextEquiv;
|
|
|
|
};
|
|
|
|
|
2012-06-08 03:28:27 -07:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
#endif
|