accessible/src/windows/ia2/ia2AccessibleText.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim:expandtab:shiftwidth=2:tabstop=2:
     3  */
     4 /* This Source Code Form is subject to the terms of the Mozilla Public
     5  * License, v. 2.0. If a copy of the MPL was not distributed with this
     6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 #ifndef _ACCESSIBLE_TEXT_H
     9 #define _ACCESSIBLE_TEXT_H
    11 #include "nsISupports.h"
    12 #include "nsIAccessibleText.h"
    14 #include "AccessibleText.h"
    16 namespace mozilla {
    17 namespace a11y {
    19 class ia2AccessibleText: public IAccessibleText
    20 {
    21 public:
    23   // IAccessibleText
    24   virtual HRESULT STDMETHODCALLTYPE addSelection(
    25       /* [in] */ long startOffset,
    26       /* [in] */ long endOffset);
    28   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_attributes(
    29       /* [in] */ long offset,
    30       /* [out] */ long *startOffset,
    31       /* [out] */ long *endOffset,
    32       /* [retval][out] */ BSTR *textAttributes);
    34   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_caretOffset(
    35       /* [retval][out] */ long *offset);
    37   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_characterExtents(
    38       /* [in] */ long offset,
    39       /* [in] */ enum IA2CoordinateType coordType,
    40       /* [out] */ long *x,
    41       /* [out] */ long *y,
    42       /* [out] */ long *width,
    43       /* [retval][out] */ long *height);
    45   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelections(
    46       /* [retval][out] */ long *nSelections);
    48   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_offsetAtPoint(
    49       /* [in] */ long x,
    50       /* [in] */ long y,
    51       /* [in] */ enum IA2CoordinateType coordType,
    52       /* [retval][out] */ long *offset);
    54   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selection(
    55       /* [in] */ long selectionIndex,
    56       /* [out] */ long *startOffset,
    57       /* [retval][out] */ long *endOffset);
    59   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_text(
    60       /* [in] */ long startOffset,
    61       /* [in] */ long endOffset,
    62       /* [retval][out] */ BSTR *text);
    64   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textBeforeOffset(
    65       /* [in] */ long offset,
    66       /* [in] */ enum IA2TextBoundaryType boundaryType,
    67       /* [out] */ long *startOffset,
    68       /* [out] */ long *endOffset,
    69       /* [retval][out] */ BSTR *text);
    71   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAfterOffset(
    72       /* [in] */ long offset,
    73       /* [in] */ enum IA2TextBoundaryType boundaryType,
    74       /* [out] */ long *startOffset,
    75       /* [out] */ long *endOffset,
    76       /* [retval][out] */ BSTR *text);
    78   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAtOffset(
    79       /* [in] */ long offset,
    80       /* [in] */ enum IA2TextBoundaryType boundaryType,
    81       /* [out] */ long *startOffset,
    82       /* [out] */ long *endOffset,
    83       /* [retval][out] */ BSTR *text);
    85   virtual HRESULT STDMETHODCALLTYPE removeSelection(
    86       /* [in] */ long selectionIndex);
    88   virtual HRESULT STDMETHODCALLTYPE setCaretOffset(
    89       /* [in] */ long offset);
    91   virtual HRESULT STDMETHODCALLTYPE setSelection(
    92       /* [in] */ long selectionIndex,
    93       /* [in] */ long startOffset,
    94       /* [in] */ long endOffset);
    96   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nCharacters(
    97       /* [retval][out] */ long *nCharacters);
    99   virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(
   100       /* [in] */ long startIndex,
   101       /* [in] */ long endIndex,
   102       /* [in] */ enum IA2ScrollType scrollType);
   104   virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(
   105       /* [in] */ long startIndex,
   106       /* [in] */ long endIndex,
   107       /* [in] */ enum IA2CoordinateType coordinateType,
   108       /* [in] */ long x,
   109       /* [in] */ long y);
   111   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_newText(
   112       /* [retval][out] */ IA2TextSegment *newText);
   114   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText(
   115       /* [retval][out] */ IA2TextSegment *oldText);
   117 protected:
   118   virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
   119                                    uint32_t *aStartOffset,
   120                                    uint32_t *aEndOffset) = 0;
   122 private:
   123   HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText);
   124   AccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType);
   125 };
   127 } // namespace a11y
   128 } // namespace mozilla
   131 #define FORWARD_IACCESSIBLETEXT(Class)                                         \
   132 virtual HRESULT STDMETHODCALLTYPE addSelection(long startOffset,               \
   133                                                long endOffset)                 \
   134 {                                                                              \
   135   return Class::addSelection(startOffset, endOffset);                          \
   136 }                                                                              \
   137                                                                                \
   138 virtual HRESULT STDMETHODCALLTYPE get_attributes(long offset,                  \
   139                                                  long *startOffset,            \
   140                                                  long *endOffset,              \
   141                                                  BSTR *textAttributes)         \
   142 {                                                                              \
   143   return Class::get_attributes(offset, startOffset, endOffset, textAttributes);\
   144 }                                                                              \
   145                                                                                \
   146 virtual HRESULT STDMETHODCALLTYPE get_caretOffset(long *offset)                \
   147 {                                                                              \
   148   return Class::get_caretOffset(offset);                                       \
   149 }                                                                              \
   150                                                                                \
   151 virtual HRESULT STDMETHODCALLTYPE get_characterExtents(long offset,            \
   152                                                        enum IA2CoordinateType coordType,\
   153                                                        long *x,                \
   154                                                        long *y,                \
   155                                                        long *width,            \
   156                                                        long *height)           \
   157 {                                                                              \
   158   return Class::get_characterExtents(offset, coordType, x, y, width, height);  \
   159 }                                                                              \
   160                                                                                \
   161 virtual HRESULT STDMETHODCALLTYPE get_nSelections(long *nSelections)           \
   162 {                                                                              \
   163   return Class::get_nSelections(nSelections);                                  \
   164 }                                                                              \
   165                                                                                \
   166 virtual HRESULT STDMETHODCALLTYPE get_offsetAtPoint(long x,                    \
   167                                                     long y,                    \
   168                                                     enum IA2CoordinateType coordType,\
   169                                                     long *offset)              \
   170 {                                                                              \
   171   return Class::get_offsetAtPoint(x, y, coordType, offset);                    \
   172 }                                                                              \
   173                                                                                \
   174 virtual HRESULT STDMETHODCALLTYPE get_selection(long selectionIndex,           \
   175                                                 long *startOffset,             \
   176                                                 long *endOffset)               \
   177 {                                                                              \
   178   return Class::get_selection(selectionIndex, startOffset, endOffset);         \
   179 }                                                                              \
   180                                                                                \
   181 virtual HRESULT STDMETHODCALLTYPE get_text(long startOffset,                   \
   182                                            long endOffset,                     \
   183                                            BSTR *text)                         \
   184 {                                                                              \
   185   return Class::get_text(startOffset, endOffset, text);                        \
   186 }                                                                              \
   187                                                                                \
   188 virtual HRESULT STDMETHODCALLTYPE get_textBeforeOffset(long offset,            \
   189                                                        enum IA2TextBoundaryType boundaryType,\
   190                                                        long *startOffset,      \
   191                                                        long *endOffset,        \
   192                                                        BSTR *text)             \
   193 {                                                                              \
   194   return Class::get_textBeforeOffset(offset, boundaryType,                     \
   195                                      startOffset, endOffset, text);            \
   196 }                                                                              \
   197                                                                                \
   198 virtual HRESULT STDMETHODCALLTYPE get_textAfterOffset(long offset,             \
   199                                                       enum IA2TextBoundaryType boundaryType,\
   200                                                       long *startOffset,       \
   201                                                       long *endOffset,         \
   202                                                       BSTR *text)              \
   203 {                                                                              \
   204   return Class::get_textAfterOffset(offset, boundaryType,                      \
   205                                     startOffset, endOffset, text);             \
   206 }                                                                              \
   207                                                                                \
   208 virtual HRESULT STDMETHODCALLTYPE get_textAtOffset(long offset,                \
   209                                                    enum IA2TextBoundaryType boundaryType,\
   210                                                    long *startOffset,          \
   211                                                    long *endOffset,            \
   212                                                    BSTR *text)                 \
   213 {                                                                              \
   214   return Class::get_textAtOffset(offset, boundaryType,                         \
   215                                  startOffset, endOffset, text);                \
   216 }                                                                              \
   217                                                                                \
   218 virtual HRESULT STDMETHODCALLTYPE removeSelection(long selectionIndex)         \
   219 {                                                                              \
   220   return Class::removeSelection(selectionIndex);                               \
   221 }                                                                              \
   222                                                                                \
   223 virtual HRESULT STDMETHODCALLTYPE setCaretOffset(long offset)                  \
   224 {                                                                              \
   225   return Class::setCaretOffset(offset);                                        \
   226 }                                                                              \
   227                                                                                \
   228 virtual HRESULT STDMETHODCALLTYPE setSelection(long selectionIndex,            \
   229                                                long startOffset,               \
   230                                                long endOffset)                 \
   231 {                                                                              \
   232   return Class::setSelection(selectionIndex, startOffset, endOffset);          \
   233 }                                                                              \
   234                                                                                \
   235 virtual HRESULT STDMETHODCALLTYPE get_nCharacters(long *nCharacters)           \
   236 {                                                                              \
   237   return Class::get_nCharacters(nCharacters);                                  \
   238 }                                                                              \
   239                                                                                \
   240 virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(long startIndex,           \
   241                                                     long endIndex,             \
   242                                                     enum IA2ScrollType scrollType)\
   243 {                                                                              \
   244   return Class::scrollSubstringTo(startIndex, endIndex, scrollType);           \
   245 }                                                                              \
   246                                                                                \
   247 virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(long startIndex,      \
   248                                                          long endIndex,        \
   249                                                          enum IA2CoordinateType coordinateType,\
   250                                                          long x,               \
   251                                                          long y)               \
   252 {                                                                              \
   253   return Class::scrollSubstringToPoint(startIndex, endIndex,                   \
   254                                        coordinateType, x, y);                  \
   255 }                                                                              \
   256                                                                                \
   257 virtual HRESULT STDMETHODCALLTYPE get_newText(IA2TextSegment *newText)         \
   258 {                                                                              \
   259   return Class::get_newText(newText);                                          \
   260 }                                                                              \
   261                                                                                \
   262 virtual HRESULT STDMETHODCALLTYPE get_oldText(IA2TextSegment *oldText)         \
   263 {                                                                              \
   264   return Class::get_oldText(oldText);                                          \
   265 }                                                                              \
   267 #endif

mercurial