1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=2:
4 /* ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
17 * The Original Code is mozilla.org code.
19 * The Initial Developer of the Original Code is
21 * Portions created by the Initial Developer are Copyright (C) 2007
22 * the Initial Developer. All Rights Reserved.
25 * Alexander Surkov <surkov.alexander@gmail.com> (original author)
27 * Alternatively, the contents of this file may be used under the terms of
28 * either the GNU General Public License Version 2 or later (the "GPL"), or
29 * 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.
39 * ***** END LICENSE BLOCK ***** */
41 #ifndef _ACCESSIBLE_TEXT_H
42 #define _ACCESSIBLE_TEXT_H
44 #include "nsISupports.h"
45 #include "nsIAccessibleText.h"
47 #include "AccessibleText.h"
49 class CAccessibleText
: public nsISupports
,
50 public IAccessibleText
55 STDMETHODIMP
QueryInterface(REFIID
, void**);
58 virtual HRESULT STDMETHODCALLTYPE
addSelection(
59 /* [in] */ long startOffset
,
60 /* [in] */ long endOffset
);
62 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_attributes(
63 /* [in] */ long offset
,
64 /* [out] */ long *startOffset
,
65 /* [out] */ long *endOffset
,
66 /* [retval][out] */ BSTR
*textAttributes
);
68 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_caretOffset(
69 /* [retval][out] */ long *offset
);
71 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_characterExtents(
72 /* [in] */ long offset
,
73 /* [in] */ enum IA2CoordinateType coordType
,
76 /* [out] */ long *width
,
77 /* [retval][out] */ long *height
);
79 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_nSelections(
80 /* [retval][out] */ long *nSelections
);
82 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_offsetAtPoint(
85 /* [in] */ enum IA2CoordinateType coordType
,
86 /* [retval][out] */ long *offset
);
88 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_selection(
89 /* [in] */ long selectionIndex
,
90 /* [out] */ long *startOffset
,
91 /* [retval][out] */ long *endOffset
);
93 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_text(
94 /* [in] */ long startOffset
,
95 /* [in] */ long endOffset
,
96 /* [retval][out] */ BSTR
*text
);
98 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_textBeforeOffset(
99 /* [in] */ long offset
,
100 /* [in] */ enum IA2TextBoundaryType boundaryType
,
101 /* [out] */ long *startOffset
,
102 /* [out] */ long *endOffset
,
103 /* [retval][out] */ BSTR
*text
);
105 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_textAfterOffset(
106 /* [in] */ long offset
,
107 /* [in] */ enum IA2TextBoundaryType boundaryType
,
108 /* [out] */ long *startOffset
,
109 /* [out] */ long *endOffset
,
110 /* [retval][out] */ BSTR
*text
);
112 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_textAtOffset(
113 /* [in] */ long offset
,
114 /* [in] */ enum IA2TextBoundaryType boundaryType
,
115 /* [out] */ long *startOffset
,
116 /* [out] */ long *endOffset
,
117 /* [retval][out] */ BSTR
*text
);
119 virtual HRESULT STDMETHODCALLTYPE
removeSelection(
120 /* [in] */ long selectionIndex
);
122 virtual HRESULT STDMETHODCALLTYPE
setCaretOffset(
123 /* [in] */ long offset
);
125 virtual HRESULT STDMETHODCALLTYPE
setSelection(
126 /* [in] */ long selectionIndex
,
127 /* [in] */ long startOffset
,
128 /* [in] */ long endOffset
);
130 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_nCharacters(
131 /* [retval][out] */ long *nCharacters
);
133 virtual HRESULT STDMETHODCALLTYPE
scrollSubstringTo(
134 /* [in] */ long startIndex
,
135 /* [in] */ long endIndex
,
136 /* [in] */ enum IA2ScrollType scrollType
);
138 virtual HRESULT STDMETHODCALLTYPE
scrollSubstringToPoint(
139 /* [in] */ long startIndex
,
140 /* [in] */ long endIndex
,
141 /* [in] */ enum IA2CoordinateType coordinateType
,
145 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_newText(
146 /* [retval][out] */ IA2TextSegment
*newText
);
148 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE
get_oldText(
149 /* [retval][out] */ IA2TextSegment
*oldText
);
152 virtual nsresult
GetModifiedText(PRBool aGetInsertedText
, nsAString
& aText
,
153 PRUint32
*aStartOffset
,
154 PRUint32
*aEndOffset
) = 0;
157 HRESULT
GetModifiedText(PRBool aGetInsertedText
, IA2TextSegment
*aNewText
);
158 nsAccessibleTextBoundary
GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType
);
162 #define FORWARD_IACCESSIBLETEXT(Class) \
163 virtual HRESULT STDMETHODCALLTYPE addSelection(long startOffset, \
166 return Class::addSelection(startOffset, endOffset); \
169 virtual HRESULT STDMETHODCALLTYPE get_attributes(long offset, \
172 BSTR *textAttributes) \
174 return Class::get_attributes(offset, startOffset, endOffset, textAttributes);\
177 virtual HRESULT STDMETHODCALLTYPE get_caretOffset(long *offset) \
179 return Class::get_caretOffset(offset); \
182 virtual HRESULT STDMETHODCALLTYPE get_characterExtents(long offset, \
183 enum IA2CoordinateType coordType,\
189 return Class::get_characterExtents(offset, coordType, x, y, width, height); \
192 virtual HRESULT STDMETHODCALLTYPE get_nSelections(long *nSelections) \
194 return Class::get_nSelections(nSelections); \
197 virtual HRESULT STDMETHODCALLTYPE get_offsetAtPoint(long x, \
199 enum IA2CoordinateType coordType,\
202 return Class::get_offsetAtPoint(x, y, coordType, offset); \
205 virtual HRESULT STDMETHODCALLTYPE get_selection(long selectionIndex, \
209 return Class::get_selection(selectionIndex, startOffset, endOffset); \
212 virtual HRESULT STDMETHODCALLTYPE get_text(long startOffset, \
216 return Class::get_text(startOffset, endOffset, text); \
219 virtual HRESULT STDMETHODCALLTYPE get_textBeforeOffset(long offset, \
220 enum IA2TextBoundaryType boundaryType,\
225 return Class::get_textBeforeOffset(offset, boundaryType, \
226 startOffset, endOffset, text); \
229 virtual HRESULT STDMETHODCALLTYPE get_textAfterOffset(long offset, \
230 enum IA2TextBoundaryType boundaryType,\
235 return Class::get_textAfterOffset(offset, boundaryType, \
236 startOffset, endOffset, text); \
239 virtual HRESULT STDMETHODCALLTYPE get_textAtOffset(long offset, \
240 enum IA2TextBoundaryType boundaryType,\
245 return Class::get_textAtOffset(offset, boundaryType, \
246 startOffset, endOffset, text); \
249 virtual HRESULT STDMETHODCALLTYPE removeSelection(long selectionIndex) \
251 return Class::removeSelection(selectionIndex); \
254 virtual HRESULT STDMETHODCALLTYPE setCaretOffset(long offset) \
256 return Class::setCaretOffset(offset); \
259 virtual HRESULT STDMETHODCALLTYPE setSelection(long selectionIndex, \
263 return Class::setSelection(selectionIndex, startOffset, endOffset); \
266 virtual HRESULT STDMETHODCALLTYPE get_nCharacters(long *nCharacters) \
268 return Class::get_nCharacters(nCharacters); \
271 virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(long startIndex, \
273 enum IA2ScrollType scrollType)\
275 return Class::scrollSubstringTo(startIndex, endIndex, scrollType); \
278 virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(long startIndex, \
280 enum IA2CoordinateType coordinateType,\
284 return Class::scrollSubstringToPoint(startIndex, endIndex, \
285 coordinateType, x, y); \
288 virtual HRESULT STDMETHODCALLTYPE get_newText(IA2TextSegment *newText) \
290 return Class::get_newText(newText); \
293 virtual HRESULT STDMETHODCALLTYPE get_oldText(IA2TextSegment *oldText) \
295 return Class::get_oldText(oldText); \