michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:expandtab:shiftwidth=2:tabstop=2: michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _ACCESSIBLE_TEXT_H michael@0: #define _ACCESSIBLE_TEXT_H michael@0: michael@0: #include "nsISupports.h" michael@0: #include "nsIAccessibleText.h" michael@0: michael@0: #include "AccessibleText.h" michael@0: michael@0: namespace mozilla { michael@0: namespace a11y { michael@0: michael@0: class ia2AccessibleText: public IAccessibleText michael@0: { michael@0: public: michael@0: michael@0: // IAccessibleText michael@0: virtual HRESULT STDMETHODCALLTYPE addSelection( michael@0: /* [in] */ long startOffset, michael@0: /* [in] */ long endOffset); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_attributes( michael@0: /* [in] */ long offset, michael@0: /* [out] */ long *startOffset, michael@0: /* [out] */ long *endOffset, michael@0: /* [retval][out] */ BSTR *textAttributes); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_caretOffset( michael@0: /* [retval][out] */ long *offset); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_characterExtents( michael@0: /* [in] */ long offset, michael@0: /* [in] */ enum IA2CoordinateType coordType, michael@0: /* [out] */ long *x, michael@0: /* [out] */ long *y, michael@0: /* [out] */ long *width, michael@0: /* [retval][out] */ long *height); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelections( michael@0: /* [retval][out] */ long *nSelections); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_offsetAtPoint( michael@0: /* [in] */ long x, michael@0: /* [in] */ long y, michael@0: /* [in] */ enum IA2CoordinateType coordType, michael@0: /* [retval][out] */ long *offset); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selection( michael@0: /* [in] */ long selectionIndex, michael@0: /* [out] */ long *startOffset, michael@0: /* [retval][out] */ long *endOffset); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_text( michael@0: /* [in] */ long startOffset, michael@0: /* [in] */ long endOffset, michael@0: /* [retval][out] */ BSTR *text); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textBeforeOffset( michael@0: /* [in] */ long offset, michael@0: /* [in] */ enum IA2TextBoundaryType boundaryType, michael@0: /* [out] */ long *startOffset, michael@0: /* [out] */ long *endOffset, michael@0: /* [retval][out] */ BSTR *text); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAfterOffset( michael@0: /* [in] */ long offset, michael@0: /* [in] */ enum IA2TextBoundaryType boundaryType, michael@0: /* [out] */ long *startOffset, michael@0: /* [out] */ long *endOffset, michael@0: /* [retval][out] */ BSTR *text); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAtOffset( michael@0: /* [in] */ long offset, michael@0: /* [in] */ enum IA2TextBoundaryType boundaryType, michael@0: /* [out] */ long *startOffset, michael@0: /* [out] */ long *endOffset, michael@0: /* [retval][out] */ BSTR *text); michael@0: michael@0: virtual HRESULT STDMETHODCALLTYPE removeSelection( michael@0: /* [in] */ long selectionIndex); michael@0: michael@0: virtual HRESULT STDMETHODCALLTYPE setCaretOffset( michael@0: /* [in] */ long offset); michael@0: michael@0: virtual HRESULT STDMETHODCALLTYPE setSelection( michael@0: /* [in] */ long selectionIndex, michael@0: /* [in] */ long startOffset, michael@0: /* [in] */ long endOffset); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nCharacters( michael@0: /* [retval][out] */ long *nCharacters); michael@0: michael@0: virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo( michael@0: /* [in] */ long startIndex, michael@0: /* [in] */ long endIndex, michael@0: /* [in] */ enum IA2ScrollType scrollType); michael@0: michael@0: virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint( michael@0: /* [in] */ long startIndex, michael@0: /* [in] */ long endIndex, michael@0: /* [in] */ enum IA2CoordinateType coordinateType, michael@0: /* [in] */ long x, michael@0: /* [in] */ long y); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_newText( michael@0: /* [retval][out] */ IA2TextSegment *newText); michael@0: michael@0: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText( michael@0: /* [retval][out] */ IA2TextSegment *oldText); michael@0: michael@0: protected: michael@0: virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText, michael@0: uint32_t *aStartOffset, michael@0: uint32_t *aEndOffset) = 0; michael@0: michael@0: private: michael@0: HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText); michael@0: AccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType); michael@0: }; michael@0: michael@0: } // namespace a11y michael@0: } // namespace mozilla michael@0: michael@0: michael@0: #define FORWARD_IACCESSIBLETEXT(Class) \ michael@0: virtual HRESULT STDMETHODCALLTYPE addSelection(long startOffset, \ michael@0: long endOffset) \ michael@0: { \ michael@0: return Class::addSelection(startOffset, endOffset); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_attributes(long offset, \ michael@0: long *startOffset, \ michael@0: long *endOffset, \ michael@0: BSTR *textAttributes) \ michael@0: { \ michael@0: return Class::get_attributes(offset, startOffset, endOffset, textAttributes);\ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_caretOffset(long *offset) \ michael@0: { \ michael@0: return Class::get_caretOffset(offset); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_characterExtents(long offset, \ michael@0: enum IA2CoordinateType coordType,\ michael@0: long *x, \ michael@0: long *y, \ michael@0: long *width, \ michael@0: long *height) \ michael@0: { \ michael@0: return Class::get_characterExtents(offset, coordType, x, y, width, height); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_nSelections(long *nSelections) \ michael@0: { \ michael@0: return Class::get_nSelections(nSelections); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_offsetAtPoint(long x, \ michael@0: long y, \ michael@0: enum IA2CoordinateType coordType,\ michael@0: long *offset) \ michael@0: { \ michael@0: return Class::get_offsetAtPoint(x, y, coordType, offset); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_selection(long selectionIndex, \ michael@0: long *startOffset, \ michael@0: long *endOffset) \ michael@0: { \ michael@0: return Class::get_selection(selectionIndex, startOffset, endOffset); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_text(long startOffset, \ michael@0: long endOffset, \ michael@0: BSTR *text) \ michael@0: { \ michael@0: return Class::get_text(startOffset, endOffset, text); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_textBeforeOffset(long offset, \ michael@0: enum IA2TextBoundaryType boundaryType,\ michael@0: long *startOffset, \ michael@0: long *endOffset, \ michael@0: BSTR *text) \ michael@0: { \ michael@0: return Class::get_textBeforeOffset(offset, boundaryType, \ michael@0: startOffset, endOffset, text); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_textAfterOffset(long offset, \ michael@0: enum IA2TextBoundaryType boundaryType,\ michael@0: long *startOffset, \ michael@0: long *endOffset, \ michael@0: BSTR *text) \ michael@0: { \ michael@0: return Class::get_textAfterOffset(offset, boundaryType, \ michael@0: startOffset, endOffset, text); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_textAtOffset(long offset, \ michael@0: enum IA2TextBoundaryType boundaryType,\ michael@0: long *startOffset, \ michael@0: long *endOffset, \ michael@0: BSTR *text) \ michael@0: { \ michael@0: return Class::get_textAtOffset(offset, boundaryType, \ michael@0: startOffset, endOffset, text); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE removeSelection(long selectionIndex) \ michael@0: { \ michael@0: return Class::removeSelection(selectionIndex); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE setCaretOffset(long offset) \ michael@0: { \ michael@0: return Class::setCaretOffset(offset); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE setSelection(long selectionIndex, \ michael@0: long startOffset, \ michael@0: long endOffset) \ michael@0: { \ michael@0: return Class::setSelection(selectionIndex, startOffset, endOffset); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_nCharacters(long *nCharacters) \ michael@0: { \ michael@0: return Class::get_nCharacters(nCharacters); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(long startIndex, \ michael@0: long endIndex, \ michael@0: enum IA2ScrollType scrollType)\ michael@0: { \ michael@0: return Class::scrollSubstringTo(startIndex, endIndex, scrollType); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(long startIndex, \ michael@0: long endIndex, \ michael@0: enum IA2CoordinateType coordinateType,\ michael@0: long x, \ michael@0: long y) \ michael@0: { \ michael@0: return Class::scrollSubstringToPoint(startIndex, endIndex, \ michael@0: coordinateType, x, y); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_newText(IA2TextSegment *newText) \ michael@0: { \ michael@0: return Class::get_newText(newText); \ michael@0: } \ michael@0: \ michael@0: virtual HRESULT STDMETHODCALLTYPE get_oldText(IA2TextSegment *oldText) \ michael@0: { \ michael@0: return Class::get_oldText(oldText); \ michael@0: } \ michael@0: michael@0: #endif michael@0: