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
|
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 void ColDescription(uint32_t aColIdx, nsString& aDescription);
|
|
|
|
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 SelectRow(uint32_t aRowIdx);
|
|
|
|
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
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2012-06-08 03:28:27 -07:00
|
|
|
virtual TableAccessible* AsTable() { return this; }
|
2014-09-16 10:30:23 -07:00
|
|
|
virtual a11y::role NativeRole() MOZ_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>
|
|
|
|
CreateTreeItemAccessible(int32_t aRow) const MOZ_OVERRIDE;
|
2009-08-19 23:45:19 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents accessible for XUL tree item in the case when XUL tree has
|
|
|
|
* multiple columns.
|
|
|
|
*/
|
2014-08-05 10:33:55 -07:00
|
|
|
class XULTreeGridRowAccessible MOZ_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
|
2013-10-28 20:30:55 -07:00
|
|
|
virtual void Shutdown();
|
2014-09-16 10:30:23 -07:00
|
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
2012-06-08 03:28:27 -07:00
|
|
|
virtual ENameValueFlag Name(nsString& aName);
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
|
2012-05-28 18:18:45 -07:00
|
|
|
EWhichChildAtPoint aWhichChild);
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2014-01-24 19:08:17 -08:00
|
|
|
virtual Accessible* GetChildAt(uint32_t aIndex) const MOZ_OVERRIDE;
|
|
|
|
virtual uint32_t ChildCount() const MOZ_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)
|
|
|
|
const MOZ_OVERRIDE MOZ_FINAL;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx);
|
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
|
2009-12-10 11:12:19 -08:00
|
|
|
virtual void CacheChildren();
|
|
|
|
|
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
|
2012-08-08 23:24:31 -07:00
|
|
|
virtual TableCellAccessible* AsTableCell() { return this; }
|
2014-09-16 10:30:23 -07:00
|
|
|
virtual nsIntRect Bounds() const MOZ_OVERRIDE;
|
2012-06-08 03:28:27 -07:00
|
|
|
virtual ENameValueFlag Name(nsString& aName);
|
2012-05-28 18:18:45 -07:00
|
|
|
virtual Accessible* FocusedChild();
|
2012-10-19 00:15:23 -07:00
|
|
|
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual int32_t IndexInParent() const;
|
2013-10-19 11:19:50 -07:00
|
|
|
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
|
2014-09-16 10:30:23 -07:00
|
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
|
2011-06-05 12:35:43 -07:00
|
|
|
|
|
|
|
// ActionAccessible
|
2014-09-16 10:30:23 -07:00
|
|
|
virtual uint8_t ActionCount() MOZ_OVERRIDE;
|
|
|
|
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
|
|
|
|
virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
|
2009-08-19 23:45:19 -07:00
|
|
|
|
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 void ColHeaderCells(nsTArray<Accessible*>* aHeaderCells) MOZ_OVERRIDE;
|
|
|
|
virtual void RowHeaderCells(nsTArray<Accessible*>* aCells) MOZ_OVERRIDE { }
|
|
|
|
virtual bool Selected() MOZ_OVERRIDE;
|
|
|
|
|
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,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsresult* aError = nullptr) const;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void DispatchClickEvent(nsIContent* aContent, uint32_t aActionIndex);
|
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
|