1 #ifndef DALI_ADAPTOR_ATSPI_TEXT_H
2 #define DALI_ADAPTOR_ATSPI_TEXT_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
24 #include <dali/devel-api/adaptor-framework/accessibility.h>
25 #include <dali/devel-api/atspi-interfaces/accessible.h>
27 namespace Dali::Accessibility
30 * @brief Interface representing objects which can store immutable texts.
32 * @see Dali::Accessibility::EditableText
34 class DALI_ADAPTOR_API Text : public virtual Accessible
38 * @brief Gets stored text in given range.
40 * @param[in] startOffset The index of first character
41 * @param[in] endOffset The index of first character after the last one expected
43 * @return The substring of stored text
45 virtual std::string GetText(size_t startOffset, size_t endOffset) = 0;
48 * @brief Gets number of all stored characters.
50 * @return The number of characters
51 * @remarks This method is `CharacterCount` in DBus method.
53 virtual size_t GetCharacterCount() = 0;
56 * @brief Gets the cursor offset.
58 * @return Value of cursor offset
59 * @remarks This method is `CaretOffset` in DBus method.
61 virtual size_t GetCursorOffset() = 0;
64 * @brief Sets the cursor offset.
66 * @param[in] offset Cursor offset
68 * @return True if successful
69 * @remarks This method is `SetCaretOffset` in DBus method.
71 virtual bool SetCursorOffset(size_t offset) = 0;
74 * @brief Gets substring of stored text truncated in concrete gradation.
76 * @param[in] offset The position in stored text
77 * @param[in] boundary The enumeration describing text gradation
79 * @return Range structure containing acquired text and offsets in original string
81 * @see Dali::Accessibility::Range
83 virtual Range GetTextAtOffset(size_t offset, TextBoundary boundary) = 0;
86 * @brief Gets selected text.
88 * @param[in] selectionIndex The selection index
89 * @note Currently only one selection (i.e. with index = 0) is supported
91 * @return Range structure containing acquired text and offsets in original string
93 * @remarks This method is `GetSelection` in DBus method.
94 * @see Dali::Accessibility::Range
96 virtual Range GetRangeOfSelection(size_t selectionIndex) = 0;
99 * @brief Removes the whole selection.
101 * @param[in] selectionIndex The selection index
102 * @note Currently only one selection (i.e. with index = 0) is supported
104 * @return bool on success, false otherwise
106 virtual bool RemoveSelection(size_t selectionIndex) = 0;
109 * @brief Sets selected text.
111 * @param[in] selectionIndex The selection index
112 * @param[in] startOffset The index of first character
113 * @param[in] endOffset The index of first character after the last one expected
115 * @note Currently only one selection (i.e. with index = 0) is supported
117 * @return true on success, false otherwise
118 * @remarks This method is `SetSelection` in DBus method.
120 virtual bool SetRangeOfSelection(size_t selectionIndex, size_t startOffset, size_t endOffset) = 0;
123 } // namespace Dali::Accessibility
125 #endif // DALI_ADAPTOR_ATSPI_TEXT_H