xpcAccessibleTextRange.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  4. * You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_a11y_xpcAccessibleTextRange_h_
  6. #define mozilla_a11y_xpcAccessibleTextRange_h_
  7. #include "nsIAccessibleTextRange.h"
  8. #include "TextRange.h"
  9. #include "mozilla/Move.h"
  10. #include "nsCycleCollectionParticipant.h"
  11. namespace mozilla {
  12. namespace a11y {
  13. class TextRange;
  14. #define NS_ACCESSIBLETEXTRANGE_IMPL_IID \
  15. { /* 133c8bf4-4913-4355-bd50-426bd1d6e1ad */ \
  16. 0xb17652d9, \
  17. 0x4f54, \
  18. 0x4c56, \
  19. { 0xbb, 0x62, 0x6d, 0x5b, 0xf1, 0xef, 0x91, 0x0c } \
  20. }
  21. class xpcAccessibleTextRange final : public nsIAccessibleTextRange
  22. {
  23. public:
  24. NS_DECL_CYCLE_COLLECTING_ISUPPORTS
  25. NS_DECL_CYCLE_COLLECTION_CLASS(xpcAccessibleTextRange)
  26. NS_IMETHOD GetStartContainer(nsIAccessibleText** aAnchor) final override;
  27. NS_IMETHOD GetStartOffset(int32_t* aOffset) final override;
  28. NS_IMETHOD GetEndContainer(nsIAccessibleText** aAnchor) final override;
  29. NS_IMETHOD GetEndOffset(int32_t* aOffset) final override;
  30. NS_IMETHOD GetContainer(nsIAccessible** aContainer) final override;
  31. NS_IMETHOD GetEmbeddedChildren(nsIArray** aList) final override;
  32. NS_IMETHOD Compare(nsIAccessibleTextRange* aOtherRange, bool* aResult) final override;
  33. NS_IMETHOD CompareEndPoints(uint32_t aEndPoint,
  34. nsIAccessibleTextRange* aOtherRange,
  35. uint32_t aOtherRangeEndPoint,
  36. int32_t* aResult) final override;
  37. NS_IMETHOD GetText(nsAString& aText) final override;
  38. NS_IMETHOD GetBounds(nsIArray** aRectList) final override;
  39. NS_IMETHOD Move(uint32_t aUnit, int32_t aCount) final override;
  40. NS_IMETHOD MoveStart(uint32_t aUnit, int32_t aCount) final override;
  41. NS_IMETHOD MoveEnd(uint32_t aUnit, int32_t aCount) final override;
  42. NS_IMETHOD Normalize(uint32_t aUnit) final override;
  43. NS_IMETHOD Crop(nsIAccessible* aContainer, bool* aSuccess) final override;
  44. NS_IMETHOD FindText(const nsAString& aText, bool aIsBackward, bool aIsIgnoreCase,
  45. nsIAccessibleTextRange** aRange) final override;
  46. NS_IMETHOD FindAttr(uint32_t aAttr, nsIVariant* aVal, bool aIsBackward,
  47. nsIAccessibleTextRange** aRange) final override;
  48. NS_IMETHOD AddToSelection() final override;
  49. NS_IMETHOD RemoveFromSelection() final override;
  50. NS_IMETHOD Select() final override;
  51. NS_IMETHOD ScrollIntoView(uint32_t aHow) final override;
  52. NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSIBLETEXTRANGE_IMPL_IID)
  53. private:
  54. explicit xpcAccessibleTextRange(TextRange&& aRange) :
  55. mRange(Forward<TextRange>(aRange)) {}
  56. xpcAccessibleTextRange() {}
  57. ~xpcAccessibleTextRange() {}
  58. friend class xpcAccessibleHyperText;
  59. xpcAccessibleTextRange(const xpcAccessibleTextRange&) = delete;
  60. xpcAccessibleTextRange& operator =(const xpcAccessibleTextRange&) = delete;
  61. TextRange mRange;
  62. };
  63. NS_DEFINE_STATIC_IID_ACCESSOR(xpcAccessibleTextRange,
  64. NS_ACCESSIBLETEXTRANGE_IMPL_IID)
  65. } // namespace a11y
  66. } // namespace mozilla
  67. #endif