1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Mozilla Foundation.
19 : * Portions created by the Initial Developer are Copyright (C) 2009
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Alexander Surkov <surkov.alexander@gmail.com> (original author)
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef nsARIAGridAccessible_h_
40 : #define nsARIAGridAccessible_h_
41 :
42 : #include "nsIAccessibleTable.h"
43 :
44 : #include "nsHyperTextAccessibleWrap.h"
45 :
46 : /**
47 : * Accessible for ARIA grid and treegrid.
48 : */
49 : class nsARIAGridAccessible : public nsAccessibleWrap,
50 : public nsIAccessibleTable
51 0 : {
52 : public:
53 : nsARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
54 :
55 : // nsISupports
56 : NS_DECL_ISUPPORTS_INHERITED
57 :
58 : // nsIAccessibleTable
59 : NS_DECL_NSIACCESSIBLETABLE
60 :
61 : protected:
62 : /**
63 : * Return true if the given row index is valid.
64 : */
65 : bool IsValidRow(PRInt32 aRow);
66 :
67 : /**
68 : * Retrn true if the given column index is valid.
69 : */
70 : bool IsValidColumn(PRInt32 aColumn);
71 :
72 : /**
73 : * Retrun true if given row and column indexes are valid.
74 : */
75 : bool IsValidRowNColumn(PRInt32 aRow, PRInt32 aColumn);
76 :
77 : /**
78 : * Return row accessible at the given row index.
79 : */
80 : nsAccessible *GetRowAt(PRInt32 aRow);
81 :
82 : /**
83 : * Return cell accessible at the given column index in the row.
84 : */
85 : nsAccessible *GetCellInRowAt(nsAccessible *aRow, PRInt32 aColumn);
86 :
87 : /**
88 : * Set aria-selected attribute value on DOM node of the given accessible.
89 : *
90 : * @param aAccessible [in] accessible
91 : * @param aIsSelected [in] new value of aria-selected attribute
92 : * @param aNotify [in, optional] specifies if DOM should be notified
93 : * about attribute change (used internally).
94 : */
95 : nsresult SetARIASelected(nsAccessible *aAccessible, bool aIsSelected,
96 : bool aNotify = true);
97 :
98 : /**
99 : * Helper method for GetSelectedColumnCount and GetSelectedColumns.
100 : */
101 : nsresult GetSelectedColumnsArray(PRUint32 *acolumnCount,
102 : PRInt32 **aColumns = nsnull);
103 : };
104 :
105 :
106 : /**
107 : * Accessible for ARIA gridcell and rowheader/columnheader.
108 : */
109 : class nsARIAGridCellAccessible : public nsHyperTextAccessibleWrap,
110 : public nsIAccessibleTableCell
111 0 : {
112 : public:
113 : nsARIAGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
114 :
115 : // nsISupports
116 : NS_DECL_ISUPPORTS_INHERITED
117 :
118 : // nsIAccessibleTableCell
119 : NS_DECL_NSIACCESSIBLETABLECELL
120 :
121 : // nsAccessible
122 : virtual void ApplyARIAState(PRUint64* aState);
123 : virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
124 : };
125 :
126 : #endif
|