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
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/
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
15 * The Original Code is mozilla.org code.
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.
23 * Aaron Leventhal (aaronl@netscape.com)
24 * Kyle Yuan (kyle.yuan@sun.com)
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.
38 * ***** END LICENSE BLOCK ***** */
40 #ifndef _nsHTMLTextAccessible_H_
41 #define _nsHTMLTextAccessible_H_
43 #include "nsTextAccessibleWrap.h"
44 #include "nsAutoPtr.h"
45 #include "nsBaseWidgetAccessible.h"
48 * Used for text nodes within HTML document.
50 class nsHTMLTextAccessible
: public nsTextAccessibleWrap
53 nsHTMLTextAccessible(nsIContent
*aContent
, nsIWeakReference
*aShell
);
56 NS_DECL_ISUPPORTS_INHERITED
59 NS_IMETHOD
GetName(nsAString
& aName
);
62 virtual nsresult
GetAttributesInternal(nsIPersistentProperties
*aAttributes
);
63 virtual PRUint32
NativeRole();
64 virtual nsresult
GetStateInternal(PRUint32
*aState
, PRUint32
*aExtraState
);
68 * Used for HTML hr element.
70 class nsHTMLHRAccessible
: public nsLeafAccessible
73 nsHTMLHRAccessible(nsIContent
*aContent
, nsIWeakReference
*aShell
);
76 virtual PRUint32
NativeRole();
80 * Used for HTML br element.
82 class nsHTMLBRAccessible
: public nsLeafAccessible
85 nsHTMLBRAccessible(nsIContent
*aContent
, nsIWeakReference
*aShell
);
88 virtual nsresult
GetNameInternal(nsAString
& aName
);
89 virtual PRUint32
NativeRole();
90 virtual nsresult
GetStateInternal(PRUint32
*aState
, PRUint32
*aExtraState
);
94 * Used for HTML label element.
96 class nsHTMLLabelAccessible
: public nsHyperTextAccessibleWrap
99 nsHTMLLabelAccessible(nsIContent
*aContent
, nsIWeakReference
*aShell
);
101 NS_DECL_ISUPPORTS_INHERITED
104 virtual nsresult
GetNameInternal(nsAString
& aName
);
105 virtual PRUint32
NativeRole();
109 * Used for HTML output element.
111 class nsHTMLOutputAccessible
: public nsHyperTextAccessibleWrap
114 nsHTMLOutputAccessible(nsIContent
* aContent
, nsIWeakReference
* aShell
);
116 NS_DECL_ISUPPORTS_INHERITED
119 NS_IMETHOD
GetRelationByType(PRUint32 aRelationType
,
120 nsIAccessibleRelation
** aRelation
);
123 virtual PRUint32
NativeRole();
124 virtual nsresult
GetAttributesInternal(nsIPersistentProperties
* aAttributes
);
128 * Used for bullet of HTML list item element (for example, HTML li).
130 class nsHTMLListBulletAccessible
: public nsLeafAccessible
133 nsHTMLListBulletAccessible(nsIContent
* aContent
, nsIWeakReference
* aShell
);
136 NS_IMETHOD
GetName(nsAString
& aName
);
139 virtual void Shutdown();
140 virtual bool IsPrimaryForNode() const;
143 virtual PRUint32
NativeRole();
144 virtual nsresult
GetStateInternal(PRUint32
*aState
, PRUint32
*aExtraState
);
145 virtual void AppendTextTo(nsAString
& aText
, PRUint32 aStartOffset
= 0,
146 PRUint32 aLength
= PR_UINT32_MAX
);
149 // XXX: Ideally we'd get the bullet text directly from the bullet frame via
150 // nsBulletFrame::GetListItemText(), but we'd need an interface for getting
151 // text from contentless anonymous frames. Perhaps something like
152 // nsIAnonymousFrame::GetText() ? However, in practice storing the bullet text
153 // here should not be a problem if we invalidate the right parts of
154 // the accessibility cache when mutation events occur.
155 nsString mBulletText
;
159 * Used for HTML list (like HTML ul).
161 class nsHTMLListAccessible
: public nsHyperTextAccessibleWrap
164 nsHTMLListAccessible(nsIContent
*aContent
, nsIWeakReference
*aShell
);
167 NS_DECL_ISUPPORTS_INHERITED
170 virtual PRUint32
NativeRole();
171 virtual nsresult
GetStateInternal(PRUint32
*aState
, PRUint32
*aExtraState
);
175 * Used for HTML list item (e.g. HTML li).
177 class nsHTMLLIAccessible
: public nsHyperTextAccessibleWrap
180 nsHTMLLIAccessible(nsIContent
* aContent
, nsIWeakReference
* aShell
);
183 NS_DECL_ISUPPORTS_INHERITED
186 NS_IMETHOD
GetBounds(PRInt32
*x
, PRInt32
*y
, PRInt32
*width
, PRInt32
*height
);
189 virtual void Shutdown();
192 virtual PRUint32
NativeRole();
193 virtual nsresult
GetStateInternal(PRUint32
*aState
, PRUint32
*aExtraState
);
197 virtual void CacheChildren();
200 nsRefPtr
<nsHTMLListBulletAccessible
> mBulletAccessible
;