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 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Aaron Leventhal (aaronl@netscape.com)
24 : * Kyle Yuan (kyle.yuan@sun.com)
25 : *
26 : * Alternatively, the contents of this file may be used under the terms of
27 : * either of the GNU General Public License Version 2 or later (the "GPL"),
28 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 : * in which case the provisions of the GPL or the LGPL are applicable instead
30 : * of those above. If you wish to allow use of your version of this file only
31 : * under the terms of either the GPL or the LGPL, and not to allow others to
32 : * use your version of this file under the terms of the MPL, indicate your
33 : * decision by deleting the provisions above and replace them with the notice
34 : * and other provisions required by the GPL or the LGPL. If you do not delete
35 : * the provisions above, a recipient may use your version of this file under
36 : * the terms of any one of the MPL, the GPL or the LGPL.
37 : *
38 : * ***** END LICENSE BLOCK ***** */
39 :
40 : #ifndef _nsHTMLTextAccessible_H_
41 : #define _nsHTMLTextAccessible_H_
42 :
43 : #include "nsTextAccessibleWrap.h"
44 : #include "nsAutoPtr.h"
45 : #include "nsBaseWidgetAccessible.h"
46 :
47 : /**
48 : * Used for text nodes within HTML document.
49 : */
50 : class nsHTMLTextAccessible : public nsTextAccessibleWrap
51 0 : {
52 : public:
53 : nsHTMLTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
54 :
55 : // nsISupports
56 : NS_DECL_ISUPPORTS_INHERITED
57 :
58 : // nsIAccessible
59 : NS_IMETHOD GetName(nsAString& aName);
60 :
61 : // nsAccessible
62 : virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
63 : virtual mozilla::a11y::role NativeRole();
64 : virtual PRUint64 NativeState();
65 : };
66 :
67 : /**
68 : * Used for HTML hr element.
69 : */
70 : class nsHTMLHRAccessible : public nsLeafAccessible
71 0 : {
72 : public:
73 : nsHTMLHRAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
74 :
75 : // nsAccessible
76 : virtual mozilla::a11y::role NativeRole();
77 : };
78 :
79 : /**
80 : * Used for HTML br element.
81 : */
82 : class nsHTMLBRAccessible : public nsLeafAccessible
83 0 : {
84 : public:
85 : nsHTMLBRAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
86 :
87 : // nsAccessible
88 : virtual nsresult GetNameInternal(nsAString& aName);
89 : virtual mozilla::a11y::role NativeRole();
90 : virtual PRUint64 NativeState();
91 : };
92 :
93 : /**
94 : * Used for HTML label element.
95 : */
96 : class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap
97 0 : {
98 : public:
99 : nsHTMLLabelAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
100 :
101 : NS_DECL_ISUPPORTS_INHERITED
102 :
103 : // nsAccessible
104 : virtual nsresult GetNameInternal(nsAString& aName);
105 : virtual mozilla::a11y::role NativeRole();
106 : };
107 :
108 : /**
109 : * Used for HTML output element.
110 : */
111 : class nsHTMLOutputAccessible : public nsHyperTextAccessibleWrap
112 0 : {
113 : public:
114 : nsHTMLOutputAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
115 :
116 : NS_DECL_ISUPPORTS_INHERITED
117 :
118 : // nsAccessible
119 : virtual mozilla::a11y::role NativeRole();
120 : virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
121 : virtual Relation RelationByType(PRUint32 aType);
122 : };
123 :
124 : /**
125 : * Used for bullet of HTML list item element (for example, HTML li).
126 : */
127 : class nsHTMLListBulletAccessible : public nsLeafAccessible
128 0 : {
129 : public:
130 : nsHTMLListBulletAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
131 :
132 : // nsIAccessible
133 : NS_IMETHOD GetName(nsAString& aName);
134 :
135 : // nsAccessNode
136 : virtual bool IsPrimaryForNode() const;
137 :
138 : // nsAccessible
139 : virtual mozilla::a11y::role NativeRole();
140 : virtual PRUint64 NativeState();
141 : virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
142 : PRUint32 aLength = PR_UINT32_MAX);
143 : };
144 :
145 : /**
146 : * Used for HTML list (like HTML ul).
147 : */
148 : class nsHTMLListAccessible : public nsHyperTextAccessibleWrap
149 0 : {
150 : public:
151 : nsHTMLListAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
152 :
153 : // nsISupports
154 : NS_DECL_ISUPPORTS_INHERITED
155 :
156 : // nsAccessible
157 : virtual mozilla::a11y::role NativeRole();
158 : virtual PRUint64 NativeState();
159 : };
160 :
161 : /**
162 : * Used for HTML list item (e.g. HTML li).
163 : */
164 : class nsHTMLLIAccessible : public nsHyperTextAccessibleWrap
165 0 : {
166 : public:
167 : nsHTMLLIAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
168 :
169 : // nsISupports
170 : NS_DECL_ISUPPORTS_INHERITED
171 :
172 : // nsAccessNode
173 : virtual void Shutdown();
174 :
175 : // nsIAccessible
176 : NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
177 :
178 : // nsAccessible
179 : virtual mozilla::a11y::role NativeRole();
180 : virtual PRUint64 NativeState();
181 :
182 : // nsHTMLLIAccessible
183 : void UpdateBullet(bool aHasBullet);
184 :
185 : protected:
186 : // nsAccessible
187 : virtual void CacheChildren();
188 :
189 : private:
190 : nsRefPtr<nsHTMLListBulletAccessible> mBullet;
191 : };
192 :
193 : inline nsHTMLLIAccessible*
194 0 : nsAccessible::AsHTMLListItem()
195 : {
196 : return mFlags & eHTMLListItemAccessible ?
197 0 : static_cast<nsHTMLLIAccessible*>(this) : nsnull;
198 : }
199 :
200 : #endif
|