• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "accessibility_element_info.h"
17 #include "hilog_wrapper.h"
18 
19 namespace OHOS {
20 namespace Accessibility {
SetComponentId(const int32_t componentId)21 void AccessibilityElementInfo::SetComponentId(const int32_t componentId)
22 {
23     elementId_ = componentId;
24     HILOG_DEBUG("elementId_[%{public}d]", elementId_);
25 }
26 
GetChildId(const int32_t index) const27 int32_t AccessibilityElementInfo::GetChildId(const int32_t index) const
28 {
29     HILOG_DEBUG("index[%{public}d]", index);
30     if (index >= childCount_ || index < 0) {
31         HILOG_ERROR("index[%{public}d] is invalid", index);
32         return -1;
33     }
34     return childNodeIds_[index];
35 }
36 
GetChildCount() const37 int32_t AccessibilityElementInfo::GetChildCount() const
38 {
39     HILOG_DEBUG("childCount_[%{public}d]", childCount_);
40     return childCount_;
41 }
42 
GetChildIds() const43 const std::vector<int32_t> &AccessibilityElementInfo::GetChildIds() const
44 {
45     HILOG_DEBUG("childCount_[%{public}d]", childCount_);
46     return childNodeIds_;
47 }
48 
AddChild(const int32_t childId)49 void AccessibilityElementInfo::AddChild(const int32_t childId)
50 {
51     HILOG_DEBUG("childId[%{public}d]", childId);
52     for (int32_t i = 0; i < childCount_; i++) {
53         if (childNodeIds_[i] == childId) {
54             HILOG_ERROR("childId[%{public}d] is exited", childId);
55             return;
56         }
57     }
58     childCount_++;
59     childNodeIds_.push_back(childId);
60     HILOG_DEBUG("childId[%{public}d] end", childId);
61 }
62 
RemoveChild(const int32_t childId)63 bool AccessibilityElementInfo::RemoveChild(const int32_t childId)
64 {
65     HILOG_DEBUG("childId[%{public}d]", childId);
66     for (auto iter = childNodeIds_.begin(); iter != childNodeIds_.end(); iter++) {
67         if (*iter == childId) {
68             iter = childNodeIds_.erase(iter);
69             childCount_--;
70             return true;
71         }
72     }
73     HILOG_ERROR("Not find childId[%{public}d]", childId);
74     return false;
75 }
76 
GetActionList() const77 const std::vector<AccessibleAction> &AccessibilityElementInfo::GetActionList() const
78 {
79     HILOG_DEBUG();
80     return operations_;
81 }
82 
AddAction(AccessibleAction & action)83 void AccessibilityElementInfo::AddAction(AccessibleAction &action)
84 {
85     HILOG_DEBUG("actionType[%{public}d]", action.GetActionType());
86     operations_.push_back(action);
87 }
88 
DeleteAction(AccessibleAction & action)89 void AccessibilityElementInfo::DeleteAction(AccessibleAction &action)
90 {
91     HILOG_DEBUG();
92     for (auto iter = operations_.begin(); iter != operations_.end(); iter++) {
93         HILOG_DEBUG("actionType[%{public}d]", action.GetActionType());
94         if (iter->GetActionType() == action.GetActionType()) {
95             iter = operations_.erase(iter);
96             return;
97         }
98     }
99     HILOG_ERROR("Not find actionType[%{public}d]", action.GetActionType());
100 }
101 
DeleteAction(ActionType & actionType)102 bool AccessibilityElementInfo::DeleteAction(ActionType &actionType)
103 {
104     HILOG_DEBUG();
105     for (auto iter = operations_.begin(); iter != operations_.end(); iter++) {
106         HILOG_DEBUG("actionType[%{public}d]", actionType);
107         if (iter->GetActionType() == actionType) {
108             iter = operations_.erase(iter);
109             return true;
110         }
111     }
112     HILOG_ERROR("Not find actionType[%{public}d]", actionType);
113     return false;
114 }
115 
DeleteAllActions()116 void AccessibilityElementInfo::DeleteAllActions()
117 {
118     HILOG_DEBUG();
119     operations_.clear();
120 }
121 
SetTextLengthLimit(const int32_t max)122 void AccessibilityElementInfo::SetTextLengthLimit(const int32_t max)
123 {
124     textLengthLimit_ = max;
125     HILOG_DEBUG("textLengthLimit_[%{public}d]", textLengthLimit_);
126 }
127 
GetTextLengthLimit() const128 int32_t AccessibilityElementInfo::GetTextLengthLimit() const
129 {
130     HILOG_DEBUG("textLengthLimit_[%{public}d]", textLengthLimit_);
131     return textLengthLimit_;
132 }
133 
GetWindowId() const134 int32_t AccessibilityElementInfo::GetWindowId() const
135 {
136     HILOG_DEBUG("windowId_[%{public}d]", windowId_);
137     return windowId_;
138 }
139 
SetWindowId(const int32_t windowId)140 void AccessibilityElementInfo::SetWindowId(const int32_t windowId)
141 {
142     windowId_ = windowId;
143     HILOG_DEBUG("windowId_[%{public}d]", windowId_);
144 }
145 
GetParentNodeId() const146 int32_t AccessibilityElementInfo::GetParentNodeId() const
147 {
148     HILOG_DEBUG("parentId_[%{public}d]", parentId_);
149     return parentId_;
150 }
151 
SetParent(const int32_t parentId)152 void AccessibilityElementInfo::SetParent(const int32_t parentId)
153 {
154     parentId_ = parentId;
155     HILOG_DEBUG("parentId_[%{public}d]", parentId_);
156 }
157 
GetRectInScreen() const158 const Rect &AccessibilityElementInfo::GetRectInScreen() const
159 {
160     HILOG_DEBUG("start");
161     return bounds_;
162 }
163 
SetRectInScreen(Rect & bounds)164 void AccessibilityElementInfo::SetRectInScreen(Rect &bounds)
165 {
166     HILOG_DEBUG();
167     bounds_.SetLeftTopScreenPostion(bounds.GetLeftTopXScreenPostion(), bounds.GetLeftTopYScreenPostion());
168     bounds_.SetRightBottomScreenPostion(bounds.GetRightBottomXScreenPostion(), bounds.GetRightBottomYScreenPostion());
169 }
170 
IsCheckable() const171 bool AccessibilityElementInfo::IsCheckable() const
172 {
173     HILOG_DEBUG("checkable_[%{public}d]", checkable_);
174     return checkable_;
175 }
176 
SetCheckable(const bool checkable)177 void AccessibilityElementInfo::SetCheckable(const bool checkable)
178 {
179     checkable_ = checkable;
180     HILOG_DEBUG("checkable_[%{public}d]", checkable_);
181 }
182 
IsChecked() const183 bool AccessibilityElementInfo::IsChecked() const
184 {
185     HILOG_DEBUG("checked_[%{public}d]", checked_);
186     return checked_;
187 }
188 
SetChecked(const bool checked)189 void AccessibilityElementInfo::SetChecked(const bool checked)
190 {
191     checked_ = checked;
192     HILOG_DEBUG("checked_[%{public}d]", checked_);
193 }
194 
IsFocusable() const195 bool AccessibilityElementInfo::IsFocusable() const
196 {
197     HILOG_DEBUG("focusable_[%{public}d]", focusable_);
198     return focusable_;
199 }
200 
SetFocusable(const bool focusable)201 void AccessibilityElementInfo::SetFocusable(const bool focusable)
202 {
203     focusable_ = focusable;
204     HILOG_DEBUG("focusable_[%{public}d]", focusable_);
205 }
206 
IsFocused() const207 bool AccessibilityElementInfo::IsFocused() const
208 {
209     HILOG_DEBUG("focused_[%{public}d]", focused_);
210     return focused_;
211 }
212 
SetFocused(const bool focused)213 void AccessibilityElementInfo::SetFocused(const bool focused)
214 {
215     focused_ = focused;
216     HILOG_DEBUG("focused_[%{public}d]", focused_);
217 }
218 
IsVisible() const219 bool AccessibilityElementInfo::IsVisible() const
220 {
221     HILOG_DEBUG("visible_[%{public}d]", visible_);
222     return visible_;
223 }
224 
SetVisible(const bool visible)225 void AccessibilityElementInfo::SetVisible(const bool visible)
226 {
227     visible_ = visible;
228     HILOG_DEBUG("visible_[%{public}d]", visible_);
229 }
230 
HasAccessibilityFocus() const231 bool AccessibilityElementInfo::HasAccessibilityFocus() const
232 {
233     HILOG_DEBUG("accessibilityFocused_[%{public}d]", accessibilityFocused_);
234     return accessibilityFocused_;
235 }
236 
SetAccessibilityFocus(const bool focused)237 void AccessibilityElementInfo::SetAccessibilityFocus(const bool focused)
238 {
239     accessibilityFocused_ = focused;
240     HILOG_DEBUG("accessibilityFocused_[%{public}d]", accessibilityFocused_);
241 }
242 
IsSelected() const243 bool AccessibilityElementInfo::IsSelected() const
244 {
245     HILOG_DEBUG("selected_[%{public}d]", selected_);
246     return selected_;
247 }
248 
SetSelected(const bool selected)249 void AccessibilityElementInfo::SetSelected(const bool selected)
250 {
251     selected_ = selected;
252     HILOG_DEBUG("selected_[%{public}d]", selected_);
253 }
254 
IsClickable() const255 bool AccessibilityElementInfo::IsClickable() const
256 {
257     HILOG_DEBUG("clickable_[%{public}d]", clickable_);
258     return clickable_;
259 }
260 
SetClickable(const bool clickable)261 void AccessibilityElementInfo::SetClickable(const bool clickable)
262 {
263     clickable_ = clickable;
264     HILOG_DEBUG("clickable_[%{public}d]", clickable_);
265 }
266 
IsLongClickable() const267 bool AccessibilityElementInfo::IsLongClickable() const
268 {
269     HILOG_DEBUG("longClickable_[%{public}d]", longClickable_);
270     return longClickable_;
271 }
272 
SetLongClickable(const bool longClickable)273 void AccessibilityElementInfo::SetLongClickable(const bool longClickable)
274 {
275     longClickable_ = longClickable;
276     HILOG_DEBUG("longClickable_[%{public}d]", longClickable_);
277 }
278 
IsEnabled() const279 bool AccessibilityElementInfo::IsEnabled() const
280 {
281     HILOG_DEBUG("enable_[%{public}d]", enable_);
282     return enable_;
283 }
284 
SetEnabled(const bool enabled)285 void AccessibilityElementInfo::SetEnabled(const bool enabled)
286 {
287     enable_ = enabled;
288     HILOG_DEBUG("enable_[%{public}d]", enable_);
289 }
290 
IsPassword() const291 bool AccessibilityElementInfo::IsPassword() const
292 {
293     HILOG_DEBUG();
294     return isPassword_;
295 }
296 
SetPassword(const bool type)297 void AccessibilityElementInfo::SetPassword(const bool type)
298 {
299     HILOG_DEBUG("type[%{public}d]", type);
300     isPassword_ = type;
301 }
302 
IsScrollable() const303 bool AccessibilityElementInfo::IsScrollable() const
304 {
305     HILOG_DEBUG("scrollable_[%{public}d]", scrollable_);
306     return scrollable_;
307 }
308 
SetScrollable(const bool scrollable)309 void AccessibilityElementInfo::SetScrollable(const bool scrollable)
310 {
311     scrollable_ = scrollable;
312     HILOG_DEBUG("scrollable_[%{public}d]", scrollable_);
313 }
314 
GetCurrentIndex() const315 int32_t AccessibilityElementInfo::GetCurrentIndex() const
316 {
317     HILOG_DEBUG("currentIndex_[%{public}d]", currentIndex_);
318     return currentIndex_;
319 }
320 
SetCurrentIndex(const int32_t index)321 void AccessibilityElementInfo::SetCurrentIndex(const int32_t index)
322 {
323     currentIndex_ = index;
324     HILOG_DEBUG("currentIndex_[%{public}d]", currentIndex_);
325 }
326 
GetBeginIndex() const327 int32_t AccessibilityElementInfo::GetBeginIndex() const
328 {
329     HILOG_DEBUG("beginIndex_[%{public}d]", beginIndex_);
330     return beginIndex_;
331 }
332 
SetBeginIndex(const int32_t index)333 void AccessibilityElementInfo::SetBeginIndex(const int32_t index)
334 {
335     beginIndex_ = index;
336     HILOG_DEBUG("beginIndex_[%{public}d]", beginIndex_);
337 }
338 
GetEndIndex() const339 int32_t AccessibilityElementInfo::GetEndIndex() const
340 {
341     HILOG_DEBUG("endIndex_[%{public}d]", endIndex_);
342     return endIndex_;
343 }
344 
SetEndIndex(const int32_t index)345 void AccessibilityElementInfo::SetEndIndex(const int32_t index)
346 {
347     endIndex_ = index;
348     HILOG_DEBUG("endIndex_[%{public}d]", endIndex_);
349 }
350 
GetInputType() const351 int32_t AccessibilityElementInfo::GetInputType() const
352 {
353     HILOG_DEBUG("inputType_[%{public}d]", inputType_);
354     return inputType_;
355 }
356 
SetInputType(const int32_t inputType)357 void AccessibilityElementInfo::SetInputType(const int32_t inputType)
358 {
359     inputType_ = inputType;
360     HILOG_DEBUG("inputType_[%{public}d]", inputType_);
361 }
362 
SetValidElement(const bool valid)363 void AccessibilityElementInfo::SetValidElement(const bool valid)
364 {
365     HILOG_DEBUG("validElevalidment_[%{public}d]", valid);
366     validElement_ = valid;
367 }
368 
SetInspectorKey(const std::string & key)369 void AccessibilityElementInfo::SetInspectorKey(const std::string &key)
370 {
371     HILOG_DEBUG("inspector key [%{public}s]", key.c_str());
372     inspectorKey_ = key;
373 }
374 
GetInspectorKey() const375 const std::string &AccessibilityElementInfo::GetInspectorKey() const
376 {
377     HILOG_DEBUG("inspector key [%{public}s]", inspectorKey_.c_str());
378     return inspectorKey_;
379 }
380 
SetPagePath(const std::string & path)381 void AccessibilityElementInfo::SetPagePath(const std::string &path)
382 {
383     HILOG_DEBUG("pagePath_[%{public}s]", path.c_str());
384     pagePath_ = path;
385 }
386 
GetPagePath() const387 const std::string &AccessibilityElementInfo::GetPagePath() const
388 {
389     HILOG_DEBUG("pagePath_[%{public}s]", pagePath_.c_str());
390     return pagePath_;
391 }
392 
IsValidElement() const393 bool AccessibilityElementInfo::IsValidElement() const
394 {
395     HILOG_DEBUG("validElement_[%{public}d]", validElement_);
396     return validElement_;
397 }
398 
IsEditable() const399 bool AccessibilityElementInfo::IsEditable() const
400 {
401     HILOG_DEBUG("editable_[%{public}d]", editable_);
402     return editable_;
403 }
404 
SetEditable(const bool editable)405 void AccessibilityElementInfo::SetEditable(const bool editable)
406 {
407     editable_ = editable;
408     HILOG_DEBUG("editable_[%{public}d]", editable_);
409 }
410 
IsPluraLineSupported() const411 bool AccessibilityElementInfo::IsPluraLineSupported() const
412 {
413     HILOG_DEBUG("multiLine_[%{public}d]", multiLine_);
414     return multiLine_;
415 }
416 
SetPluraLineSupported(const bool multiLine)417 void AccessibilityElementInfo::SetPluraLineSupported(const bool multiLine)
418 {
419     multiLine_ = multiLine;
420     HILOG_DEBUG("multiLine_[%{public}d]", multiLine_);
421 }
422 
IsPopupSupported() const423 bool AccessibilityElementInfo::IsPopupSupported() const
424 {
425     HILOG_DEBUG("popupSupported_[%{public}d]", popupSupported_);
426     return popupSupported_;
427 }
428 
SetPopupSupported(const bool supportPopup)429 void AccessibilityElementInfo::SetPopupSupported(const bool supportPopup)
430 {
431     popupSupported_ = supportPopup;
432     HILOG_DEBUG("popupSupported_[%{public}d]", popupSupported_);
433 }
434 
IsDeletable() const435 bool AccessibilityElementInfo::IsDeletable() const
436 {
437     HILOG_DEBUG("deletable_[%{public}d]", deletable_);
438     return deletable_;
439 }
440 
SetDeletable(const bool deletable)441 void AccessibilityElementInfo::SetDeletable(const bool deletable)
442 {
443     deletable_ = deletable;
444     HILOG_DEBUG("deletable_[%{public}d]", deletable_);
445 }
446 
IsEssential() const447 bool AccessibilityElementInfo::IsEssential() const
448 {
449     HILOG_DEBUG("isEssential_[%{public}d]", isEssential_);
450     return isEssential_;
451 }
452 
SetEssential(const bool essential)453 void AccessibilityElementInfo::SetEssential(const bool essential)
454 {
455     isEssential_ = essential;
456     HILOG_DEBUG("isEssential_[%{public}d]", isEssential_);
457 }
458 
IsGivingHint() const459 bool AccessibilityElementInfo::IsGivingHint() const
460 {
461     HILOG_DEBUG("hint_[%{public}d]", hint_);
462     return hint_;
463 }
SetHinting(const bool hinting)464 void AccessibilityElementInfo::SetHinting(const bool hinting)
465 {
466     hint_ = hinting;
467     HILOG_DEBUG("hint_[%{public}d]", hint_);
468 }
469 
GetBundleName() const470 const std::string &AccessibilityElementInfo::GetBundleName() const
471 {
472     HILOG_DEBUG("bundleName_[%{public}s]", bundleName_.c_str());
473     return bundleName_;
474 }
475 
SetBundleName(const std::string & bundleName)476 void AccessibilityElementInfo::SetBundleName(const std::string &bundleName)
477 {
478     bundleName_ = bundleName;
479     HILOG_DEBUG("bundleName_[%{public}s]", bundleName_.c_str());
480 }
481 
GetComponentType() const482 const std::string &AccessibilityElementInfo::GetComponentType() const
483 {
484     HILOG_DEBUG("componentType_[%{public}s]", componentType_.c_str());
485     return componentType_;
486 }
487 
SetComponentType(const std::string & className)488 void AccessibilityElementInfo::SetComponentType(const std::string &className)
489 {
490     componentType_ = className;
491     HILOG_DEBUG("componentType_[%{public}s]", componentType_.c_str());
492 }
493 
GetContent() const494 const std::string &AccessibilityElementInfo::GetContent() const
495 {
496     HILOG_DEBUG("text_[%{public}s]", text_.c_str());
497     return text_;
498 }
499 
SetContent(const std::string & text)500 void AccessibilityElementInfo::SetContent(const std::string &text)
501 {
502     text_ = text;
503     HILOG_DEBUG("text_[%{public}s]", text_.c_str());
504 }
505 
SetSelectedBegin(const int32_t start)506 void AccessibilityElementInfo::SetSelectedBegin(const int32_t start)
507 {
508     beginSelected_ = start;
509     HILOG_DEBUG("beginSelected_[%{public}d]", beginSelected_);
510 }
511 
GetSelectedBegin() const512 int32_t AccessibilityElementInfo::GetSelectedBegin() const
513 {
514     HILOG_DEBUG("beginSelected_[%{public}d]", beginSelected_);
515     return beginSelected_;
516 }
517 
SetSelectedEnd(const int32_t end)518 void AccessibilityElementInfo::SetSelectedEnd(const int32_t end)
519 {
520     endSelected_ = end;
521     HILOG_DEBUG("endSelected_[%{public}d]", endSelected_);
522 }
523 
GetSelectedEnd() const524 int32_t AccessibilityElementInfo::GetSelectedEnd() const
525 {
526     HILOG_DEBUG("endSelected_[%{public}d]", endSelected_);
527     return endSelected_;
528 }
529 
GetHint() const530 const std::string &AccessibilityElementInfo::GetHint() const
531 {
532     HILOG_DEBUG("hintText_[%{public}s]", hintText_.c_str());
533     return hintText_;
534 }
535 
SetHint(const std::string & hintText)536 void AccessibilityElementInfo::SetHint(const std::string &hintText)
537 {
538     hintText_ = hintText;
539     HILOG_DEBUG("hintText_[%{public}s]", hintText_.c_str());
540 }
541 
GetDescriptionInfo() const542 const std::string &AccessibilityElementInfo::GetDescriptionInfo() const
543 {
544     HILOG_DEBUG("contentDescription_[%{public}s]", contentDescription_.c_str());
545     return contentDescription_;
546 }
547 
SetDescriptionInfo(const std::string & contentDescription)548 void AccessibilityElementInfo::SetDescriptionInfo(const std::string &contentDescription)
549 {
550     contentDescription_ = contentDescription;
551     HILOG_DEBUG("contentDescription_[%{public}s]", contentDescription_.c_str());
552 }
553 
SetComponentResourceId(const std::string & viewIdResName)554 void AccessibilityElementInfo::SetComponentResourceId(const std::string &viewIdResName)
555 {
556     resourceName_ = viewIdResName;
557     HILOG_DEBUG("resourceName_[%{public}s]", resourceName_.c_str());
558 }
559 
GetComponentResourceId() const560 const std::string &AccessibilityElementInfo::GetComponentResourceId() const
561 {
562     HILOG_DEBUG("resourceName_[%{public}s]", resourceName_.c_str());
563     return resourceName_;
564 }
565 
SetLiveRegion(const int32_t liveRegion)566 void AccessibilityElementInfo::SetLiveRegion(const int32_t liveRegion)
567 {
568     liveRegion_ = liveRegion;
569     HILOG_DEBUG("liveRegion_[%{public}d]", liveRegion_);
570 }
571 
GetLiveRegion() const572 int32_t AccessibilityElementInfo::GetLiveRegion() const
573 {
574     HILOG_DEBUG("liveRegion_[%{public}d]", liveRegion_);
575     return liveRegion_;
576 }
577 
SetContentInvalid(const bool contentInvalid)578 void AccessibilityElementInfo::SetContentInvalid(const bool contentInvalid)
579 {
580     contentInvalid_ = contentInvalid;
581     HILOG_DEBUG("contentInvalid_[%{public}d]", contentInvalid_);
582 }
583 
GetContentInvalid() const584 bool AccessibilityElementInfo::GetContentInvalid() const
585 {
586     HILOG_DEBUG("contentInvalid_[%{public}d]", contentInvalid_);
587     return contentInvalid_;
588 }
589 
SetError(const std::string & error)590 void AccessibilityElementInfo::SetError(const std::string &error)
591 {
592     error_ = error;
593     HILOG_DEBUG("error_[%{public}s]", error_.c_str());
594 }
595 
GetError() const596 const std::string &AccessibilityElementInfo::GetError() const
597 {
598     HILOG_DEBUG("error_[%{public}s]", error_.c_str());
599     return error_;
600 }
601 
SetLabeled(const int32_t componentId)602 void AccessibilityElementInfo::SetLabeled(const int32_t componentId)
603 {
604     labeled_ = componentId;
605     HILOG_DEBUG("labeled_[%{public}d]", labeled_);
606 }
607 
GetLabeledAccessibilityId() const608 int32_t AccessibilityElementInfo::GetLabeledAccessibilityId() const
609 {
610     HILOG_DEBUG("labeled_[%{public}d]", labeled_);
611     return labeled_;
612 }
613 
SetAccessibilityId(const int32_t componentId)614 void AccessibilityElementInfo::SetAccessibilityId(const int32_t componentId)
615 {
616     elementId_ = componentId;
617     HILOG_DEBUG("elementId_[%{public}d]", elementId_);
618 }
619 
GetAccessibilityId() const620 int32_t AccessibilityElementInfo::GetAccessibilityId() const
621 {
622     HILOG_DEBUG("elementId_[%{public}d]", elementId_);
623     return elementId_;
624 }
625 
GetRange() const626 const RangeInfo &AccessibilityElementInfo::GetRange() const
627 {
628     HILOG_DEBUG("start");
629     return rangeInfo_;
630 }
631 
SetRange(RangeInfo & rangeInfo)632 void AccessibilityElementInfo::SetRange(RangeInfo &rangeInfo)
633 {
634     HILOG_DEBUG("start");
635     rangeInfo_.SetMax(rangeInfo.GetMax());
636     rangeInfo_.SetMin(rangeInfo.GetMin());
637     rangeInfo_.SetCurrent(rangeInfo.GetCurrent());
638 }
639 
GetGrid() const640 const GridInfo &AccessibilityElementInfo::GetGrid() const
641 {
642     HILOG_DEBUG("start");
643     return grid_;
644 }
645 
SetGrid(const GridInfo & grid)646 void AccessibilityElementInfo::SetGrid(const GridInfo &grid)
647 {
648     HILOG_DEBUG("start");
649     grid_ = grid;
650 }
651 
GetGridItem() const652 const GridItemInfo &AccessibilityElementInfo::GetGridItem() const
653 {
654     HILOG_DEBUG("start");
655     return gridItem_;
656 }
657 
SetGridItem(const GridItemInfo & gridItem)658 void AccessibilityElementInfo::SetGridItem(const GridItemInfo &gridItem)
659 {
660     HILOG_DEBUG("start");
661     gridItem_ = gridItem;
662 }
663 
AccessibilityElementInfo()664 AccessibilityElementInfo::AccessibilityElementInfo()
665 {
666     HILOG_DEBUG("start");
667 }
668 
AccessibleAction(ActionType actionType,const std::string & description)669 AccessibleAction::AccessibleAction(ActionType actionType, const std::string &description)
670 {
671     HILOG_DEBUG("start");
672     actionType_ = actionType;
673     description_ = description;
674 }
675 
GetActionType() const676 ActionType AccessibleAction::GetActionType() const
677 {
678     HILOG_DEBUG("actionType_[%{public}d]", actionType_);
679     return actionType_;
680 }
681 
GetDescriptionInfo() const682 const std::string &AccessibleAction::GetDescriptionInfo() const
683 {
684     HILOG_DEBUG("description_[%{public}s]", description_.c_str());
685     return description_;
686 }
687 
RangeInfo(int32_t min,int32_t max,int32_t current)688 RangeInfo::RangeInfo(int32_t min, int32_t max, int32_t current)
689 {
690     HILOG_DEBUG("start");
691     min_ = min;
692     max_ = max;
693     current_ = current;
694     HILOG_DEBUG("min_[%{public}d]", min_);
695     HILOG_DEBUG("max_[%{public}d]", max_);
696     HILOG_DEBUG("current_[%{public}d]", current_);
697 }
698 
GetMin() const699 int32_t RangeInfo::GetMin() const
700 {
701     HILOG_DEBUG("min_[%{public}d]", min_);
702     return min_;
703 }
704 
GetMax() const705 int32_t RangeInfo::GetMax() const
706 {
707     HILOG_DEBUG("max_[%{public}d]", max_);
708     return max_;
709 }
710 
GetCurrent() const711 int32_t RangeInfo::GetCurrent() const
712 {
713     HILOG_DEBUG("current_[%{public}d]", current_);
714     return current_;
715 }
716 
SetMin(int32_t min)717 void RangeInfo::SetMin(int32_t min)
718 {
719     min_ = min;
720     HILOG_DEBUG("min_[%{public}d]", min_);
721 }
722 
SetMax(int32_t max)723 void RangeInfo::SetMax(int32_t max)
724 {
725     max_ = max;
726     HILOG_DEBUG("max_[%{public}d]", max_);
727 }
728 
SetCurrent(int32_t current)729 void RangeInfo::SetCurrent(int32_t current)
730 {
731     current_ = current;
732     HILOG_DEBUG("current_[%{public}d]", current_);
733 }
734 
GridInfo(int32_t rowCount,int32_t columnCount,int32_t mode)735 GridInfo::GridInfo(int32_t rowCount, int32_t columnCount, int32_t mode)
736 {
737     HILOG_DEBUG("start");
738     rowCount_ = rowCount;
739     columnCount_ = columnCount;
740     selectionMode_ = mode;
741 
742     HILOG_DEBUG("rowCount_[%{public}d]", rowCount_);
743     HILOG_DEBUG("columnCount_[%{public}d]", columnCount_);
744     HILOG_DEBUG("selectionMode_[%{public}d]", selectionMode_);
745 }
746 
SetGrid(int32_t rowCount,int32_t columnCount,int32_t mode)747 void GridInfo::SetGrid(int32_t rowCount, int32_t columnCount, int32_t mode)
748 {
749     HILOG_DEBUG("start");
750     rowCount_ = rowCount;
751     columnCount_ = columnCount;
752     selectionMode_ = mode;
753 
754     HILOG_DEBUG("rowCount_[%{public}d]", rowCount_);
755     HILOG_DEBUG("columnCount_[%{public}d]", columnCount_);
756     HILOG_DEBUG("selectionMode_[%{public}d]", selectionMode_);
757 }
758 
SetGrid(GridInfo other)759 void GridInfo::SetGrid(GridInfo other)
760 {
761     HILOG_DEBUG("start");
762     rowCount_ = other.rowCount_;
763     columnCount_ = other.columnCount_;
764     selectionMode_ = other.selectionMode_;
765 
766     HILOG_DEBUG("rowCount_[%{public}d]", rowCount_);
767     HILOG_DEBUG("columnCount_[%{public}d]", columnCount_);
768     HILOG_DEBUG("selectionMode_[%{public}d]", selectionMode_);
769 }
770 
GetRowCount() const771 int32_t GridInfo::GetRowCount() const
772 {
773     HILOG_DEBUG("start");
774     HILOG_DEBUG("rowCount_[%{public}d]", rowCount_);
775     return rowCount_;
776 }
777 
GetColumnCount() const778 int32_t GridInfo::GetColumnCount() const
779 {
780     HILOG_DEBUG("columnCount_[%{public}d]", columnCount_);
781     return columnCount_;
782 }
783 
GetSelectionMode() const784 int32_t GridInfo::GetSelectionMode() const
785 {
786     HILOG_DEBUG("selectionMode_[%{public}d]", selectionMode_);
787     return selectionMode_;
788 }
789 
GridItemInfo(int32_t rowIndex,int32_t rowSpan,int32_t columnIndex,int32_t columnSpan,bool heading,bool selected)790 GridItemInfo::GridItemInfo(int32_t rowIndex, int32_t rowSpan, int32_t columnIndex, int32_t columnSpan,
791     bool heading, bool selected)
792 {
793     HILOG_DEBUG("start");
794     rowIndex_ = rowIndex;
795     rowSpan_ = rowSpan;
796     columnIndex_ = columnIndex;
797     columnSpan_ = columnSpan;
798     heading_ = heading;
799     selected_ = selected;
800 
801     HILOG_DEBUG("rowIndex_[%{public}d]", rowIndex_);
802     HILOG_DEBUG("rowSpan_[%{public}d]", rowSpan_);
803     HILOG_DEBUG("columnIndex_[%{public}d]", columnIndex_);
804     HILOG_DEBUG("columnSpan_[%{public}d]", columnSpan_);
805     HILOG_DEBUG("heading_[%{public}d]", heading_);
806     HILOG_DEBUG("selected_[%{public}d]", selected_);
807 }
808 
SetGridItemInfo(GridItemInfo other)809 void GridItemInfo::SetGridItemInfo(GridItemInfo other)
810 {
811     HILOG_DEBUG("start");
812     rowIndex_ = other.rowIndex_;
813     rowSpan_ = other.rowSpan_;
814     columnIndex_ = other.columnIndex_;
815     columnSpan_ = other.columnSpan_;
816     heading_ = other.heading_;
817     selected_ = other.selected_;
818 
819     HILOG_DEBUG("rowIndex_[%{public}d]", rowIndex_);
820     HILOG_DEBUG("rowSpan_[%{public}d]", rowSpan_);
821     HILOG_DEBUG("columnIndex_[%{public}d]", columnIndex_);
822     HILOG_DEBUG("columnSpan_[%{public}d]", columnSpan_);
823     HILOG_DEBUG("heading_[%{public}d]", heading_);
824     HILOG_DEBUG("selected_[%{public}d]", selected_);
825 }
826 
SetGridItemInfo(int32_t rowIndex,int32_t rowSpan,int32_t columnIndex,int32_t columnSpan,bool heading,bool selected)827 void GridItemInfo::SetGridItemInfo(int32_t rowIndex, int32_t rowSpan, int32_t columnIndex,
828     int32_t columnSpan, bool heading, bool selected)
829 {
830     HILOG_DEBUG("start");
831     rowIndex_ = rowIndex;
832     rowSpan_ = rowSpan;
833     columnIndex_ = columnIndex;
834     columnSpan_ = columnSpan;
835     heading_ = heading;
836     selected_ = selected;
837 
838     HILOG_DEBUG("rowIndex_[%{public}d]", rowIndex_);
839     HILOG_DEBUG("rowSpan_[%{public}d]", rowSpan_);
840     HILOG_DEBUG("columnIndex_[%{public}d]", columnIndex_);
841     HILOG_DEBUG("columnSpan_[%{public}d]", columnSpan_);
842     HILOG_DEBUG("heading_[%{public}d]", heading_);
843     HILOG_DEBUG("selected_[%{public}d]", selected_);
844 }
845 
GetColumnIndex() const846 int32_t GridItemInfo::GetColumnIndex() const
847 {
848     HILOG_DEBUG("columnIndex_[%{public}d]", columnIndex_);
849     return columnIndex_;
850 }
851 
GetRowIndex() const852 int32_t GridItemInfo::GetRowIndex() const
853 {
854     HILOG_DEBUG("rowIndex_[%{public}d]", rowIndex_);
855     return rowIndex_;
856 }
857 
GetColumnSpan() const858 int32_t GridItemInfo::GetColumnSpan() const
859 {
860     HILOG_DEBUG("columnSpan_[%{public}d]", columnSpan_);
861     return columnSpan_;
862 }
863 
GetRowSpan() const864 int32_t GridItemInfo::GetRowSpan() const
865 {
866     HILOG_DEBUG("rowSpan_[%{public}d]", rowSpan_);
867     return rowSpan_;
868 }
869 
IsHeading() const870 bool GridItemInfo::IsHeading() const
871 {
872     HILOG_DEBUG("heading_[%{public}d]", heading_);
873     return heading_;
874 }
875 
IsSelected() const876 bool GridItemInfo::IsSelected() const
877 {
878     HILOG_DEBUG("selected_[%{public}d]", selected_);
879     return selected_;
880 }
881 
GetPageId() const882 int32_t AccessibilityElementInfo::GetPageId() const
883 {
884     HILOG_DEBUG("pageId_[%{public}d]", pageId_);
885     return pageId_;
886 }
887 
SetPageId(const int32_t pageId)888 void AccessibilityElementInfo::SetPageId(const int32_t pageId)
889 {
890     pageId_ = pageId;
891     HILOG_DEBUG("pageId_[%{public}d]", pageId_);
892 }
893 
SetTextMovementStep(const TextMoveUnit granularity)894 void AccessibilityElementInfo::SetTextMovementStep(const TextMoveUnit granularity)
895 {
896     textMoveStep_ = granularity;
897     HILOG_DEBUG("textMoveStep_[%{public}d]", textMoveStep_);
898 }
899 
GetTextMovementStep() const900 TextMoveUnit AccessibilityElementInfo::GetTextMovementStep() const
901 {
902     HILOG_DEBUG("textMoveStep_[%{public}d]", textMoveStep_);
903     return textMoveStep_;
904 }
905 
SetItemCounts(const int32_t itemCounts)906 void AccessibilityElementInfo::SetItemCounts(const int32_t itemCounts)
907 {
908     itemCounts_ = itemCounts;
909     HILOG_DEBUG("itemCounts_[%{public}d]", itemCounts_);
910 }
911 
GetItemCounts() const912 int32_t AccessibilityElementInfo::GetItemCounts() const
913 {
914     HILOG_DEBUG("itemCounts_[%{public}d]", itemCounts_);
915     return itemCounts_;
916 }
917 
SetTriggerAction(const ActionType action)918 void AccessibilityElementInfo::SetTriggerAction(const ActionType action)
919 {
920     HILOG_DEBUG("action[%{public}d]", action);
921     triggerAction_ = action;
922 }
923 
GetTriggerAction() const924 ActionType AccessibilityElementInfo::GetTriggerAction() const
925 {
926     return triggerAction_;
927 }
928 
SetContentList(const std::vector<std::string> & contentList)929 void AccessibilityElementInfo::SetContentList(const std::vector<std::string> &contentList)
930 {
931     contentList_.clear();
932     contentList_.resize(contentList.size());
933     std::copy(contentList.begin(), contentList.end(), contentList_.begin());
934 }
935 
GetContentList(std::vector<std::string> & contentList) const936 void AccessibilityElementInfo::GetContentList(std::vector<std::string> &contentList) const
937 {
938     contentList.clear();
939     contentList.resize(contentList_.size());
940     std::copy(contentList_.begin(), contentList_.end(), contentList.begin());
941 }
942 
SetLatestContent(const std::string & content)943 void AccessibilityElementInfo::SetLatestContent(const std::string &content)
944 {
945     latestContent_ = content;
946 }
947 
GetLatestContent() const948 const std::string &AccessibilityElementInfo::GetLatestContent() const
949 {
950     return latestContent_;
951 }
952 } // namespace Accessibility
953 } // namespace OHOS