accessible/src/windows/ia2/ia2AccessibleText.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/src/windows/ia2/ia2AccessibleText.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,268 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:expandtab:shiftwidth=2:tabstop=2:
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#ifndef _ACCESSIBLE_TEXT_H
    1.12 +#define _ACCESSIBLE_TEXT_H
    1.13 +
    1.14 +#include "nsISupports.h"
    1.15 +#include "nsIAccessibleText.h"
    1.16 +
    1.17 +#include "AccessibleText.h"
    1.18 +
    1.19 +namespace mozilla {
    1.20 +namespace a11y {
    1.21 +
    1.22 +class ia2AccessibleText: public IAccessibleText
    1.23 +{
    1.24 +public:
    1.25 +
    1.26 +  // IAccessibleText
    1.27 +  virtual HRESULT STDMETHODCALLTYPE addSelection(
    1.28 +      /* [in] */ long startOffset,
    1.29 +      /* [in] */ long endOffset);
    1.30 +
    1.31 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_attributes(
    1.32 +      /* [in] */ long offset,
    1.33 +      /* [out] */ long *startOffset,
    1.34 +      /* [out] */ long *endOffset,
    1.35 +      /* [retval][out] */ BSTR *textAttributes);
    1.36 +
    1.37 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_caretOffset(
    1.38 +      /* [retval][out] */ long *offset);
    1.39 +
    1.40 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_characterExtents(
    1.41 +      /* [in] */ long offset,
    1.42 +      /* [in] */ enum IA2CoordinateType coordType,
    1.43 +      /* [out] */ long *x,
    1.44 +      /* [out] */ long *y,
    1.45 +      /* [out] */ long *width,
    1.46 +      /* [retval][out] */ long *height);
    1.47 +
    1.48 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelections(
    1.49 +      /* [retval][out] */ long *nSelections);
    1.50 +
    1.51 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_offsetAtPoint(
    1.52 +      /* [in] */ long x,
    1.53 +      /* [in] */ long y,
    1.54 +      /* [in] */ enum IA2CoordinateType coordType,
    1.55 +      /* [retval][out] */ long *offset);
    1.56 +
    1.57 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selection(
    1.58 +      /* [in] */ long selectionIndex,
    1.59 +      /* [out] */ long *startOffset,
    1.60 +      /* [retval][out] */ long *endOffset);
    1.61 +
    1.62 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_text(
    1.63 +      /* [in] */ long startOffset,
    1.64 +      /* [in] */ long endOffset,
    1.65 +      /* [retval][out] */ BSTR *text);
    1.66 +
    1.67 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textBeforeOffset(
    1.68 +      /* [in] */ long offset,
    1.69 +      /* [in] */ enum IA2TextBoundaryType boundaryType,
    1.70 +      /* [out] */ long *startOffset,
    1.71 +      /* [out] */ long *endOffset,
    1.72 +      /* [retval][out] */ BSTR *text);
    1.73 +
    1.74 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAfterOffset(
    1.75 +      /* [in] */ long offset,
    1.76 +      /* [in] */ enum IA2TextBoundaryType boundaryType,
    1.77 +      /* [out] */ long *startOffset,
    1.78 +      /* [out] */ long *endOffset,
    1.79 +      /* [retval][out] */ BSTR *text);
    1.80 +
    1.81 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAtOffset(
    1.82 +      /* [in] */ long offset,
    1.83 +      /* [in] */ enum IA2TextBoundaryType boundaryType,
    1.84 +      /* [out] */ long *startOffset,
    1.85 +      /* [out] */ long *endOffset,
    1.86 +      /* [retval][out] */ BSTR *text);
    1.87 +
    1.88 +  virtual HRESULT STDMETHODCALLTYPE removeSelection(
    1.89 +      /* [in] */ long selectionIndex);
    1.90 +
    1.91 +  virtual HRESULT STDMETHODCALLTYPE setCaretOffset(
    1.92 +      /* [in] */ long offset);
    1.93 +
    1.94 +  virtual HRESULT STDMETHODCALLTYPE setSelection(
    1.95 +      /* [in] */ long selectionIndex,
    1.96 +      /* [in] */ long startOffset,
    1.97 +      /* [in] */ long endOffset);
    1.98 +
    1.99 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nCharacters(
   1.100 +      /* [retval][out] */ long *nCharacters);
   1.101 +
   1.102 +  virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(
   1.103 +      /* [in] */ long startIndex,
   1.104 +      /* [in] */ long endIndex,
   1.105 +      /* [in] */ enum IA2ScrollType scrollType);
   1.106 +
   1.107 +  virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(
   1.108 +      /* [in] */ long startIndex,
   1.109 +      /* [in] */ long endIndex,
   1.110 +      /* [in] */ enum IA2CoordinateType coordinateType,
   1.111 +      /* [in] */ long x,
   1.112 +      /* [in] */ long y);
   1.113 +
   1.114 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_newText(
   1.115 +      /* [retval][out] */ IA2TextSegment *newText);
   1.116 +
   1.117 +  virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText(
   1.118 +      /* [retval][out] */ IA2TextSegment *oldText);
   1.119 +
   1.120 +protected:
   1.121 +  virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
   1.122 +                                   uint32_t *aStartOffset,
   1.123 +                                   uint32_t *aEndOffset) = 0;
   1.124 +
   1.125 +private:
   1.126 +  HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText);
   1.127 +  AccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType);
   1.128 +};
   1.129 +
   1.130 +} // namespace a11y
   1.131 +} // namespace mozilla
   1.132 +
   1.133 +
   1.134 +#define FORWARD_IACCESSIBLETEXT(Class)                                         \
   1.135 +virtual HRESULT STDMETHODCALLTYPE addSelection(long startOffset,               \
   1.136 +                                               long endOffset)                 \
   1.137 +{                                                                              \
   1.138 +  return Class::addSelection(startOffset, endOffset);                          \
   1.139 +}                                                                              \
   1.140 +                                                                               \
   1.141 +virtual HRESULT STDMETHODCALLTYPE get_attributes(long offset,                  \
   1.142 +                                                 long *startOffset,            \
   1.143 +                                                 long *endOffset,              \
   1.144 +                                                 BSTR *textAttributes)         \
   1.145 +{                                                                              \
   1.146 +  return Class::get_attributes(offset, startOffset, endOffset, textAttributes);\
   1.147 +}                                                                              \
   1.148 +                                                                               \
   1.149 +virtual HRESULT STDMETHODCALLTYPE get_caretOffset(long *offset)                \
   1.150 +{                                                                              \
   1.151 +  return Class::get_caretOffset(offset);                                       \
   1.152 +}                                                                              \
   1.153 +                                                                               \
   1.154 +virtual HRESULT STDMETHODCALLTYPE get_characterExtents(long offset,            \
   1.155 +                                                       enum IA2CoordinateType coordType,\
   1.156 +                                                       long *x,                \
   1.157 +                                                       long *y,                \
   1.158 +                                                       long *width,            \
   1.159 +                                                       long *height)           \
   1.160 +{                                                                              \
   1.161 +  return Class::get_characterExtents(offset, coordType, x, y, width, height);  \
   1.162 +}                                                                              \
   1.163 +                                                                               \
   1.164 +virtual HRESULT STDMETHODCALLTYPE get_nSelections(long *nSelections)           \
   1.165 +{                                                                              \
   1.166 +  return Class::get_nSelections(nSelections);                                  \
   1.167 +}                                                                              \
   1.168 +                                                                               \
   1.169 +virtual HRESULT STDMETHODCALLTYPE get_offsetAtPoint(long x,                    \
   1.170 +                                                    long y,                    \
   1.171 +                                                    enum IA2CoordinateType coordType,\
   1.172 +                                                    long *offset)              \
   1.173 +{                                                                              \
   1.174 +  return Class::get_offsetAtPoint(x, y, coordType, offset);                    \
   1.175 +}                                                                              \
   1.176 +                                                                               \
   1.177 +virtual HRESULT STDMETHODCALLTYPE get_selection(long selectionIndex,           \
   1.178 +                                                long *startOffset,             \
   1.179 +                                                long *endOffset)               \
   1.180 +{                                                                              \
   1.181 +  return Class::get_selection(selectionIndex, startOffset, endOffset);         \
   1.182 +}                                                                              \
   1.183 +                                                                               \
   1.184 +virtual HRESULT STDMETHODCALLTYPE get_text(long startOffset,                   \
   1.185 +                                           long endOffset,                     \
   1.186 +                                           BSTR *text)                         \
   1.187 +{                                                                              \
   1.188 +  return Class::get_text(startOffset, endOffset, text);                        \
   1.189 +}                                                                              \
   1.190 +                                                                               \
   1.191 +virtual HRESULT STDMETHODCALLTYPE get_textBeforeOffset(long offset,            \
   1.192 +                                                       enum IA2TextBoundaryType boundaryType,\
   1.193 +                                                       long *startOffset,      \
   1.194 +                                                       long *endOffset,        \
   1.195 +                                                       BSTR *text)             \
   1.196 +{                                                                              \
   1.197 +  return Class::get_textBeforeOffset(offset, boundaryType,                     \
   1.198 +                                     startOffset, endOffset, text);            \
   1.199 +}                                                                              \
   1.200 +                                                                               \
   1.201 +virtual HRESULT STDMETHODCALLTYPE get_textAfterOffset(long offset,             \
   1.202 +                                                      enum IA2TextBoundaryType boundaryType,\
   1.203 +                                                      long *startOffset,       \
   1.204 +                                                      long *endOffset,         \
   1.205 +                                                      BSTR *text)              \
   1.206 +{                                                                              \
   1.207 +  return Class::get_textAfterOffset(offset, boundaryType,                      \
   1.208 +                                    startOffset, endOffset, text);             \
   1.209 +}                                                                              \
   1.210 +                                                                               \
   1.211 +virtual HRESULT STDMETHODCALLTYPE get_textAtOffset(long offset,                \
   1.212 +                                                   enum IA2TextBoundaryType boundaryType,\
   1.213 +                                                   long *startOffset,          \
   1.214 +                                                   long *endOffset,            \
   1.215 +                                                   BSTR *text)                 \
   1.216 +{                                                                              \
   1.217 +  return Class::get_textAtOffset(offset, boundaryType,                         \
   1.218 +                                 startOffset, endOffset, text);                \
   1.219 +}                                                                              \
   1.220 +                                                                               \
   1.221 +virtual HRESULT STDMETHODCALLTYPE removeSelection(long selectionIndex)         \
   1.222 +{                                                                              \
   1.223 +  return Class::removeSelection(selectionIndex);                               \
   1.224 +}                                                                              \
   1.225 +                                                                               \
   1.226 +virtual HRESULT STDMETHODCALLTYPE setCaretOffset(long offset)                  \
   1.227 +{                                                                              \
   1.228 +  return Class::setCaretOffset(offset);                                        \
   1.229 +}                                                                              \
   1.230 +                                                                               \
   1.231 +virtual HRESULT STDMETHODCALLTYPE setSelection(long selectionIndex,            \
   1.232 +                                               long startOffset,               \
   1.233 +                                               long endOffset)                 \
   1.234 +{                                                                              \
   1.235 +  return Class::setSelection(selectionIndex, startOffset, endOffset);          \
   1.236 +}                                                                              \
   1.237 +                                                                               \
   1.238 +virtual HRESULT STDMETHODCALLTYPE get_nCharacters(long *nCharacters)           \
   1.239 +{                                                                              \
   1.240 +  return Class::get_nCharacters(nCharacters);                                  \
   1.241 +}                                                                              \
   1.242 +                                                                               \
   1.243 +virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(long startIndex,           \
   1.244 +                                                    long endIndex,             \
   1.245 +                                                    enum IA2ScrollType scrollType)\
   1.246 +{                                                                              \
   1.247 +  return Class::scrollSubstringTo(startIndex, endIndex, scrollType);           \
   1.248 +}                                                                              \
   1.249 +                                                                               \
   1.250 +virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(long startIndex,      \
   1.251 +                                                         long endIndex,        \
   1.252 +                                                         enum IA2CoordinateType coordinateType,\
   1.253 +                                                         long x,               \
   1.254 +                                                         long y)               \
   1.255 +{                                                                              \
   1.256 +  return Class::scrollSubstringToPoint(startIndex, endIndex,                   \
   1.257 +                                       coordinateType, x, y);                  \
   1.258 +}                                                                              \
   1.259 +                                                                               \
   1.260 +virtual HRESULT STDMETHODCALLTYPE get_newText(IA2TextSegment *newText)         \
   1.261 +{                                                                              \
   1.262 +  return Class::get_newText(newText);                                          \
   1.263 +}                                                                              \
   1.264 +                                                                               \
   1.265 +virtual HRESULT STDMETHODCALLTYPE get_oldText(IA2TextSegment *oldText)         \
   1.266 +{                                                                              \
   1.267 +  return Class::get_oldText(oldText);                                          \
   1.268 +}                                                                              \
   1.269 +
   1.270 +#endif
   1.271 +

mercurial