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
|
|
|
|
|
|
|
#ifndef __nsXULTreeGridAccessible_h__
|
|
|
|
#define __nsXULTreeGridAccessible_h__
|
|
|
|
|
|
|
|
#include "nsXULTreeAccessible.h"
|
2012-03-27 17:53:58 -07:00
|
|
|
#include "TableAccessible.h"
|
|
|
|
#include "xpcAccessibleTable.h"
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents accessible for XUL tree in the case when it has multiple columns.
|
|
|
|
*/
|
|
|
|
class nsXULTreeGridAccessible : public nsXULTreeAccessible,
|
2012-03-27 17:53:58 -07:00
|
|
|
public xpcAccessibleTable,
|
|
|
|
public nsIAccessibleTable,
|
|
|
|
public mozilla::a11y::TableAccessible
|
2009-08-19 23:45:19 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 02:01:40 -07:00
|
|
|
nsXULTreeGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIAccessibleTable
|
2012-03-27 17:53:58 -07:00
|
|
|
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
|
|
|
|
|
2012-04-19 14:32:11 -07:00
|
|
|
// TableAccessible
|
|
|
|
virtual PRUint32 ColCount();
|
|
|
|
virtual PRUint32 RowCount();
|
2012-05-28 18:18:45 -07:00
|
|
|
virtual Accessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
|
2012-04-26 04:19:59 -07:00
|
|
|
virtual void UnselectRow(PRUint32 aRowIdx);
|
2012-04-19 14:32:11 -07:00
|
|
|
|
2012-03-27 17:53:58 -07:00
|
|
|
// nsAccessNode
|
|
|
|
virtual void Shutdown();
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2012-03-27 17:53:58 -07:00
|
|
|
virtual mozilla::a11y::TableAccessible* AsTable() { return this; }
|
2012-01-11 19:07:35 -08:00
|
|
|
virtual mozilla::a11y::role NativeRole();
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// nsXULTreeAccessible
|
2012-05-28 18:18:45 -07:00
|
|
|
virtual already_AddRefed<Accessible> CreateTreeItemAccessible(PRInt32 aRow);
|
2009-08-19 23:45:19 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents accessible for XUL tree item in the case when XUL tree has
|
|
|
|
* multiple columns.
|
|
|
|
*/
|
|
|
|
class nsXULTreeGridRowAccessible : public nsXULTreeItemAccessibleBase
|
|
|
|
{
|
|
|
|
public:
|
2012-05-28 18:18:45 -07:00
|
|
|
using Accessible::GetChildAt;
|
2010-08-18 19:14:50 -07:00
|
|
|
|
2012-05-27 02:01:40 -07:00
|
|
|
nsXULTreeGridRowAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* aParent, nsITreeBoxObject* aTree,
|
2012-02-07 14:38:54 -08:00
|
|
|
nsITreeView* aTreeView, PRInt32 aRow);
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
// nsISupports and cycle collection
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridRowAccessible,
|
2011-06-09 02:44:31 -07:00
|
|
|
nsXULTreeItemAccessibleBase)
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
// nsAccessNode
|
2010-06-11 21:04:35 -07:00
|
|
|
virtual void Shutdown();
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2012-01-11 19:07:35 -08:00
|
|
|
virtual mozilla::a11y::role NativeRole();
|
2012-04-30 20:08:31 -07:00
|
|
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
2012-05-28 18:18:45 -07:00
|
|
|
virtual Accessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
|
|
|
EWhichChildAtPoint aWhichChild);
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
virtual Accessible* GetChildAt(PRUint32 aIndex);
|
2012-05-25 03:53:45 -07:00
|
|
|
virtual PRUint32 ChildCount() const;
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2009-08-19 23:45:19 -07:00
|
|
|
// nsXULTreeItemAccessibleBase
|
2012-05-28 18:18:45 -07:00
|
|
|
virtual Accessible* GetCellAccessible(nsITreeColumn* aColumn);
|
2009-08-19 23:45:19 -07:00
|
|
|
virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);
|
|
|
|
|
|
|
|
protected:
|
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();
|
|
|
|
|
|
|
|
// nsXULTreeItemAccessibleBase
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleHashtable 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID \
|
|
|
|
{ /* 84588ad4-549c-4196-a932-4c5ca5de5dff */ \
|
|
|
|
0x84588ad4, \
|
|
|
|
0x549c, \
|
|
|
|
0x4196, \
|
|
|
|
{ 0xa9, 0x32, 0x4c, 0x5c, 0xa5, 0xde, 0x5d, 0xff } \
|
|
|
|
}
|
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
class nsXULTreeGridCellAccessible : public nsLeafAccessible,
|
|
|
|
public nsIAccessibleTableCell
|
2009-08-19 23:45:19 -07:00
|
|
|
{
|
|
|
|
public:
|
2010-08-18 19:14:50 -07:00
|
|
|
|
2012-05-27 02:01:40 -07:00
|
|
|
nsXULTreeGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
2012-02-07 14:38:54 -08:00
|
|
|
nsXULTreeGridRowAccessible* aRowAcc,
|
|
|
|
nsITreeBoxObject* aTree, nsITreeView* aTreeView,
|
2009-08-19 23:45:19 -07:00
|
|
|
PRInt32 aRow, nsITreeColumn* aColumn);
|
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2011-06-09 02:44:31 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridCellAccessible,
|
|
|
|
nsLeafAccessible)
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
// nsIAccessible
|
|
|
|
|
|
|
|
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
|
|
|
|
PRInt32 *aWidth, PRInt32 *aHeight);
|
|
|
|
|
|
|
|
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
|
|
|
|
NS_IMETHOD DoAction(PRUint8 aIndex);
|
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
// nsIAccessibleTableCell
|
|
|
|
NS_DECL_NSIACCESSIBLETABLECELL
|
|
|
|
|
2009-08-19 23:45:19 -07:00
|
|
|
// nsAccessNode
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool Init();
|
2010-10-20 21:16:10 -07:00
|
|
|
virtual bool IsPrimaryForNode() const;
|
2009-08-19 23:45:19 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2012-04-30 20:08:31 -07:00
|
|
|
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
2012-05-28 18:18:45 -07:00
|
|
|
virtual Accessible* FocusedChild();
|
2009-08-19 23:45:19 -07:00
|
|
|
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
2011-06-05 12:35:43 -07:00
|
|
|
virtual PRInt32 IndexInParent() const;
|
2011-10-03 07:26:11 -07:00
|
|
|
virtual Relation RelationByType(PRUint32 aType);
|
2012-01-11 19:07:35 -08:00
|
|
|
virtual mozilla::a11y::role NativeRole();
|
2011-04-09 16:38:06 -07:00
|
|
|
virtual PRUint64 NativeState();
|
2012-06-03 22:41:06 -07:00
|
|
|
virtual PRUint64 NativeInteractiveState() const;
|
2011-06-05 12:35:43 -07:00
|
|
|
|
|
|
|
// ActionAccessible
|
|
|
|
virtual PRUint8 ActionCount();
|
2009-08-19 23:45:19 -07:00
|
|
|
|
|
|
|
// nsXULTreeGridCellAccessible
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return index of the column.
|
|
|
|
*/
|
|
|
|
PRInt32 GetColumnIndex() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fire name or state change event if the accessible text or value has been
|
|
|
|
* changed.
|
|
|
|
*/
|
|
|
|
void CellInvalidated();
|
|
|
|
|
|
|
|
protected:
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
|
|
|
virtual Accessible* GetSiblingAtOffset(PRInt32 aOffset,
|
|
|
|
nsresult *aError = nsnull) const;
|
2009-08-19 23:45:19 -07:00
|
|
|
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
|
|
|
|
|
|
|
|
// nsXULTreeGridCellAccessible
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
|
|
|
PRInt32 mRow;
|
|
|
|
nsCOMPtr<nsITreeColumn> mColumn;
|
|
|
|
|
|
|
|
nsString mCachedTextEquiv;
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeGridCellAccessible,
|
|
|
|
NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
|
|
|
|
|
|
|
|
#endif
|