1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : *
3 : * ***** BEGIN LICENSE BLOCK *****
4 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * The Original Code is the Mozilla browser.
17 : *
18 : * The Initial Developer of the Original Code is
19 : * Netscape Communications Corporation.
20 : * Portions created by the Initial Developer are Copyright (C) 1999
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : * Eric Vaughan <evaughan@netscape.com> (original author)
25 : * Alexander Surkov <surkov.alexander@gmail.com>
26 : *
27 : * Alternatively, the contents of this file may be used under the terms of
28 : * either of the GNU General Public License Version 2 or later (the "GPL"),
29 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 : * in which case the provisions of the GPL or the LGPL are applicable instead
31 : * of those above. If you wish to allow use of your version of this file only
32 : * under the terms of either the GPL or the LGPL, and not to allow others to
33 : * use your version of this file under the terms of the MPL, indicate your
34 : * decision by deleting the provisions above and replace them with the notice
35 : * and other provisions required by the GPL or the LGPL. If you do not delete
36 : * the provisions above, a recipient may use your version of this file under
37 : * the terms of any one of the MPL, the GPL or the LGPL.
38 : *
39 : * ***** END LICENSE BLOCK ***** */
40 :
41 : #ifndef _nsIAccessibilityService_h_
42 : #define _nsIAccessibilityService_h_
43 :
44 : #include "nsIAccessibleRetrieval.h"
45 : #include "nsIAccessibleEvent.h"
46 :
47 : #include "nsAutoPtr.h"
48 :
49 : class nsAccessible;
50 : class nsINode;
51 : class nsIContent;
52 : class nsIDocument;
53 : class nsIFrame;
54 : class nsIPresShell;
55 : class nsObjectFrame;
56 :
57 : // 10ff6dca-b219-4b64-9a4c-67a62b86edce
58 : #define NS_IACCESSIBILITYSERVICE_IID \
59 : { 0x10ff6dca, 0xb219, 0x4b64, \
60 : { 0x9a, 0x4c, 0x67, 0xa6, 0x2b, 0x86, 0xed, 0xce } }
61 :
62 : class nsIAccessibilityService : public nsIAccessibleRetrieval
63 0 : {
64 : public:
65 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IACCESSIBILITYSERVICE_IID)
66 :
67 : /**
68 : * Return an accessible object for a DOM node in the given pres shell.
69 : *
70 : * @param aNode [in] the DOM node to get an accessible for
71 : * @param aPresShell [in] the presentation shell which contains layout info
72 : * for the DOM node
73 : */
74 : virtual nsAccessible* GetAccessible(nsINode* aNode,
75 : nsIPresShell* aPresShell) = 0;
76 :
77 : /**
78 : * Return root document accessible that is or contains a document accessible
79 : * for the given presshell.
80 : *
81 : * @param aPresShell [in] the presshell
82 : * @param aCanCreate [in] points whether the root document accessible
83 : * should be returned from the cache or can be created
84 : */
85 : virtual nsAccessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
86 : bool aCanCreate) = 0;
87 :
88 : /**
89 : * Creates accessible for the given DOM node or frame.
90 : */
91 : virtual already_AddRefed<nsAccessible>
92 : CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
93 : virtual already_AddRefed<nsAccessible>
94 : CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
95 : virtual already_AddRefed<nsAccessible>
96 : CreateHTMLCheckboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
97 : virtual already_AddRefed<nsAccessible>
98 : CreateHTMLComboboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
99 : virtual already_AddRefed<nsAccessible>
100 : CreateHTMLGroupboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
101 : virtual already_AddRefed<nsAccessible>
102 : CreateHTMLHRAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
103 : virtual already_AddRefed<nsAccessible>
104 : CreateHTMLImageAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
105 : virtual already_AddRefed<nsAccessible>
106 : CreateHTMLLabelAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
107 : virtual already_AddRefed<nsAccessible>
108 : CreateHTMLLIAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
109 : virtual already_AddRefed<nsAccessible>
110 : CreateHTMLListboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
111 : virtual already_AddRefed<nsAccessible>
112 : CreateHTMLMediaAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
113 : virtual already_AddRefed<nsAccessible>
114 : CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, nsIContent* aContent,
115 : nsIPresShell* aPresShell) = 0;
116 : virtual already_AddRefed<nsAccessible>
117 : CreateHTMLRadioButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
118 : virtual already_AddRefed<nsAccessible>
119 : CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
120 : virtual already_AddRefed<nsAccessible>
121 : CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
122 : virtual already_AddRefed<nsAccessible>
123 : CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
124 : virtual already_AddRefed<nsAccessible>
125 : CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
126 : virtual already_AddRefed<nsAccessible>
127 : CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
128 : virtual already_AddRefed<nsAccessible>
129 : CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
130 :
131 : /**
132 : * Adds/remove ATK root accessible for gtk+ native window to/from children
133 : * of the application accessible.
134 : */
135 : virtual nsAccessible* AddNativeRootAccessible(void* aAtkAccessible) = 0;
136 : virtual void RemoveNativeRootAccessible(nsAccessible* aRootAccessible) = 0;
137 :
138 : /**
139 : * Notification used to update the accessible tree when new content is
140 : * inserted.
141 : */
142 : virtual void ContentRangeInserted(nsIPresShell* aPresShell,
143 : nsIContent* aContainer,
144 : nsIContent* aStartChild,
145 : nsIContent* aEndChild) = 0;
146 :
147 : /**
148 : * Notification used to update the accessible tree when content is removed.
149 : */
150 : virtual void ContentRemoved(nsIPresShell* aPresShell, nsIContent* aContainer,
151 : nsIContent* aChild) = 0;
152 :
153 : /**
154 : * Notify accessibility that anchor jump has been accomplished to the given
155 : * target. Used by layout.
156 : */
157 : virtual void NotifyOfAnchorJumpTo(nsIContent *aTarget) = 0;
158 :
159 : /**
160 : * Notify the accessibility service that the given presshell is
161 : * being destroyed.
162 : */
163 : virtual void PresShellDestroyed(nsIPresShell *aPresShell) = 0;
164 :
165 : /**
166 : * Recreate an accessible for the given content node in the presshell.
167 : */
168 : virtual void RecreateAccessible(nsIPresShell* aPresShell,
169 : nsIContent* aContent) = 0;
170 :
171 : /**
172 : * Fire accessible event of the given type for the given target.
173 : *
174 : * @param aEvent [in] accessible event type
175 : * @param aTarget [in] target of accessible event
176 : */
177 : virtual void FireAccessibleEvent(PRUint32 aEvent, nsAccessible* aTarget) = 0;
178 : };
179 :
180 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIAccessibilityService,
181 : NS_IACCESSIBILITYSERVICE_IID)
182 :
183 : // for component registration
184 : // {DE401C37-9A7F-4278-A6F8-3DE2833989EF}
185 : #define NS_ACCESSIBILITY_SERVICE_CID \
186 : { 0xde401c37, 0x9a7f, 0x4278, { 0xa6, 0xf8, 0x3d, 0xe2, 0x83, 0x39, 0x89, 0xef } }
187 :
188 : extern nsresult
189 : NS_GetAccessibilityService(nsIAccessibilityService** aResult);
190 :
191 : #endif
|