2009-08-20 06:45:19 +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-08-20 06:45:19 +00:00
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
#ifndef mozilla_a11y_XULTreeGridAccessible_h__
|
|
|
|
#define mozilla_a11y_XULTreeGridAccessible_h__
|
2009-08-20 06:45:19 +00:00
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
#include "XULTreeAccessible.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-08-20 06:45:19 +00:00
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2014-11-05 15:46:37 +00:00
|
|
|
class XULTreeGridCellAccessible;
|
|
|
|
|
2009-08-20 06:45:19 +00:00
|
|
|
/**
|
|
|
|
* Represents accessible for XUL tree in the case when it has multiple columns.
|
|
|
|
*/
|
2012-06-08 10:28:27 +00:00
|
|
|
class XULTreeGridAccessible : public XULTreeAccessible,
|
|
|
|
public TableAccessible
|
2009-08-20 06:45:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-11-19 20:36:05 +00:00
|
|
|
XULTreeGridAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
|
|
|
nsTreeBodyFrame* aTreeFrame) :
|
2014-10-22 00:49:28 +00:00
|
|
|
XULTreeAccessible(aContent, aDoc, aTreeFrame)
|
2012-11-19 20:36:05 +00:00
|
|
|
{ mGenericTypes |= eTable; }
|
2009-08-20 06:45:19 +00:00
|
|
|
|
2012-04-19 21:32:11 +00:00
|
|
|
// TableAccessible
|
2015-03-21 16:28:04 +00: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 21:32:11 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual TableAccessible* AsTable() override { return this; }
|
|
|
|
virtual a11y::role NativeRole() override;
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~XULTreeGridAccessible();
|
2009-08-20 06:45:19 +00:00
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
// XULTreeAccessible
|
2014-01-25 03:08:17 +00:00
|
|
|
virtual already_AddRefed<Accessible>
|
2015-03-21 16:28:04 +00:00
|
|
|
CreateTreeItemAccessible(int32_t aRow) const override;
|
2009-08-20 06:45:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents accessible for XUL tree item in the case when XUL tree has
|
|
|
|
* multiple columns.
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
class XULTreeGridRowAccessible final : public XULTreeItemAccessibleBase
|
2009-08-20 06:45:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-05-29 01:18:45 +00:00
|
|
|
using Accessible::GetChildAt;
|
2010-08-19 02:14:50 +00:00
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
XULTreeGridRowAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
|
|
|
Accessible* aParent, nsITreeBoxObject* aTree,
|
2012-08-22 15:56:38 +00:00
|
|
|
nsITreeView* aTreeView, int32_t aRow);
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
// nsISupports and cycle collection
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-06-08 10:28:27 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridRowAccessible,
|
|
|
|
XULTreeItemAccessibleBase)
|
2009-08-20 06:45:19 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void Shutdown() override;
|
|
|
|
virtual a11y::role NativeRole() override;
|
|
|
|
virtual ENameValueFlag Name(nsString& aName) override;
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
|
2015-03-21 16:28:04 +00:00
|
|
|
EWhichChildAtPoint aWhichChild) override;
|
2009-08-20 06:45:19 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual Accessible* GetChildAt(uint32_t aIndex) const override;
|
|
|
|
virtual uint32_t ChildCount() const override;
|
2009-12-10 19:12:19 +00:00
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
// XULTreeItemAccessibleBase
|
2014-11-05 15:46:37 +00:00
|
|
|
virtual XULTreeGridCellAccessible* GetCellAccessible(nsITreeColumn* aColumn)
|
2015-03-21 16:28:04 +00:00
|
|
|
const override final;
|
|
|
|
virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx) override;
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~XULTreeGridRowAccessible();
|
2009-12-10 19:12:19 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void CacheChildren() override;
|
2009-12-10 19:12:19 +00:00
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
// XULTreeItemAccessibleBase
|
2014-11-05 15:46:37 +00:00
|
|
|
mutable nsRefPtrHashtable<nsPtrHashKey<const void>, XULTreeGridCellAccessible>
|
|
|
|
mAccessibleCache;
|
2009-08-20 06:45:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents an accessible for XUL tree cell in the case when XUL tree has
|
|
|
|
* multiple columns.
|
|
|
|
*/
|
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
class XULTreeGridCellAccessible : public LeafAccessible,
|
2014-10-22 00:49:28 +00:00
|
|
|
public TableCellAccessible
|
2009-08-20 06:45:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-08-19 02:14:50 +00:00
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
XULTreeGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
|
|
|
XULTreeGridRowAccessible* aRowAcc,
|
|
|
|
nsITreeBoxObject* aTree, nsITreeView* aTreeView,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aRow, nsITreeColumn* aColumn);
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-06-08 10:28:27 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridCellAccessible,
|
2012-06-04 12:32:29 +00:00
|
|
|
LeafAccessible)
|
2009-08-20 06:45:19 +00:00
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2015-03-21 16:28:04 +00: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 19:35:43 +00:00
|
|
|
|
|
|
|
// ActionAccessible
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual uint8_t ActionCount() override;
|
|
|
|
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
|
|
|
|
virtual bool DoAction(uint8_t aIndex) override;
|
2009-08-20 06:45:19 +00:00
|
|
|
|
2012-08-09 06:24:31 +00:00
|
|
|
// TableCellAccessible
|
2015-03-21 16:28:04 +00: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-09 06:24:31 +00:00
|
|
|
|
2009-08-20 06:45:19 +00:00
|
|
|
/**
|
|
|
|
* Fire name or state change event if the accessible text or value has been
|
|
|
|
* changed.
|
2014-03-14 18:22:08 +00:00
|
|
|
* @return true if name has changed
|
2009-08-20 06:45:19 +00:00
|
|
|
*/
|
2014-03-14 18:22:08 +00:00
|
|
|
bool CellInvalidated();
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~XULTreeGridCellAccessible();
|
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
// Accessible
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsresult* aError = nullptr) const override;
|
|
|
|
virtual void DispatchClickEvent(nsIContent* aContent, uint32_t aActionIndex) override;
|
2009-08-20 06:45:19 +00:00
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
// XULTreeGridCellAccessible
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if value of cell can be modified.
|
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsEditable() const;
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
enum { eAction_Click = 0 };
|
|
|
|
|
|
|
|
nsCOMPtr<nsITreeBoxObject> mTree;
|
2012-04-27 07:56:49 +00:00
|
|
|
nsITreeView* mTreeView;
|
2009-08-20 06:45:19 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mRow;
|
2009-08-20 06:45:19 +00:00
|
|
|
nsCOMPtr<nsITreeColumn> mColumn;
|
|
|
|
|
|
|
|
nsString mCachedTextEquiv;
|
|
|
|
};
|
|
|
|
|
2012-06-08 10:28:27 +00:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
2009-08-20 06:45:19 +00:00
|
|
|
|
|
|
|
#endif
|