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